
function dummy(){
	return true;
	}

function enviarLocal()
{
	if(Validar(document.contacto) )
	{
    document.contacto.submit();
	
	}
	
}
		  
   function IsEmailValid(FormName,ElemName)
{
        var EmailOk  = true
        var Temp     = ElemName
        var AtSym    = Temp.value.indexOf('@')
        var Period   = Temp.value.lastIndexOf('.')
        var Space    = Temp.value.indexOf(' ')
        var Length   = Temp.value.length - 1   // Array is from 0 to length-1
        
        if ((AtSym < 1) ||                     // '@' cannot be in first position
            (Period <= AtSym+1) ||             // Must be at least one valid char btwn '@' and '.'
            (Period == Length ) ||             // Must be at least one valid char after '.'
            (Space  != -1))                    // No empty spaces permitted
           {  
              EmailOk = false              
           } else {
               EmailOk = true;
           }
        return EmailOk
}

function esDigito (c)
{
	return ((c >= "0") && (c <= "9"));
}

function esEntero (s)
{
	var i;
    for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (!esDigito(c)) return false;
    }
    return true;
}

function sinComas (s)
{
	if (s.indexOf(",")==-1) return true;
	else return false;
	
}

function Validar(f) 
{
	var temp = "Por favor revisa y completa la planilla: \r";
	var flag = 0;


	if (f.nombre.value=="")
	{
		   temp = temp+"Nombre, "
	       flag = 1;
	}
	else
	{
		if (!sinComas(f.nombre.value))
		{
			temp = temp+"El Nombre no debe contener coma(s), "
	        flag = 1;
		}
	}

	if (f.apellido.value=="")
	{
		   temp = temp+"Apellido, "
		   flag = 1;
	} else
	{
		if (!sinComas(f.apellido.value))
		{
			temp = temp+"El Apellido no debe contener coma(s), "
	        flag = 1;
		}
	}
	
	if (f.email.value=="")
	{
		   temp = temp+"E-mail, "
	       flag = 1;
	}
	else
	{
		if (!IsEmailValid(f,f.email)) 
		{
			temp = temp + "E-mail inválido, "
			flag = 1;
		} else 
		{
			if (!sinComas(f.email.value))
			{
				temp = temp + "E-mail inválido (no debe contener coma(s)), "
				flag = 1;
			}
		}
	}

	if (f.telefono.value=="")
	{
		   temp = temp+"Teléfono, "
	       flag = 1;
	} else{
		if (!esEntero(f.telefono.value))
		{
			temp = temp + "El Teléfono debe tener sólo valores numéricos, "
			flag = 1;
		}
	}	

	if (f.ciudad.value=="")
	{
		   temp = temp+"Ciudad, "
	       flag = 1;
	}
	else
	{
		if (!sinComas(f.ciudad.value))
		{
			temp = temp+"La ciudad no debe contener coma(s), "
	        flag = 1;
		}
	}
	
	if (f.comentario.value=="")
	{
		   temp = temp+"Comentario, "
	       flag = 1;
	}


	if ( flag!=0 ){
	 	  alert(temp.substring(0,temp.length-2));
	      return false;
	}
	else
	{
		return true;
	}

}