<!--

function AbrirVentana(pagina) {
	var w = screen.width - 10;
	var h = screen.height- 100;
	window.open(pagina,"","left=0,top=0,fullscreen=no,scrollbars=yes,toolbar=yes,location=no,directories=no,status=yes,menubar=no,resizable=yes,width="+ w +",height="+ h);
}

function Desplegar(menu){
	if(document.getElementById("M_"+menu).style.visibility=="visible"){
		document.getElementById("M_"+menu).style.visibility="hidden";
		document.getElementById("M_"+menu).style.display="none";
//		document.getElementById("F_"+menu).src="graficos/flecha_down.gif";
	}else{
		document.getElementById("M_"+menu).style.display="Inline";
		document.getElementById("M_"+menu).style.visibility="visible";
//		document.getElementById("F_"+menu).src="graficos/flecha_up.gif";
	}
}
function desplegar2(menu){
	if(document.getElementById(menu).style.visibility=="visible"){
		document.getElementById(menu).style.visibility="hidden";
		document.getElementById(menu).style.display="none";
	}else{
		document.getElementById(menu).style.display="inline";
		document.getElementById(menu).style.visibility="visible";
	}
}
function desplegar3(menu,accion){
//menu=objeto, accion=cambiar visible si/no
	if (document.getElementById(menu)){
		if(accion==0){
			document.getElementById(menu).style.visibility="hidden";
			document.getElementById(menu).style.display="none";
		}else{
			document.getElementById(menu).style.display="inline";
			document.getElementById(menu).style.visibility="visible";
		}
	}
}
function pestana(pestana,accion,jj){
//menu=objeto, accion=cambiar visible si/no, jj=num de pestana
	if(accion==0){
		document.getElementById(pestana).style.backgroundImage="url(graficos/pest" + jj + "a.gif)";
		document.getElementById(pestana).style.borderBottom="1px solid #cccccc";
		if (document.getElementById('pestaEnlaces'+jj)){
				document.getElementById('pestaEnlaces'+jj).style.color="#000000";
				document.getElementById('pestaEnlaces'+jj).style.fontWeight="normal";
		}
	}else{
		document.getElementById(pestana).style.backgroundImage="url(graficos/pest" + jj + ".gif)";
		document.getElementById(pestana).style.borderBottom="1px solid #eeeeee";
		if (document.getElementById('pestaEnlaces'+jj)){
				document.getElementById('pestaEnlaces'+jj).style.color="#ffffff";
				document.getElementById('pestaEnlaces'+jj).style.fontWeight="bold";
		}
	}
}

function ValidoAcceso(NombreForm){
	var i;
		var sFormulario=document.forms[NombreForm];
		var validado = true;
		var oculto = false; // se focalizan campos "InternoColdata"
		for (i=0; i<= sFormulario.length-1; i++){
		  if (sFormulario.elements[i].attributes["validationmsg"]){
			if (sFormulario.elements[i].attributes["validationmsg"].value != ""){
				switch (sFormulario.elements[i].type) {  
					case "select-multiple" :  
						if (sFormulario.elements[i].options.length =="0"){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
							sFormulario.elements[i].focus();
							return false;
						}
						break;
					case "textarea" :  
						if (sFormulario.elements[i].value.length > sFormulario.elements[i].maxLength){validado=false;}
						if (sFormulario.elements[i].value.length == "0" ){validado=false;}
						if (validado==false){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
sFormulario.elements[i].focus();					
							return false;
						}
						break;
					case "hidden" :
						if(!sFormulario.elements[i].attributes["validacionInternaColdata"]) {
							break;
						}
						else {
							if(sFormulario.elements[i].value.toLowerCase() == "<p>&nbsp;</p>") {
								validado = false;
							}
						}



						oculto = true; supml = false; supli = false;
						if (sFormulario.elements[i].value.length > sFormulario.elements[i].maxLength){
							validado=false;
							supml = true;
						}
						if (sFormulario.elements[i].value.length == "0" ){validado=false;}
						if (sFormulario.elements[i].value.length < sFormulario.elements[i].minlength ){
							validado=false;
							supli = true;
						}

						if (validado==false){
              if(supml) {
                alert(sFormulario.elements[i].attributes["maxlengthmsg"].value);
               }
              else if(supli) {
                alert(sFormulario.elements[i].attributes["minlengthmsg"].value);
              }
              alert(sFormulario.elements[i].attributes["validationmsg"].value);
              document.getElementById(sFormulario.elements[i].attributes["id"].value+"InternoColdata").focus();					
							return false;
						}
						break;
					default :  
						if (sFormulario.elements[i].type !="image" && sFormulario.elements[i].type !="select-multiple" &&
						 sFormulario.elements[i].type !="textarea" && sFormulario.elements[i].type !="checkbox" && 
						 sFormulario.elements[i].type !="radio" && sFormulario.elements[i].attributes["validationmsg"].value != "0" && 
						 sFormulario.elements[i].attributes["validationmsg"] != "undefined" && sFormulario.elements[i].disabled == false && 
						 (sFormulario.elements[i].value =="" || sFormulario.elements[i].value =="0" )){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
							sFormulario.elements[i].focus();
							return false;
						}
						break;
					}  
				
				if (sFormulario.elements[i].minlength){
					if (sFormulario.elements[i].value.length < sFormulario.elements[i].minlength){validado=false;}
				}
				if (validado==false){
					alert(sFormulario.elements[i].attributes["validationmsg"].value);
					if(oculto) {
						alert("oc");
						sFormulario.elements[i+"InternoColdata"].focus();					
					}
					else {
						sFormulario.elements[i].focus();
					}
					return false;
				}
				 if (sFormulario.elements[i].attributes["validarmail"]){
						if(sFormulario.elements[i].value.length <= 4 || sFormulario.elements[i].value.indexOf("@") < 0 || sFormulario.elements[i].value.lastIndexOf(".") <= sFormulario.elements[i].value.indexOf("@")) {
							alert("No se ha reconocido la dirección de correo");
							sFormulario.elements[i].focus();
							return false;
						}
				  }

			 }
		  }
		}	
	return true
}

