// Expresiones regulares para la validación de un nombre y un mail

var alphaRegexp = new RegExp("^[a-zA-Z \\,\\.\\/\\àÀáÁâÂãÃäÄåÅæÆªçÇèÈéÉêÊëËìÌíÍîÎïÏðÐñÑòÒóÓôÔõÕöÖøØùÙúÚûÛüÜýÝþÞÿß&]*$");
var phoneRegexp = new RegExp("^[0-9\(-)]{2,4}-? ?[0-9]{7,8}$");
var emailRegexp = new RegExp("^([a-zA-Z0-9_\\-]+\\.)*[a-zA-Z0-9_\\-]+@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,})(\\]?)$");
var urlRegexp =   new RegExp("^/http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/");
var cpRegexp = new RegExp("^[0-9]{5,5}([- ]?[0-9]{4,4})?$");


function isCif(cif){
	cif=cif.toUpperCase();
	var v1 = new Array(0,2,4,6,8,1,3,5,7,9);
	var v2 = new Array('J','A','B','C','D','E','F','G','H','I');
	var digCrtl=cif.charAt(cif.length-1);
	var temp = 0;
	var temp1;
	if(/^[Pp]{1}[0-9]{8}$/.test(cif)) {	return false}		
	if(!/^[A-Za-z0-9]{9}$/.test(cif)) {	return false}
	if (!/^[ABCDEFGHJPQRSUVNW]/.test(cif)) {return false} else {
		for(i=2;i<=6;i+=2 ) {  temp = temp + v1[ parseInt(cif.substr(i-1,1)) ];temp = temp + parseInt(cif.substr(i,1)); };
		temp = temp + v1[ parseInt(cif.substr(7,1)) ];
		temp = (10 - ( temp % 10));
		if( temp == 10 ){
		    if(!(digCrtl=="J" || digCrtl=="0")) {return false}
		}else{if(digCrtl==temp || digCrtl==v2[temp]) {return true}
		  else if(digCrtl!=temp) {return false}
		}
	}
	return true;
}

