/*
 *  Librerias de control cliente para la web del CEJ. 
 *               SAG  ESPAÑA   2007
 */
    
/*
Libreria de utilidades para gestionar formularios javascript
  Se trata de automatizar al máximo las tareas de validación de formularios
  Para ello se crean diferentes tipos de datos, en los cuales la función sabrá exactamente, que validación debe
  aplicar, según que caso:
   - dateformat    = validación de fechas (dd/mm/aaaa)
   - timeformat    = validación de tiempo (hh:mm)
   - numberformat  = validación de números enteros 
   - decimalformat = validación de números decimales (f,f)
   - nifformat     = validación de numeros válidos aplicables al número de identificación fiscal
   - stringformat  = validación de cadenas no contengan números

   En todas las validaciones arriba indicadas, se validará de forma transparente, cadenas vacias, cadenas nulas, etc ...
*/

var DATE_FORMAT    = "dateformat";
var TIME_FORMAT    = "timeformat";
var NUMBER_FORMAT  = "numberformat";
var DECIMAL_FORMAT = "decimalformat";
var NIF_FORMAT     = "nifformat";
var STRING_FORMAT  = "stringformat";

var n4=(document.layers);
var ie=(document.all);
var n6=(document.getElementById);
var id_seleccionado=0;

var carFecha = "/";
var carHora = ":";

function activeForm(){
   //Averiguando el número de elementos que tiene el formulario en total ...
   var formSize = document.forms[0].elements.length;
   var value = "";
   var id = "";
   for(var i=0;i<formSize;i++){
	  value = document.forms[0].elements[i].value;
	  id = document.forms[0].elements[i].id;
	  if(id == DATE_FORMAT){
	     if(!ValidateDate(value)) return false;
	     else continue;
	  }else if (id == TIME_FORMAT){
          if(!ValidateTime(value)) return false;
		 else continue; 
	  }else if (id == DECIMAL_FORMAT){
         
	  }else if (id == NUMBER_FORMAT){
          if(!checkInteger(value)) return false
		 else continue; 
	  }else if (id == NIF_FORMAT){
          if(!validaNIF(value)) return false;
		 else continue;
	  }else if (id == STRING_FORMAT){
          if(value == null || value == "") return false;
		 else continue;
	  }
   }

   return true;
}

function ValidateTime(value){
	if(value != null && value != "" && value.indexOf(":") != -1){
      var arr = new Array();
	  arr = value.split(":");
	  if(arr.length == 3){
		  //Viene con segundos ... hh:mm:ss
		  var h = arr[0];
		  var m = arr[1];
          var s = arr[2];
		  //Revisamos la hora ... 
          if(parseToInteger(h) > 24 || parseToInteger(h) < 0 || h.length != 2) {
			  alert("Por favor, informe correctamente la hora");
			  return false;
		  }
		  //Revisamos los minutos ...
          if(parseToInteger(m) > 59 || parseToInteger(m) < 0 || m.length != 2) {
			  alert("Por favor, informe correctamente los minutos");
			  return false;
		  }
		  //Revisamos los segundos ...
          if(parseToInteger(s) > 59 || parseToInteger(s) < 0 || s.length != 2) {
			  alert("Por favor informe correctamente los segundos");
			  return false;
		  }
	  } else {
		  //Viene sin segundos .. hh:mm
		  var h = arr[0];
		  var m = arr[1];
          //Revisamos la hora ... 
          if(parseToInteger(h) > 24 || parseToInteger(h) < 0 || h.length != 2) {
			  alert("Por favor, informe correctamente la hora");
			  return false;
		  }
		  //Revisamos los minutos ...
          if(parseToInteger(m) > 59 || parseToInteger(m) < 0 || m.length != 2) {
			  alert("Por favor, informe correctamente los minutos");
			  return false;
		  }
	  }

	} else {
	    alert("Por favor, informe correctamente el valor de la hora (hh:mm:ss ó hh:mm)");
	    return false;
	}

	return true;
}

function insertCaracterHora(campo, ev){
    var hora = document.getElementById(campo);
    var aceptar;
    var tecla = (document.all) ? ev.keyCode : ev.which;
    
    if(hora.value.length==2){
        if(tecla!=59){
            hora.value = hora.value+carHora;
            aceptar = checkNumerico(ev);
        }else{
            aceptar = true;
        }
    }else{
        aceptar = checkNumerico(ev);
    }
    return aceptar;
}


//Comprueba primero si puede pasar a integer el valor y si es así lo devuelve convertido. En caso contrario, saltará un alert.
function parseToInteger(stringvalue){
	try{
		var integer = parseInt(stringvalue, 10);
		return integer;
	}catch(onError){
		alert("El valor " + stringvalue + " no se puede convertir a integer");
		return false;
	}
}

//Chequea si el valor puede, presumiblemente, convertirse a integer
function checkInteger(integervalue){
	try{
		var integer = parseInt(integervalue, 10);
		return true;
	}catch(onError){
		alert("El valor " + integervalue + " es incorrecto")
		return false;
	}
}


/*
 * Método que se encarga de realizar el correspondiente submit de la página con los parametros apropiados
 *
 */

function getAction(action, type, admin){
    if(admin==null || isNull(admin) || admin == "false"){
        document.forms[0].action.value = action;
        document.forms[0].type.value = type;
    }else{
        document.forms[0].admin.value = admin;
    }
    document.forms[0].submit();
}

function goTo(){
	document.forms[0].submit();
}

/*
 * Método que se encarga de realizar el correspondiente submit de la página con los parametros apropiados
 *
 */

function getProfessionAction(action, type, car){
    document.fPlan.action.value = action;
    document.fPlan.type.value = type;
    document.fPlan.car.value = car;
    document.fPlan.submit();
}

/*
 * Recogerá todos los input de un formulario y dependiendo de los parametros que se encuentre en el name,
 * validará mostrando un alert en caso de:
 * - El input no debe ir a null o vacio
 * - El input solo se modi  ficará, si el administrador del sistema lo considera oportuno.
 */

function check(form){

	//INPUT|obligatorio|modificable|nombre_campo|nombre_input|tipo_dato@@value
	var bufferObligatory="";
    var numElements = form.elements.length;
	var data;
	var dataElements = new Array();
	for(var i=0;i<numElements;i++){
		var data = form.elements[i].name;
		var value = form.elements[i].value;
		dataElements = data.split("|");
		if(data == null || data == "") continue;
        if(dataElements[0] == "INPUT"){
		   if(data.indexOf("NACIMIENTO") != -1) if(!ValidateDate(value)) return false;
		   if(data.indexOf("DNI") != -1) if(!validaNIF(value)) return false;
           if(dataElements[1] == "Y"){
              //Es obligatorio 
			  if(value == "") bufferObligatory += "- " + trim(dataElements[4]).substring(0, dataElements[4].length-2) + "\n";
		   }
		}//Si no es input, no se valida
	}
  
    if(bufferObligatory != "") {
     	var message1 = "Los siguientes campos son obligatorios:\n \n" + bufferObligatory;
     	alert( message1);
	} else { 
        form.submit(); 
	}
}

function goToURL(url){
    document.location.href=url;
}

function trim(str){
    return RTrim(LTrim(str));
}

function isNull(value){
	value = trim(value);
	if(value == null || value == "" || value == "undefined") return true;
	else return false;
}

function LTrim(str){
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(0)) != -1) {
    // Que no sea un String vacio ...
    var j=0, i = s.length;
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;
    s = s.substring(j, i);
  }
  return s;
}

function RTrim(str){
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    var i = s.length - 1; 
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;
    s = s.substring(0, i+1);
  }

  return s;
}


var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }

    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";

    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDateOK(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("Por favor, introduzca la fecha con el formato dd/mm/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Por favor, introduzca un mes comprendido entre 1 y 12")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Por favor, introduzca un día que se corresponda con el mes elegido")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Por favor, introduzca correctamente los dígitos del año elegido")
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Por favor, introduzca la fecha con el formato dd/mm/yyyy")
		return false
	}
    return true
}

function ValidateDate(date){
	
	if (!isDateOK(date)){
		return false
	}

    return true
 }

 // Función que valida un NIF
 function validaNIF(nif) {
	if(nif == null || nif == "") return nif;
	var numero, letra, letraAux;
	var sinLetra = false;
	var letrasValidas = 'TRWAGMYFPDXBNJZSQVHLCKE';

	// Comprobamos que no tenga espacios en blanco ni letras entre los números
	if (nif.indexOf(' ') != -1) {
	  alert('Por favor, introduzca correctamente su Nif.\nÉste sólo puede contener caracteres numéricos y la letra correspondiente.');
	  return false;
	}
	if (!isNaN(nif.charAt(nif.length-1))) {
	  sinLetra = true;
	  numero = nif;
	  letra = '';
	} else {
	  numero = nif.substring(0, nif.length-1);
	  letra = nif.charAt(nif.length-1);
	}
	if (isNaN(numero)) {
	  alert('Por favor, introduzca correctamente su Nif.\nÉste sólo puede contener caracteres numéricos y la letra correspondiente.');
	  return false;
	}

	// Comprobamos la longitud
	if (nif.length < 2 || nif.length > 9) {
	  alert('Por favor, introduzca correctamente su Nif.\nÉste sólo puede contener caracteres numéricos y la letra correspondiente.');
	  return false;
	}

	// Validamos la letra
	letraAux = letrasValidas.charAt(numero%23);
	if (sinLetra) {
	  alert('Por favor, introduzca correctamente su Nif.\nÉste sólo puede contener caracteres numéricos y la letra correspondiente.');
	  return false;
	}
	if (letra.toUpperCase()  != letraAux) {
	  alert('Por favor, introduzca correctamente su Nif.\nÉste sólo puede contener caracteres numéricos y la letra correspondiente.');
	  return false;
	}

	// Validación correcta
	return true;
}

