/*VALIDA FORMULARIO DE CONTACTO*/

function WebForm_OnSubmit(form)
{
	
	/*if(!isSelected(form.ciudad)) // Valida que se seleccione una opcion del pulldown
	{
		alert('Seleccione una ciudad') // Si no es valido envia un alerta
		form.ciudad.focus(); // Pone el cursor en el campo validado
		return false;
	}*/
	
	if(Empty(form.ctl00_Estructura_Contenidos_nombre.value) || form.ctl00_Estructura_Contenidos_nombre.value=="Nombre")
	{
		alert('Insert your first name');
		form.ctl00_Estructura_Contenidos_nombre.value="";
		form.ctl00_Estructura_Contenidos_nombre.focus();
		return false;
	}
	
/*
	
	if(!isInteger(form.fono.value)) // Valida que el campo sea númerico
	{
		alert('Ingrese su teléfono') // Si viene vacio o con letras envia un alerta
		form.fono.focus(); // Pone el cursor en el campo validado
		form.fono.select(); // Selecciona el texto ingresado en el campo
		return false; // Detine el envio del formulario
	}
	
	if(!isMail(form.mail.value)) // Valida que no venga vacio y sea un e-mail válido 
	{
		alert('Ingrese su e-mail')  // Si no es valido envia un alerta
		form.mail.focus(); // Pone el cursor en el campo validado
 		form.mail.select(); // Selecciona el texto ingresado en el campo
		return false; // Detine el envio del formulario
	}
	
	*/
	return;

}

//mmosquera@temperies.com.ar
//validaciones para el contactenos
//********************************************************
function validarNombre(source, arguments)
{
    if (arguments.Value == 'Nombre') 
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarApellido(source, arguments)
{
    if (arguments.Value == 'Apellido')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarDireccion(source, arguments)
{
    if (arguments.Value == 'Dirección')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarRegion(source, arguments)
{
    if (arguments.Value == 'Seleccione Región')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarComuna(source, arguments)
{
    if (arguments.Value == 'Seleccione Comuna')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}


function validarTelefono(source, arguments)
{
    if ( arguments.Value == 'Teléfono') 
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
           
}

function validarEmail(source, arguments)
{
    if (arguments.Value == 'nombreusuario@dominio.com')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarEmpresa(source, arguments)
{
    if (arguments.Value == 'Empresa')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarAsunto(source, arguments)
{
    if (arguments.Value == 'Seleccione Motivo Contacto')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarMensaje(source, arguments)
{
    if (arguments.Value == 'Mensaje')
        arguments.IsValid = false;
    else        
        if (arguments.Value.length <= 1000)
            arguments.IsValid = true;    
        else
            arguments.IsValid = false;          
}

function validarModelo(source, arguments)
{
    if (arguments.Value == 'Seleccione Modelo')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarVersion(source, arguments)
{
    if (arguments.Value == 'Seleccione Versión')
        arguments.IsValid = false;
    else
        arguments.IsValid = true;    
}

function validarRut(source, arguments)
{
    if (arguments.Value == 'Rut')
        arguments.IsValid = false;
    else        
        if (!isRut(arguments.Value))
            arguments.IsValid = false;    
        else
            arguments.IsValid = true;
}

function ltrimn(s) {

    return s.replace(/^\s+/, "");
}


function rtrimn(s) {

    return s.replace(/\s+$/, "");
}


function trimn(s) {

    return  rtrimn (ltrimn (s));
}
//********************************************************