function ValidoPedido(NombreForm){
	
var i;
		var sFormulario=document.forms[NombreForm];
		var validado = true;
		var oculto = false; // se focalizan campos "InternoColdata"
		for (i=0; i<= sFormulario.length-1; i++){
		  if (sFormulario.elements[i].attributes["validationmsg"]){
			if (sFormulario.elements[i].attributes["validationmsg"].value != ""){
				switch (sFormulario.elements[i].type) {  
					case "select-multiple" :  
						if (sFormulario.elements[i].options.length =="0"){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
							sFormulario.elements[i].focus();
							return false;
						}
						break;
					case "textarea" :  
						if (sFormulario.elements[i].value.length > sFormulario.elements[i].maxLength){validado=false;}
						if (sFormulario.elements[i].value.length == "0" ){validado=false;}
						if (validado==false){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
sFormulario.elements[i].focus();					
							return false;
						}
						break;
					case "hidden" :
						if(!sFormulario.elements[i].attributes["validacionInternaColdata"]) {
							break;
						}
						else {
							if(sFormulario.elements[i].value.toLowerCase() == "<p>&nbsp;</p>") {
								validado = false;
							}
						}



						oculto = true; supml = false; supli = false;
						if (sFormulario.elements[i].value.length > sFormulario.elements[i].maxLength){
							validado=false;
							supml = true;
						}
						if (sFormulario.elements[i].value.length == "0" ){validado=false;}
						if (sFormulario.elements[i].value.length < sFormulario.elements[i].minlength ){
							validado=false;
							supli = true;
						}

						if (validado==false){
              if(supml) {
                alert(sFormulario.elements[i].attributes["maxlengthmsg"].value);
               }
              else if(supli) {
                alert(sFormulario.elements[i].attributes["minlengthmsg"].value);
              }
              alert(sFormulario.elements[i].attributes["validationmsg"].value);
              document.getElementById(sFormulario.elements[i].attributes["id"].value+"InternoColdata").focus();					
							return false;
						}
						break;
					default :  
						if (sFormulario.elements[i].type !="image" && sFormulario.elements[i].type !="select-multiple" &&
						 sFormulario.elements[i].type !="textarea" && sFormulario.elements[i].type !="checkbox" && 
						 sFormulario.elements[i].type !="radio" && sFormulario.elements[i].attributes["validationmsg"].value != "0" && 
						 sFormulario.elements[i].attributes["validationmsg"] != "undefined" && sFormulario.elements[i].disabled == false && 
						 (sFormulario.elements[i].value =="" || sFormulario.elements[i].value =="0" )){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
							sFormulario.elements[i].focus();
							return false;
						}
						break;
					}  
				
				if (sFormulario.elements[i].minlength){
					if (sFormulario.elements[i].value.length < sFormulario.elements[i].minlength){validado=false;}
				}
				if (validado==false){
					alert(sFormulario.elements[i].attributes["validationmsg"].value);
					if(oculto) {
						alert("oc");
						sFormulario.elements[i+"InternoColdata"].focus();					
					}
					else {
						sFormulario.elements[i].focus();
					}
					return false;
				}
				 if (sFormulario.elements[i].attributes["validarmail"]){
						if(sFormulario.elements[i].value.length <= 4 || sFormulario.elements[i].value.indexOf("@") < 0 || sFormulario.elements[i].value.lastIndexOf(".") <= sFormulario.elements[i].value.indexOf("@")) {
							alert("No se ha reconocido la dirección de correo");
							sFormulario.elements[i].focus();
							return false;
						}
				  }

			 }
		  }
		}	
	if (!sFormulario.elements["C1"].checked && !sFormulario.elements["C2"].checked){
			alert('Por favor, indique la forma de pago, cheque o transferencia');
			return false;
	}


	return true
	
}