// Funcion que valida que el nif se introduce correctamente por teclado
function checkNIF(ev,camp){
    var campo = document.getElementById(camp).value;
    var longCampo = campo.length;
    var tecla = (document.all) ? ev.keyCode : ev.which;
    var c = String.fromCharCode(tecla);
    var aceptar;
                        
    if(tecla==8){
        aceptar = true;
    }else if(campo.length<8){
        aceptar = /^\d$/.test(c);
        if(!aceptar){
            var letraValida = /^[AaBbCcDdEeFfGgHhJjKkLlMmNnPpQqRrSsTtVvXxYyZz]$/.test(c);
            if((letraValida)&&(campo.length>0)){
                for(i=longCampo;i<8;i++){
                    campo = '0'+campo;
                }
                document.getElementById(camp).value = campo;
                aceptar = true;
            }
        }
    }else if(campo.length==8){
        aceptar = /^[AaBbCcDdEeFfGgHhJjKkLlMmNnPpQqRrSsTtVvXxYyZz]$/.test(c);
        if(!aceptar){
            alert("Debe de introducir una letra válida para el NIF.");
        }
    }else{
        aceptar = false;
    }        
    
    return aceptar;
}

//Función para devolver una variable js, a partir de un literal que le llega como argumento a la función.
function getVariable(variable){
	return variable;
}

function formatDate(date){
   //1900-01-01 00:00:00.0
   if(date != null && date != ""){
	   var arrs = date.split("-");
	   var day = arrs[2].substring(0, 2);
	   var month = arrs[1];
	   var year = arrs[0];

	   return day + "/" + month + "/" + year; 
   } return date
}

function formatIntellDate(date){
   //1900-01-01 00:00:00.0
   if(date != null && date != "" && date.indexOf("-") != -1 && date.indexOf(":") != -1 && trim(date).length == 23){
	   var arrs = date.split("-");
	   var day = arrs[2].substring(0, 2);
	   var month = arrs[1];
	   var year = arrs[0];

	   return day + "/" + month + "/" + year; 
   } return date
}

function getDescProvincias(id){
	if(id == null || id == "") return "";
	var arr = new Array();
	var arr2 = new Array();
	if(parseInt(id, 10) < 10) id = "0" + id;
	arr = getProvincias();
	for(var i=0;i<arr.length;i++){
       arr2 = arr[i].split("|");
	   if(arr2[1] == id) return arr2[0];
	}
}

function getDescLocales(id){
	if(id == null || id == "") return "";
	var arr = new Array();
	var arr2 = new Array();
	if(parseInt(id, 10) < 10) id = "0" + id;
	arr = getLocales();
	for(var i=0;i<arr.length;i++){
       arr2 = arr[i].split("|");
	   if(arr2[1] == id) return arr2[0];
	}
}

function getDescTribunal(id){
	if(id == null || id == "") return "";
	var arr = new Array();
	var arr2 = new Array();
	if(parseInt(id, 10) < 10) id = "0" + id;
	arr = getTribunales();
	for(var i=0;i<arr.length;i++){
       arr2 = arr[i].split("|");
	   if(arr2[1] == id) return arr2[0];
	}
}

function getDescCarrera(id){
	if(id == null || id == "") return "";
	var arr = new Array();
	var arr2 = new Array();
	//if(parseInt(id, 10) < 10) id = "0" + id;
	arr = getCarreras();
	for(var i=0;i<arr.length;i++){
       arr2 = arr[i].split("|");
	   if(arr2[1] == id) return arr2[0];
	}
}

function replaceChars(entry, out, add) {
	var temp = "" + entry; 
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}

	return temp;
}

//En el caso de nif num = 9
function addLeftCeros(value, num){
	if(value != null && value != "" && value.length < num ){
		var total = num-value.length;
		for(var i=0;i<total;i++){
			value = "0" + value;
		} 
    }
	return value;
}

function replaceSpecialChars(entry) { 
    /*entry = searchAndReplace(entry, "'", "´");
    entry = searchAndReplace(entry, "\"", "");
    entry = searchAndReplace(entry, "á", "&aacute;");
	entry = replaceChars(entry, "é", "&eacute;");
	entry = replaceChars(entry, "í", "&iacute;");
	entry = replaceChars(entry, "ó", "&oacute;");
	entry = replaceChars(entry, "ú", "&uacute;");
	entry = replaceChars(entry, "Á", "&Aacute;");
	entry = replaceChars(entry, "É", "&Eacute;");
	entry = replaceChars(entry, "Í", "&Iacute;");
	entry = replaceChars(entry, "Ó", "&Oacute;");
	entry = replaceChars(entry, "Ú", "&Uacute;");
    */
	return entry;
}
/*
function searchAndReplace(cadena, search, replace){
     	int pos=0, pos2=0;
        var result=cadena;
	    if(search == null || search.equals("")) return cadena;
        if(replace == null) return cadena;
        while((pos = cadena.indexOf(search, pos)) != -1)
	    {
           result = cadena.substring(0, pos);
           result += replace;
		   result += cadena.substring(pos + search.length, cadena.length);
		   cadena = result;
           pos+=replace.length;
	    }
        return result;
    }

	*/

function getCoursesAction(action, type){
    document.fCourses.action.value = action;
    document.fCourses.type.value = type;
    document.fCourses.submit();
}

function getListAlumnsTraining(idC, formacion, cuerpo){
    document.fList.idC.value = idC;
    document.fList.tipoF.value = formacion;
    document.fList.cuerpo.value = cuerpo;
    document.fList.submit();
}

function getListAlumnsAction(idP){
    document.fList.idP.value = idP;
    document.fList.submit();
}

function getListAlumnsActionC(idC){
    document.fList.idC.value = idC;
    document.fList.submit();
}

