
//ESTA FUNCIÓN ES PARA MANTENER ACTIVO EN AZUL BRILLANTE LA OPCIÓN DEL MENÚ PRINCIPAL SELECCIONADA
//function menu(activo){
//	if (activo != ""){
//		document.getElementById(activo).style.color="#ffa841";	
//	}
//	else{
//		document.getElementById('inicio').style.color="#ffa841";	
//	}
//}
	
	
//igual que la primera pero para activar el submenu de productos

function subMenu(activo){
	if (activo != ""){
		document.getElementById(activo).style.color="#ffa841";	
	}
	else{
		return true;
	}
}
	


// para los submenus de segundo nivel de FORMACIÓN
function subMenu1(activo){
	if (activo != ""){
		document.getElementById(activo).style.color="#ffa841";	
	}
	else{
		return true;
	}
}
	
	
function validarEmail() {
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.revista.email.value)){
	document.revista.submit();
  } else {
	alert("La dirección de EMAIL es incorrecta.");
	return (false);
  }	
}

function validaRevista(){
	//alert(document.revista.elements(3).name)
	var campos= "Los siguientes campos son obligatorios:\n";
	var errores = 0;
	for (i=0; i<=12; i++){
		if (document.revista.elements(i).value == ""){
				errores = 1;
				//campos = campos + document.revista.elements(i).name + "\n";
			}
		
		}
	if(errores == 1) {
			document.getElementById('error').style.display="";
			
			
			//alert(campos);
			
		}else{
			validarEmail();
			
			}
	
	}
	
	
function validaDistri(){
	var campos = document.distri.elements.length - 1;
	var errores = 0;
	var error;
	for (i=0; i<=campos; i++){
		if (document.distri.elements(i).value == ""){
			errores = 1;
		}
	}
	if(errores == 1) {
		posiciona();
		estadoForm(true,'distri');
		error = "Todos los campos son obligatorios."
		document.getElementById('p1').innerHTML = error;
 		document.getElementById('capaerrores').style.display = "";
 		
 		location.href = "#";
	}
	else{	
		posiciona();
		validarEmaildistri();
	}
	
	
}
	
	function errores(errortelefono, errorfax, errorcp, errormail){
		
		alert("Se han encontrado los siguientes errores:" + errortelefono + errorfax + errorcp + errormail)
		}
	
	
	function validarEmaildistri() {
	var error = 0
	var errortelefono, errorfax, errorcp, errormail;
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.distri.email.value)){
document.getElementById('p4').style.display="none";

  		} else {
		 error = 1;
		errormail= "La dirección de EMAIL es incorrecta";
		document.getElementById('p4').style.display="";
		
  		}	
  
	if (isNaN(document.distri.telefono.value) == false){
			
			if (document.distri.telefono.value.length<9){
				error = 1;
				errortelefono = "El campo TELÉFONO es incorrecto"
				document.getElementById('p1').style.display="none";

			}else{
				document.getElementById('p1').style.display="none";;
				}
		}else{
			error = 1;
			errortelefono = "El campo TELÉFONO es incorrecto"
			document.getElementById('p1').style.display="";
			}
		if(isNaN (document.distri.fax.value)== false){
				if (document.distri.fax.value.length<9){
				error = 1;
				errorfax = "El campo FAX es incorrecto"
				document.getElementById('p2').style.display="";
				}else{
					document.getElementById('p2').style.display="none";
					}
		}else{
			error = 1;
			errorfax = "El campo FAX es incorrecto"
			}
									  
		 if(isNaN (document.distri.cp.value)== false){
													
				if (document.distri.cp.value.length<5){
				error = 1;
				errorcp = "El campo CÓDIGO POSTAL es incorrecto"
				document.getElementById('p3').style.display="";
				}else{
					document.getElementById('p3').style.display="none";
					}
		}else{
			error = 1;
			errorcp = "El campo CÓDIGO POSTAL es incorrecto"
			document.getElementById('p3').style.display="";
			}
 if (error == 1){

	 document.getElementById('p1').innerHTML = errortelefono;
	 document.getElementById('p2').innerHTML = errorfax;
	 document.getElementById('p3').innerHTML = errorcp;
	 document.getElementById('p4').innerHTML = errormail;
	 
	 document.getElementById('capaerrores').style.display = "";
	 location.href = "#";
	 //errores(errortelefono, errorfax, errorcp, errormail);
	 }else{
		 document.distri.submit();
		 } 
}
	
	
	
				
 function validarEmailcontacto() {
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.contacto.email.value)){
	document.contacto.submit();
  } else {
	alert("La dirección de EMAIL es incorrecta.");
	return (false);
  }	
}

