// -------------------------------------------------------------------
// Ajax XML Ticker (txt file source)
// -------------------------------------------------------------------

////////////No need to edit beyond here//////////////

function createAjaxObj(){
var httprequest=false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}

// -------------------------------------------------------------------
// Main Ajax Ticker Object function
// ajax_ticker(xmlfile, divId, divClass, delay, optionalfadeornot)
// -------------------------------------------------------------------

function ajax_ticker(xmlfile, divId, divClass, delay, fadeornot){
this.xmlfile=xmlfile //Variable pointing to the local ticker xml file (txt)
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=0
this.opacitystring=(typeof fadeornot!="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : ""
if (this.opacitystring!="") this.delay+=500 //add 1/2 sec to account for fade effect, if enabled
this.opacitysetting=0.2 //Opacity value when reset. Internal use.
this.messages=[] //Arrays to hold each message of ticker
this.ajaxobj=createAjaxObj()
document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'"><span style="color:#000000">Cargando Noticias...</span</div></div>')
this.getXMLfile()
}

// -------------------------------------------------------------------
// getXMLfile()- Use Ajax to fetch xml file (txt)
// -------------------------------------------------------------------

ajax_ticker.prototype.getXMLfile=function(){
if (this.ajaxobj){
var instanceOfTicker=this
var url=this.xmlfile+"?bustcache="+new Date().getTime()
this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
this.ajaxobj.open('GET', url, true)
this.ajaxobj.send(null)
}
}

// -------------------------------------------------------------------
// initialize()- Initialize ticker method.
// -Gets contents of xml file and parse it using JavaScript DOM methods 
// -------------------------------------------------------------------

ajax_ticker.prototype.initialize=function(){ 
if (this.ajaxobj.readyState == 4){ //if request of file completed
if (this.ajaxobj.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful
this.contentdiv=document.getElementById(this.tickerid).firstChild //div of inner content that holds the messages
var xmldata=this.ajaxobj.responseText
this.contentdiv.style.display="none"
this.contentdiv.innerHTML=xmldata
if (this.contentdiv.getElementsByTagName("div").length==0){ //if no messages were found
this.contentdiv.innerHTML="<b>Error</b> fetching remote ticker file!"
return
}
var instanceOfTicker=this
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){instanceOfTicker.contentdiv=instanceOfTicker.ajaxobj=null})
//Cycle through XML object and store each message inside array
for (var i=0; i<this.contentdiv.getElementsByTagName("div").length; i++){
if (this.contentdiv.getElementsByTagName("div")[i].className=="message")
this.messages[this.messages.length]=this.contentdiv.getElementsByTagName("div")[i].innerHTML
}
this.contentdiv.innerHTML=""
this.contentdiv.style.display="block"
this.rotatemsg()
}
}
}

// -------------------------------------------------------------------
// rotatemsg()- Rotate through ticker messages and displays them
// -------------------------------------------------------------------

ajax_ticker.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{ //else, construct item, show and rotate it!
this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
this.contentdiv.innerHTML=this.messages[this.pointer]
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 5) //FADE EFFECT- PLAY IT
this.pointer=(this.pointer<this.messages.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container periodically
}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

ajax_ticker.prototype.fadetransition=function(fadetype, timerid){
	
var contentdiv=this.contentdiv
if (fadetype=="reset")
this.opacitysetting=0.03
if (contentdiv.filters && contentdiv.filters[0]){
if (typeof contentdiv.filters[0].opacity=="number") //IE6+
contentdiv.filters[0].opacity=this.opacitysetting*100
else //IE 5.5
contentdiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!=""){
contentdiv.style.MozOpacity=this.opacitysetting
}
else
this.opacitysetting=1
if (fadetype=="up")
this.opacitysetting+=0.03
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}


