/*
====================	Funciones de Layers		=======================
*/


distLayers = new Array(2);

for (x = 0; x < distLayers.length; x++)
{
	distLayers[x] = new Array(6);
	distLayers[x][0] = 'Barra'+(x+1)+'';
	distLayers[x][2] = new Array(4)
	distLayers[x][3] = false;	
}

distLayers[0][5] = 'index_05';
distLayers[1][5] = 'index_20';


function MM_showHideLayers() 
{ //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;

	if (args[0] != "")
	{	
		for (i=0; i<(args.length-2); i+=3) 
		{
			if ((obj=MM_findObj(args[i]))!=null) 
			{ 
				v=args[i+2];
				if (obj.style) 
				{ 
					obj=obj.style;
					v=(v=='show')?'visible':(v='hide')?'hidden':v; 
				}
				obj.visibility=v;
			}
		}
	}
}


function iniciaValores(capa,X,Y) {
//var leftsize = ((screen.width-779)/2)-34 //absolute

//alert(X);

//alert(Y);

var leftsize = 0 //relative

  if(ie)
   {
     document.all[capa].style.top=Y;
     document.all[capa].style.left=X + leftsize;
   }
   else if(n4)
    {
      document.layers[capa].top=Y;
      document.layers[capa].left=X + leftsize;
    }
    if(n6)
     {
       document.getElementById(capa).style.top=Y;
       document.getElementById(capa).style.left=X + leftsize;
     }
}


function PositionLayers() { 
  var i=0,LayersName=PositionLayers.arguments;

  for(i=0;i<=(LayersName.length-3);i+=3) {	
	iniciaValores(LayersName[i],LayersName[i+1],LayersName[i+2]);
  }
}


/*
Informacion de configuracion de pantalla
del servidor
*/
function Ver(data)
{
	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 (data == "width")
		return myWidth;
	else
		return myHeight;

}



function SetBottomClip()
{               
	if (document.all)
	{

		for (x = 0; x < distLayers.length; x++)
		{
			document.all[distLayers[x][0]].style.clip="rect("+distLayers[x][2][0]+","+distLayers[x][2][1]+","+distLayers[x][2][2]+","+distLayers[x][2][3]+")";
		}
	}

	else if(document.layers)
		{
			for (x = 0; x < distLayers.length; x++)
			{	
				document.layers[distLayers[x][0]].clip.top = distLayers[x][2][0];
				document.layers[distLayers[x][0]].clip.right = distLayers[x][2][1];
				document.layers[distLayers[x][0]].clip.bottom = distLayers[x][2][2];
				document.layers[distLayers[x][0]].clip.left = distLayers[x][2][3]; 				
			}

		}

		else if(document.getElementById)
		{
			for (x = 0; x < distLayers.length; x++)
			{                             
				document.getElementById(distLayers[x][0]).style.clip="rect("+distLayers[x][2][0]+","+distLayers[x][2][1]+","+distLayers[x][2][2]+","+distLayers[x][2][3]+")";
			}            
		}
}



/*
Funcion que ubica los layers segun la 
configuracion de pantalla del cliente
*/

function DistanciasLayers()
{
	
	width = Ver("width");
	marginwidth = (width - 795) / 2 ;

	height = Ver("height");

	marginheight = (height - 411) / 2 ;
	
	//left
	if (width < 781)
		if (ie)
			distLayers[0][1] = marginwidth + (width)*0.76;
		else
			distLayers[0][1] = marginwidth + (width)*0.74;
	else
		if (width < 1133)
			if (ie)
				distLayers[0][1] = marginwidth + (width*0.8)*0.76;
			else
				distLayers[0][1] = marginwidth + (width*0.8)*0.74;
		else
			if (ie)
				distLayers[0][1] = marginwidth + (width*0.8)*0.74;
			else
				distLayers[0][1] = marginwidth + (width*0.8)*0.72;

	//top
	if (ie)
		distLayers[0][4] = marginheight + 87;
	else
		distLayers[0][4] = marginheight + 102;


	//posicion de los clips del Layer 1
	distLayers[0][2][0] = '0';
	distLayers[0][2][1] = '148';
	distLayers[0][2][2] = '0';
	distLayers[0][2][3] = '0';
	
	//====================================================

	//left
	if (width < 781)
		if (ie)
			distLayers[1][1] = marginwidth + (width)*0.76;
		else
			distLayers[1][1] = marginwidth + (width)*0.74;
	else	
		if (width < 1133)		
			if (ie)
				distLayers[1][1] = marginwidth + (width*0.8)*0.76;
			else
				distLayers[1][1] = marginwidth + (width*0.8)*0.74;
		else
			if (ie)
				distLayers[1][1] = marginwidth + (width*0.8)*0.74;
			else
				distLayers[1][1] = marginwidth + (width*0.8)*0.72;

	
	if (ie)
		distLayers[1][4] = marginheight + 294;	
	else
		distLayers[1][4] = marginheight + 308;	
	
	distLayers[1][2][0] = '0';
	distLayers[1][2][1] = '148';
	distLayers[1][2][2] = '0';
	distLayers[1][2][3] = '0';

	
	texto = "";

	for (x = 0; x < distLayers.length; x++)	
	{		
		texto = texto + '\'' + distLayers[x][0] + '\',' + distLayers[x][1] + ',\''+distLayers[x][4]+'\',';
		//alert(texto);
	}

	texto = texto.substring(0,texto.length-1);


	eval('PositionLayers('+texto+');');	
	
}


function DesplegarLay(capa , opcion)
{
	x = capa;
	var y = 0;

	MM_swapImgRestore();

	for (y = 0; y < distLayers.length; y++)
	{
		MM_showHideLayers(distLayers[y][0],'','hide');
		distLayers[y][3] = false;
		MM_swapImage(distLayers[y][5],'','img/'+distLayers[y][5]+'.gif',1);
	}

	if(opcion == "show")
	{		
		MM_showHideLayers(distLayers[x][0],'','show');
		distLayers[x][3] = true;	
	}
	
}

function init()
{
	//ubica los layers
	DistanciasLayers();
	
}



function refresh()
{
	init();
	setTimeout("refresh()",50);
}

/*
====================	Fin Funciones de Layers		=======================
*/