function distri(){
	alert(document.distribuidor.estado.value);
	document.getElementById('subservicios').style.display="block";
	}
		
function cambiaImagencasos(){
	document.getElementById('bann').style.display = "";
	document.getElementById('bann').src = "/softland_chile/img/home/casos/" + document.banner.banners.value;
	
	}
	
function cambiaImagenrevista(){
	document.getElementById('bann').style.display = "";
	document.getElementById('bann').src = "/softland_chile/img/home/revista/" + document.banner.banners.value;
	
	}
	
function cambiaImagendistri(){
	document.getElementById('bann').style.display = "";
	document.getElementById('bann').src = "/softland_chile/img/home/distri/" + document.banner.banners.value;
	
	}
	
	
//Funcion para el apartado de distribuidores. Para cuando seleccionamos un estado, que nos aparezca el listado de distribuidores de ese estado.	
function cambiar(region){
		//alert("/softland_chile/distribuidores/comprar.asp?menu=distri&id_estado=" + estado)
		
		location.href= "/softland_chile/distribuidores/comprar.asp?menu=distri&id_region=" + region;
	}
	
function cambiarempresa(region,empresa){
		//alert("/softland_chile/distribuidores/comprar.asp?menu=distri&id_estado=" + estado)
		
		location.href= "/softland_chile/distribuidores/comprar.asp?menu=distri&id_region=" + region + "&id_empresa=" + empresa;
	}
function cambiarimplementador(region,implementador){
	//alert("/softland_chile/distribuidores/comprar.asp?menu=distri&id_estado=" + estado)
	
	location.href= "/softland_chile/distribuidores/comprar.asp?menu=distri&id_region=" + region + "&id_implementador=" + implementador;
}
	
function abreDistri(){
	window.open('/softland_chile/distribuidores/comprar.asp','distribuidores','width=540, height=400, toolbars=no, resizable=no, directories=no, top=0, left= 0, scrollbars=yes');
	
	}
	
	
//Validador de campos de administrador y validador de fecha en el administrador

function getYear(d) { 
   return (d < 1000) ? d + 1900 : d;
   }
 
 function isDate (day, month, year) {
   // month argument must be in the range 1 - 12
   month = month - 1;  // javascript month range : 0- 11
   var tempDate = new Date(year,month,day);
   if ( (getYear(tempDate.getYear()) == year) &&
      (month == tempDate.getMonth()) &&
      (day == tempDate.getDate()) )
       return true;
   else
      return false
   }
 
 function fechak(fecha)
 {
 if (fecha!="")
 {
 var fecha2=fecha
 p=fecha2.split("/")
  if (isDate(p[0],p[1],p[2])==false)
  {
   alert("ERROR: por favor, introduzca una fecha correcta")
   
  }else{
	document.banner.submit();
}
}
}






function validarCampos(){
var campos = document.banner.elements.length - 1;
	var errores = 0;
	var error;
	for (i=0; i<=campos; i++){
		if (document.banner.elements(i).value == ""){
				errores = 1;
				
			}
		
		}
	if(errores == 1) {
		alert("Todos los campos son obligatorios.");
	
	
	}else{
		fechak(document.banner.fecha.value)
		
		}
	}






function estadoForm(estado,nombreFormulario){

	if(nombreFormulario == 'distri'){
		var longitud = document.distri.elements.length - 1;
	}
	if(nombreFormulario == 'contacto'){
		var longitud = document.contacto.elements.length;
	}
	if(nombreFormulario == 'revista'){
		var longitud = document.revista.elements.length;
	}
	for(i=1;i<=longitud;i++){
		campo = 'entrada' + i;
		//alert(campo);
		document.getElementById(eval('campo')).disabled = estado;
	}
}
function ocultaCapa(param){
	document.getElementById('capaerrores').style.display = 'none';	
}	

