// JavaScript Document

var testresultscontactar
var testresultsamigo
var testresultstuemail

function checkemail_contactar(){
var str=document.formulario_contactar.email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
	testresultscontactar=true
else{
	alert("Tu email no es válido!!!")
	testresultscontactar=false
}
	return (testresultscontactar)
}

function checkemail_contactar_eng(){
var str=document.formulario_contactar.email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
	testresultscontactar=true
else{
	alert("Your email is not valid!!!")
	testresultscontactar=false
}
	return (testresultscontactar)
}

function checkemail_tuemail(){
var str=document.formulario_amigo.youremail.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
	testresultstuemail=true
else{
	alert("Your email is not valid!!!")
	testresultstuemail=false
}
	return (testresultstuemail)
}

function checkemail_amigo(){
var str=document.formulario_amigo.friendemail.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
	testresultsamigo=true
else{
	alert("El email del destinatario no es válido!!!")
	testresultsamigo=false
}
	return (testresultsamigo)
}

function checkemail_tuemail_eng(){
var str=document.formulario_amigo.youremail.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
	testresultstuemail=true
else{
	alert("Your email is not valid!!!")
	testresultstuemail=false
}
	return (testresultstuemail)
}

function checkemail_amigo_eng(){
var str=document.formulario_amigo.friendemail.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
	testresultsamigo=true
else{
	alert("Friend's email is not valid!!!")
	testresultsamigo=false
}
	return (testresultsamigo)
}

function enviar_contactar()
{
    if (document.formulario_contactar.Nombre_y_Apellidos.value == '') {
        alert('No se ha introducido un valor para "Nombre y Apellidos"');
		formulario_contactar.Nombre_y_Apellidos.focus();
    }
    else if (document.formulario_contactar.Informacion.value == '') {
        alert('No se ha introducido un valor para "Consulta"');
		formulario_contactar.Informacion.focus();
    }
    else if ((document.formulario_contactar.telefono.value == '') && (document.formulario_contactar.email.value == '')) {
        alert('No se ha introducido una forma de contacto: Teléfono o Email');
    }
    else {
		if (checkemail_contactar()==true) document.formulario_contactar.submit();
    }
}

function enviar_contactar_eng()
{
    if (document.formulario_contactar.Name_and_Surname.value == '') {
        alert('Please, enter your full name');
		formulario_contactar.Name_and_Surname.focus();
    }
    else if (document.formulario_contactar.Information.value == '') {
        alert('Please, enter your message"');
		formulario_contactar.Information.focus();
    }
    else if ((document.formulario_contactar.phone.value == '') && (document.formulario_contactar.email.value == '')) {
        alert('Please, enter either a phone number or valid email address');
    }
    else {
		if (checkemail_contactar_eng()==true) document.formulario_contactar.submit();
    }
}

function enviar_amigo()
{
    if (document.formulario_amigo.yourname.value == '') {
        alert('No se ha introducido un valor para "Tu Nombre"');
		formulario_amigo.yourname.focus();
    }
    else if (document.formulario_amigo.youremail.value == '') {
        alert('No se ha introducido un valor para "Tu Email"');
		formulario_amigo.youremail.focus();
    }
    else if (document.formulario_amigo.friendname.value == '') {
        alert('No se ha introducido un valor para "Nombre del destinatario"');
		formulario_amigo.friendname.focus();
    }
    else if (document.formulario_amigo.friendemail.value == '') {
        alert('No se ha introducido un valor para "Email del destinatario"');
		formulario_amigo.friendemail.focus();
    }
    else {
		if ((checkemail_tuemail()==true) && (checkemail_amigo()==true)) document.formulario_amigo.submit();
    }
}