/*
Funciones necesarias para crear un div dinámicamente
*/
/*
function createDiv(id, tipo){
	value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" +
	          "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG></TD>" +
	          "</TR>";

	if(tipo == "_C"){
		value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendCourseRequest(\""+id+"\");'>Solicitar&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>";
	}else if (tipo == "_I"){
		value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG></TD>" +
				  "</TR>";
	}
	value +="</TABLE>";

	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="240px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top=posY+"px";
	document.getElementById("capaOculta").style.left=posX+"px";
}
*/
function createDiv(id, tipo){


    if(ie){
		value="<div id='tr1' style='width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
				  "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG>" +
				  "</div>";

		if(tipo == "_C"){
			value +=  "<div id='tr2' style='position:relative; top:1px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						"<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='CEJServlet?dispatcher=vacio&public=true&action=dmndCourse&type=D&idCurso="+id+"'>Solicitar&nbsp;este&nbsp;curso</A></STRONG>" +
					  "</div>";
		}else if (tipo == "_I"){
			value +=  "<div id='tr3' style='position:relative; top:1px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						 "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG>" +
					  "</div>";
		}
			
			
		value +=	  "<div id='tr5' style='position:relative; top:3px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                                          "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:SendSpeech(\""+id+"\");'>Enviar&nbsp;ponencia&nbsp;para&nbsp;este&nbsp;curso</A></STRONG>" + 
					  "</div>";
	} else {
		
		value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" +
	          "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG></TD>" +
	          "</TR>";

	if(tipo == "_C"){
		    value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='CEJServlet?dispatcher=vacio&public=true&action=dmndCourse&type=D&idCurso="+id+"'>Solicitar&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>";
	}else if (tipo == "_I"){
		value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG></TD>" +
				  "</TR>";
	}
	value +=	  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:SendSpeech(\""+id+"\");'>Enviar&nbsp;ponencia&nbsp;para&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>" +
			 "</TABLE>";
	}


	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="240px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top=posY+"px";
	document.getElementById("capaOculta").style.left=posX+"px";
}

function createDivFiscales(id, tipo){
    if(ie){
		value="<div id='tr1' style='width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
				  "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG>" +
				  "</div>";
		if(tipo == "_C"){
			value +=  "<div id='tr2' style='position:relative; top:1px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						"<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='CEJServlet?dispatcher=vacio&public=true&action=dmndCourse&type=D&idCurso="+id+"'>Solicitar&nbsp;este&nbsp;curso</A></STRONG>" +
					  "</div>";
		}else if (tipo == "_I"){
			value +=  "<div id='tr3' style='position:relative; top:1px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						 "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG>" +
					  "</div>";
		}	
		value +=	  "<div id='tr4' style='position:relative; top:2px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						 "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDietas(\""+id+tipo+"\");'>Solicitar&nbsp;dietas&nbsp;para&nbsp;este&nbsp;curso</A></STRONG>" + 
					  "</div>"+
					  "<div id='tr5' style='position:relative; top:3px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						"<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:SendSpeech(\""+id+"\");'>Enviar&nbsp;ponencia&nbsp;para&nbsp;este&nbsp;curso</A></STRONG>" + 
					  "</div>";
	}
	else{
		value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" +
	          "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG></TD>" +
	          "</TR>";
	    if(tipo == "_C"){
		    value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\"javascript:alert('La oferta de cursos para la Carrera Fiscal tiene carácter informativo. El plazo y forma de solicitud le será oportunamente comunicado por la Secretaría Técnica de la Fiscalía General del Estado a través del procedimiento habitual');\">Solicitar&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>";
	}
	else if (tipo == "_I"){
		value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG></TD>" +
				  "</TR>";
	}
	value +=	  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDietas(\""+id+tipo+"\");'>Solicitar&nbsp;dietas&nbsp;para&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>" +
				  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:SendSpeech(\""+id+"\");'>Enviar&nbsp;ponencia&nbsp;para&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>" +
			 "</TABLE>";
	}

	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="240px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top=posY+"px";
	document.getElementById("capaOculta").style.left=posX+"px";
}

/*
function createDivFiscales(id, tipo){

    if(ie){
		value="<div id='tr1' style='width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
				  "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG>" +
				  "</div>";
		if(tipo == "_C"){
			value +=  "<div id='tr2' style='position:relative; top:1px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						"<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\"javascript:alert('La oferta de cursos para la Carrera Fiscal tiene carácter informativo. El plazo y forma de solicitud le será oportunamente comunicado por la Secretaría Técnica de la Fiscalía General del Estado a través del procedimiento habitual')\">Solicitar&nbsp;este&nbsp;curso</A></STRONG>" +
					  "</div>";
		}else if (tipo == "_I"){
			value +=  "<div id='tr3' style='position:relative; top:1px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						 "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG>" +
					  "</div>";
		}	
		value +=	  "<div id='tr4' style='position:relative; top:2px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						 "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDietas(\""+id+tipo+"\");'>Solicitar&nbsp;dietas&nbsp;para&nbsp;este&nbsp;curso</A></STRONG>" + 
					  "</div>"+
					  "<div id='tr5' style='position:relative; top:3px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						"<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:SendSpeech(\""+id+"\");'>Enviar&nbsp;ponencia&nbsp;para&nbsp;este&nbsp;curso</A></STRONG>" + 
					  "</div>";
	}
	else{
		value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" +
	          "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG></TD>" +
	          "</TR>";
	    if(tipo == "_C"){
		    value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\"javascript:alert('La oferta de cursos para la Carrera Fiscal tiene carácter informativo. El plazo y forma de solicitud le será oportunamente comunicado por la Secretaría Técnica de la Fiscalía General del Estado a través del procedimiento habitual');\">Solicitar&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>";
	}
	else if (tipo == "_I"){
		value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG></TD>" +
				  "</TR>";
	}
	value +=	  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDietas(\""+id+tipo+"\");'>Solicitar&nbsp;dietas&nbsp;para&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>" +
				  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:SendSpeech(\""+id+"\");'>Enviar&nbsp;ponencia&nbsp;para&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>" +
			 "</TABLE>";
	}

	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="240px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top=posY+"px";
	document.getElementById("capaOculta").style.left=posX+"px";
}
*/

function createDivForensics(id, tipo){
     if(id==2662 || id==2663){
		 alert("Los cursos 'Identificación forense en grandes catástrofes', del 3 al 5 de abril y 'Toxicología forense medioambiental', del 8 a 10 de mayo, dirigido a Facultativos del Instituto Nacional de Toxicología seleccionados a través del Instituto Nacional de Toxicología y Ciencias Forenses, están abiertos a la formación de Médicos Forenses mediante las solicitudes que se reciban en el Centro de estucios Jurídicos");
	 }

	 id_seleccionado=id;

    if(ie){
		value="<div id='tr1' style='width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
				  "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG>" +
				  "</div>";

		if(tipo == "_C"){
		    value +=  "<div id='tr2' style='position:relative; top:1px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						"<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='CEJServlet?dispatcher=vacio&public=true&action=dmndCourse&type=D&idCurso="+id+"'>Solicitar&nbsp;este&nbsp;curso</A></STRONG>" +
					    "</div>";

		}else if (tipo == "_I"){
			value +=  "<div id='tr3' style='position:relative; top:1px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						 "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG>" +
					  "</div>";
		}
			
			
		value +=	  "<div id='tr4' style='position:relative; top:2px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						 "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDietas(\""+id+tipo+"\");'>Solicitar&nbsp;dietas&nbsp;para&nbsp;este&nbsp;curso</A></STRONG>" + 
					  "</div>"+
					  "<div id='tr5' style='position:relative; top:3px; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
						"<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:SendSpeech(\""+id+"\");'>Enviar&nbsp;ponencia&nbsp;para&nbsp;este&nbsp;curso</A></STRONG>" + 
					  "</div>";
	} else {
		
		value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" +
	          "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDetalle(\""+id+"\");'>Ver&nbsp;informaci&oacute;n&nbsp;del&nbsp;curso</A></STRONG></TD>" +
	          "</TR>";

	if(tipo == "_C"){
		    value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='CEJServlet?dispatcher=vacio&public=true&action=dmndCourse&type=D&idCurso="+id+"'>Solicitar&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>";
	}else if (tipo == "_I"){
		value +=  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:sendSpeechRequest(\""+id+"\");'>Solicitar&nbsp;impartici&oacute;n de ponencia</A></STRONG></TD>" +
				  "</TR>";
	}
	value +=	  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:addDietas(\""+id+tipo+"\");'>Solicitar&nbsp;dietas&nbsp;para&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>" +
				  "<TR  background=\"../html/images/bk_op04.gif\">" +
					 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:SendSpeech(\""+id+"\");'>Enviar&nbsp;ponencia&nbsp;para&nbsp;este&nbsp;curso</A></STRONG></TD>" +
				  "</TR>" +
			 "</TABLE>";
	}


	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="240px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top=posY+"px";
	document.getElementById("capaOculta").style.left=posX+"px";
}


function createDivListados(nombre, idPlanCurso, planCurso, tipoUsuario,usuario){

    if(ie){
		value="<div id='tr1' style='width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaPdf(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>PDF&nbsp;con&nbsp;alumnos&nbsp;insertados&nbsp;por&nbsp;usuario</A></STRONG>" +
                      "</div>"+
		      "<div id='tr2' style='position:relative; top:1px; width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaPdfCej(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>PDF&nbsp;con&nbsp;alumnos&nbsp;asignados&nbsp;al&nbsp;curso</A></STRONG>" +
                      "</div>"+
                      "<div id='tr3' style='position:relative; top:1px; width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaExcel(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>Excel&nbsp;con&nbsp;alumnos&nbsp;insertados&nbsp;por&nbsp;usuario</A></STRONG>" +
                      "</div>"+
                      "<div id='tr4' style='position:relative; top:1px; width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaExcelCej(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>Excel&nbsp;con&nbsp;alumnos&nbsp;asignados&nbsp;al&nbsp;curso</A></STRONG>" +
                      "</div>"+
                      "<div id='tr4' style='position:relative; top:1px; width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:borrarDiv();'>Cerrar</A></STRONG>" +
                      "</div>";
	} else {
		
		value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" +
	          "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaPdf(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>PDF&nbsp;con&nbsp;alumnos&nbsp;insertados&nbsp;por&nbsp;usuario</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaPdfCej(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>PDF&nbsp;con&nbsp;alumnos&nbsp;asignados&nbsp;al&nbsp;curso</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaExcel(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>Excel&nbsp;con&nbsp;alumnos&nbsp;insertados&nbsp;por&nbsp;usuario</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaExcelCej(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>Excel&nbsp;con&nbsp;alumnos&nbsp;asignados&nbsp;al&nbsp;curso</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:borrarDiv();'>Cerrar</A></STRONG></TD>" +
	          "</TR>"+
         	  "</TABLE>";
	}


	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="240px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top="330px";
	document.getElementById("capaOculta").style.left="0px";
}

function createDivListados2(nombre, idPlanCurso, planCurso, tipoUsuario, usuario){

    if(ie){
		value="<div id='tr1' style='width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaPdf(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>PDF&nbsp;con&nbsp;alumnos&nbsp;insertados&nbsp;por&nbsp;usuario</A></STRONG>" +
                      "</div>"+
		      "<div id='tr2' style='position:relative; top:1px; width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaPdfCej(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>PDF&nbsp;con&nbsp;alumnos&nbsp;asignados&nbsp;al&nbsp;curso</A></STRONG>" +
                      "</div>"+
                      "<div id='tr3' style='position:relative; top:1px; width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaExcel(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>Excel&nbsp;con&nbsp;alumnos&nbsp;insertados&nbsp;por&nbsp;usuario</A></STRONG>" +
                      "</div>"+
                      "<div id='tr4' style='position:relative; top:1px; width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaExcelCej(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>Excel&nbsp;con&nbsp;alumnos&nbsp;asignados&nbsp;al&nbsp;curso</A></STRONG>" +
                      "</div>"+
                      "<div id='tr4' style='position:relative; top:1px; width:270; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                      "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:borrarDiv();'>Cerrar</A></STRONG>" +
                      "</div>";
	} else {
		
		value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" +
	          "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaPdf(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>PDF&nbsp;con&nbsp;alumnos&nbsp;insertados&nbsp;por&nbsp;usuario</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaPdfCej(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>PDF&nbsp;con&nbsp;alumnos&nbsp;asignados&nbsp;al&nbsp;curso</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaExcel(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>Excel&nbsp;con&nbsp;alumnos&nbsp;insertados&nbsp;por&nbsp;usuario</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:descargaExcelCej(\""+nombre+"\",\""+idPlanCurso+"\",\""+planCurso+"\",\""+tipoUsuario+"\",\""+usuario+"\");'>Excel&nbsp;con&nbsp;alumnos&nbsp;asignados&nbsp;al&nbsp;curso</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:borrarDiv();'>Cerrar</A></STRONG></TD>" +
	          "</TR>"+
         	  "</TABLE>";
	}


	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="240px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top="190px";
	document.getElementById("capaOculta").style.left="0px";
}

function descargaPdf(nombre, idPlanCurso,planCurso, tipoUsuario, usuario){
    borrarDiv();
    window.open("CEJServlet?dispatcher=GENERA_PDF_EXTERNAL_USER&nombrePlanCurso=" + nombre+"&idPlanCurso="+idPlanCurso+"&planCurso="+planCurso+"&tipoUsuario="+tipoUsuario+"&usuario="+usuario,"vModal","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=500, top=0,left=0");   
}    
function descargaPdfCej(nombre, idPlanCurso,planCurso, tipoUsuario, usuario){
    borrarDiv();
    window.open("CEJServlet?dispatcher=GENERA_PDF_CURSO_ALUMNO&nombrePlanCurso=" + nombre+"&idPlanCurso="+idPlanCurso+"&planCurso="+planCurso+"&tipoUsuario="+tipoUsuario+"&usuario="+usuario,"vModal","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=500, top=0,left=0");   
} 
function descargaExcel(nombre, idPlanCurso,planCurso, tipoUsuario, usuario){
    borrarDiv();
    window.open("CEJServlet?dispatcher=GENERA_EXCEL_EXTERNAL_USER&nombrePlanCurso=" + nombre+"&idPlanCurso="+idPlanCurso+"&planCurso="+planCurso+"&tipoUsuario="+tipoUsuario+"&usuario="+usuario,"vModal","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=500, top=0,left=0");   
}     
function descargaExcelCej(nombre, idPlanCurso,planCurso, tipoUsuario, usuario){
    borrarDiv();
    window.open("CEJServlet?dispatcher=GENERA_EXCEL_CURSO_ALUMNO&nombrePlanCurso=" + nombre+"&idPlanCurso="+idPlanCurso+"&planCurso="+planCurso+"&tipoUsuario="+tipoUsuario+"&usuario="+usuario,"vModal","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=500, top=0,left=0");   
}

// e.d. 4-2-2009 Excel con listado de asistentes a curso selecionado.
function descargaExcelAsistentes(idC){
    
    window.open("CEJServlet?dispatcher=GENERA_EXCEL_ASISTENTES&idCurso=" + idC,"vModal","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=500, top=0,left=0");   
}    

/*
Funciones necesarias para crear un div dinámicamente para gestion de usuarios (admin)
*/
function createDivGest(id, rol, opc){
    //if(ie){
          value = "";
          if(param != "true"){
                value = "<div id='tr1' style='position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                          "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:gestUsu(\""+id+"\", 1);'>Actualizar fotografía</A></STRONG>" +
                        "</div>" + 
                        "<div id='tr2' style='top:1; position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                          "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:gestUsu(\""+id+"\", 2, "+opc+");'>Recordar contraseña</A></STRONG>" +
                        "</div>";  
          } 
          value += "<div id='tr2' style='top:1; position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                       "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:gestUsu(\""+id+"\", 3);'>Registro de solicitud de cursos</A></STRONG>" +
                   "</div>" + 
                   "<div id='tr2' style='top:1; position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                       "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:gestUsu(\""+id+"\", 7);'>Consultar solicitudes enviadas</A></STRONG>" +
                   "</div>"+
                   "<div id='tr2' style='top:1; position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                       "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:gestUsu(\""+id+"\", 6);'>Modificar solicitudes enviadas de convocatorias abiertas</A></STRONG>" +
                   "</div>";
          if (rol=="SI")
                   value += "<div id='tr2' style='top:1; position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                            "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:gestUsuEjecutados(\""+id+"\");'>Modificar solicitudes de procesos ejecutados</A></STRONG>" +
                            "</div>";

          value += "<div id='tr2' style='top:1; position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
                       "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:gestUsu(\""+id+"\", 5);'>Estado adjudicación</A></STRONG>" +
                   "</div>";


     /*} else {
          value = "";
          value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>"; 
               if(param != "true"){  
                   value +="<TR background=\"../html/images/bk_op04.gif\">" +
                      "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:gestUsu(" + id + ", 1);'>Actualizar fotografia</A></STRONG></TD>" +
                   "</TR>" +
                   "<TR background=\"../html/images/bk_op04.gif\">" +
                      "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:gestUsu(" + id + ", 2,"+opc+");'>Recordar contraseña</A></STRONG></TD>" +
                   "</TR>";
                }
                  value += "<TR background=\"../html/images/bk_op04.gif\">" +
                      "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:gestUsu(" + id + ", 3);'>Registro de solicitud de cursos</A></STRONG></TD>" +
                   "</TR>" +
                   "<TR background=\"../html/images/bk_op04.gif\">" +
                   "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:gestUsu(" + id + ", 7);'>Consultar solicitudes enviadas</A></STRONG></TD>" +
                   "</TR>"+
                "<TR background=\"../html/images/bk_op04.gif\">" +
                  "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:gestUsu(" + id + ", 6);'>Modificar solicitudes enviadas de convocatorias abiertas</A></STRONG></TD>" +
                "</TR>";
          if (rol=="SI")
                value="<TR background=\"../html/images/bk_op04.gif\">" +
                      "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:gestUsuEjecutados(" + id + ");'>Modificar solicitudes de procesos ejecutados</A></STRONG></TD>" +
                      "</TR>";
          value="<TR background=\"../html/images/bk_op04.gif\">" +
                  "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:gestUsu(" + id + ", 5);'>Estado adjudicación</A></STRONG></TD>" +
                "</TR>";
          
	}*/

	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="420px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top=posY+"px";
	document.getElementById("capaOculta").style.left=posX+"px";

}


function createDivGestCambiarPass(id, opc){
    value = "<div id='tr2' style='top:1; position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
            "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG>\n\<A href=\'CEJServlet?dispatcher=vacio&action=recordarPass&type=U&id="+id+"&menu="+opc+"&isRolCambiarPassword=1'>Recordar contraseña</A></STRONG>" +
            "</div>";
    document.getElementById("capaOculta").innerHTML=value;
    document.getElementById("capaOculta").style.visibility="visible";
    document.getElementById("capaOculta").style.width="420px";
    document.getElementById("capaOculta").style.height="30px";
    document.getElementById("capaOculta").style.top=posY+"px";
    document.getElementById("capaOculta").style.left=posX+"px";
}

function createDivGestCodigoUsu(id, opc){
    value = "<div id='tr2' style='top:1; position:relative; width:420; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
            "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG>\n\<A href=\'CEJServlet?dispatcher=vacio&action=cambiarCodigoUsuarioDesdeAdmin&type=U&id="+id+"&menu="+opc+"&isRolCambiarPassword=1'>Crear código usuario y contraseña</A></STRONG>" +
            "</div>";
    document.getElementById("capaOculta").innerHTML=value;
    document.getElementById("capaOculta").style.visibility="visible";
    document.getElementById("capaOculta").style.width="420px";
    document.getElementById("capaOculta").style.height="30px";
    document.getElementById("capaOculta").style.top=posY+"px";
    document.getElementById("capaOculta").style.left=posX+"px";
}

function createDivP(id, anio){
	
    if(ie){
		value="<div id='tr1' style='width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
				  "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:getAction(\""+id+"\", "+anio+");'>Ver&nbsp;cursos&nbsp;del&nbsp;plan</A></STRONG>" +
			  "</div>" + 
              "<div id='tr2' style='position:relative; top:1; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
				  "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:publicar(\""+id+"\", "+anio+");'>Publicar&nbsp;todos&nbsp;los&nbsp;cursos&nbsp;del&nbsp;plan</A></STRONG>" +
			  "</div>" + 
              "<div id='tr3' style='position:relative; top:2; width:240; height:20; background-image:url(../html/images/bk_op04.gif); visibility:visible'> " +
				  "<img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href=\'javascript:despublicar(\""+id+"\", "+anio+");'>Despublicar&nbsp;todos&nbsp;los&nbsp;cursos&nbsp;del&nbsp;plan</A></STRONG>" +
			  "</div>";
	} else {

		value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" + 
				  "<TR background=\"../html/images/bk_op04.gif\">" +
					 "<TD ><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:getAction(\""+id+"\", "+anio+");'>Ver&nbsp;cursos&nbsp;del&nbsp;plan</A></STRONG></TD>" +
				  "</TR>";

		value +=	  "<TR  background=\"../html/images/bk_op04.gif\">" +
						 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:publicar(\""+id+"\", "+anio+");'>Publicar&nbsp;todos&nbsp;los&nbsp;cursos&nbsp;del&nbsp;plan</A></STRONG></TD>" +
					  "</TR>" +
					  "<TR  background=\"../html/images/bk_op04.gif\">" +
						 "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:despublicar(\""+id+"\", "+anio+");'>Despublicar&nbsp;todos&nbsp;los&nbsp;cursos&nbsp;del&nbsp;plan</A></STRONG></TD>" +
					  "</TR>" +
				 "</TABLE>";

	}
	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="220px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top=posY+"px";
	document.getElementById("capaOculta").style.left=posX+"px";
}	      

function gestUsu(id, type, menu){
	//Cerrar capa del menú ncontextual ...
    borrarDiv();
    if(type == 1){ //Es la capa de la fotografía ...
	   //Cerrando cualquier capa que haya abierta ...
           //Abriendo la capa de la fotografia ...
	   document.getElementById("capaActualizarFoto").style.visibility = "visible";
           document.getElementById("idPersona").value = id;
    } else if(type == 2){
	   //Cerrando cualquier capa que haya abierta ...
           document.getElementById("capaActualizarFoto").style.visibility = "hidden";
	   goToURL("CEJServlet?dispatcher=vacio&action=recordarPass&type=U&id=" + id +"&menu="+ menu);
    } else if(type == 3){
	   //Cerrando cualquier capa que haya abierta ...
           document.getElementById("capaActualizarFoto").style.visibility = "hidden";
	   goToURL("CEJServlet?dispatcher=vacio&action=admDmndCourse&type=D&id=" + id);
	   //goToURL("CEJServlet?dispatcher=vacio&action=peticionCursosAlumno&type=L&id=" + id);
    } else if(type == 4){
	   //Cerrando cualquier capa que haya abierta ...
           document.getElementById("capaActualizarFoto").style.visibility = "hidden";
	   goToURL("CEJServlet?dispatcher=vacio&action=listSolicitudesEnviadasStudent&type=L&id=" + id);
    } else if(type == 5){
	   //Cerrando cualquier capa que haya abierta ...
	   goToURL("CEJServlet?dispatcher=DETALLE_ALUMNO&idUsuario=" + id);
    }else if(type == 6){ //solo para q aparezca el menu de meritos al pinchar sobre solicitudes enviadas
	   document.getElementById("capaActualizarFoto").style.visibility = "hidden";
	   goToURL("CEJServlet?dispatcher=vacio&action=admDmndCourse&type=D&enviadas=true&id=" + id);
    }else if(type == 7){
	   document.getElementById("capaActualizarFoto").style.visibility = "hidden";
	   goToURL("CEJServlet?dispatcher=vacio&action=admDmndCourse&type=D&enviadas=true&consulta=true&id=" + id);
    }

}

function gestUsuEjecutados(id){
   //Cerrar capa del menú ncontextual ...
   borrarDiv();
   //Cerrando cualquier capa que haya abierta ...
   document.getElementById("capaActualizarFoto").style.visibility = "hidden";
   goToURL("CEJServlet?dispatcher=vacio&action=admDmndCourse&type=D&enviadas=true&id=" + id + "&ejecutado=true");
}

function addDetalle(idC){
	    if(idC.indexOf("_") != -1){
		   var aux = idC.split("_");
           var id = aux[0];
		   var pf = aux[1];
		   if(pf.indexOf("I")>-1) document.fDetalle.action.value="getDetailCourseFI";
		   else document.fDetalle.action.value="getDetailCourseFC";
			document.fDetalle.idC.value=id;
        }else{ 
			document.fDetalle.idC.value=idC;
        }
		document.fDetalle.submit();
}
function addDietas(idC){
	   var aux = idC.split("_");
	   var id = aux[0];
	   var pf = aux[1];
	   if(pf.indexOf("I")>-1) goToURL("CEJServlet?dispatcher=DIETAS&idCurso=" + id+"_I");
	   else if(pf.indexOf("Language")>-1) goToURL("CEJServlet?dispatcher=DIETAS&idCurso=" + id+"_Language");
	   else goToURL("CEJServlet?dispatcher=DIETAS&idCurso=" + id+"_C");
}
function SendSpeech(idC){
	   var car = document.getElementById("car");
	   if(idC.indexOf("_") != -1){
		   var aux = idC.split("_");
                   var id = aux[0];
		   var pf = aux[1];
		  if(pf.indexOf("C")>-1) goToURL("CEJServlet?dispatcher=vacio&action=submitPonencias&type=D&idC=" + id + "&typeFormacion=C&car=" + car);
    	          else goToURL("CEJServlet?dispatcher=vacio&action=submitPonencias&type=D&idC=" + id + "&typeFormacion=I&car=" + car);
	   }else{
		var id= document.fDetalle.pf.value;
		  if(id.indexOf("C")>-1) goToURL("CEJServlet?dispatcher=vacio&action=submitPonencias&type=D&idC=" + idC + "&typeFormacion=C&car=" + car);
    	          else goToURL("CEJServlet?dispatcher=vacio&action=submitPonencias&type=D&idC=" + idC + "&typeFormacion=I&car=" + car);
	   }
}

function SendSpeechJSP(idC, car, pf){
	   if(idC.indexOf("_") != -1){
              var aux = idC.split("_");
              var id = aux[0];
              var pf = aux[1];
              if(pf.indexOf("C")>-1) goToURL("CEJServlet?dispatcher=vacio&action=submitPonencias&type=D&idC=" + id + "&typeFormacion=C&car=" + car);
              else goToURL("CEJServlet?dispatcher=vacio&action=submitPonencias&type=D&idC=" + id + "&typeFormacion=I&car=" + car);
	   }else{
              var id= pf;
              if(id.indexOf("C")>-1) goToURL("CEJServlet?dispatcher=vacio&action=submitPonencias&type=D&idC=" + idC + "&typeFormacion=C&car=" + car);
              else goToURL("CEJServlet?dispatcher=vacio&action=submitPonencias&type=D&idC=" + idC + "&typeFormacion=I&car=" + car);
	   }
}

function borrarDiv(){
	document.getElementById("capaOculta").innerHTML="";
	document.getElementById("capaOculta").style.visibility="hidden";
}

function borrarDivForensics(){
	if(id_seleccionado==2662 || id_seleccionado==2663){
	}
	else{
		document.getElementById("capaOculta").innerHTML="";
		document.getElementById("capaOculta").style.visibility="hidden";
	}
}

function initDiv() {
	if (!document.all) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = mouseMoveDiv;
}
function mouseMoveDiv(e) {
            if (ie){
                    /*document.getElementById("ejeX").value = event.x+document.body.scrollLeft;
                    posX= document.getElementById("ejeX").value;
                    document.getElementById("ejeY").value = event.y+document.body.scrollTop;
                    posY=document.getElementById("ejeY").value;*/
                    posX = event.x+document.body.scrollLeft;
                    posY = event.y+document.body.scrollTop;
            }else{
                    posX = e.pageX-250;
                    posY = e.pageY-80;
            }
}

function sendCourseRequest(idCourse){
	if(idCourse.indexOf("_") != -1){
		var result = idCourse.split("_");
		if(trim(result[1]) == "FC")
		   goToURL("CEJServlet?dispatcher=vacio&action=courseRequestFromDetail&type=D&idCurso=" + result[0]);
		else alert("La solicitud de cursos sobre formación inicial, no está disponible.");
	} else goToURL("CEJServlet?dispatcher=vacio&action=courseRequestFromDetail&type=D&idCurso=" + idCourse);
}

function sendSpeechRequest(idCourse){
    if(idCourse.indexOf("_") != -1){
        var result = idCourse.split("_");
        if(trim(result[1]) == "FI")
           goToURL("CEJServlet?dispatcher=vacio&action=speechRequestFromDetail&type=D&idCurso=" + result[0]);
        else alert("La solicitud de impartición de ponencias sobre formación continuada, no está disponible.");
    } else goToURL("CEJServlet?dispatcher=vacio&action=speechRequestFromDetail&type=D&idCurso=" + idCourse);
}

function getCatalogue(){
    document.fLibrary.submit();
}

function goToUrlFIFC(cuerpo, formacion){
    document.fPlanNuevo.type.value="AJSP";
    if (formacion=="FC"){
        document.fPlanNuevo.action.value="list_FC";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        //document.location.href="CEJServlet?dispatcher=vacio&type=AJSP&action=list_FC&cuerpo="+cuerpo;
    }else if (formacion=="FI"){
        document.fPlanNuevo.action.value="list_FI";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        document.fPlanNuevo.tipo.value="FI";
        //document.location.href="CEJServlet?dispatcher=vacio&type=AJSP&action=list_FI&cuerpo="+cuerpo+"&tipo=FI";
    }else{
        document.fPlanNuevo.action.value="list_FI";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        document.fPlanNuevo.tipo.value="Idiomas";
        //document.location.href="CEJServlet?dispatcher=vacio&type=AJSP&action=list_FI&cuerpo="+cuerpo+"&tipo=Idiomas";
    }
    document.fPlanNuevo.submit();
}

function goToUrlFIFCAut(cuerpo, formacion, autonomia){
    document.fPlanNuevo.type.value="AJSP";
    document.fPlanNuevo.action.value="list_FC";
    document.fPlanNuevo.cuerpo.value=cuerpo;    
    document.fPlanNuevo.aut.value=autonomia;
    //document.location.href="CEJServlet?dispatcher=vacio&type=AJSP&action=list_FC&cuerpo="+cuerpo+"&aut="+autonomia;
    document.fPlanNuevo.submit();
}

function goToUrlFIFCAnio(cuerpo, formacion){
    document.fPlanNuevo.type.value="AJSP";
    document.fPlanNuevo.anioPlan.value=document.getElementById('anio').value;
    if (formacion=="FC"){
        document.fPlanNuevo.action.value="list_FC";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        //document.location.href="CEJServlet?dispatcher=vacio&type=AJSP&action=list_FC&cuerpo="+cuerpo+"&anioPlan=" + document.getElementById('anio').value;
    }else if (formacion=="FI"){
        document.fPlanNuevo.action.value="list_FI";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        document.fPlanNuevo.tipo.value="FI";
        //document.location.href="CEJServlet?dispatcher=vacio&type=AJSP&action=list_FI&cuerpo="+cuerpo+"&tipo=FI&anioPlan=" + document.getElementById('anio').value;
    }else{
        document.fPlanNuevo.action.value="list_FI";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        document.fPlanNuevo.tipo.value="Idiomas";
        //document.location.href="CEJServlet?dispatcher=vacio&type=AJSP&action=list_FI&cuerpo="+cuerpo+"&tipo=Idiomas&anioPlan=" + document.getElementById('anio').value;
    }
    document.fPlanNuevo.submit();
}

function goToUrlFIFC2(cuerpo, formacion){
    document.fPlanNuevo.type.value="AJSP";
    if (formacion=="FC"){
        document.fPlanNuevo.action.value="list_FC";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        //document.location.href="../servlet/CEJServlet?dispatcher=vacio&type=AJSP&action=list_FC&cuerpo="+cuerpo;
    }else if (formacion=="FI"){
        document.fPlanNuevo.action.value="list_FI";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        document.fPlanNuevo.tipo.value="FI";
        //document.location.href="../servlet/CEJServlet?dispatcher=vacio&type=AJSP&action=list_FI&cuerpo="+cuerpo+"&tipo=FI";
    }else{
        document.fPlanNuevo.action.value="list_FI";
        document.fPlanNuevo.cuerpo.value=cuerpo;
        document.fPlanNuevo.tipo.value="Idiomas";
        //document.location.href="../servlet/CEJServlet?dispatcher=vacio&type=AJSP&action=list_FI&cuerpo="+cuerpo+"&tipo=Idiomas";
    }
    document.fPlanNuevo.submit();
}

/********************************* A J A X ******************************************/
/************************************************************************************/
//Función usando la tecnologia ajax, para hacer peticiones a servidor sin necesidad de 
//cargar una nueva página.  
function ajaxObject(){
    var xmlhttp=false; 
    try { 
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
    } catch (e) { 
          try { 
              xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
          } catch (E) { 
              xmlhttp = false; 
          } 
    }
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
         xmlhttp = new XMLHttpRequest();
    }

    return xmlhttp;
}

//Función que hay que invocar. Se le pasa como parametro la pagina que queremos que cargue y el id del contenedor sobre la que queremos 
//que se cargue
function cargarContenido(page, nameContainer){
    var contenedor;
    contenedor = document.getElementById(nameContainer);
    ajax = ajaxObject();
    ajax.open("GET", page, true);
    ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
    ajax.onreadystatechange=function() {
        if (ajax.readyState==4) {
            contenedor.innerHTML = ajax.responseText
        }
    }
    ajax.send(null)
}

//Función que hay que invocar. Se le pasa como parametro la página que queremos que cargue y sobre la variable que se va asignar
function cargarContenido(page, object){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("GET", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = ajax.responseText
                execute();
            }
        }
        ajax.send(null)
    }catch(isE){alert(isE)}
    return true;
}

//Función que hay que invocar. Se le pasa como parametro la página que queremos que cargue y sobre la variable que se va asignar
function cargarContenido(page, object, tipo){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("GET", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = ajax.responseText
                execute(tipo);
            }
        }
        ajax.send(null)
    }catch(isE){alert(isE)} 
    return true;
}

//Función que hay que invocar. Se le pasa como parametro la página que queremos que cargue y sobre la variable que se va asignar
function cargarContenidoTrainingPlan(tipo, page, object){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("GET", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = ajax.responseText
                execute(tipo);
            }
        }
        ajax.send(null)
    }catch(isE){alert(isE)} 
    return true;
}

function cargarContenidoPost(page, object, tipo){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("POST", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = "";
                object.value = ajax.responseText
                execute(tipo);
            }
        }
        ajax.send(null)
    }catch(isE){alert(isE)} 
    return true;
}

function cargarContenidoPost(page, object){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("POST", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = "";
                object.value = ajax.responseText
                execute();
            }
        }
        ajax.send(null)
    }catch(isE){alert(isE)} 
    return true;
}

function cargarContenidoPost2(page){
    try{
        ajax = ajaxObject();
        ajax.open("POST", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        /*ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                alert(ajax.responseText);
            }
        }*/
        ajax.send('')
        execute (ajax.responseText);
    }catch(isE){alert(isE)} 
    return true;
}

function cargarContenidoCuestionario(page, object){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("GET", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = "";
                object.value = ajax.responseText
                execute();
            }
        }
        ajax.send(null)
    }catch(isE){alert(isE)}
    return true;
}

function cargarContenidoPropuestas(page, object){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("GET", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = ajax.responseText
                executePropuesta();
            }
        }
        ajax.send(null)
    }catch(isE){alert(isE)}
    return true;
}

//Función que hay que invocar. Se le pasa como parametro la página que queremos que cargue y sobre la variable que se va asignar
function cargarContenidoPostExternal(page, object){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("GET", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = ajax.responseText;
            }
        }
        ajax.send(null)
    }catch(isE){alert(isE)} 
    return true;
}

function cargarContenidoArbol(page, object){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("POST", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                var aux = ajax.responseText;
                alert(document.getElementById("capaArbol"));
                document.getElementById("capaArbol").innerHTML = aux;
                alert("Segunda");
                
            }

        }
        ajax.send(null)
    }catch(isE){alert(isE)} 
    return true;
}