function posiciona(){
	var x_res = screen.width;
	var y_res = screen.height;
	var dividendo = 2;

	var posicionCapa = new Array;
	posicionCapa[0] = document.getElementById('capaerrores').style.top;
	posicionCapa[1] = document.getElementById('capaerrores').style.left;
	
	var x_final=((x_res) - posicionCapa[0])/dividendo;
	var y_final=((y_res) - posicionCapa[1])/dividendo;
	
	document.getElementById('capaerrores').top = x_final;
	document.getElementById('capaerrores').left = y_final;
}



function final(){
	document.getElementById('p1').innerHTML = 'El env&iacute;o del formulario se ha realizado correctamente. Gracias por su colaboraci&oacute;n';
	document.getElementById('p0').style.display = 'none';
	document.getElementById('capaerrores').style.display = "";
}
function validaFormrevista() {
	var campos = document.revista.elements.length - 1;
	var errores = 0;
	var error;

	for (i=0; i<=campos; i++){
		if (document.revista.elements(i).value == ""){
			errores = 1;
		}
	}	
	if(errores == 1) {
		posiciona();
		estadoForm(true,'revista');
		error = "Todos los campos son obligatorios."
		document.getElementById('p1').innerHTML = error;
 		document.getElementById('capaerrores').style.display = "";
 		
 		//location.href = "#";
	}
	else{	
		posiciona();
		estadoForm(true,'revista');
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.revista.email.value)){
			document.revista.submit();
		}
		else{
			estadoForm(true,'revista');
			error= "La dirección de EMAIL es incorrecta";
			document.getElementById('p1').innerHTML = error;
 			document.getElementById('capaerrores').style.display = "";
 		 	//location.href = "#";
	  	}
	}		
}


function validarEmaildistri() {
	estadoForm(true,'distri');
	var error = 0
	var errortelefono, errorfax, errorcp, errormail;
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.distri.email.value)){
		document.getElementById('p4').style.display="none";
 	}
	else{
		error = 1;
		errormail= "La dirección de EMAIL es incorrecta";
		document.getElementById('p4').style.display="";
	}	
	if (isNaN(document.distri.telefono.value) == false){
		if (document.distri.telefono.value.length<9){
			error = 1;
			errortelefono = "El campo TELÉFONO es incorrecto"
			document.getElementById('p1').style.display="none";
		}
		else{
			document.getElementById('p1').style.display="none";
		}
	}
	else{
		error = 1;
		errortelefono = "El campo TELÉFONO es incorrecto"
		document.getElementById('p1').style.display="";
	}
	if(isNaN (document.distri.fax.value)== false){
		if (document.distri.fax.value.length<9){
			error = 1;
			errorfax = "El campo FAX es incorrecto"
			document.getElementById('p2').style.display="";
		}
		else{
			document.getElementById('p2').style.display="none";
		}
	}
	else{
		error = 1;
		errorfax = "El campo FAX es incorrecto"
	}
	if(isNaN (document.distri.cp.value)== false){
		if (document.distri.cp.value.length<5){
			error = 1;
			errorcp = "El campo CÓDIGO POSTAL es incorrecto"
			document.getElementById('p3').style.display="";
		}
		else{
			document.getElementById('p3').style.display="none";
		}
	}
	else{
		error = 1;
		errorcp = "El campo CÓDIGO POSTAL es incorrecto"
		document.getElementById('p3').style.display="";
	}
	 if (error == 1){
		 document.getElementById('p1').innerHTML = errortelefono;
		 document.getElementById('p2').innerHTML = errorfax;
		 document.getElementById('p3').innerHTML = errorcp;
		 document.getElementById('p4').innerHTML = errormail;
		 document.getElementById('capaerrores').style.display = "";
		 location.href = "#";
	 }
	 else{
	 	//alert("todoOK");
		document.distri.submit();
	 } 
	 
}
	
	

				
function validarFormcontacto() {
	var campos = document.contacto.elements.length;
	//alert(campos);
	var errores = 0;
	var error;
	for (i=1; i<=campos; i++){
		//alert(i);
		if (document.contacto.elements(i).value == ""){
			errores = 1;
		}
	}	
	if(errores == 1) {
		posiciona();
		estadoForm(true,'contacto');
		error = "Todos los campos son obligatorios."
		document.getElementById('p1').innerHTML = error;
 		document.getElementById('capaerrores').style.display = "";
	}
	else{
		posiciona();
		//alert('entra');
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.contacto.email.value)){
			estadoForm(true,'contacto');
			document.contacto.submit();
		}
		else{
			error= "La dirección de EMAIL es incorrecta";
			document.getElementById('p1').innerHTML = error;
 			document.getElementById('capaerrores').style.display = "";
 		 	//location.href = "#";
	  	}
	}		
}
function sacavalor(eloptionclikao){
	document.banner.nombre_municipio.value=document.banner.id_estado.options[eloptionclikao].text;	

}
function validarFormDistri(){
	if(document.banner.id_estado.selectedIndex == 0){
		alert("Por favor introduce el estado.");

	}
	else if (document.banner.nombre_distribuidor.value == "" || document.banner.nombre_distribuidor.value == null){
		alert("Por favor introduce el nombre del distribuidor.");

	}
	else{
		document.banner.submit();
	}
}

