// JavaScript Document


var activeMenu = 0;

var IE  =  (document.all) ? true : false; 
var NS4	=	(document.layers) ? true : false; 
var NS	=	(!document.all && document.getElementById) ? true : false; 





	function getObj ( nNombre ){
		if (IE){
			return document.all[nNombre];	
		}else{
			return document.getElementById(nNombre);
		}
			
	}


	function  showMenu ( nMnu )
	{
		var obj =  getObject( "frm" +  nMnu );
		var objAnt = null;
		
		if  (  activeMenu != 0 )
		{	
			objAnt =  getObject ( "frm" + activeMenu  );
			objAnt.style.display = "none";
			btnNormal ( activeMenu );
		}
	
		if  ( nMnu == activeMenu  ) 
		{	
			reloadFrame( nMnu )
		}
			
		if ( obj != null )
		{
			if (obj.style.display == "none")
			{
				obj.style.display="inline";
				activeMenu = nMnu;
			}
		}	
			
		btnActive ( nMnu )
	}
	
	function reloadFrame( n )
	{
		 var oGrm = getObject ( "ifrm_" + n   );
		 oGrm.src= arrFrm[n-1];
	}
	

	
	function btnActive ( tab )
	{
		
	
		obj  = getObject( "btnTop" + tab );
		obj.className = "btnTopCenterSel";		
						
		obj  = getObject( "div" + tab );
		obj.className = "btnTextSel";		
		obj.style.paddingBottom = "7px";	
		//reloadFrame( tab );
		
	}

	function btnNormal ( tab )
	{
		obj  = getObject( "btnTop" + tab );
		obj.className = "btnTopCenter";		
						
		obj  = getObject( "div" + tab );
		obj.className = "btnText";		
		obj.style.paddingBottom = "7px";	
	}

	function btnUp ( tab )
	{
	//	obj  = getObject( "btnTop" + tab );
	//	obj.className = "btnTopCenterUp";		
						
		obj  = getObject( "div" + tab );
		obj.className = "btnTextUp";	
		obj.style.paddingBottom = "12px";	
	}
	
	

	function changeTab ( tab , type )
	{
		var obj; 
					
		if  ( activeMenu !=  tab ) 
		{
			if  ( type == 0 )   
			{	btnNormal ( tab );	}	
			else
			{	btnUp ( tab );		}
		}	
	}


function alertSize() {
  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;
  }
 
}


function TamVentana() { 
  
  var Tamanyo = [0, 0]; 
  
  if (typeof window.innerWidth != 'undefined') 
  { 
  
    Tamanyo = [ 
        window.innerWidth - 70 , 
        window.innerHeight - 70
    ]; 
  } 
  else if (typeof document.documentElement != 'undefined' 
      && typeof document.documentElement.clientWidth != 
      'undefined' && document.documentElement.clientWidth != 0) 
  { 

 		Tamanyo = [ 
        	document.documentElement.clientWidth - 70 , 
        	document.documentElement.clientHeight - 70 
    	]; 
  } 
  else   
  { 

   	Tamanyo = [ 
        document.getElementsByTagName('body')[0].clientWidth - 20 , 
        document.getElementsByTagName('body')[0].clientHeight - 70
	]; 
  } 

  return Tamanyo; 
} 
	
	function showPop( id )
	{

		var IE = ((!(!document.all)))?true:false;
		var obj, objBody, objBlock;

		if(IE){  
			obj = document.all[ id ];
			objBody = document.all[ "principal"];
			objBlock = document.all[ "popBloq" ];
		}else{
			obj = document.getElementById( id );
			objBody = document.getElementById( "principal");
			objBlock = document.getElementById( "popBloq" );
		}
		objBody.className="sombra";
		objBlock.style.display="block";
		objBlock.style.height = document.body.scrollHeight;
		
		obj.style.display  = "inline";	
		window.scrollTo(0, 0);
		
	}


	function hidePop( id  )
	{
		var oDiv = document.getElementById( id );
		var oBody = document.getElementById( "principal");
		var oFrm = document.getElementById( "frmPop");
		var objBlock = document.getElementById( "popBloq" );
		
		oDiv.style.display = "none"; 
		objBlock.style.display="none";
		oBody.className="";
		oFrm.src="";
			
		var Cadena = window.parent.document.location.href;
		
		getObj('span-productos').style.borderBottom = "none";
		getObj('span-index').style.borderBottom = "none";
		getObj('span-quienes').style.borderBottom = "none";
		getObj('span-refacciones').style.borderBottom = "none";
		getObj('span-mundo').style.borderBottom = "none";
		getObj('span-contacto').style.borderBottom = "none";
		getObj('span-centro').style.borderBottom = "none";
		
		if (Cadena.search("index.aspx") > 1) { getObj('span-index').style.borderBottom = "double"; }
		if (Cadena.search("producto.aspx")> 1) { getObj('span-productos').style.borderBottom = "double"; }
		if (Cadena.search("quienes-somos.aspx")> 1) { getObj('span-quienes').style.borderBottom = "double"; }
		if (Cadena.search("pilares.aspx")> 1) { getObj('span-quienes').style.borderBottom = "double"; }
		if (Cadena.search("descargas.aspx")> 1) { getObj('span-mundo').style.borderBottom = "double"; }
		if (Cadena.search("contactenos.aspx")> 1)	{ getObj('span-contacto').style.borderBottom = "double"; }	
		
	}


	

	function centerWin( wWin, hWin )
	{
		var Tam = TamVentana();
		
		var Coord = [0, 0];
		
		Coord[0] = parseInt( (document.body.clientWidth - wWin ) / 2) ;
		Coord[1] = parseInt( (document.body.clientHeight - hWin ) / 2) ;
		
		return Coord;
	}


	function changeFrmSrc (	id, url)
	{
		var oWin = document.getElementById( id);
		
		if  (oWin !=  null )  
		{	oWin.src  = url;	}
		
	}


	function changeFrm (	id, url, title, w, h  )
	{
		var oWin = document.getElementById( id	);
		var oDiv = document.getElementById( 'divPop');
		
		document.getElementById('divPopTitle').innerHTML = title;
		var Coord = centerWin( w, h); 
		
		if  (oDiv !=  null )  
		{	
			oDiv.style.width	= w + 'px';
			oDiv.style.height	= h + 'px';
			oDiv.style.left		= Coord[0] + 'px';
			oDiv.style.top		= Coord[1] + 'px';
			
			oDiv.style.top = 75 + 'px';
		}
		
		if  (oWin !=  null )  
		{	
			oWin.src  	= url;	
			oWin.width	= w;
			oWin.height	= h;		
		}
	
	}


	var sDiv = '<div  id="divPop" style="position: absolute; top:0px; left:0px; width:0px; height:0px; background-color:#FFFFFF" >' ;
	var sFrm = '<iframe id="frmPop" src="" frameborder="0" width="0" height="0"></iframe>' ;