/********************************  FIN DE AJAX **********************************************/

//Funciones para la gestión del arbol y la visualización de la capa de detalle (ver tambien menu.js)
/********************************************************************************************/
/********************************************************************************************/

var ie=(document.all);
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
var Y="";

function closeDiv(divname){
    document.getElementById(divname).style.visibility = "hidden";
}

function empty(){
}


//Primero comprobamos el navegador
var mie =(navigator.appName.indexOf("Microsoft")>=0)
var txtAct="";
//txtAct: objeto global con la capa del scroll.



 function vertical_one(primera, capa, sent, vel){
sent = 0;
    var w = document.getElementById("Layer1").style.height;
    var tot = 0;
    tot = parseInt(Y,10);
    var tot2 = parseInt(trim(w.substring(0, w.length-2)));
    tot = tot - tot2/2;
    var totS = "";
    totS = tot+"";
    totS += "px";
    document.getElementById("Layer1").style.top=totS;

    var dimen=0;
    //Primera vez que se ejecuta, iniciar todo

    if (primera){
        txtAct = document.getElementById(capa);
        txtAct.alto = txtAct.offsetHeight;
        txtAct.clp = 0;

        txtAct.sup = txtAct.style.posTop+txtAct.alto*sent

        txtAct.incr = Math.round(txtAct.alto*vel/100);
    } else { 
        txtAct.clp += txtAct.incr; 
        //La región de recorte no puede ser mas alta del 100%
        if (txtAct.clp > 100) 
            txtAct.clp = 100;
    } 

    if (sent>0)
        dimen = txtAct.clp;
    else
        dimen = 100 - txtAct.clp;

 
    if (sent>0) //de Abajo hacia Arriba sent=1
        txtAct.style.clip = 'rect(auto, auto,'+ dimen+'%, auto)'
    else
        txtAct.style.clip = 'rect('+ dimen+'%, auto, auto, auto)'


    txtAct.style.posTop= Math.round(txtAct.sup - txtAct.alto*dimen/100);

    if(primera) 
       verCapa(txtAct, true); 

    if(txtAct.clp < 100){
       if(mie) setTimeout("vertical_one(false,' ',"+sent+","+txtAct.incr+");", txtAct.vel);
       else setTimeout("vertical_one(false,' ',"+sent+","+txtAct.incr+");", txtAct.vel+150);
    }else
       txtAct.clp = -1;
}