///////////////////////////////////////////////////////////////
function ampliar(){
	window.open("/Contactar/Mapa.asp","","width=536,height=485,left=100,top=100,scrollbars=no")
}
///////////////////////////////////////////////////////////////
function cerrar(){
	window.close()
}
///////////////////////////////////////////////////////////////
function abrirPOPUP(url,ancho,alto){
	window.open(url,"","width="+ancho+",height="+alto+",left=100,top=100,scrollbars=yes")
}
///////////////////////////////////////////////////////////////
function olvido(){
	if(document.getElementById("form_usuario").usuario.value == ""){
		alert("Si deseas que te enviemos tu contraseña a tu cuenta de correo, \nantes debes rellenar la casilla Usuario. Después pulsa de nuevo este enlace. \nGracias");
		return;
	}

	window.open("../Popups/Olvido.asp?login="+document.getElementById("form_usuario").usuario.value,"","width=230,height=160,left=100,top=100,scrollbars=no")
}
///////////////////////////////////////////////////////////////
function comprobarRegistro(tipo){
	var ok = true;
	if(document.getElementById("formu").Acepto.checked != true){
		alert("Debe aceptar las condiciones de registro de usuarios para poder registrarse.");
		ok = false;
	}
	
	if(document.getElementById("formu").Nombre.value == "" && ok == true){
		alert("El campo \"Nombre\" es obligatorio.");
		document.getElementById("formu").Nombre.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Apellido_1.value == "" && ok == true){
		alert("El campo \"Primer Apellido\" es obligatorio.");
		document.getElementById("formu").Apellido_1.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Apellido_2.value == "" && ok == true){
		alert("El campo \"Segundo Apellido\" es obligatorio.");
		document.getElementById("formu").Apellido_2.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Login.value == "" && ok == true){
		alert("El campo \"Correo electrónico\" es obligatorio.");
		document.getElementById("formu").Login.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Login.value != "" && ok == true){
		var s = document.getElementById("formu").Login.value;
		//var filter=/^[A-Za-z.][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
		var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!filter.test(s)){
		alert("Ha escrito mal sus datos en el campo \"Correo electrónico\".");
		document.getElementById("formu").Login.focus();
		ok = false;
		}
	}
	
	if(document.getElementById("formu").Password.value == "" && ok == true){
		alert("El campo \"Contraseña\" es obligatorio.");
		document.getElementById("formu").Password.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Password.value != "" && ok == true){
		var valor = document.getElementById("formu").Password.value;
		if(valor.length < 6){
			alert("Recuerda que la contraseña debe ser como mínimo de 6 caracteres.");
			document.getElementById("formu").Password.focus();
			ok = false;
		}
	}
	
	if(document.getElementById("formu").Password2.value == "" && ok == true){
		alert("El campo \"Confirmar contraseña\" es obligatorio.");
		document.getElementById("formu").Password2.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Password.value != document.getElementById("formu").Password2.value && ok == true){
		alert("No coinciden los campos \"Contraseña\" y \"Confirmar contraseña\".");
		document.getElementById("formu").Password2.focus();
		ok = false;
	}
	
	if(ok){
		if(tipo=="NUEVO"){
			enviarRegistro();
		}
		else{
			enviarRegistroM();
		}
	}
}
function enviarRegistro(){
	document.getElementById("formu").action="/Usuarios/EnvioRegistro.asp"
	document.getElementById("formu").submit();
}
function enviarRegistroM(){
	document.getElementById("formu").action="/Usuarios/EnvioRegistroM.asp"
	document.getElementById("formu").submit();
}
///////////////////////////////////////////////////////////////
function comprobarSuscripcion(){
	var ok = true;
	if(document.getElementById("formu").Nombre.value == ""){
		alert("El campo \"Nombre\" es obligatorio.");
		document.getElementById("formu").Nombre.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Apellido_1.value == "" && ok == true){
		alert("El campo \"Primer Apellido\" es obligatorio.");
		document.getElementById("formu").Apellido_1.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Apellido_2.value == "" && ok == true){
		alert("El campo \"Segundo Apellido\" es obligatorio.");
		document.getElementById("formu").Apellido_2.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Login.value == "" && ok == true){
		alert("El campo \"Correo electrónico\" es obligatorio.");
		document.getElementById("formu").Login.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Login.value != "" && ok == true){
		var s = document.getElementById("formu").Login.value;
		//var filter=/^[A-Za-z.][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
		var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!filter.test(s)){
		alert("Ha escrito mal sus datos en el campo \"Correo electrónico\".");
		document.getElementById("formu").Login.focus();
		ok = false;
		}
	}
	
	if(ok){enviarSuscripcion();}
}
function enviarSuscripcion(){
	document.getElementById("formu").action="/Usuarios/EnvioSuscripcion.asp"
	document.getElementById("formu").submit();
}
//////////////////////////////////////////////////////////////////////
//FUNCION PARA SOLO PERMITIR ESCRITURA DE NUMEROS
function soloNumeros(myfield, e, dec){
	var key;
	var keychar;
	if (window.event)
		key = window.event.keyCode;
	else if (e)
		key = e.which;
	else
		return true;
	
	keychar = String.fromCharCode(key);
	// control keys
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
		return true;
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
	  return true;
	// decimal point jump
	else if (dec && (keychar == ".")){
	  myfield.formu.elements[dec].focus();
	  return false;
	}
	else
	  return false;
}