function validarPreciosUpgrade() {
	var p1;
	var p2;
	var i1;
	var i2;
	//Se hace un replace porque sólo entiende como separación decimal el punto.
	p1 = document.banner.precio1.value.replace(",",".");
	p2 = document.banner.precio2.value.replace(",",".");
	i1 = document.banner.iva1.value.replace(",",".");
	i2 = document.banner.iva2.value.replace(",",".");
	
	if(document.banner.precio1.value==""){
		alert("Debe indicar un precio 1.");
	}
	else if(isNaN(p1)){
		alert("El precio 1 es numérico.");
	}
	else if(document.banner.iva1.value==""){
		alert("Debe indicar un iva 1.");
	}
	else if(isNaN(i1)){
		alert("El iva 1 es numérico.");
	}
	else if(document.banner.precio2.value==""){
		alert("Debe indicar un precio 2.");
	}
	else if(isNaN(p2)){
		alert("El precio 2 es numérico.");
	}
	else if(document.banner.iva2.value==""){
		alert("Debe indicar un iva 2.");
	}
	else if(isNaN(i2)){
		alert("El iva 2 es numérico.");
	}
	else if(document.banner.area.value=="-"){
		alert("Debe indicar un área de producto.");
	}
	else if(document.banner.producto.value=="-"){
		alert("Debe indicar un producto.");
	}
	else{
		document.banner.submit();	
	}
}
function validarOfertaNaranja() {
	if(document.banner.oferta.value==""){
		alert("Debe indicar una oferta.");
	}
	/*else if(document.banner.resumen1.value==""){
		alert("Debe indicar un títular 1º.");
	}
	else if(document.banner.contenido1.value==""){
		alert("Debe indicar un contenido 1º.");
	}
	else if(document.banner.alt1.value==""){
		alert("Debe indicar un alt 1º.");
	}
	else if(document.banner.enlace1.value==""){
		alert("Debe indicar un texto para el enlace  1º.");
	}
	else if(document.banner.url1.value==""){
		alert("Debe indicar una url para el enlace  1º.");
	}
	else if(document.banner.resumen2.value==""){
		alert("Debe indicar un títular 2º.");
	}
	else if(document.banner.contenido2.value==""){
		alert("Debe indicar un contenido 2º.");
	}
	else if(document.banner.alt2.value==""){
		alert("Debe indicar un alt 2º.");
	}
	else if(document.banner.enlace2.value==""){
		alert("Debe indicar un texto para el enlace  2º.");
	}
	else if(document.banner.url2.value==""){
		alert("Debe indicar una url para el enlace  2º.");
	}*/
	else{
		document.banner.submit();	
	}
}
function recargaModuloInsertar(){
	document.banner.llenar_producto.value = "si";
	document.banner.action = "modulos.asp?menu=insertaprecio";
	document.banner.submit();	
}
function recargaModuloModificar(idPrecio){
	document.banner.action = "modulos.asp?menu=updateprecio&idprecio=" + idPrecio;
	document.banner.submit();	
}
function insertarPubBanner(){
	if (document.banner.lado[0].checked == false && document.banner.lado[1].checked == false){
		alert("Debe indicar en qué lado quiere colocar el banner.");
	}else{
		document.banner.action = "insertar.asp?menu=banner";
		document.banner.submit();
	}	
}
function modificarPubBanner(){
	if (validaBanner() == true){
		document.banner.action = "update.asp?op=banner&idbanner=" + document.banner.idImagen.value;
		document.banner.submit();
	}	
}
function borrarBanner(){
	var arrayBanners;
	var respuesta;
	if (document.banner.banners.value == "|||||"){
		alert("Debe seleccionar una imagen.");
	}else{
		arrayBanners = document.banner.banners.value.split("|");
		document.banner.idImagen.value = arrayBanners[0];
		document.banner.imagen.value = arrayBanners[1];
		
		respuesta = confirm("¿Está usted seguro de borrar la imagen junto con todos sus datos?");
		if (respuesta == true){
			document.banner.action = "delete.asp?menu=banner&idbanner=" + document.banner.idImagen.value;
			document.banner.submit();
		}
	}	
}
function validarContrato(){
	if (document.banner.contenido.value == ""){
		alert("Por favor, introduce el contenido del contrato de soporte.");
	}
	else{
		document.banner.submit();
	}	
}
function validarAtencionPreferencial(){
	if (document.banner.contenido.value == ""){
		alert("Por favor, introduce el contenido de atención preferencial.");
	}
	else{
		document.banner.submit();
	}	
}
function validarNoticia(){
	if (document.banner.titulo.value == ""){
		alert("Por favor, introduce el título de la noticia.");
	}
	else if (document.banner.contenido.value == ""){
		alert("Por favor, introduce el contenido de la noticia.");
	}
	else{
		document.banner.submit();
	}	
}
function validarCursosSeminarios(){
	if (document.banner.contenido.value == ""){
		alert("Por favor, introduce el contenido de cursos y seminarios.");
	}
	else{
		document.banner.submit();
	}	
}
function validarBolsa(){
	if (document.banner.area.value == ""){
		alert("Por favor, introduce el área.");
	}
	else{
		document.banner.submit();
	}	
}
function validaBanner(){
	if (document.banner.idImagen.value == ""){
		alert("No puede modificar el banner porque todavía no está activo.");
		return false;
	}else{
		if (document.banner.lado[0].checked == false && document.banner.lado[1].checked == false){
			alert("Debe indicar en qué lado quiere colocar el banner.");
			return false;
		}else{
			return true;
		}
	}
}
function aceptar(){
	var arrayBanners;
	if (document.banner.banners.value == "|||||"){
		alert("Debe seleccionar una imagen.");
	}else{
		arrayBanners = document.banner.banners.value.split("|");
		document.banner.idImagen.value = arrayBanners[0];
		document.banner.imagen.value = arrayBanners[1];
		document.banner.control.value = "ok";
		document.banner.action="/softland_chile/admin/modulos.asp?menu=banners&func=1";
		document.banner.submit();
	}		
}

