// JavaScript Document
function ajusta_pantalla()
{
	var idcapa='principal';
	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;
	}
	document.getElementById(idcapa).style.width=(myWidth-17)+"px";
	document.getElementById(idcapa).style.height=myHeight+"px";
	document.getElementById('capa_principal').style.height=(myHeight-176)+"px";
	if(document.getElementById('marquesina'))
	{
		document.getElementById('marquesina').style.width=(myWidth-600)+"px";
	}
	if(document.getElementById('secciones'))
	{
		document.getElementById('secciones').style.width=(myWidth-190)+"px";
		var regla=(navigator.appName.indexOf("Microsoft")!=-1)?document.styleSheets[0].rules:document.styleSheets[0].cssRules;
		regla[1].style.width=((myWidth-200)/3)+"px";
		regla[2].style.width=((myWidth-200))+"px";
		regla[3].style.width=((myWidth-200)/2)+"px";
	}
}

function menu_in(obj)
{
	obj.style.paddingLeft=15+"px";
}

function menu_out(obj)
{
	obj.style.paddingLeft=0+"px";
}
function resalta()
{
	if(document.getElementById("men_oca").style.background=="" 
		|| document.getElementById("men_oca").style.background=="none transparent scroll repeat 0% 0%" 
		|| document.getElementById("men_oca").style.background=="transparent none repeat scroll 0% 0%"
		|| document.getElementById("men_oca").style.background=="none repeat scroll 0% 0% transparent")
	{
		document.getElementById("men_oca").style.background="#FF0000";
		document.getElementById("men_oca").style.color="#FFFFFF";
	}
	else
	{
		document.getElementById("men_oca").style.background="none transparent scroll repeat 0% 0%";
		document.getElementById("men_oca").style.color="#333333";
	}
	//alert(document.getElementById("men_oca").style.background);
}
function verifica_mail(texto){ 

    var mailres = true;             
    var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-"; 
     
    var arroba = texto.indexOf("@",0); 
    if ((texto.lastIndexOf("@")) != arroba) arroba = -1; 
     
    var punto = texto.lastIndexOf("."); 
                 
    for (var contador = 0 ; contador < texto.length ; contador++)
	{ 
        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){ 
            mailres = false; 
            break; 
    	} 
    } 

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1)) mailres = true; 
    else mailres = false; 
  
    return mailres; 
}
function verifica_form_contacto()
{
	var enviar;
	enviar=true;
	
	if(document.frm_contacto.persona.value.length==0)
	{
		document.frm_contacto.persona.focus();
		enviar=enviar&&false;
	}
	
	if(!verifica_mail(document.frm_contacto.email.value))
	{
		document.frm_contacto.email.focus();
		enviar=enviar&&false;
	}
	if(!enviar)
	{
		alert("Datos incompletos");
		return enviar;
	}
	
	document.frm_contacto.submit();
}
function menu_cambiante()
{
	setInterval(resalta,500);
}

if (window.addEventListener){
  window.addEventListener('load', ajusta_pantalla, false);
  window.addEventListener('resize', ajusta_pantalla, false);
} else if (window.attachEvent){
  window.attachEvent('onload', ajusta_pantalla);
  window.attachEvent('onresize', ajusta_pantalla);
}






