// JavaScript Document
var i;
var bEjecutado = false; 
var nMiliSegundos = 10000;
var numimg=6;
var strImg = new Array();
var imagenes = new Array();

for(i=0;i<numimg;i++) 
{
strImg[i] = 'bgimg_fh'+i+'.jpg';
imagenes[i] = new Image();
imagenes[i].src = strImg[i];
}

i=0;

function iddle(){
	centerDiv();
	document.getElementById("alldiv").style.display = "";
	document.getElementById("load").style.display = "none";
    window.setInterval("doTrans()", nMiliSegundos); 
}
   
function doTrans() {
	
	if (i<numimg-1)
		i = i + 1;
	else
		i = 0;
	
	if(navigator.appName == "Microsoft Internet Explorer") imgObj.filters[0].apply();
	imgObj.style.background = 'url(imagenes/'+strImg[i]+')';	
	if(navigator.appName == "Microsoft Internet Explorer") imgObj.filters[0].play();
}

function hideall() {
	document.getElementById("historia").style.display = "none";
	document.getElementById("noticias").style.display = "none";
	document.getElementById("empresas").style.display = "none";
	document.getElementById("clasificados").style.display = "none";
}

function showdiv(id) {
	hideall();
	if (id==1) document.getElementById("historia").style.display = "";
	if (id==2) document.getElementById("noticias").style.display = "";
	if (id==3) document.getElementById("empresas").style.display = "";
	if (id==4) document.getElementById("clasificados").style.display = "";
}

function centerDiv()
{	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else {
		if( document.documentElement &&
			( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			  //IE 6+ in 'standards compliant mode'
			  myWidth = document.documentElement.clientWidth;
			  myHeight = document.documentElement.clientHeight;
			} else {
			  if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		  }
		}
	}
	
	if (myWidth>970)
	{
		document.getElementById("alldiv").style.left = (myWidth-970)/2+'px';
	}
	else
	{
		document.getElementById("alldiv").style.left = 0+'px';		
	}

	
	if (myHeight>740)
	{
		document.getElementById("alldiv").style.top = (myHeight-740)/2+80+'px';
	}
	else
	{
		document.getElementById("alldiv").style.top = 80+'px';		
	}
}