///////////////////////////////////////////////////////////////
function comprobarDatos(accion){
	if(document.getElementById("formu").Nombre.value == ""){
		alert("El campo \"Nombre\" es obligatorio.");
		document.getElementById("formu").Nombre.focus();
		return;
	}
	
	if(document.getElementById("formu").Apellido_1.value == ""){
		alert("El campo \"Primer Apellido\" es obligatorio.");
		document.getElementById("formu").Apellido_1.focus();
		return;
	}
	
	if(document.getElementById("formu").Apellido_2.value == ""){
		alert("El campo \"Segundo Apellido\" es obligatorio.");
		document.getElementById("formu").Apellido_2.focus();
		return;
	}

	if(document.getElementById("formu").Password.value == ""){
		alert("El campo \"Contraseña\" es obligatorio.");
		document.getElementById("formu").Password.focus();
		return;
	}
	
	if(document.getElementById("formu").Password.value != ""){
		var valor = document.getElementById("formu").Password.value;
		if(valor.length < 6){
			alert("El campo \"Contraseña\" debe tener más de 6 caracteres.");
			document.getElementById("formu").Password.focus();
			return;
		}
	}
	
	if(accion=="borrar"){
		var result
		result=window.confirm("¿Seguro que desea borrar este Usuario?")
					
		if(result){
			document.getElementById("formu").action="IMBusuario.asp?accion="+accion
			document.getElementById("formu").submit();
		}
	}
	else{
		document.getElementById("formu").action="IMBusuario.asp?accion="+accion
		document.getElementById("formu").submit();
	}
			

}

///////////////////////////////////////////////////////////////
function busquedaUsuarios(){
	var nombre = document.getElementById("formBusquedas").Nombre.value;
	var idCiclo = document.getElementById("formBusquedas").Id_Ciclo.value;
	var idNivel = document.getElementById("formBusquedas").Id_Nivel.value;
	var idPerfil = document.getElementById("formBusquedas").Id_Perfil.value;
	var query = "ListadoUsuarios.asp?nombre="+nombre+"&idCiclo="+idCiclo+"&idNivel="+idNivel+"&idPerfil="+idPerfil;
	document.getElementById("formBusquedas").action = query;
	document.getElementById("formBusquedas").submit();
}
///////////////////////////////////////////////////////////////
function busquedaActividadesADMIN(){
	var TituloActividad = document.getElementById("formBusquedas").TituloActividad.value;
	var Id_CursoEscolar = document.getElementById("formBusquedas").Id_CursoEscolar.value;
	var Id_TipoActividad = document.getElementById("formBusquedas").Id_TipoActividad.value;
	var query = "ListadoActividades.asp?TituloActividad="+TituloActividad+"&Id_CursoEscolar="+Id_CursoEscolar+"&Id_TipoActividad="+Id_TipoActividad;
	document.getElementById("formBusquedas").action = query;
	document.getElementById("formBusquedas").submit();
}


