// JavaScript Document

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
<!--
// Kaosweaver Calendar Settings - do not remove
// by Paul Davis - http://www.kaosweaver.com
// KW_lang[English]
// KW_order[0,1,2]
// KW_del1[/]
// KW_del2[/]
// KW_dd[true]
// KW_cWidth[170]
// KW_fd[-1]

var sDate = new Array();
var mName = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
var wName = new Array("Do","Lu","Ma","Mi","Ju","Vi","Sa")
var cFontName = "Verdana,Arial, Helvetica, sans-serif;"
var KW_color = new Array("#FFFFFF","#377BA8","#FB9437","#C7D7EC","#88B2C7","#F7EFBD","#003C79","#377BA8")
var KW_cl=0;
var KW_od=1;
var KW_tmo=0;
var KW_cWidth=170;
var KW_fd=-1;
var KW_ss=0;
var KW_sw=0;
var descx=-1;
var descy=-1;
var bwNN=(document.captureEvents)?1:0;
function popmousemove(e){descx=(bwNN)?e.pageX:event.x;descy=(bwNN)?e.pageY:event.y}
function KW_mouseInit(){
	if(bwNN)document.captureEvents(Event.MOUSEMOVE);document.onmousemove=popmousemove;
}
function m_class(m,d,y) { 
	this.month=m;this.day=d;this.year=y;this.output=this.day+"/"+this.month+"/"+this.year;
	var kd=new Date();this.special=checkDates(this.month,this.day,this.year)
	this.today=((kd.getMonth()+1)==this.month && kd.getDate()==this.day && kd.getFullYear()==this.year)
	var td=new Date(this.year, (this.month-1), this.day+KW_od);this.past=(KW_od==-1)?0:(kd>td)
	var tf=new Date(kd.getFullYear(),kd.getMonth(),kd.getDate()+KW_fd);
	var d1=new Date(this.year, (this.month-1), this.day);
	this.future=(KW_fd==-1)?0:(tf<d1);this.ss=(this.special && KW_ss);
	this.display=(this.past || this.future || this.ss);
}

// Kaosweaver End of Calendar Settings - do not remove




function checkDates(m1,d1,y1) { //v2.1.5
	var rStr=false;for(var i=0;i<sDate.length;i++) {var tDate=sDate[i].split(",");
		if (tDate[2]=="*" || tDate[2]==y1) {if (tDate[1]==d1 && tDate[0]==m1)	rStr=true;
		}}return rStr;
}