function enviar_amigo_eng()
{
    if (document.formulario_amigo.yourname.value == '') {
        alert('A value for "Your Name" has not been introduced');
		formulario_amigo.yourname.focus();
    }
    else if (document.formulario_amigo.youremail.value == '') {
        alert('A value for "Your email" has not been introduced');
		formulario_amigo.youremail.focus();
    }
    else if (document.formulario_amigo.friendname.value == '') {
        alert('A value for "Friend\'s name" has not been introduced');
		formulario_amigo.friendname.focus();
    }
    else if (document.formulario_amigo.friendemail.value == '') {
        alert('A value for "Friend\'s email" has not been introduced"');
		formulario_amigo.friendemail.focus();
    }
    else {
		if ((checkemail_tuemail_eng()==true) && (checkemail_amigo_eng()==true)) document.formulario_amigo.submit();
    }
}

function borrar_contactar()
{
	formulario_contactar.reset();
}

function borrar_amigo()
{
	formulario_amigo.reset();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Variables de color para el menú
var menuColor1 = "#28592c";
var menuColor1over = "#889E5A";
var menuColor2 = "#FAF8CC";
var menuColor2over = "#ddd97d";

function cambiaColorMenu(src)
{
	if (src.bgColor.toLowerCase()==menuColor1.toLowerCase()) {src.bgColor=menuColor1over;}
	else if (src.bgColor.toLowerCase()==menuColor1over.toLowerCase()) {src.bgColor=menuColor1;}
	else if (src.bgColor.toLowerCase()==menuColor2.toLowerCase()) {src.bgColor=menuColor2over;}
	else if (src.bgColor.toLowerCase()==menuColor2over.toLowerCase()) {src.bgColor=menuColor2;}
}

function openPictureWindow_Fever(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); 	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function openPictureWindow_Fever_Mod(imageType,imageName,imageWidth,imageHeight,alt,desc,posLeft,posTop) {  // v4.01

	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0 align="center">');
	newWindow.document.write('<TR><TD BGCOLOR="#899D5E" align="center"><FONT COLOR=white FACE=Arial SIZE=2><b>'+alt+'</b></FONT></TD></TR>');
	newWindow.document.write('<TR><TD align="center" bgcolor="#FFFFFF">');
	if (imageType == "swf"){
	newWindow.document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+imageWidth+'" height="'+imageHeight+'">');
	newWindow.document.write('<param name=movie value="'+imageName+'"><param name=quality value=high>');
	newWindow.document.write('<embed src="'+imageName+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+imageWidth+'" height="'+imageHeight+'">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src="'+imageName+'" alt="'+alt+'">'); 	}
	newWindow.document.write('</TD></TR>');
	newWindow.document.write('<TR><TD BGCOLOR="#DBE1B0" align="center">');
	newWindow.document.write('<FONT COLOR=black FACE=Arial SIZE=2>'+desc+'</FONT>');
	newWindow.document.write('</TD></TR></TABLE>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();

}

function enviar_activacion()
{
    if (document.formulario_activacion.name.value == '') {
        alert('No se ha introducido un valor para "Nombre Real"');
		formulario_activacion.name.focus();
    }
    else if (document.formulario_activacion.email.value == '') {
        alert('No se ha introducido un valor para "Email"');
		formulario_activacion.email.focus();
    }
    else if (document.formulario_activacion.ciudad.value == '') {
        alert('No se ha introducido un valor para "Ciudad"');
		formulario_activacion.ciudad.focus();
    }
    else if (document.formulario_activacion.pais.value == '') {
        alert('No se ha introducido un valor para "Pais"');
		formulario_activacion.pais.focus();
    }
    else {
		document.formulario_activacion.submit();
    }
}

function enviar_desactivacion()
{
    if (document.formulario_desactivacion.name.value == '') {
        alert('No se ha introducido un valor para "Nombre Real"');
		formulario_desactivacion.name.focus();
    }
    else if (document.formulario_desactivacion.email.value == '') {
        alert('No se ha introducido un valor para "Email"');
		formulario_desactivacion.email.focus();
    }
    else {
		document.formulario_desactivacion.submit();
    }
}