///////////////////////////////////////////////////////////////
function busquedaTrabajos(){
	var Id_Ciclo = document.getElementById("formuBus").Id_Ciclo.value;
	var Id_CursoEscolar = document.getElementById("formuBus").Id_CursoEscolar.value;
	var Id_Nivel = document.getElementById("formuBus").Id_Nivel.value;
	var Id_Modulo = document.getElementById("formuBus").Id_Modulo.value;
	var query = "Trabajos.asp?Id_Ciclo="+Id_Ciclo+"&Id_CursoEscolar="+Id_CursoEscolar+"&Id_Nivel="+Id_Nivel+"&Id_Modulo="+Id_Modulo+"&grupo=3";
	document.getElementById("formuBus").action = query;
	document.getElementById("formuBus").submit();
}
///////////////////////////////////////////////////////////////
function busquedaTrabajos2(){
	var Id_Ciclo = document.getElementById("formuBus").Id_Ciclo.value;
	var Id_CursoEscolar = "";
	var Id_Nivel = "";
	var Id_Modulo = "";
	var query = "Trabajos.asp?Id_Ciclo="+Id_Ciclo+"&Id_CursoEscolar="+Id_CursoEscolar+"&Id_Nivel="+Id_Nivel+"&Id_Modulo="+Id_Modulo+"&grupo=2";
	document.getElementById("formuBus").action = query;
	document.getElementById("formuBus").submit();
}
///////////////////////////////////////////////////////////////
function busquedaTrabajos4(){
	var Id_Ciclo = document.getElementById("formuBus").Id_Ciclo.value;
	var Id_CursoEscolar = "";
	var Id_Nivel = document.getElementById("formuBus").Id_Nivel.value;
	var Id_Modulo = document.getElementById("formuBus").Id_Modulo.value;
	var query = "Trabajos.asp?Id_Ciclo="+Id_Ciclo+"&Id_CursoEscolar="+Id_CursoEscolar+"&Id_Nivel="+Id_Nivel+"&Id_Modulo="+Id_Modulo+"&grupo=4";
	document.getElementById("formuBus").action = query;
	document.getElementById("formuBus").submit();
}
///////////////////////////////////////////////////////////////
function busquedaTrabajosADMIN(){
	var Id_Ciclo = document.getElementById("formuBus").Id_Ciclo.value;
	var Id_CursoEscolar = document.getElementById("formuBus").Id_CursoEscolar.value;
	var Id_Nivel = document.getElementById("formuBus").Id_Nivel.value;
	var Id_Modulo = document.getElementById("formuBus").Id_Modulo.value;
	var query = "ListadoTrabajos.asp?Id_Ciclo="+Id_Ciclo+"&Id_CursoEscolar="+Id_CursoEscolar+"&Id_Nivel="+Id_Nivel+"&Id_Modulo="+Id_Modulo;
	document.getElementById("formuBus").action = query;
	document.getElementById("formuBus").submit();
}
///////////////////////////////////////////////////////////////
function busquedaActividades(){
	var Id_CursoEscolar = document.getElementById("formuBus").Id_CursoEscolar.value;
	var Id_TipoActividad = document.getElementById("formuBus").Id_TipoActividad.value;
	var Id_Ciclo = document.getElementById("formuBus").Id_Ciclo.value;
	var query = "Archivo.asp?Id_Ciclo="+Id_Ciclo+"&Id_CursoEscolar="+Id_CursoEscolar+"&Id_TipoActividad="+Id_TipoActividad;
	document.getElementById("formuBus").action = query;
	document.getElementById("formuBus").submit();
}