var Common = {
	setMsgError: function(errores, f, b){
		if (b == null) 
			b = f;
		if ($("div#msgError").length == 0) {
			$('<div id="msgError"></div>').insertBefore(b);
		} else {
			$("div#msgError").html("");
		}
		$('<ul></ul>').prependTo('div#msgError');
		if ( errores[0] == "") if ($("div#msgError").length != 0)$("div#msgError").remove();
		if ( errores[0] != "") scroll(0,0);
		for (var i = errores.length - 2; i > -1; i--) 
			$('<li>' + errores[i] + '</li>').prependTo('div#msgError ul');
	},
	validFormfLoginHome: function(){	
		var errorTxt = "";
		var f = $("form#login");
		var b = $("#utils");
		var login = f.find(" #user").attr("value");
		if( login == "") errorTxt += literal["formLogin"][0] + "|";
	
		var password = f.find(" #pass").attr("value");
		if( password == "") errorTxt += literal["formLogin"][1] + "|";
	
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	},
	validFormfLogin: function(){	
		var errorTxt = "";
		var f = $("form#formLogin");
		var login = f.find(" #login").attr("value");
		if( login == "") errorTxt += literal["formLogin"][0] + "|";
	
		var password = f.find(" #password").attr("value");
		if( password == "") errorTxt += literal["formLogin"][1] + "|";
	
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	},
	validFormOlvidoPass: function(){
		var errorTxt = "";
		var f = $("form#olvido_pass");
		var email = f.find(" #email").attr("value");
		if( email == "") errorTxt += literal["olvido_pass"][0] + "|";
		if( email != "") if (!emailRegexp.test(email)) errorTxt += literal["olvido_pass"][1] + "|";	
	
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	},
	validFormfRecomienda: function(){
		var errorTxt = "";
		var f = $("form#formRecomienda");
		var nombre_emisor = f.find(" #nombre_emisor").attr("value");
		if( nombre_emisor == "") errorTxt += literal["fRecomienda"][0] + "|";
		if( nombre_emisor != "") if (!alphaRegexp.test(nombre_emisor)) errorTxt += literal["fRecomienda"][1] + "|";
		
		var email_emisor = f.find(" #email_emisor").attr("value");
		if( email_emisor == "") errorTxt += literal["fRecomienda"][2] + "|";
		if( email_emisor != "") if (!emailRegexp.test(email_emisor)) errorTxt += literal["fRecomienda"][3] + "|";
		
		var email_receptor = f.find(" #email_receptor").attr("value");
		if( email_receptor == "") errorTxt += literal["fRecomienda"][4] + "|";
		if( email_receptor != "") if (!emailRegexp.test(email_receptor)) errorTxt += literal["fRecomienda"][5] + "|";
		
		
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	},
	validFormAltaBasica:function(){
		var errorTxt = "";
		var f = $("form#altaBasica");
		var usuario = f.find("#usuario").attr("value");
		if( usuario == "") errorTxt += literal["altaBasica"][0] + "|";
		if( usuario != "") if (!alphaRegexp.test(usuario)) errorTxt += literal["altaBasica"][1] + "|";
		
		var clave = f.find("#clave").attr("value");
		var claveR = f.find("#repetir").attr("value");
		if( clave == "") errorTxt += literal["altaBasica"][2] + "|";
		if( clave != "") if (!alphaRegexp.test(clave)) errorTxt += literal["altaBasica"][3] + "|";	
		if ( clave != claveR) errorTxt += literal["altaBasica"][4] + "|";
		
		var email = f.find("#email").attr("value");
		var confirmarEmail = f.find("#confirmarEmail").attr("value");
		if( email == "") errorTxt += literal["altaBasica"][5] + "|";
		if( email != "") if (!emailRegexp.test(email)) errorTxt += literal["altaBasica"][6] + "|";
		if ( email != confirmarEmail) errorTxt += literal["altaBasica"][12] + "|";
		
		var empresa = f.find("#empresa").attr("value");
		if( empresa == "") errorTxt += literal["altaBasica"][7] + "|";
	
		var contacto = f.find("#contacto").attr("value");
		if( contacto == "") errorTxt += literal["altaBasica"][8] + "|";
		if( contacto != "") if (!alphaRegexp.test(contacto)) errorTxt += literal["altaBasica"][9] + "|";
		
		var telefono = f.find("#telefono").attr("value");
		telefono = telefono.replace(/[\s]/g,'');
		if( telefono == "") errorTxt += literal["altaBasica"][10] + "|";
		if( telefono != "") if( telefono.length <9 ) errorTxt += literal["altaBasica"][11] + "|";
		
		var fax = f.find("#fax").attr("value");
		fax = fax.replace(/[\s]/g,'');
		if( fax!== "") if( fax.length <9) errorTxt += literal["altaBasica"][13] + "|";
//		if( fax != "") if (!phoneRegexp.test(fax)) errorTxt += literal["altaBasica"][13] + "|";
		
		var cif = f.find("#cif").attr("value");
		if( cif != "") if (!isCif(cif)) errorTxt += literal["altaBasica"][14] + "|";
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	},
	validFormfContacto:function(){
		var errorTxt = "";
		var f = $("form#formContacto");
		var nombre = f.find("#nombre").attr("value");
		if( nombre == "") errorTxt += literal["fContacto"][0] + "|";
		if( nombre != "") if (!alphaRegexp.test(nombre)) errorTxt += literal["fContacto"][1] + "|";
		
		var apellidos = f.find("#apellidos").attr("value");
		if( apellidos == "") errorTxt += literal["fContacto"][2] + "|";
		if( apellidos != "") if (!alphaRegexp.test(apellidos)) errorTxt += literal["fContacto"][3] + "|";
		
		var email = f.find("#email").attr("value");
		if( email == "") errorTxt += literal["fContacto"][4] + "|";
		if( email != "") if (!emailRegexp.test(email)) errorTxt += literal["fContacto"][5] + "|";
		
		var telefono = f.find("#telefono").attr("value");
		telefono = telefono.replace(/[\s]/g,'');
		if( telefono == "") errorTxt += literal["fContacto"][6] + "|";
		if( telefono != "") if( telefono.length < 9) errorTxt += literal["fContacto"][7] + "|";
//		if( telefono != "") if (!phoneRegexp.test(telefono)) errorTxt += literal["fContacto"][7] + "|";

		//var fax = f.find("#fax").attr("value");
		//if( fax.length > 11) errorTxt += literal["altaBasica"][11] + "|";
		
		var pais = f.find("#pais")[0].selectedIndex;
		if( pais == 0) errorTxt += literal["fContacto"][12] + "|";
		
		var ciudad = f.find("#ciudad").attr("value");
		if( ciudad == "") errorTxt += literal["fContacto"][8] + "|";
		if( ciudad != "") if (!alphaRegexp.test(ciudad)) errorTxt += literal["fContacto"][9] + "|";
		
		var titulo = f.find("#titulo").attr("value");
		if( titulo == "") errorTxt += literal["fContacto"][10] + "|";
		
		var aspectos = f.find("#aspectos").attr("value");
		if( aspectos == "") errorTxt += literal["fContacto"][11] + "|";
		
		
		var aviso= f.find("#aviso_legal");
		
		if (!aviso.attr("checked")){
			errorTxt += literal['fContacto'][13] + "|";
		}
			
		
		
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	},
	validFormfRegistro:function(){
		var errorTxt = "";
		var f = $("form#fRegistro");
		var empresa = f.find("#empresa").attr("value");
		if( empresa == "") errorTxt += literal["fRegistro"][0] + "|";
	
		var cif = f.find("#cif").attr("value");
		if( cif != "") if (!isCif(cif)) errorTxt += literal["fRegistro"][1] + "|";
		
		var nombre = f.find("#nombre").attr("value");
		if( nombre == "") errorTxt += literal["fRegistro"][2] + "|";
		if( nombre != "") if (!alphaRegexp.test(nombre)) errorTxt += literal["fRegistro"][3] + "|";
		
		var apellidos = f.find("#apellidos").attr("value");
		if( apellidos == "") errorTxt += literal["fRegistro"][4] + "|";
		if( apellidos != "") if (!alphaRegexp.test(apellidos)) errorTxt += literal["fRegistro"][5] + "|";
		
		var email = f.find("#email").attr("value");
		if( email != "") if (!emailRegexp.test(email)) errorTxt += literal["fRegistro"][6] + "|";
		
		var telefono = f.find("#telefono").attr("value");
		telefono = telefono.replace(/[\s]/g,'');
		if( telefono != "") if( telefono.length < 9) errorTxt += literal["fRegistro"][7] + "|";
//		if( telefono != "") if (!phoneRegexp.test(telefono)) errorTxt += literal["fRegistro"][7] + "|";
		
		var provincia = f.find("#provincia").attr("value");
		if( provincia == "") errorTxt += literal["fRegistro"][8] + "|";
		if( provincia != "") if (!alphaRegexp.test(provincia)) errorTxt += literal["fRegistro"][9] + "|";
		
		var poblacion = f.find("#poblacion").attr("value");
		if( poblacion != "") if (!alphaRegexp.test(poblacion)) errorTxt += literal["fRegistro"][10] + "|";
		
		var usuario = f.find("#usuario").attr("value");
		if( usuario == "") errorTxt += literal["fRegistro"][11] + "|";
		if( usuario != "") if (!alphaRegexp.test(usuario)) errorTxt += literal["fRegistro"][12] + "|";
		
		var pass = f.find("#pass").attr("value");
		if(  pass == "") errorTxt += literal["fRegistro"][13] + "|";
		if(  pass != "") if (!alphaRegexp.test( pass)) errorTxt += literal["fRegistro"][14] + "|";
		
		
		
		var condiciones = $("form#fRegistro #condiciones");
		if (errorTxt.length == 0 ){
			if (!condiciones.attr("checked")){
				errorTxt += literal['fRegistro'][15] + "|";
				
			}
			
		}
		
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	},
	validFormfTusDatos:function(){
		var errorTxt = "";
		var f = $("form#fTusDatos");

		var nombre = f.find("#nombre").attr("value");
		if( nombre == "") errorTxt += literal["fTusDatos"][16] + "|";
		if( nombre != "") if (!alphaRegexp.test(nombre)) errorTxt += literal["fTusDatos"][17] + "|";
		
		var apellidos = f.find("#apellidos").attr("value");
		if( apellidos == "") errorTxt += literal["fTusDatos"][18] + "|";
		if( apellidos != "") if (!alphaRegexp.test(apellidos)) errorTxt += literal["fTusDatos"][19] + "|";
		
		var email = f.find("#email").attr("value");
		if( email == "") errorTxt += literal["fTusDatos"][0] + "|";
		if( email != "") if (!emailRegexp.test(email)) errorTxt += literal["fTusDatos"][1] + "|";

		var login = f.find("#login").attr("value");
		if( login == "") errorTxt += literal["fTusDatos"][15] + "|";
		
		var clave = f.find("#clave").attr("value");
		var claveR =  f.find("#repetir").attr("value");
		if( clave == "") errorTxt += literal["fTusDatos"][2] + "|";
		if ( clave != claveR) errorTxt += literal["fTusDatos"][4] + "|";
		
		var empresa = f.find("#empresa").attr("value");
		if( empresa == "") errorTxt += literal["fTusDatos"][5] + "|";
		if( empresa != "") if (!alphaRegexp.test(empresa)) errorTxt += literal["fTusDatos"][6] + "|";
		
		var cif = f.find("#cif").attr("value");
		if( cif != "") if (!isCif(cif)) errorTxt += literal["fTusDatos"][7] + "|";
		
		var telefono = f.find("#telefono").attr("value");
		telefono = telefono.replace(/[\s]/g,'');
		if( telefono != "") if( telefono.length < 9) errorTxt += literal["fTusDatos"][8] + "|";
//		if( telefono != "") if (!phoneRegexp.test(telefono)) errorTxt += literal["fTusDatos"][8] + "|";
		
		var fax = f.find("#fax").attr("value");
		fax = fax.replace(/[\s]/g,'');
		if( fax != "") if( fax.length < 9) errorTxt += literal["fTusDatos"][9] + "|";
//		if( fax != "") if (!phoneRegexp.test(fax)) errorTxt += literal["fTusDatos"][9] + "|";
		
		var cp = f.find("#cp").attr("value");
		if( cp != "") if (!cpRegexp.test(cp)) errorTxt += literal["fTusDatos"][10] + "|";
		
		var pais = f.find("#pais")[0].selectedIndex;
		if( pais == 0) errorTxt += literal["fContacto"][11] + "|";
		
		
		var provincia = f.find("#provincia").attr("value");
		if( provincia == "-1") errorTxt += literal["fTusDatos"][12] + "|";
		
		var tipoEntidad = f.find("#tipoEntidad").attr("value");
		if( tipoEntidad == "-1") errorTxt += literal["fTusDatos"][13] + "|";
		
		var tipoActividad = f.find("#tipoActividad").attr("value");
		if( tipoActividad == "") errorTxt += literal["fTusDatos"][14] + "|";
		
		var aviso = f.find("#aviso_legal")
		
		if (aviso.length > 0) {
			if (!aviso.attr("checked")){
				errorTxt += literal['fTusDatos'][20] + "|";
			}
		}
			
		
		
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	},
	validFormfTusAlertas:function(){
		var errorTxt = "";
		var f = $("form#fTusAlertas");
		/*var email = f.find("#email").attr("value");
		if( email == "") errorTxt += literal["fTusAlertas"][0] + "|";
		if( email != "") if (!emailRegexp.test(email)) errorTxt += literal["fTusAlertas"][1] + "|";*/
		
		
		var formatoHTML = f.find("#formatoHTML").attr("checked");
		var formatoText = f.find("#formatoText").attr("checked");
		if ( !formatoHTML  && !formatoText )errorTxt += literal["fTusAlertas"][2] + "|";
		
		/*var siExisten = f.find("#siExisten")[0].selectedIndex;
		if( siExisten == 0) errorTxt += literal["fTusAlertas"][3] + "|";*/

		var tipoEntidad = f.find("#tipoEntidad").attr("value");
		if( tipoEntidad == "") errorTxt += literal["fTusAlertas"][4] + "|";
		
		var ubicacionProyecto = f.find("#ubicacionProyecto").attr("value");
		if( ubicacionProyecto == "") errorTxt += literal["fTusAlertas"][5] + "|";	
		var ambitoEuropeo = f.find("#ambitoEuropeo").attr("checked");
		var ambitoNacional = f.find("#ambitoNacional").attr("checked");
		var ambitoAutonomico = f.find("#ambitoAutonomico").attr("checked");
		if ( !ambitoEuropeo  && !ambitoNacional  && !ambitoAutonomico)errorTxt += literal["fTusAlertas"][6] + "|";
		
		var objetoProyecto = f.find("#objetoProyecto").attr("value");
		if( objetoProyecto == "") errorTxt += literal["fTusAlertas"][7] + "|";
		
		var actividadProyecto = f.find("#actividadProyecto").attr("value");
		if( actividadProyecto == "") errorTxt += literal["fTusAlertas"][8] + "|";
		var aviso = f.find("#aviso_legal");
		if (aviso.length > 0) {
				if (!aviso.attr("checked")){
					errorTxt += literal['fTusDatos'][20] + "|";
				}
			}
		var errores = errorTxt.split("|");
		Common.setMsgError(errores,f)
		if (errores[0] != "" ) return false	
		return true;
	}
}