function KW_doCalendar(obj,E,m,y) { //v2.6.0
  var d=new Date();f=0;d.setDate(1);if (!m && m!=0) {m=d.getMonth();f=KW_cl}
  if (f==1 && MM_findObj('KW_selectedMonth').value!=-1)
  m=MM_findObj('KW_selectedMonth').value-1;d.setMonth(m);
  if (!y) y=d.getFullYear();if (f==1 && MM_findObj('KW_selectedYear').value!=-1)
  y=MM_findObj('KW_selectedYear').value;d.setFullYear(y);dy=d.getDay();if (!E) E=0;
  if(E==1)dy=(dy==0)?6:dy-1;dP=new Date();dP.setMonth(m);dP.setDate(0);
  pStart=dP.getDate()-dy+1;dStr=new Array();for (i=pStart;i<dP.getDate()+1;i++) { tmo=(KW_tmo)?"":i;
  tMonth=(m==0)?"12":m;tYear=(m==0)?y-1:y;dStr[dStr.length]=new m_class(tMonth,tmo,tYear);
  }EOM=false;for (i=1;!EOM;i++){d.setDate(i);if (m!=d.getMonth()) EOM=true; else {
  dStr[dStr.length]=new m_class((Number(m)+1),i,y);}}cnt=1;si=0;
  if(E==1)si=(d.getDay()==0)?6:d.getDay()-1;else si=d.getDay();	for (i=si;i<7;i++) {
  tMonth=(m==11)?"1":Number(m)+2;tYear=(m==11)?Number(y)+1:y; tmo=(KW_tmo)?"":cnt;
  dStr[dStr.length]=new m_class(tMonth,tmo,tYear); cnt++;}pM=(m==0)?11:m-1;
  pY=(m==0)?y-1:y;nM=(m==11)?0:Number(m)+1;nY=(m==11)?Number(y)+1:y;
  wStr="<ht"+""+"ml><he"+""+"ad><st"+""+"yle type=\"text/css\"><!--  body { background-color: "+KW_color[6]+"}\ntd {  font-family: "+cFontName+" font-size: 11px; }\n.tblHdr { font-weight: bold; color: "+KW_color[0]+"; background-color: "+KW_color[6]+" }\n.subTbl{ color: "+KW_color[0]+"; background-color: "+KW_color[7]+";  text-align: center}-->\n</st"+""+"yle>\n<ti"+""+"tle>"+mName[m]+", "+y+"</ti"+""+"tle>\n</he"+""+"ad>\n<bo"+""+"dy  topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" leftmargin=\"0\" onLoad=\"window.focus()\">\n<table width=\"100%\" border=\"0\" cellspacing=\"0\">\n<tr>\n<td bgcolor=\""+KW_color[6]+"\">\n<table width=\"100%\" border=0>\n"
  wStr+="<tr>\n<td align=center bgcolor=\""+KW_color[6]+"\" class=\"tblHdr\" colspan=\"4\"><a href=\"javascript:window.opener.KW_doCalendar('"+obj+"',"+E+",'"+pM+"','"+pY+"');\" class=\"tblHdr\">&laquo</a>&nbsp;&nbsp;"+mName[m]+"&nbsp;&nbsp;<a href=\"javascript:window.opener.KW_doCalendar('"+obj+"',"+E+",'"+nM+"','"+nY+"');\"  class=\"tblHdr\">&raquo</a></td>\n<td colspan=3 align=center class=\"tblHdr\"><a href=\"javascript:window.opener.KW_doCalendar('"+obj+"',"+E+",'"+m+"','"+(y-1)+"');\" class=\"tblHdr\">&laquo</a>&nbsp;&nbsp;"+y+"&nbsp;&nbsp;<a href=\"javascript:window.opener.KW_doCalendar('"+obj+"',"+E+",'"+m+"','"+(Number(y)+1)+"');\"  class=\"tblHdr\">&raquo</a></td>\n</tr>\n"
  wStr+="<tr>\n";for(wdn=0;wdn<7;wdn++)wStr+="<td class=\"subTbl\">"+wName[wdn]+"</td>\n";wStr+="</tr>\n"
  for (x=0;x<parseInt(dStr.length/7);x++) {	wStr+="<tr>\n";	for (y=0;y<7;y++) {
  yT=(E==1)?5:0;bC=(y==yT||y==6)?KW_color[2]:KW_color[3];
  if ((y==yT||y==6) && KW_sw && !dStr[x*7+y].display) dStr[x*7+y].display=true;
  if ((Number(m)+1)!=dStr[x*7+y].month) bC=KW_color[5]; if (dStr[x*7+y].special)
  bC=KW_color[4];if (dStr[x*7+y].today) bC=KW_color[1];
  a0=(KW_cl!=1)?"":"window.opener.MM_findObj('KW_selectedMonth',window.opener.document).value='"+dStr[x*7+y].month+"';window.opener.MM_findObj('KW_selectedYear',window.opener.document).value='"+dStr[x*7+y].year+"'; "
  a1=(dStr[x*7+y].display)?"":"<a href=\"javascript:window.opener.MM_findObj('"+obj+"',window.opener.document).value='"+dStr[x*7+y].output+"';"+a0+" window.close();\" >";
  a2=(dStr[x*7+y].display)?"":"</a>";
  wStr+="<td align=\"center\" bgcolor="+bC+">"+a1+dStr[x*7+y].day+a2+"</td>\n";
	}	wStr+="</tr>\n";}	wStr+="<tr><td colspan=7></td></tr></table></td></tr></table></bo"+""+"dy></ht"+""+"ml>";
	var screenX=(self.screenX)?self.screenX+20:window.screenLeft
	var screenY=(self.screenY)?self.screenY+70:window.screenTop
	var w =(descx==-1)?parseInt(screen.width/2-75):descx+screenX;
	var h=(descy==-1)?parseInt(screen.height/2-75):descy+screenY;
	if (isNaN(w)) w=descx+20
	if (isNaN(h)) h=descy+70	
	var look='width='+KW_cWidth+',height=155,left='+w+',top='+h;	popwin=window.open('','calendar',look);
	popwin.document.open();	popwin.document.write(wStr);	popwin.document.close();
}
//-->
<!--
function volver()
    {
     history.back()
    }
	 
	 
	
	function checkLogin(){
		login = document.form.login.value;
		password = document.form.password.value;
		
		if (login == ''){
			alert('Por favor, introduce el Nombre.');
			return(false);
		}
		else{
			if (password== ''){
				alert('Por favor, introduce el Password.');
				return(false);
			}
			else{
				return(true);
			}			
		}
	}
	
	function ir(url)	{
	self.location.href = url;
}
//-->
<!--
	function cambiaPsw(){
		password = document.form.psw.value;
		password2 = document.form.psw2.value;
		if ((password != null) && (password != '')){
			if (password.length > 5){
				if (password == password2){
					return(true);
				}
				else{
					alert('Los dos passwords deben coincidir. Por favor vuelve a introducir el segundo password.');
					return(false);
				}
			}
			else{
				alert('El nuevo password debe tener al menos 6 letras.');
				return(false);
			}
		
		}
		else{
			alert('Introduzce el nuevo password.');
			return(false);
		}
	}