/*
var sFormulario=document.forms[NombreForm];
	var validado = true;

	for (i=0; i<= sFormulario.length-1; i++){
			
		if (sFormulario.elements[i].attributes["validationmsg"]){

			switch (sFormulario.elements[i].type ) {  
				case "select-multiple" :  
					if (sFormulario.elements[i].options.length =="0"){
						alert(sFormulario.elements[i].attributes["validationmsg"].value);
						sFormulario.elements[i].focus();
						return false;
					}
				case "textarea" :  
					if (sFormulario.elements[i].value.length > sFormulario.elements[i].maxlength){validado=false;}
					if (sFormulario.elements[i].value.length == "0" ){validado=false;}
					if (validado==false){
						alert(sFormulario.elements[i].attributes["validationmsg"].value);
						return false;
					}
					break;
				default :  
					if (sFormulario.elements[i].type !="image" && sFormulario.elements[i].type !="select-multiple" &&
					 sFormulario.elements[i].type !="textarea" && sFormulario.elements[i].type !="checkbox" && 
					 sFormulario.elements[i].type !="radio" && sFormulario.elements[i].attributes["validationmsg"].value != "0" && 
					 sFormulario.elements[i].attributes["validationmsg"].value != "undefined" && sFormulario.elements[i].disabled == false && 
					 (sFormulario.elements[i].value =="" || sFormulario.elements[i].value =="0" )){
						alert(sFormulario.elements[i].attributes["validationmsg"].value);
						sFormulario.elements[i].focus();
						return false;
					}
					break;
			}  
			if (validado==false){
				alert(sFormulario.elements[i].attributes["validationmsg"].value);
				sFormulario.elements[i].focus();
				return false;
			}
		}
	}

*/