///////////////////////////////////////////////////////////////
function rellenaYear(){
	primerYear = 1995;
	fecha = new Date()
	actualYear = fecha.getFullYear();
	intervalo = actualYear-primerYear;
	
	cadena = "<label for='YearTrabajo' class='sin'><span>A&ntilde;o</span></label>"
	cadena += "<select name='YearTrabajo' id='YearTrabajo'>"
	for(x=0; x<intervalo+1; x++){
		cadena += "<option value='"+(actualYear-x)+"'>"+(actualYear-x)+"</option>"	
	}
	cadena += "</select>"
	document.getElementById("years").innerHTML = cadena;	
}
///////////////////////////////////////////////////////////////
function rellenaYear(seleccionado){
	primerYear = 1995;
	fecha = new Date()
	actualYear = fecha.getFullYear();
	intervalo = actualYear-primerYear;
	
	cadena = "<label for='YearTrabajo' class='sin'><span>A&ntilde;o</span></label>"
	cadena += "<select name='YearTrabajo' id='YearTrabajo'>"
	for(x=0; x<intervalo+1; x++){
		if(seleccionado == (actualYear-x)){
			cadena += "<option value='"+(actualYear-x)+"' selected='selected'>"+(actualYear-x)+"</option>"
		}
		else{
			cadena += "<option value='"+(actualYear-x)+"'>"+(actualYear-x)+"</option>"
		}
	}
	cadena += "</select>"
	document.getElementById("years").innerHTML = cadena;	
}

///////////////////////////////////////////////////////////////
function cambiaTipo(tipo){
	if(tipo==1){
		document.getElementById("tipoEscuela").style.display = "block";
		document.getElementById("tipoProfesional").style.display = "none";
		document.getElementById("TipoHidden").value = 1;
	}
	else{
		document.getElementById("tipoEscuela").style.display = "none";
		document.getElementById("tipoProfesional").style.display = "block";
		document.getElementById("TipoHidden").value = 2;
	}
}
//////////////////////////////////////////
/*function seleccionaModulo(valor){
	var indice = document.getElementById("formu").Id_Modulo.options.length;
	for(x=0;x<indice;x++){
		if(document.getElementById("formu").Id_Modulo.options[x].value==valor){
			document.getElementById("formu").Id_Modulo.options[x].selected = true;
		}
	}
}*/
///////////////////////////////////////////////////////////////
function comprobarTrabajo(){
	var ok = true;
	if(document.getElementById("formu").Acepto.checked != true){
		alert("Debe aceptar las condiciones de registro de usuarios para poder registrarse.");
		ok = false;
	}
	
	if(document.getElementById("formu").ObjetoHidden.value == "" && ok == true){
		alert("Debe seleccionar un tipo de objeto.");
		ok = false;
	}
	
	if(document.getElementById("formu").Titulo.value == "" && ok == true){
		alert("El campo \"Titulo\" es obligatorio.");
		document.getElementById("formu").Titulo.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Descripcion.value == "" && ok == true){
		alert("El campo \"Descripcion\" es obligatorio.");
		document.getElementById("formu").Descripcion.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").ImgPrincipalHidden.value == "" && ok == true){
		alert("El campo \"Imagen principal\" es obligatorio.");
		ok = false;
	}
	
	if(ok){
		document.getElementById("formu").action="/Usuarios/EnvioTrabajo.asp"
		document.getElementById("formu").submit();
	}
}

///////////////////////////////////////////////////////////////
function comprobarTrabajoM(){
	var ok = true;
	if(document.getElementById("formu").Acepto.checked != true){
		alert("Debe aceptar las condiciones de registro de usuarios para poder registrarse.");
		ok = false;
	}
	
	if(document.getElementById("formu").ObjetoHidden.value == "" && ok == true){
		alert("Debe seleccionar un tipo de objeto.");
		ok = false;
	}
	
	if(document.getElementById("formu").Titulo.value == "" && ok == true){
		alert("El campo \"Titulo\" es obligatorio.");
		document.getElementById("formu").Titulo.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").Descripcion.value == "" && ok == true){
		alert("El campo \"Descripcion\" es obligatorio.");
		document.getElementById("formu").Descripcion.focus();
		ok = false;
	}
	
	if(document.getElementById("formu").ImgPrincipalHidden.value == "" && ok == true){
		alert("El campo \"Imagen principal\" es obligatorio.");
		ok = false;
	}
	
	if(ok){
		document.getElementById("formu").action="/Usuarios/EnvioTrabajoM.asp"
		document.getElementById("formu").submit();
	}
}