function vertical_two (primera, capa, sent, vel, tipo){

    var w;
    if (tipo=="Curso") w = document.getElementById("Layer1").style.height;
    if (tipo=="Ponencia") w = document.getElementById("Layer2").style.height;
    if (tipo=="Ponente") w = document.getElementById("Layer3").style.height;
    if (tipo=="Opciones") w = document.getElementById("layerOpciones").style.height;
    if (tipo=="Login") w = document.getElementById("Login").style.height;

    var tot = 0;
    tot = parseInt(Y,10);
    var tot2 = parseInt(trim(w.substring(0, w.length-2)));
    tot = tot - tot2/2;
    if(tipo=="Opciones") tot += 20;
    var totS = "";
    totS = tot+"";
    totS += "px";        
    if (tipo=="Curso") document.getElementById("Layer1").style.top=totS;
    if (tipo=="Ponencia") document.getElementById("Layer2").style.top=totS;
    if (tipo=="Ponente") document.getElementById("Layer3").style.top=totS;
    if (tipo=="Opciones") document.getElementById("layerOpciones").style.top=totS;
    if (tipo=="Login") document.getElementById("Login").style.top=totS;
 
    var dimen=0;
 
    //Primera vez que se ejecuta, iniciar todo
    if (primera){
        txtAct = document.getElementById(capa);
        txtAct.alto = txtAct.offsetHeight;
        txtAct.clp = 0;
        txtAct.sup = txtAct.style.posTop+txtAct.alto*sent
        txtAct.incr = Math.round(txtAct.alto*vel/100);
 
    } else { 
 
        txtAct.clp += txtAct.incr; 
        //La región de recorte no puede ser mas alta del 100%
        if (txtAct.clp > 100) 
            txtAct.clp = 100;
    } 
 
    if (sent>0)
        dimen = txtAct.clp;
    else
        dimen = 100 - txtAct.clp;
 
 
    if (sent>0) //de Abajo hacia Arriba sent=1
        txtAct.style.clip = 'rect(auto, auto,'+ dimen+'%, auto)'
    else
        txtAct.style.clip = 'rect('+ dimen+'%, auto, auto, auto)'
 
    txtAct.style.posTop= Math.round(txtAct.sup - txtAct.alto*dimen/100);
 
    if(primera) 
       verCapa(txtAct, true); 
 
    if(txtAct.clp < 100){
       if(mie) setTimeout("vertical_two(false,' ',"+sent+","+txtAct.incr+", '"+tipo+"');", txtAct.vel);
       else setTimeout("vertical_two(false,' ',"+sent+","+txtAct.incr+", '"+tipo+"');", txtAct.vel+150);
    }else
       txtAct.clp = -1;
 }           

  
