	
			
			function isValidEmail(str) {
   				return (str.indexOf(".")>0 ) && (str.indexOf("@") > 0);
 			}
				
				
			function ValidarNumero(elemento,texto){
			//   if (ValidarNulo(elemento,texto)==false) return false;
			   for (var i=0;i<elemento.value.length;i++)
			   {
				  chr=elemento.value.substring(i,i+1);
				  if ( (chr!="0") && (chr!="1") && (chr!="2") && (chr!="3") && (chr!="4") && (chr!="5") && (chr!="6") && (chr!="7") && (chr!="8") && (chr!="9") && (chr!=",") && (chr!=".") )
						{
						   alert("ERROR: El campo "+ texto+ " debe ser numérico");
						   elemento.focus();
						   return false;
				  }
			
				}
				return true;
			}

			function Validar()
			{
				if (document.form_anuncia.nombre.value==""){
					alert("Por favor rellene el nombre.");
					document.form_anuncia.nombre.focus();
					return false;
				}
				beginUpload()
				if (document.form_anuncia.email.value==""){
					alert("Por favor rellene el email.");
					document.form_anuncia.email.focus();
					return false;
				}
				if (!isValidEmail(document.form_anuncia.email.value)){
					alert("El email no es valido.");
					document.form_anuncia.email.focus();
					return false;
				}
				if (document.form_anuncia.email2.value==""){
					alert("Por favor rellene la comprobación del e-mail.");
					document.form_anuncia.email2.focus();
					return false;
				}
				if (!isValidEmail(document.form_anuncia.email2.value)){
					alert("El email no es valido.");
					document.form_anuncia.email2.focus();
					return false;
				}
				if (document.form_anuncia.email2.value!=document.form_anuncia.email.value)
				{
					alert("Los emails no coinciden");
					document.form_anuncia.email2.focus();
					return false;

				}
				if (document.form_anuncia.texto.value==""){
					alert("Por favor rellene la descripción del inmueble.");
					document.form_anuncia.texto.focus();
					return false;
				}
				if (document.form_anuncia.precio.value==""){
					alert("Por favor rellene el precio aproximado.");
					document.form_anuncia.precio.focus();
					return false;
				}
				if (document.form_anuncia.precio.value!=""){
					if ( ValidarNumero(document.form_anuncia.precio,"precio" )==false){
						return false;
					}
				}
				if (document.form_anuncia.hipoteca.value==""){
					alert("Por favor rellene la hipoteca pendiente.");
					document.form_anuncia.hipoteca.focus();
					return false;
				}
				if (document.form_anuncia.hipoteca.value!=""){
					if ( ValidarNumero(document.form_anuncia.hipoteca,"hipoteca" )==false){
						return false;
					}
				}
				if (document.form_anuncia.metros.value==""){
					alert("Por favor rellene mos metros cuadrado.");
					document.form_anuncia.metros.focus();
					return false;
				}
				if (document.form_anuncia.metros.value!=""){
					if ( ValidarNumero(document.form_anuncia.metros,"metros cuadrados" )==false){
						return false;
					}
				}
				
				if (document.form_anuncia.texto2.value==""){
					alert("Por favor rellene la descripción en cambiaría por.");
					document.form_anuncia.texto2.focus();
					return false;
				}
					
				if (document.form_anuncia.ciudad.options[document.form_anuncia.ciudad.selectedIndex].value==0)
				{
					alert("Por favor elija el municipio.");
					document.form_anuncia.ciudad.focus();
					return false;
				}
				if (document.form_anuncia.acepto.checked==false){
					alert("Por favor acepte las condiciones.");
					document.form_anuncia.acepto.focus();
					return false;
				}
				
				var txekeado=false;
				var c = new Array();
			    c = document.form_anuncia.getElementsByTagName('input');
			   for (var i = 0; i < c.length; i++)
			   {
			     if (c[i].type == 'checkbox')
			     {
        			  if(c[i].name=='provinciapor[]'){
					  	if(c[i].checked==true){
							var txekeado=true;
						}
					  }
			     }
			   }
			   if (txekeado==false){

					alert("Por favor, elija al menos una provincia en la que estas interesado.");
					document.form_anuncia.texto2.focus();
					return false;
				}
				//beginUpload()
				return true;
			}