$(document).ready(function(){	
	
	
	if ($("#tipo_busqueda").length > 0){
		
			$("#tipo_busqueda").removeClass("hide");
			$("#tipo_busqueda").click(function (){
			$("#advanced").show();
			
			//modificiacion para que añada un hidden si esta plegado o desplegado
			var f = $("form#buscador");
			var oculto = f.find("#oculto").attr("value");
						
				if (oculto ==0)
				{
					
					$("#oculto").remove();
					$('<input type="hidden" name="oculto" id="oculto" value="1" />').prependTo('form#buscador');
				}
				if (oculto ==1)
				{
					$("#oculto").remove();
					$('<input type="hidden" name="oculto" id="oculto" value="0" />').prependTo('form#buscador');
				}
				
			if ($(this).html() == literal["general"][0]){
				$(this).html(literal["general"][1]);
				aux = "";
				$("#ayudas input").attr("checked","");
				$("#ambito input").attr("checked","checked");
				$("#otras select").each(function(i){ $(this)[0].selectedIndex = 0});
				aux = $("#advanced").html();
				$("#advanced").html("");
				$("#camposHidden").html();
				//$('<div id="camposHidden"><input type="hidden" name="activas"  value="1" /></div>').prependTo('div#advanced');
				$('<div id="camposHidden"><input type="hidden" name="activas"  value="0" /></div>').prependTo('div#advanced');
				
			}else{
				$("#camposHidden").html('');
				$("#advanced").html(aux);
				$("#ayudas input").attr("checked","");
				$("#ambito input").attr("checked","checked");
				$("#ayuda_estatales").attr("checked","checked");
				
				
				$("#otras select").each(function(i){ $(this)[0].selectedIndex = 0});
				aux = "";
				if ($("form#buscador #pais").val() != 1){
					if ($("form#buscador #idProvincia").length > 0)  $("form#buscador #idProvincia").addClass("hide");
					$("form#buscador dt.locate").addClass("hide");
				}
				$(this).html(literal["general"][0]);
			}
		});
	}

	if ($("#advanced").length > 0){
		
		var f = $("form#buscador");
		var oculto = f.find("#oculto").attr("value");
		
			var combos = false;
			var radios = false;
			
			//if ($("#advanced #idProvincia")[0].selectedIndex != 0) combos = true;
			
			$("#ambito input").each(function(i){ if ($(this).attr("type") != "radio" ) if (!$(this).attr("checked") ) radios = true;});
			
			if ( !combos && !radios){
				
				if (oculto == 0 || oculto == '')
				{
					var aux = $("#advanced").html();
					$("#advanced").html("");
					$("#camposHidden").html();
					//$('<div id="camposHidden"><input type="hidden" name="activas"  value="1" /><input type="hidden" name="europeas" id="ambito_comunitarias" value="1" /><input type="hidden" name="nacionales" id="ambito_estatales" value="1" /><input type="hidden" name="autonomicas" id="ambito_autonomicas" value="1" /><input type="hidden" name="locales" id="ambito_locales" value="1" /><input type="hidden" name="internacionales" id="ambito_internacionales" value="1" /></div>').prependTo('div#advanced');
					$('<div id="camposHidden"><input type="hidden" name="activas"  value="0" /><input type="hidden" name="europeas" id="ambito_comunitarias" value="1" /><input type="hidden" name="nacionales" id="ambito_estatales" value="1" /><input type="hidden" name="autonomicas" id="ambito_autonomicas" value="1" /><input type="hidden" name="locales" id="ambito_locales" value="1" /><input type="hidden" name="internacionales" id="ambito_internacionales" value="1" /></div>').prependTo('div#advanced');
				}
				
			}else{
				
				if (oculto == 0 || oculto == '')
				{
					$("#advanced").hide();
				}
				
				$("#tipo_busqueda").html(literal["general"][0]);
				
				
			}
			
			if (oculto == 0 || oculto == '')
				{
					$("#tipo_busqueda").html(literal["general"][1]);
				}
				
			if (oculto == 1)
				{
					$("#tipo_busqueda").html(literal["general"][0]);
				}	
	}

	if ( $("form#buscador").length > 0 ){
		$("form#buscador").bind("submit",function(){
			if ($("#ambito_comunitarias").attr("checked") == true && $("#ambito_estatales").attr("checked") == true && $("#ambito_autonomicas").attr("checked") == true) {
				$("#ambito_total").attr("value","selected");
				
			}
		});
		if ($("form#buscador #pais").val() != 1){
			$("form#buscador #region")[0].selectedIndex = 0;
			if ($("form#buscador #idProvincia").length > 0) $("form#buscador #idProvincia")[0].selectedIndex = 0;
			$("form#buscador #region").addClass("hide");
			if ($("form#buscador #idProvincia").length > 0)  $("form#buscador #idProvincia").addClass("hide");
			$("form#buscador .locate").addClass("hide");
		}
		$("form#buscador #pais").bind("change",function(){
			if ($("form#buscador #pais").val() != 1){
				$("form#buscador #region")[0].selectedIndex = 0;
				if ($("form#buscador #idProvincia").length > 0)  $("form#buscador #idProvincia")[0].selectedIndex = 0;
				$("form#buscador #region").addClass("hide");
				if ($("form#buscador #idProvincia").length > 0)  $("form#buscador #idProvincia").addClass("hide");
				$("form#buscador dt.locate").addClass("hide");
			}else{
				$("form#buscador #region").removeClass("hide");
				if ($("form#buscador #idProvincia").length > 0)  $("form#buscador #idProvincia").removeClass("hide");
				$("form#buscador dt.locate").removeClass("hide");
			}
		});
		
	}
	if ( $("form#olvido_pass").length > 0 ){
		$("form#olvido_pass").bind("submit",Common.validFormOlvidoPass)
	}
	if ( $("form#altaBasica").length > 0 ){
		$("form#altaBasica").bind("submit",Common.validFormAltaBasica)
	}
	if ( $("form#fRegistro").length > 0 ){
		$("form#fRegistro").bind("submit",Common.validFormfRegistro)
	}
	if ( $("form#fTusDatos").length > 0 ){
		$("form#fTusDatos").bind("submit",Common.validFormfTusDatos)
	}
	if ( $("form#fTusAlertas").length > 0 ){
		$("form#fTusAlertas").bind("submit",Common.validFormfTusAlertas)
	}
	
	if ( $("form#formLogin").length > 0 ){
		$("form#formLogin").bind("submit",Common.validFormfLogin)
	}
	if ( $("form#login").length > 0 ){
		$("form#login").bind("submit",Common.validFormfLoginHome)
	}
	if ( $("form#formRecomienda").length > 0 ){
		$("form#formRecomienda").bind("submit",Common.validFormfRecomienda)
	}
	if ( $("form#formContacto").length > 0 ){
		$("form#formContacto").bind("submit",Common.validFormfContacto)
	}
	
});