function ValidoPedidoCursos(NombreForm){
	var i;
		var sFormulario=document.forms[NombreForm];
		var validado = true;
		var oculto = false; // se focalizan campos "InternoColdata"
		for (i=0; i<= sFormulario.length-1; i++){
		  if (sFormulario.elements[i].attributes["validationmsg"]){
			if (sFormulario.elements[i].attributes["validationmsg"].value != ""){
				switch (sFormulario.elements[i].type) {  
					case "select-multiple" :  
						if (sFormulario.elements[i].options.length =="0"){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
							sFormulario.elements[i].focus();
							return false;
						}
						break;
					case "textarea" :  
						if (sFormulario.elements[i].value.length > sFormulario.elements[i].maxLength){validado=false;}
						if (sFormulario.elements[i].value.length == "0" ){validado=false;}
						if (validado==false){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
sFormulario.elements[i].focus();					
							return false;
						}
						break;
					case "hidden" :
						if(!sFormulario.elements[i].attributes["validacionInternaColdata"]) {
							break;
						}
						else {
							if(sFormulario.elements[i].value.toLowerCase() == "<p>&nbsp;</p>") {
								validado = false;
							}
						}



						oculto = true; supml = false; supli = false;
						if (sFormulario.elements[i].value.length > sFormulario.elements[i].maxLength){
							validado=false;
							supml = true;
						}
						if (sFormulario.elements[i].value.length == "0" ){validado=false;}
						if (sFormulario.elements[i].value.length < sFormulario.elements[i].minlength ){
							validado=false;
							supli = true;
						}

						if (validado==false){
              if(supml) {
                alert(sFormulario.elements[i].attributes["maxlengthmsg"].value);
               }
              else if(supli) {
                alert(sFormulario.elements[i].attributes["minlengthmsg"].value);
              }
              alert(sFormulario.elements[i].attributes["validationmsg"].value);
              document.getElementById(sFormulario.elements[i].attributes["id"].value+"InternoColdata").focus();					
							return false;
						}
						break;
					default :  
						if (sFormulario.elements[i].type !="image" && sFormulario.elements[i].type !="select-multiple" &&
						 sFormulario.elements[i].type !="textarea" && sFormulario.elements[i].type !="checkbox" && 
						 sFormulario.elements[i].type !="radio" && sFormulario.elements[i].attributes["validationmsg"].value != "0" && 
						 sFormulario.elements[i].attributes["validationmsg"] != "undefined" && sFormulario.elements[i].disabled == false && 
						 (sFormulario.elements[i].value =="" || sFormulario.elements[i].value =="0" )){
							alert(sFormulario.elements[i].attributes["validationmsg"].value);
							sFormulario.elements[i].focus();
							return false;
						}
						break;
					}  
				
				if (sFormulario.elements[i].minlength){
					if (sFormulario.elements[i].value.length < sFormulario.elements[i].minlength){validado=false;}
				}
				if (validado==false){
					alert(sFormulario.elements[i].attributes["validationmsg"].value);
					if(oculto) {
						alert("oc");
						sFormulario.elements[i+"InternoColdata"].focus();					
					}
					else {
						sFormulario.elements[i].focus();
					}
					return false;
				}
				 if (sFormulario.elements[i].attributes["validarmail"]){
						if(sFormulario.elements[i].value.length <= 4 || sFormulario.elements[i].value.indexOf("@") < 0 || sFormulario.elements[i].value.lastIndexOf(".") <= sFormulario.elements[i].value.indexOf("@")) {
							alert("No se ha reconocido la dirección de correo");
							sFormulario.elements[i].focus();
							return false;
						}
				  }

			 }
		  }
		}
	//alert(sFormulario.elements["C3"].disabled==true)
/*	alert((!sFormulario.elements["C3"].checked && sFormulario.elements["C3"].disabled==true))
	alert((!sFormulario.elements["C4"].checked && sFormulario.elements["C4"].disabled==true))
	*/
	//if (!sFormulario.elements["C1"].checked && !sFormulario.elements["C2"].checked &&  !sFormulario.elements["C3"].checked  &&  !sFormulario.elements["C4"].checked){

	if (!sFormulario.elements["C2"].checked &&  !sFormulario.elements["C3"].checked  &&  !sFormulario.elements["C4"].checked){
			alert('Por favor, indique la forma de pago');
			return false;
	}
/*	if (sFormulario.elements["C1"].checked && (sFormulario.elements["T12"].value=='' ||  sFormulario.elements["T13"].value=='')  ){
			alert('Por favor, introduzca el número de cheque y la entidad bancaria');
			return false;
	}*/
	if (sFormulario.elements["C4"].checked && (sFormulario.elements["T18"].value=='' ||  sFormulario.elements["T19"].value=='' ||  sFormulario.elements["T20"].value=='' ||  sFormulario.elements["T21"].value=='')){
			alert('Por favor, introduzca el número de entidad, número de sucursal, dígito de control y número de cuenta');
			return false;
	}
	if (sFormulario.elements["C4"].checked){
			if (sFormulario.elements["T18"].value.length!=4){
				alert('El número de entidad ha de tener 4 dígitos');
				sFormulario.elements["T18"].focus();
				return false;
			}
			if (sFormulario.elements["T19"].value.length!=4){
				alert('El número de sucursal ha de tener 4 dígitos');
				sFormulario.elements["T19"].focus();
				return false;
			}
			if (sFormulario.elements["T20"].value.length!=2){
				alert('El dígito de control debe tener 2 caracteres');
				sFormulario.elements["T20"].focus();
				return false;
			}
			if (sFormulario.elements["T21"].value.length!=10){
				alert('El número de cuenta debe tener 10 caracteres');
				sFormulario.elements["T21"].focus();
				return false;
			}

	}

	

	return true
	
}


function CambiaComilla(){
	if (event.keyCode==39){	event.keyCode=180;}
	if (event.keyCode==13){ event.keyCode=0;}
}

function SoloNum(){
//	if (event.keyCode!=13&&(event.keyCode<48||event.keyCode>57)){event.keyCode=0;}
	if (event.keyCode<48||event.keyCode>57){event.keyCode=0;}
}

function Buscar()
{
	if (document.getElementById("qsc").value.length<3){
		alert("El parámetro de búsqueda ha de tener al menos 3 caracteres.")
		document.getElementById("qsc").focus();
		return false;
	}
}