function vertical_three (primera, capa, sent, vel, tipo, coordenadaY){

    var w;
    if (tipo=="Curso") w = document.getElementById("Layer1").style.height;
    if (tipo=="Ponencia") w = document.getElementById("Layer2").style.height;
    if (tipo=="Ponente") w = document.getElementById("Layer3").style.height;
    if (tipo=="Opciones") w = document.getElementById("layerOpciones").style.height;
    if (tipo=="Login") w = document.getElementById("Login").style.height;

    var tot = 0;
    tot = parseInt(coordenadaY,10);
    var tot2 = parseInt(trim(w.substring(0, w.length-2)));
    tot = tot - tot2/2;
    if(tipo=="Opciones") tot += 20;
    var totS = "";
    totS = tot+"";
    totS += "px";        
    if (tipo=="Curso") document.getElementById("Layer1").style.top=totS;
    if (tipo=="Ponencia") document.getElementById("Layer2").style.top=totS;
    if (tipo=="Ponente") document.getElementById("Layer3").style.top=totS;
    if (tipo=="Opciones") document.getElementById("layerOpciones").style.top=totS;
    if (tipo=="Login") document.getElementById("Login").style.top=totS;
 
    var dimen=0;

    //Primera vez que se ejecuta, iniciar todo
    if (primera){
        txtAct = document.getElementById(capa);
        txtAct.alto = txtAct.offsetHeight;
        txtAct.clp = 0;
        txtAct.sup = txtAct.style.posTop+txtAct.alto*sent
        txtAct.incr = Math.round(txtAct.alto*vel/100);
    } else { 

        txtAct.clp += txtAct.incr; 
        //La región de recorte no puede ser mas alta del 100%
        if (txtAct.clp > 100) 
            txtAct.clp = 100;
    } 

    if (sent>0)
        dimen = txtAct.clp;
    else
        dimen = 100 - txtAct.clp;


    if (sent>0) //de Abajo hacia Arriba sent=1
        txtAct.style.clip = 'rect(auto, auto,'+ dimen+'%, auto)'
    else
        txtAct.style.clip = 'rect('+ dimen+'%, auto, auto, auto)'

    txtAct.style.posTop= Math.round(txtAct.sup - txtAct.alto*dimen/100);

    if(primera) 
       verCapa(txtAct, true); 

    if(txtAct.clp < 100){
       if(mie) setTimeout("vertical_three(false,' ',"+sent+","+txtAct.incr+", '"+tipo+"','"+coordenadaY+"');", txtAct.vel);
       else setTimeout("vertical_three(false,' ',"+sent+","+txtAct.incr+", '"+tipo+"','"+coordenadaY+"');", txtAct.vel+150);
    }else
       txtAct.clp = -1;
 }           