//-->
<!--
function delAdmin(){
		admin = document.form.nombre.value;
		
		if (admin != null)  {
					var promptmsg = 'Vas a eliminar a un administrador.\n¿Estás seguro?';
					var go = confirm(promptmsg);
					if (go) {
						return(true)
					} else {
						return(false);
		
	}
	}
	}
//-->
<!-- check Mail
function checkEmail(frase){
	largoFrase=frase.length 
	indice1=0
	arroba=0
	exito=false
	
	if (largoFrase>5){
		while (indice1!=largoFrase){
			indice2=indice1+1
			aux=frase.substring(indice1,indice2)
			if (aux=='@') ++arroba
			++indice1
		}
		if (arroba==1){
			inicio=frase.substring(0,1)
			final1=frase.substring((largoFrase-1),largoFrase)
			if ((inicio!='@')&&(final1!='@')){
				if ((inicio!='.')&&(final1!='.')){
					final1=frase.substring((largoFrase-2),(largoFrase-1))
					if ((final1!='.')&&(final1!='@')){
						inicio=frase.substring((largoFrase-3),(largoFrase-2))
						final1=frase.substring((largoFrase-4),(largoFrase-3))
						if ((inicio!='@')&&(final1!='@')){
							inicio=frase.substring((largoFrase-3),(largoFrase-2))
							final1=frase.substring((largoFrase-4),(largoFrase-3))
							if((inicio=='.')||(final1=='.')){ 
								indice1=0
								dos=true
								while (indice1!=largoFrase){
										indice2=indice1+2
										aux=frase.substring(indice1,indice2)
										if ((aux=='.@')||(aux=='@.')) dos=false 
										++indice1
								}
								if(dos!=false){
									indice1=0
									dos=true
									while (indice1!=largoFrase){
										indice2=indice1+2
										aux=frase.substring(indice1,indice2)
										if (aux=='..') dos=false 
										++indice1
									}
									if (dos!=false){
										ult1=isNaN(frase.substring((largoFrase-1),largoFrase))
										ult2=isNaN(frase.substring((largoFrase-2),(largoFrase-1)))
										ult3=isNaN(frase.substring((largoFrase-3),(largoFrase-2)))
										if ((ult1==true)&&(ult2==true)&&(ult3==true)){
											exito=true
										}
										else{
											exito=false
										}
									}
									else{
										exito=false
									}
								}
								else{
									exito=false
								}
							}
							else{
								exito=false
							}
						
						}
						else{
							exito=false		
						}				
					}
					else{
						exito=false	
					}						
				}
				else{
					exito=false	
				}
			}
			else{
				exito=false
			}
		}	
		else{
			exito=false
		}
	}
	else{
		exito=false
	}
	
	return(exito)
}
//-->
<!--

	function checkFormNl(){
		if (checkEmail(document.form.email.value) == true){
			if (document.form.nombre.value != '') {
			if((document.form.interesado[0].checked)||(document.form.interesado[1].checked) && (document.form.nomEmpresa.value!= ''))

{
					
					mensaje = 'Al enviar sus datos,  acepta las condiciones sobre nuestra política de privacidad . Si acepta las condiciones haga click en "Aceptar".';
															if (confirm(mensaje)){
																return(true);
															}
															else{
																alert('Envio de datos no aceptado')
																return(false);
															}
					} 
				 else {
				
					alert('Por favor, indica el nombre de la empresa o selecciona la casilla "particular".');
				}
				
			} else {
				alert('Por favor, indica nombre y apellidos.');
			}
		} else {
			alert('Es necesario introducir una dirección de correo válida.');
		}
		return(false);
	}

	
	//************ Input Registro News letter:EMPRESA
	function focusCampo() 
{ 
document.form[3].checked = true; 

} 
//-->
<!--Activa (checked) radio 

function focusCampo() 
{ 
document.form[3].checked = true; 
} 


function focusCampo4() 
{ 
document.form[4].checked = true; 

} 
function focusCampoMod() 
{ 
document.form[5].checked = true; 

} 
function focusCampoMod2() 
{ 
document.form[6].checked = true; 

} 
function focusDelEmp() 
{ 

document.form[4].value = ""; 
} 
function focusDelEmpMod() 
{ 

document.form[5].value = ""; 
} 
function focusDelEmpMod2() 
{ 

document.form[7].value = ""; 
} 
function focusDelEmp3() 
{ 

document.form[6].value = ""; 
} 



