/*VALIDACION FORMULARIO DE CONTACTO*/

function validaContactenos(form){

	

		if (form.motivo.options[form.motivo.selectedIndex].value == "0"){

		alert('Seleccione el Motivo de Contacto por favor');

		form.motivo.focus();

		return false;

		}	

		

		if (Empty(form.nombres.value) || (form.nombres.value.length < 3)) 

		{

        alert('Ingrese su nombre por favor');

		form.nombres.focus();

        return false;

        }

        

		if (Empty(form.apellidos.value) || (form.apellidos.value.length < 3)) 

		{

        	alert('Ingrese su apellido por favor');

			form.apellidos.focus();

        	return false;

        }

     	

        if (Empty(form.telefono.value)) 

		{

        	alert('Ingrese su teléfono de contacto por favor');

			form.telefono.focus();

        	return false;

        }

        

        if (!isMail(form.email.value)) {

            alert('Ingrese un e-mail válido para contactarle por favor');

			form.email.focus();

            return false;

        }	

		

				if (Empty(form.mensaje.value)) {

        alert('Detalle tu mensaje por favor');

		form.mensaje.focus();

        return false;

        }

		

		form.action="/graba_contacto.php";



		return true;

}




function validaContactenosEN(form){

	

		if (form.motivo.options[form.motivo.selectedIndex].value == "0"){

		alert('Must provide Reason for contact');

		form.motivo.focus();

		return false;

		}	

		

		if (Empty(form.nombres.value) || (form.nombres.value.length < 3)) 

		{

        alert('Must provide name');

		form.nombres.focus();

        return false;

        }

        

		if (Empty(form.apellidos.value) || (form.apellidos.value.length < 3)) 

		{

        	alert('Must provide surname');

			form.apellidos.focus();

        	return false;

        }

     	

        if (Empty(form.telefono.value)) 

		{

        	alert('Must provide Telephone number');

			form.telefono.focus();

        	return false;

        }

        

        if (!isMail(form.email.value)) {

            alert('Must provide validate email');

			form.email.focus();

            return false;

        }	

		

				if (Empty(form.mensaje.value)) {

        alert('Enter message');

		form.mensaje.focus();

        return false;

        }

		




		return true;

}

/*VALIDACION FORMULARIO OPORTUNIDADES DE TRABAJO*/

function validaOportunidades(form){

	

	if (Empty(form.nombres.value) || (form.nombres.value.length < 3))

	{

		alert('Debe ingresar nombre completo.');

		form.nombres.focus();

		return false;

	}

		

	if (Empty(form.apellidos.value) || (form.apellidos.value.length < 3))

	{

		alert('Debe ingresar apellido completo.');

		form.apellidos.focus();

		return false;

	}



				

	if (Empty(form.telefono.value)|| (form.telefono.value.length < 6)) {

		alert('Ingresa su teléfono');

		form.telefono.focus();

		return false;

	}

	

	if (!isMail(form.email.value)) {

		alert('Ingresa un E-mail válido para contactarte por favor');

		form.email.focus();

		return false;

	}



	if(form.area.options[form.area.selectedIndex].value == "0")

	{

		alert('Debe seleccionar un área de interés.');

		form.area.focus();

		return false;

	}

	

	if (Empty(form.archivoadjunto.value))

	{

		alert('Debe ingresar un archivo en formato word.');

		form.archivoadjunto.focus();

		return false;

	}

	

	if (!Empty(form.archivoadjunto.value))

     {

    	resultado=TestFileType(form.archivoadjunto.value,['.doc'])

		if (resultado ==false)

			return false;

    }

		form.action="/graba_oportunidad.php";



	return ;

		

}


/*VALIDACION FORMULARIO OPORTUNIDADES DE TRABAJO EN*/

function validaOportunidadesEN(form){

	

	if (Empty(form.nombres.value) || (form.nombres.value.length < 3))

	{

		alert('Must provide name.');

		form.nombres.focus();

		return false;

	}

		

	if (Empty(form.apellidos.value) || (form.apellidos.value.length < 3))

	{

		alert('Must provide surname.');

		form.apellidos.focus();

		return false;

	}



				

	if (Empty(form.telefono.value)|| (form.telefono.value.length < 6)) {

		alert('Must provide Telephone number');

		form.telefono.focus();

		return false;

	}

	

	if (!isMail(form.email.value)) {

		alert('Must provide validate email');

		form.email.focus();

		return false;

	}



	if(form.area.options[form.area.selectedIndex].value == "0")

	{

		alert('Must provide Area of interest.');

		form.area.focus();

		return false;

	}

	

	if (Empty(form.archivoadjunto.value))

	{

		alert('Must provide C.V. in Word format.');

		form.archivoadjunto.focus();

		return false;

	}

	

	if (!Empty(form.archivoadjunto.value))

     {

    	resultado=TestFileType(form.archivoadjunto.value,['.doc'])

		if (resultado ==false)

			return false;

    }

		form.action="/graba_oportunidad.php";



	return ;

		

}


function TestFileType( fileName, fileTypes )

{

	if (!fileName) return;

	dots = fileName.split(".")

	fileType = "." + dots[dots.length-1].toLowerCase();

	if (fileTypes.join(".").indexOf(fileType) != -1)

		return  true;

	else

	{

		alert("Solo suba archivos de tipo: \n\n" + (fileTypes.join(" .")) + "\n\nSeleccione un nuevo archivo y reintente.");

		return false;

	}

}