///////////////////////////////////////////////////////////////
function comprobarTrabajoAdmin(accion){
	if(document.getElementById("formu").ObjetoHidden.value == ""){
		alert("Debe seleccionar un tipo de objeto.");
		return;
	}
	
	if(document.getElementById("formu").Titulo.value == ""){
		alert("El campo \"Titulo\" es obligatorio.");
		document.getElementById("formu").Titulo.focus();
		return;
	}
	
	if(document.getElementById("formu").Descripcion.value == ""){
		alert("El campo \"Descripcion\" es obligatorio.");
		document.getElementById("formu").Descripcion.focus();
		return;
	}
	
	if(document.getElementById("formu").ImgPrincipalHidden.value == ""){
		alert("El campo \"Imagen principal\" es obligatorio.");
		return;
	}
	
	if(accion=="borrar"){
		var result
		result=window.confirm("¿Seguro que desea borrar este Usuario?")
					
		if(result){
			document.getElementById("formu").action="IMBtrabajo.asp?accion="+accion
			document.getElementById("formu").submit();
		}
	}
	else{
		document.getElementById("formu").action="IMBtrabajo.asp?accion="+accion
		document.getElementById("formu").submit();
	}
}


///////////////////////////////////////////////////////////////
function comprobarActividad(accion){
	if(document.getElementById("formu").TipoActividad.value == ""){
		alert("Debe seleccionar un tipo de actividad.");
		return;
	}
	
	if(document.getElementById("formu").Titulo.value == ""){
		alert("El campo \"Titulo\" es obligatorio.");
		document.getElementById("formu").Titulo.focus();
		return;
	}
	
	if(accion=="borrar"){
		var result
		result=window.confirm("¿Seguro que desea borrar este Usuario?")
					
		if(result){
			document.getElementById("formu").action="IMBactividad.asp?accion="+accion
			document.getElementById("formu").submit();
		}
	}
	else{
		document.getElementById("formu").action="IMBactividad.asp?accion="+accion
		document.getElementById("formu").submit();
	}
}




/////////////////////////////////////////////////////////////////////////////
function abrirPrivacidad(){
	window.open("/popups/privacidad.asp","","width=500,height=425,left=100,top=100,status=no,scrollbars=yes")
}
/////////////////////////////////////////////////////////////////////////////
function abrirAdvertencia(){
	window.open("/popups/advertencia.asp","","width=500,height=425,left=100,top=100,status=no,scrollbars=yes")
}
/////////////////////////////////////////////////////////////////////////////
function abrirDerechos(){
	window.open("/popups/Derechos.asp","","width=500,height=425,left=100,top=100,status=no,scrollbars=yes")
}

/////////////////////////////////////////////////////////////////////////////
function comprobarPerfil(idPerfil,titulacion){
	if(idPerfil==4){
		primerYear = 1984;
		fecha = new Date()
		actualYear = fecha.getFullYear();
		intervalo = actualYear-primerYear;
		ok = false
		
		cadena = "<p class='margin'>"
		cadena += "<label for='Titulacion'><span>Titulaci&oacute;n</span></label>"
		cadena += "<select name='Titulacion' id='Titulacion'>"
		for(x=0; x<intervalo+1; x++){
			if(titulacion==(actualYear-x)){
				cadena += "<option value='"+(actualYear-x)+"' selected='selected'>"+(actualYear-x)+"</option>"	
			}
			else if(titulacion == 1){
				cadena += "<option value='1' selected='selected'>No titulado</option>"
				ok = true
			}
			else{
				cadena += "<option value='"+(actualYear-x)+"'>"+(actualYear-x)+"</option>"	
			}
		}
		if(!ok){
			cadena += "<option value='1'>No titulado</option>"
		}
		cadena += "</select>"
		cadena += "</p>"
		document.getElementById("titulaciones").innerHTML = cadena;
	}
	else{
		document.getElementById("titulaciones").innerHTML = "";
	}
}

