// JavaScript Document

 
 


 
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  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 awidth(pageid)
	{
	 var winWidth = window.innerWidth;
	 if (!winWidth)  winWidth = document.body.offsetWidth;
	 var winHeight=window.innerHeight;
	 if (!winHeight) winHeight=document.body.offsetHeight;
	 
	 leftcapa=0;
	 topcapa=-1;
	 miimagen=MM_findObj("littleimg1");
		
		if (miimagen)  {
			a=miimagen.width;
			b=miimagen.height;
			c=a/b;
			if (miimagen.height>170)
			{
				miimagen.height=170;
				miimagen.width=170*c;
			}
		}
		 

	 obj=MM_findObj("diseny");
	 if (winWidth>1024) leftcapa=(winWidth/2)-512;
	  
	   topcapa=(winHeight/2)-310;
	   if (topcapa<0) topcapa=0;
		if (topcapa>0) obj.style.className="marcoTotal";
	 
	 obj.style.left=leftcapa+1;
	 obj.style.top=topcapa;
 
    if (pageid==7)
	{var otrobj,textobj
		otrobj=MM_findObj("contenidoImagen");
		otrobj.style.height='100px';
		otrobj=MM_findObj("contenidotextual")
		otrobj.style.height='340px';
		
	}
	 
	 
	 obj.style.visibility="visible";
	
	



 }
 
 

 
 function isDate(dateStr) {

 
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{1,2})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?
	
	if (matchArray == null) {
	
		return (false);
	}
	
	month = matchArray[3]; // p@rse date into variables
	day = matchArray[1];
	year = matchArray[5];
	
	if (month < 1 || month > 12) { // check month range
	
		return (false);
	}
	
	if (day < 1 || day > 31) {
	
		return (false);
	}
	
	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
	
		return (false);
	}
	
	if (month == 2) { // check for february 29th
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day > 29 || (day==29 && !isleap)) {
		
			return (false);
		}
	}
		return (true); // date is valid
}





var retardo;

function oculta_retarda(capa,temps){
 if (empezar){
     if (!temps) temps=800;
	
	ocultar =capa
	clearTimeout(retardo)
	retardo = setTimeout("hideMenu(" + capa + ")",temps)
 }
}
 
 function muestra (capa){
	
	 clearTimeout (retardo);
 }
 var empezar=true;
 
 
function  hideMenu (i)
{  
    mimenu="subMenu"+i;
	b=MM_findObj(mimenu);
	b.style.left=1200;
 
}

 
 
oldmenu=-1;
loaded=1;
function subMenu(i)
{
	
	var mimenu,mipadre,a,b,c;
	
	if (empezar){
		if (oldmenu!=-1 && i!=-1)
		{
			  b=MM_findObj ("submenu"+oldmenu);
			  if (b) b.style.left=1200;
		}
		mimenu="submenu"+i;
		
		mipadre="menu"+i;
		b=MM_findObj(mimenu);
		c=MM_findObj(mipadre);
		if (b)
		{  
		    oculta_retarda(i,2800);
			b.style.left=2;
			var jom;
			jom=i;
			if (i>7) jom=i-1;
			
			b.style.top=61+35*jom;
		}
		if (i!=-1) oldmenu=i;
	}
	
}