function cambiaImagen(){
	
	var arrayBanners;
	var val_act;
	
	arrayBanners = document.banner.banners.value.split("|");
	
	document.getElementById('bann').style.display = "";
	document.getElementById('bann').src = "/softland_chile/img/home/banners/" + arrayBanners[1];
	document.banner.alt.value = arrayBanners[4];
	document.banner.url.value = arrayBanners[5];
	if (arrayBanners[2] == "1"){
		val_act = true;	
	}
	else if (arrayBanners[2] == "0"){
		val_act = false;
	}
	else{
		val_act = false;
	}
	document.banner.activo.checked = val_act;
	if (arrayBanners[3] == "d"){
		document.banner.lado[0].checked = true;
		document.banner.lado[1].checked = false;
	}
	else if (arrayBanners[3] == "i"){
		document.banner.lado[0].checked = false;
		document.banner.lado[1].checked = true;
	}
	else{
		document.banner.lado[0].checked = false;
		document.banner.lado[1].checked = false;
	}
	
}
function limpiarPantalla(){
	document.banner.alt.value = "";
	document.banner.url.value = "";	
	document.banner.activo.checked = false;
	document.banner.lado[0].checked = false;
	document.banner.lado[1].checked = false;
	document.banner.idImagen.value = "";
	document.banner.imagen.value = "";
}
function validarEmpresa(){
	if (document.banner.empresa.value == ""){
		alert("Por favor, introduce el nombre de la empresa.");
	}
	else if (document.banner.direccion.value == ""){
		alert("Por favor, introduce la dirección de la empresa.");
	}
	else if (document.banner.poblacion.value == ""){
		alert("Por favor, introduce la población de la empresa.");
	}
	else if (document.banner.codigotlf.value == ""){
		alert("Por favor, introduce el código teléfonico de la ciudad.");
	}
	else if (document.banner.codigotlf.value.length != 2){
		alert("Por favor, el código teléfonico debe contener 2 dígitos.");
	}
	else if (document.banner.email.value != "" && (document.banner.email.value.indexOf("@") == -1 || document.banner.email.value.indexOf(".") == -1)){
		alert("El correo electrónico no es correcto.");
	}
	else{
		document.banner.submit();
	}	
}
function validarImplementador(){
	var fechaactual = new Date();
	
	if (document.banner.nombre.value == ""){
		alert("Por favor, introduce el nombre del implementador.");
	}
	if (document.banner.apellidos.value == ""){
		alert("Por favor, introduce los apellidos del implementador.");
	}
	else if (document.banner.nregistro.value == ""){
		alert("Por favor, introduce el número de registro del implementador.");
	}
	else if (document.banner.certificadoen.value == ""){
		alert("Por favor, introduce el software en que el que está certificado el implementador.");
	}
	else if (document.banner.fecha.value == ""){
		alert("Por favor, introduce la fecha de vencimiento del certificado.");
	}
	else if (document.banner.fecha.value.length != 10){
		alert("Por favor, introduce una fecha correcta.");
	}
	else if (document.banner.fecha.value.substring(0,2) < 1 || document.banner.fecha.value.substring(0,2) > 31){
		alert("Por favor, introduce un día correcto.");
	}
	else if (document.banner.fecha.value.substring(3,5) < 1 || document.banner.fecha.value.substring(3,5) > 12){
		alert("Por favor, introduce un mes correcto.");
	}
	else if (document.banner.fecha.value.substring(6,10) < fechaactual.getYear()){
		alert("Por favor, introduce un año actual o superior al que nos encontramos.");
	}
	else{
		document.banner.submit();
	}	
}
function validarTextoBienvenida(){
	if (document.banner.texto.value == ""){
		alert("Por favor, introduce el texto de bienvenida.");
	}
	else{
		document.banner.submit();
	}	
}
function validarDisDistribuidor(){
	var longitud = document.banner.rut1.value.length + document.banner.rut2.value.length + document.banner.rut3.value.length + document.banner.rut4.value.length;
	
	if (document.banner.distribuidor.value == ""){
		alert("Por favor, introduce el nombre del distribuidor.");
	}
	else if (document.banner.rut1.value == "" || document.banner.rut2.value == "" || document.banner.rut3.value == "" || document.banner.rut4.value == ""){
		alert("Por favor, el rut debe incluir 9 caracteres.");
	}
	else if (longitud != 9){
		alert("Por favor, el rut debe incluir 9 caracteres.");
	}
	else if (isNaN(document.banner.rut1.value) || isNaN(document.banner.rut2.value) || isNaN(document.banner.rut3.value)){
		alert("Por favor, las 3 primeras partes del rut deben ser numéricas.");
	}
	else if (document.banner.password.value == ""){
		alert("Por favor, introduce el password.");
	}
	else if (document.banner.cantidad.value == ""){
		alert("Por favor, introduce la cantidad.");
	}
	else if (document.banner.compras.value == ""){
		alert("Por favor, introduce las compras.");
	}
	else if (document.banner.pagos.value == ""){
		alert("Por favor, introduce los pagos.");
	}
	else if (document.banner.implementaciones.value == ""){
		alert("Por favor, introduce las implementaciones.");
	}
	else if (document.banner.registros.value == ""){
		alert("Por favor, introduce los registros.");
	}
	else if (document.banner.reclamos.value == ""){
		alert("Por favor, introduce los reclamos.");
	}
	else if (document.banner.compromiso.value == ""){
		alert("Por favor, introduce el nivel de compromiso.");
	}
	else if (document.banner.total.value == ""){
		alert("Por favor, introduce el total de puntaje.");
	}
	else if (isNaN(document.banner.cantidad.value)){
		alert("Por favor, la cantidad es numérica.");
	}
	else if (isNaN(document.banner.compras.value)){
		alert("Por favor, las compras son numéricas.");
	}
	else if (isNaN(document.banner.pagos.value)){
		alert("Por favor, los pagos son numéricos.");
	}
	else if (isNaN(document.banner.implementaciones.value)){
		alert("Por favor, las implementaciones son numéricas.");
	}
	else if (isNaN(document.banner.registros.value)){
		alert("Por favor, los registros son numéricos.");
	}
	else if (isNaN(document.banner.reclamos.value)){
		alert("Por favor, los reclamos son numéricos.");
	}
	else if (isNaN(document.banner.compromiso.value)){
		alert("Por favor, el nivel de compromiso es numérico.");
	}
	else if (isNaN(document.banner.total.value)){
		alert("Por favor, el total de puntaje es numérico.");
	}
	else{
		document.banner.submit();
	}	
}
function validarDisBeneficios(){
	if (document.banner.tipo.value == "-"){
		alert("Por favor, selecciona un tipo de beneficio.");
	}
	else if (document.banner.beneficio.value == ""){
		alert("Por favor, introduce una explicación del beneficio.");
	}
	else{
		document.banner.submit();
	}	
}

	
function openDocPDF(filename,target){
	
	//to ensure no global variable conflict with other script
	var strWinHandle = target + "objDocWin"; 
	
	//just focus to the corresponding window if it is already open
	if (window[strWinHandle] && !window[strWinHandle].closed){
		window[strWinHandle].focus();
		return false;
	}

	//open blank page
	window[strWinHandle] = window.open('','_blank','menubar=0,location=0,toolbar=0,resizable=1,status=0');

	//change window name (target); later, target will be used as frame name
	window[strWinHandle].name = strWinHandle; 

	//create frameset with only 1 frame	
	var strHTML = '<!--#include virtual="/softland_chile/includes/BloqueaPaginas.htm"-->';
	strHTML += '<html>\r\n<head>\r\n';
	strHTML += '<title>'+filename.substring(filename.lastIndexOf("/")+1)+'</title>\r\n';
	strHTML += '</head>\r\n';
	strHTML += '<frameset onload="window.focus()" rows="100%,*" border="0" frameborder="0" framespacing="0">\r\n';
	strHTML += '<frame name="'+target+'" src="about:blank">\r\n'; //set target as frame name
	strHTML += '</frameset>\r\n';
	strHTML += '</html>';
	window[strWinHandle].document.write(strHTML);
	window[strWinHandle].document.close();

	//put a little delay; Netscape6 causes a null document object when called directly
	setTimeout('loadDoc("'+strWinHandle+'","'+target+'","'+filename+'")',0);

	return false; //this cancels href of the calling link
}