//Muestra u oculta una capa
function verCapa(obj, sn){

      var mostrar = (sn)?'block':'none';
      var estado = (sn)?'visible':'hidden';

      if(true){
         obj.style.display = mostrar;
         obj.style.visibility= estado; 
      }
      else
        obj.visibility = estado;
 }

function paramDiv(e){
   try{
     if(isNav){ 
         Y = e.pageY-80;
     } else {
         // Y = event.y+document.body.scrollTop  -- anterior
         Y = event.y;
    }
   }catch(isErr){
   }
}  

if (isNav) {
   document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = paramDiv;

//deprecado (antigua funcionalidad antes de usar ajax)
 function getData(){
    document.getElementById("desCurso").innerHTML = document.frames['frameCurso'].document.getElementById("des_curso").value;
    document.getElementById("lugarCurso").innerHTML = document.frames['frameCurso'].document.getElementById("impartido_curso").value;
    document.getElementById("fechasCurso").innerHTML = document.frames['frameCurso'].document.getElementById("fechas_curso").value;
    document.getElementById("fechasProcesoCurso").innerHTML = document.frames['frameCurso'].document.getElementById("fechas_proceso_curso").value;
    document.getElementById("dirigidoCurso").innerHTML = document.frames['frameCurso'].document.getElementById("dirigido_curso").value;
    document.getElementById("horasCurso").innerHTML = document.frames['frameCurso'].document.getElementById("horas_lectivas_curso").value;
    try{
       vertical(true, 'Layer1', 1, 2);
    }catch(Exc){
       ;
    }
}

//Se invoca desde la interfaz de AJAX y procesara la respuesta que se encuentra en el objeto 'contenedor'
//Tanto esta función como el objeto 'contenedor', deben estar implementados

function cerrarVentanas(){
    document.getElementById("LayerCurso").style.visibility = "hidden";
    document.getElementById("LayerPonencia").style.visibility = "hidden";
    document.getElementById("LayerAlumno").style.visibility = "hidden";           
    document.getElementById("layerOpciones").style.visibility = "hidden";
}

function vertical(primera, capa, sent, vel, tipo){
    var w;
    if (tipo=="Curso") w = document.getElementById("LayerCurso").style.height;
    if (tipo=="Ponencia") w = document.getElementById("LayerPonencia").style.height;
    if (tipo=="Alumno") w = document.getElementById("LayerAlumno").style.height;
    if (tipo=="opciones") w = document.getElementById("layerOpciones").style.height;
    if (tipo=="Ponentes") w = document.getElementById("layerPonentes").style.height;

    var tot = 0;
    tot = parseInt(Y,10);
    var tot2 = parseInt(trim(w.substring(0, w.length-2)));
    tot = tot - tot2/2;
    if (tipo=="opciones") tot+=20;
    var totS = "";
    totS = tot+"";
    totS += "px";        
    if (tipo=="Curso") document.getElementById("LayerCurso").style.top=totS;
    if (tipo=="Ponencia") document.getElementById("LayerPonencia").style.top=totS;
    if (tipo=="Alumno") document.getElementById("LayerAlumno").style.top=totS;
    if (tipo=="opciones") document.getElementById("layerOpciones").style.top=totS;
    if (tipo=="Ponentes") document.getElementById("layerPonentes").style.top=totS;
    var dimen=0;
    //Primera vez que se ejecuta, iniciar todo

    if (primera){
        txtAct = document.getElementById(capa);
        txtAct.alto = txtAct.offsetHeight;
        txtAct.clp = 0;

        txtAct.sup = txtAct.style.posTop+txtAct.alto*sent

        txtAct.incr = Math.round(txtAct.alto*vel/100);
    } else { 
        txtAct.clp += txtAct.incr; 
        //La región de recorte no puede ser mas alta del 100%
        if (txtAct.clp > 100) 
            txtAct.clp = 100;
    } 

    if (sent>0)
        dimen = txtAct.clp;
    else
        dimen = 100 - txtAct.clp;


    if (sent>0) //de Abajo hacia Arriba sent=1
        txtAct.style.clip = 'rect(auto, auto,'+ dimen+'%, auto)'
    else
        txtAct.style.clip = 'rect('+ dimen+'%, auto, auto, auto)'


    txtAct.style.posTop= Math.round(txtAct.sup - txtAct.alto*dimen/100);

    if(primera) 
       verCapa(txtAct, true); 

    if(txtAct.clp < 100){
       if(mie) setTimeout("vertical(false,' ',"+sent+","+txtAct.incr+", '"+tipo+"');", txtAct.vel);
       else setTimeout("vertical(false,' ',"+sent+","+txtAct.incr+", '"+tipo+"');", txtAct.vel+150);
    }else
       txtAct.clp = -1;
}

function getCoursesAlumnData(id){
    goToURL("CEJServlet?dispatcher=vacio&action=getCoursesAlumnData&type=D&id=" + id);
}


function solicitarCurso(idCourse){    
        goToURL("CEJServlet?dispatcher=vacio&action=courseRequestFromDetail&type=D&idCurso=" + idCourse);
}

function abrirPonencia( pathPonencia ){
    if (pathPonencia=="") alert("No se ha encontrado ningún documento");
    else window.open(pathPonencia);
}

function generarPdf( idP, tipo, cuerpo, anio, cursosMultidisciplinares ){
    window.open("CEJServlet?dispatcher=GENERA_PDF_CURSOS&id="+idP+"&tipo="+tipo+"&cuerpo="+cuerpo+"&anio="+anio+"&cursosMultidisciplinares="+cursosMultidisciplinares);
}

function mostrarOtrosNavegadores(tipo){
    var w;
    if (tipo=="Curso") w = document.getElementById("LayerCurso").style.height;
    if (tipo=="Ponencia") w = document.getElementById("LayerPonencia").style.height;
    if (tipo=="Alumno") w = document.getElementById("LayerAlumno").style.height;
    if (tipo=="opciones") w = document.getElementById("layerOpciones").style.height;

    var tot = 0;
    tot = parseInt(Y,10);
    var tot2 = parseInt(trim(w.substring(0, w.length-2)));
    tot = tot - tot2/2;
    if (tipo=="opciones") tot+=20;
    var totS = "";
    totS = tot+"";
    totS += "px";        
    if (tipo=="Curso"){
        document.getElementById("LayerCurso").style.top=totS;
        document.getElementById("LayerCurso").style.visibility="visible";
    }
    if (tipo=="Ponencia"){
        document.getElementById("LayerPonencia").style.top=totS;
        document.getElementById("LayerPonencia").style.visibility="visible";
    }
    if (tipo=="Alumno"){
        document.getElementById("LayerAlumno").style.top=totS;
        document.getElementById("LayerAlumno").style.visibility="visible";
    }
    if (tipo=="opciones"){
        document.getElementById("layerOpciones").style.top=totS;
        document.getElementById("layerOpciones").style.visibility="visible";
    }
}

function mostrarOtrosNavegadores_two (tipo){

    var w;
    if (tipo=="Curso") w = document.getElementById("Layer1").style.height;
    if (tipo=="Ponencia") w = document.getElementById("Layer2").style.height;
    if (tipo=="Ponente") w = document.getElementById("Layer3").style.height;
    if (tipo=="Opciones") w = document.getElementById("layerOpciones").style.height;
    if (tipo=="Login") w = document.getElementById("Login").style.height;

    var tot = 0;
    tot = parseInt(Y,10);
    var tot2 = parseInt(trim(w.substring(0, w.length-2)));
    tot = tot - tot2/2;
    if(tipo=="Opciones") tot += 20;
    var totS = "";
    totS = tot+"";
    totS += "px";        
    if (tipo=="Curso"){
        document.getElementById("Layer1").style.top=totS;
        document.getElementById("Layer1").style.visibility="visible";
    }
    if (tipo=="Ponencia"){
        document.getElementById("Layer2").style.top=totS;
        document.getElementById("Layer2").style.visibility="visible";
    }
    if (tipo=="Ponente"){
        document.getElementById("Layer3").style.top=totS;   
        document.getElementById("Layer3").style.visibility="visible";
    }
    if (tipo=="Opciones"){
        document.getElementById("layerOpciones").style.top=totS;
        document.getElementById("layerOpciones").style.visibility="visible";
    }
    if (tipo=="Login"){
        document.getElementById("Login").style.top=totS;
        document.getElementById("Login").style.visibility="visible";
    }

 }           

 function mostrarOtrosNavegadores_one(){

    var w = document.getElementById("Layer1").style.height;
    var tot = 0;
    tot = parseInt(Y,10);
    var tot2 = parseInt(trim(w.substring(0, w.length-2)));
    tot = tot - tot2/2;
    var totS = "";
    totS = tot+"";
    totS += "px";
    document.getElementById("Layer1").style.top=totS;
    document.getElementById("Layer1").style.visibility="visible";

 }
/***************************************************************************************/
/***************************************************************************************/

 function filterSpecialCharacters(data){
    var arr = ["|","_","#","@"];
    for(var i=0;i<arr.length;i++){
        data = replaceChars(data, arr[i], ""); 
    }

    return data;
 }  

 function filterHTMLTags(data){
   //Comillas
   data = replaceChars(data, "'", "´"); 
   data = replaceChars(data, "\"", "´"); 
   //Simbolos para códigos html
   data = replaceChars(data, "<", ""); 
   data = replaceChars(data, ">", ""); 

   return data;
 }

 function downloadCertificate(idCP, tipoF, tipoCert){
    var aceptar = confirm("Se va a generar un certificado.\nEste documento tiene caracter oficial por lo que no puede ser generado en soporte digital.\nAsegúrese de que su impresora está encendida y con papel y pulse el botón 'Aceptar'.");
    if (aceptar){
      var ventimp = window.open("CEJServlet?dispatcher=GENERAR_CERTIFICADO&idCP=" + idCP + "&tipoFormacion=" + tipoF + "&tipoCertificado=" + tipoCert,"ventana","width=0,height=0");
    }
 }

 function downloadCertificateEstructure(idE, idCP, tipoF, tipoCert){
    var aceptar = confirm("Se va a generar un certificado.\nEste documento tiene caracter oficial por lo que no puede ser generado en soporte digital.\nAsegúrese de que su impresora está encendida y con papel y pulse el botón 'Aceptar'.");
    if (aceptar){
        var ventimp = window.open("CEJServlet?dispatcher=GENERAR_CERTIFICADO&idCP=" + idCP + "&tipoFormacion=" + tipoF + "&tipoCertificado=" + tipoCert + "&idEstructura=" + idE,"ventana","width=0,height=0");
    }
 }

function createDivQuestionnaire(idC, tipo){
	value="<TABLE border='0' width='100%' height='100%' bordercolor='#999966'>" +
	          "<TR background=\"../html/images/bk_op04.gif\">" +
	             "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:goToQues(\""+idC+"\");'>Ver detalle</A></STRONG></TD>" +
	          "</TR>"+
                  "<TR  background=\"../html/images/bk_op04.gif\">" +
		  "<TD><img src=\"../html/images/sub_op.gif\" alt=\"../html/images/icono guion\">&nbsp;<STRONG><A href='javascript:clonQues(\""+idC+"\", \""+tipo+"\");'>Clonar cuestionario</A></STRONG></TD>" +
		  "</TR>"+
                  "</TABLE>";

	document.getElementById("capaOculta").innerHTML=value;
	document.getElementById("capaOculta").style.visibility="visible";
	document.getElementById("capaOculta").style.width="240px";
	document.getElementById("capaOculta").style.height="50px";
	document.getElementById("capaOculta").style.top=posY+"px";
	document.getElementById("capaOculta").style.left=posX+"px";
}

function getGroups(formulario,id){
    document.getElementById("action").value = "getGroups";
    document.getElementById("type").value = "JSPL";
    document.getElementById("idPro").value = id;
    document.getElementById(formulario).submit();
}

function getGroupsFC(formulario,id){
    document.getElementById("action").value = "getGroupsFC";
    document.getElementById("type").value = "JSPL";
    document.getElementById("idPro").value = id;
    document.getElementById(formulario).submit();
}

function getModules(grupo, formulario, id){
    document.getElementById("action").value = "getModules";
    document.getElementById("group").value = grupo;
    document.getElementById("idPro").value = id;
    document.getElementById(formulario).submit();
}

function getModulesFC(grupo, formulario, id){
    document.getElementById("action").value = "getModulesFC";
    document.getElementById("group").value = grupo;
    document.getElementById("idPro").value = id;
    document.getElementById(formulario).submit();
}

function getOffers(modulo, formulario, id){
    document.getElementById("action").value = "getOffers";
    document.getElementById("module").value = modulo;
    document.getElementById("idPro").value = id;
    document.getElementById(formulario).submit();
}

function getOffersFC(modulo, formulario, id){
    document.getElementById("action").value = "getOffersFC";
    document.getElementById("module").value = modulo;
    document.getElementById("idPro").value = id;
    document.getElementById(formulario).submit();
}

function imprimirPDF(formulario, id, modo, volver, idPro){
    document.getElementById("action").value = "imprimirPDF";
    document.getElementById("id").value = id;
    document.getElementById("idPro").value = idPro;
    document.getElementById("mode").value = modo;
    document.getElementById("volver").value = volver;
    document.getElementById(formulario).submit();
}

function imprimirPDFFC(formulario, id, modo, volver, idPro){
    document.getElementById("action").value = "imprimirPDFFC";
    document.getElementById("id").value = id;
    document.getElementById("idPro").value = idPro;
    document.getElementById("mode").value = modo;
    document.getElementById("volver").value = volver;
    document.getElementById(formulario).submit();
}

function printTravelExpensesPDF(formulario, volver){
    document.getElementById("action").value = "printTravelExpensesPDF";
    document.getElementById("volver").value = volver;
    document.getElementById(formulario).submit();
}

function getSecureUrl(page, object){
    try{
        var contenedor;
        ajax = ajaxObject();
        ajax.open("GET", page, true); 
        ajax.setRequestHeader("Content-Type", "text/plain;charset=iso-8859-1"); 
        
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4){
                object.value = "";
                object.value = ajax.responseText
                execute();
            }
        }
        ajax.send(null)

        

    }catch(isE){alert(isE)}
    return true;
}