function Zoom(foto) {
	var win= null;
	var imaxe = new Image;
	imaxe.src = foto;
	//si el ancho y el alto es distinto de cero es que ya está cargada
	if (imaxe.width!=0 && imaxe.height!=0){
		var h=imaxe.height+30;
		var w=imaxe.width;
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
		settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=auto,resizable=no';
		gfoto=foto;
		win=window.open("zoom.html?"+foto,"foto",settings);
		if(parseInt(navigator.appVersion) >= 4)	{win.window.focus();}
		imaxe=null
		w=null
		h=null
		winl=null
		wint=null
	}
	else{
		//esperamos 0.5 segundos y empezamos otra vez
		setTimeout("Zoom('"+foto+"')", 500)
	}
}

function votar(nombreForm) {
	var f = document.forms[nombreForm];
	var seleccion = 0;
	for (i=0;i<=f.length-1;i++) 
	{
		if (f.elements[i].checked)
		{
			seleccion = 1;
		}
	}
	if (seleccion == 0) {
		alert("Por favor, seleccione una respuesta");
		return false;
	}
}

	function validaContenido(que){
		if (que.login.value.length==0){
			 alert("Por favor, introduzca el usuario");que.login.focus();return false 
			}
		if (que.pass.value.length==0){
			 alert("Por favor, introduzca la contraseña");que.pass.focus();return false 
			 }
			
	//	que.pass.value.length==0? true : alert("Por favor, introduzca la contraseña");que.pass.focus();return false
	}
		function valida(sFormu){
			if (!ValidoAcceso(sFormu)) { 
				return false
			}else{
				var er_email = /^(.+\@.+\..+)$/;
				if(!er_email.test(document.formDatos.txtEmail.value)) { 
			      		alert('El Campo E-MAIL no es válido.')
						document.formDatos.txtEmail.focus()
			      		return false    //no submit
			    }
			     if (document.formDatos.txtPassword.value != document.formDatos.txtRepitePassword.value) {
			        alert("ERROR: El campo contraseña y su repetición deben ser idénticos..");
					document.formDatos.txtPassword.focus()
			        return false;
			     }
				 if (document.formDatos.condiciones.checked != true){
				 	var bRespuesta = confirm("No se han aceptado las condiciones de uso del portal,\nno puede darse de alta si no las acepta.\n¿Desea aceptarlas?");
					if (bRespuesta){
						document.formDatos.condiciones.focus()
						document.formDatos.condiciones.checked = true
					}else{
				        return false;
					}
				 }
			}
		}

function Mostrar(Provincia)
{
	switch (Provincia)
		{
		case 'galicia':
			location.href="economistas.asp?fam=1&qsa=66&qsd=62"
			break;
		case 'asturias':
			location.href="economistas.asp?fam=1&qsa=66&qsd=63"
			break;
		case 'cantabria':
			location.href="economistas.asp?fam=1&qsa=66&qsd=64"
			break;
		case 'paisvasco':
			location.href="economistas.asp?fam=1&qsa=66&qsd=65"
			break;
		case 'navarra':
			location.href="economistas.asp?fam=1&qsa=66&qsd=67"
			break;
		case 'aragon':
			location.href="economistas.asp?fam=1&qsa=66&qsd=68"
			break;
		case 'cataluna':
			location.href="economistas.asp?fam=1&qsa=66&qsd=70"
			break;
		case 'madrid':
			location.href="economistas.asp?fam=1&qsa=66&qsd=74"
			break;
		case 'cyl':
			location.href="economistas.asp?fam=1&qsa=66&qsd=72"
			break;
		case 'larioja':
			location.href="economistas.asp?fam=1&qsa=66&qsd=73"
			break;
		case 'cmancha':
			location.href="economistas.asp?fam=1&qsa=66&qsd=76"
			break;
		case 'valencia':
			location.href="economistas.asp?fam=1&qsa=66&qsd=78"
			break;
		case 'andalucia':
			location.href="economistas.asp?fam=1&qsa=66&qsd=84"
			break;
		case 'murcia':
			location.href="economistas.asp?fam=1&qsa=66&qsd=86"
			break;
		case 'baleares':
			location.href="economistas.asp?fam=1&qsa=66&qsd=89"
			break;
		case 'canarias':
			location.href="economistas.asp?fam=1&qsa=66&qsd=91"
			break;
		case 'ceuta':
			location.href="economistas.asp?fam=1&qsa=66&qsd=92"
			break;
		case 'melilla':
			location.href="economistas.asp?fam=1&qsa=66&qsd=92"
			break;
		case 'extremadura':
			location.href="economistas.asp?fam=1&qsa=66&qsd=81"
			break;					
		
		}
}
//-->