function loadDoc(strWinHandle,target,filename){
	//Flash the 'Loading...' message
	var strHTML = '<!--#include virtual="/softland_chile/includes/BloqueaPaginas.htm"-->' ;
	strHTML += '<html><body>\n' ;
	strHTML += '<table width="100%" height="100%">\n';
	strHTML += '<tr><td align="center" valign="middle">\n';
	strHTML += '<font face="Arial" color="red">Por favor espere mientras carga documento...</font><br><br>\n';
	//provide link to close window (for browsers with no appropriate plugin for the needed software)
	strHTML += '<font face="Arial" size="1" color="gray">Si no tienes el software/plugin requerido para cargar  el documento dentro del browser, por favor cerrar esta ventana.</font>\n';
	strHTML += '</td></tr>\n</table>\n';
	strHTML += '</body></html>';
	var winDocFrame = window[strWinHandle].frames[target];
	winDocFrame.document.write(strHTML); //winDocFrame.document is null in Netscape6 if called directly
	winDocFrame.document.close();
		
	//preload the document
	var doc = new Image();
	doc.onerror = function(){
		//check window if still open, the user might have closed it
		if (window[strWinHandle] && !window[strWinHandle].closed){
			winDocFrame.location.replace(filename); //finally, set frameset's location to the document filename
		}
	}
	doc.src = filename; //onerror handler fires since image src is not actually an image
}