/////////////////////////////////////////////

var idElemento
function redimension(id,urlImagen){
	idElemento = id
	eval ("imagenREDI = new Image();");
	eval ("imagenREDI.src = " + "\"" + urlImagen + "\";");
	opacidad = 0;
	if(document.all && !window.opera)
		document.getElementById(id).style.filter = "alpha(opacity=" + opacidad * 100 + ")";
	else if(window.opera)
		document.getElementById(id).style.opacity = opacidad;
	else
		document.getElementById(id).style.MozOpacity = opacidad;
		
	testeador = setInterval("cargando()",30)
}

function cargando() {
	if (eval("imagenREDI").complete == true) {
		clearInterval(testeador);
		redi(idElemento)
	}
}


function redi(id){
	var W = document.getElementById(id).offsetWidth
	var H = document.getElementById(id).offsetHeight
	if(W>=H){// 'horizontal				
		//'ancho fijo calculamos alto
		W_imagen = 244
		H_imagen = parseInt((H*W_imagen)/W)
	}
	else{
		//'alto fijo calculamos ancho
		H_imagen = 244						
		W_imagen = parseInt((W*H_imagen)/H)
	}
	document.getElementById(id).style.width = W_imagen + "px"
	document.getElementById(id).style.height = H_imagen + "px"
	
	opacidad = 1;
	if(document.all && !window.opera)
		document.getElementById(id).style.filter = "alpha(opacity=" + opacidad * 100 + ")";
	else if(window.opera)
		document.getElementById(id).style.opacity = opacidad;
	else
		document.getElementById(id).style.MozOpacity = opacidad;
	//document.getElementById("contenedorIMG").style.display = "block"
}

/////////////////////////////////////////////////////
var sMensaje = "Contenidos protegidos por la ley de propiedad intelectual e industrial";

function anularBotonDerecho(e) {

    if (navigator.appName == "Netscape"
       && (e.which == 3 || e.which == 2)){
      alert(sMensaje);
      return false;
    } else if (navigator.appName == "Microsoft Internet Explorer" 
        && (event.button == 2)) {
      alert(sMensaje);
    }
}

document.onmousedown = anularBotonDerecho;
document.oncontextmenu = new Function("return false");


// Función para la fecha //
function fecha(){
	var this_month = new Array(12);
	this_month[0]  = "01";
	this_month[1]  = "02";
	this_month[2]  = "03";
	this_month[3]  = "04";
	this_month[4]  = "05";
	this_month[5]  = "06";
	this_month[6]  = "07";
	this_month[7]  = "08";
	this_month[8]  = "09";
	this_month[9]  = "10";
	this_month[10] = "11";
	this_month[11] = "12";
	
	var this_day_e = new Array(7);
	this_day_e[0]  = "Domingo";
	this_day_e[1]  = "Lunes";
	this_day_e[2]  = "Martes";
	this_day_e[3]  = "Mi&eacute;rcoles";
	this_day_e[4]  = "Jueves";
	this_day_e[5]  = "Viernes";
	this_day_e[6]  = "S&aacute;bado";
	
	var today = new Date();
	var day   = today.getDate();
	var month = today.getMonth();
	var year  = today.getYear();
	var dia = today.getDay();
    if (year < 1000) {
       year += 1900; }
	   
	document.write ("<span>" + day + "/" + this_month[month] + "/" + year + "</span>");
}

/////////// Eliminar el recuadro de flash en IE //////////////////
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