function alertaDel(){
	
	var promptmsg= 'Vas a eliminar un registro.\n¿Estás seguro?';
var go = confirm(promptmsg);
					if (go) {
						return(true)
					} else {
						return(false);
		
	}
	}

function checkFormIns(){
		if (checkEmail(document.form.email.value) == true){
			if (document.form.nombre.value != '') {
			if (document.form.apellidos.value != '') {
			if ((document.form.telefono.value != '') && (document.form.telefono.value.length > 8 )){
			if((document.form.interesado[0].checked)||(document.form.interesado[1].checked) && (document.form.nomEmpresa.value!= '')){
			mensaje = 'Al enviar sus datos,  acepta las condiciones sobre nuestra política de privacidad . Si acepta las condiciones haga click sobre "Aceptar".';
															if (confirm(mensaje)){
																return(true);
															}
															else{
																alert('Envio de datos no aceptado')
																return(false);
															}
			
			}
													
												
				 else {
				
					alert('Por favor, indique el nombre de la empresa o selecciona la casilla "particular".');
				}
				}else {
				
					alert('Por favor, indique un número de teléfono válido ');
				}
				} else {
				alert('Por favor, indique sus apellidos o primer apellido.');
			}
			} else {
				alert('Por favor, indique su nombre.');
			}
		} else {
			alert('Es necesario introducir una dirección de correo válida.');
		}
		return(false);
	}	
//-->
<!--
function InsCurso(){
		if (checkEmail(document.form.email.value) == true){
			if (document.form.nombre.value != '') {
			if (document.form.apellidos.value != '') {
			if ((document.form.telefono.value != '') && (document.form.telefono.value.length > 8 )){
			if((document.form.interesado[0].checked)||(document.form.interesado[1].checked) && (document.form.nomEmpresa.value!= '')){
																return(true);
			}
													
												
				 else {
				
					alert('Por favor, indique el nombre de la empresa o selecciona la casilla "particular".');
				}
				}else {
				
					alert('Por favor, indique un número de teléfono válido ');
				}
				} else {
				alert('Por favor, indique sus apellidos o primer apellido.');
			}
			} else {
				alert('Por favor, indique su nombre.');
			}
		} else {
			alert('Es necesario introducir una dirección de correo válida.');
		}
		return(false);
	}	
//-->
<!--
	function checkFormNl2(){
		if (checkEmail(document.form.email.value) == true){
			if (document.form.nombre.value != '') {
			if((document.form.interesado[0].checked)||(document.form.interesado[1].checked) && (document.form.nomEmpresa.value!= ''))

{
																return(true);
															
					} 
				 else {
				
					alert('Por favor, indica el nombre de la empresa o selecciona la casilla "particular".');
				}
				
			} else {
				alert('Por favor, indica nombre y apellidos.');
			}
		} else {
			alert('Es necesario introducir una dirección de correo válida.');
		}
		return(false);
	}
//-->
<!--
function delBolsa(user) {
		var promptmsg = '¿ESTÁS SEGUR@ DE QUE QUIERES DARTE DE BAJA EN EL SERVICIO?.\n* Todos tus datos serán eliminados. \n* No volverás a formar parte de los procesos de selección.';
		var go = confirm(promptmsg);
	
		if (go) {
			document.location.href = '../users/delInscrito.asp?'+user;
		}
	}
	
//***********
function abrirventana(ruta){	
	document.body.style.cursor="wait";
	var oVentana;
	var disenho=disennoModal(500, 470); 
	oVentana = window.showModalDialog(ruta ,"", disenho);		
	document.body.style.cursor= "default";
}
//-->
<!--

function checkMailing(){

		for (i=1;i<=document.form.i.value;i++) {
			if (eval("document.form.checkbox_"+i).checked) {
				if (document.form.asunto.value != '') {
					if(document.form.mensaje.value != '') {
					var promptmsg = 'Vas a enviar una newsletter.\n¿Estás seguro?';
					var go = confirm(promptmsg);
					if (go) {
						return(true)
					} else {
						return(false);		
					}
				} else {
					alert('Tienes que escribir el mensaje.');
					return(false);
				}
				} else {
					alert('Tienes escribir algo en "Asunto".');
					return(false);
				}
			}
		}
		alert('Tienes que seleccionar por lo menos un email al que enviar el mensaje.');
		return(false);
	}	
	//-->