function insertCaracterFecha(campo,ev){
    var fecha = document.getElementById(campo);
    var aceptar;
    var tecla = (document.all) ? ev.keyCode : ev.which;
    
    if((fecha.value.length==2)||(fecha.value.length==5)){
        if(tecla!=47){
            fecha.value = fecha.value+carFecha;
            aceptar = checkNumerico(ev);
        }else{
            aceptar = true;
        }
    }else{
        aceptar = checkNumerico(ev);
    }
    return aceptar;
}


function insertCaracterHora(campo, ev){
    var hora = document.getElementById(campo);
    var aceptar;
    var tecla = (document.all) ? ev.keyCode : ev.which;
    
    if(hora.value.length==2){
        if(tecla!=59){
            hora.value = hora.value+carHora;
            aceptar = checkNumerico(ev);
        }else{
            aceptar = true;
        }
    }else{
        aceptar = checkNumerico(ev);
    }
    return aceptar;
}

function insertAllCharactersHour(campo){
    var hora = document.getElementById(campo);
    if(hora.value.length==2){
        hora.value = hora.value+carHora+"00";
    }else if (hora.value.length==3){
        hora.value = hora.value + "00";
    }else if (hora.value.length==4){
        hora.value = hora.value + "0";
    }
}


function checkNumerico(ev){
    var tecla = (window.event) ? ev.keyCode : ev.which;
    var aceptar;

    if(tecla==8){
        aceptar = true;
    }else if((tecla>=48)&&(tecla<=57)){
        aceptar = true;
    }else{
        aceptar = false;
    }
    return aceptar;
}

 function fechaMayorQue(fec1, fec2){  
    var bRes = false;  
    var sDia1 = fec1.substr(0, 2);  
    var sMes1 = fec1.substr(3, 2);  
    var sAno1 = fec1.substr(6, 4);  
    var sDia2 = fec2.substr(0, 2);  
    var sMes2 = fec2.substr(3, 2);  
    var sAno2 = fec2.substr(6, 4);  
    if (sAno1 > sAno2) bRes = true;  
    else {  
        if (sAno1 == sAno2){  
            if (sMes1 > sMes2) bRes = true;  
            else {  
                if (sMes1 == sMes2)  
                    if (sDia1 > sDia2) bRes = true;  
            }  
        }  
    }  
    return bRes;  
}

 function getDescripcionMes(iMes)
 {
    var sMes = "";
    if (iMes==1) sMes = "Enero";
    if (iMes==2) sMes = "Febrero";
    if (iMes==3) sMes = "Marzo";
    if (iMes==4) sMes = "Abril";
    if (iMes==5) sMes = "Mayo";
    if (iMes==6) sMes = "Junio";
    if (iMes==7) sMes = "Julio";
    if (iMes==8) sMes = "Agosto";
    if (iMes==9) sMes = "Septiembre";
    if (iMes==10) sMes = "Octubre";
    if (iMes==11) sMes = "Noviembre";
    if (iMes==12) sMes = "Diciembre";
    return sMes;
   }
