// JavaScript Document// JavaScript Document 
//
// Biplano
// Bryte 04.mayo.2007
//
/*
//Variables de inicializacion ejemplo:

*/

function mainAnimation()
{
	//if(typeof retardo == "undefined") retardo = 0;	
	if(typeof mainPosition == "undefined") mainPosition = 0;
	if(typeof imageToggle == "undefined") imageToggle = "url(../../lmbinaries/img447_image.gif)";
	
	if (mainPosition == 0){
		
		$('#master').animate({top:550},'slow');
		imageToggle = "url(../../lmbinaries/img448_image.gif)";
		mainPosition = 1;
	}
	else if (mainPosition ==1) {
		$('#master').animate({top:165},'slow');
		imageToggle = "url(../../lmbinaries/img447_image.gif)";
		mainPosition = 0;
	}	

	$('#header-toggle').css("backgroundImage", imageToggle);
}

function submenuIn(cual)
{
	if(cual != undefined) {
		$('#'+cual).animate({top:-14},'slow');
	}
	for (i=1; i<4; i++){
		t = $('#submenu'+i).css('top');
		if(t == "-14px") $('#submenu'+i).animate({top:12},'slow');
	}
}


function formatea(campo)
{
	signo = $(campo).val();
	signo = signo.indexOf('[');
	if(signo>0)	$(campo).val("");
}
function sugerencias(formName){
	var errors ='';
	sugerencia = $('#sugerencia').val();
	nombre = $('#nombre').val();
	email = $('#email').val();
	ciudad = $('#ciudad').val();
	pais = $('#pais').val();
	mensaje = $('#mensaje').val();
	politica = $('#politica').is(":checked");
	
	if (nombre!="" && email !="" && mensaje !=""){

		arroba = email.indexOf('@');
		punto = email.indexOf('.');
		if (arroba<1 || arroba > email.length-6 || punto<1 || punto > email.length-3) errors += ' - Revise su email \n';
		signo = mensaje.indexOf('[');
		if(signo>0) errors += ' - Escriba una consulta \n';
	}
	else{
		if(nombre =="" )errors += ' - Nombre y apellidos: debe introducir su nombre y apellidos. \n';
		if(email =="" )errors += ' - Email: debe introducir una dirección de correo válida. \n';
		if(mensaje =="" )errors += ' - Escriba un mensaje o sugerencia. \n';
	}
	
	if (!politica)errors += ' - Debe aceptar la Política de Privacidad.\n';
	
	if (errors) 
		{
		alert('Por favor, verifique los siguientes datos:               \n'+errors);
		return false
		}

	$('#form1').submit();
	return false;
}
function subscribirse(){
	var errors ='';
	nombre = $('#nombre').val();
	email = $('#email').val();
	politica = $('#politica').is(":checked");
	
	if (nombre!="" && email !=""){

		arroba = email.indexOf('@');
		punto = email.indexOf('.');
		if (arroba<1 || arroba > email.length-6 || punto<1 || punto > email.length-3) errors += ' - Revise su email \n';
	}
	else{
		if(nombre =="" )errors += ' - Nombre y apellidos: debe introducir su nombre y apellidos. \n';
		if(email =="" )errors += ' - Email: debe introducir una dirección de correo válida. \n';
	}
	
	if (!politica)errors += ' - Debe aceptar la Política de Privacidad.\n';
	
	if (errors) 
		{
		alert('Por favor, verifique los siguientes datos:               \n'+errors);
		return false
		}

	$('#form1').submit();
	return false;
}

function contacto(){
	var errors ='';
	nombre = $('#nombre').val();
	email = $('#email').val();
	empresa = $('#empresa').val();
	tel = $('#tel1').val();
	politica = $('#politica').is(":checked");
	
	if (nombre!="" && email !="" && tel !="" && empresa !=""){

		arroba = email.indexOf('@');
		punto = email.indexOf('.');
		if (arroba<1 || arroba > email.length-6 || punto<1 || punto > email.length-3) errors += ' - Revise su email \n';
	}
	else{
		if(nombre =="" )errors += ' - Nombre y apellidos: debe introducir su nombre y apellidos. \n';
		if(email =="" )errors += ' - Email: debe introducir una dirección de correo válida. \n';
		if(empresa =="" )errors += ' - Empresa: debe introducir el nombre de su empresa. \n';
		if(tel =="" )errors += ' - Telefono: debe introducir un numero de telefono. \n';
	}
	
	if (!politica)errors += ' - Debe aceptar la Política de Privacidad.\n';
	
	if (errors) 
		{
		alert('Por favor, verifique los siguientes datos:               \n'+errors);
		return false
		}

	$('#form1').submit();
	return false;
}

// Abre ventana divPopUp del texto legal
wLegalFlag = false;
function wLegal()
{
	  // Tamaño interior de la ventana 
	  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(wLegalFlag)
	{
		$('#popLegal').css({top:"-800px", left:"-800px"});
		$('#DivShim5').css('display','none')
		wLegalFlag = false;
	}
	else
	{
		x = parseInt((myWidth - 300 ) / 2);
		y = parseInt((myHeight - 200 ) / 2);
		
		//xx = ""+xx+"px";
		//yy = ""+yy+"px";
				
		$('#popLegal').css('top', y);
		$('#popLegal').css('left', x);
		
		$('#DivShim5').css('visibility', 'visible');
		$('#DivShim5').css('display', 'block');
		$('#DivShim5').css('top', y);
		$('#DivShim5').css('left', x);
		$('#DivShim5').css('z-index', 3);
		
		/*$('DivShim5').style.visibility = 'visible';
		$('DivShim5').style.display = 'block';
		$('DivShim5').style.top = y + 'px';
		$('DivShim5').style.left = x + 'px';
		$('DivShim5').style.zIndex = 3;
		*/
		wLegalFlag = true;

	}
} 