//<![CDATA[
		   
	   
var elementos_carrusel=["carrusel_aula_virtual.jpg","carrusel_biblioteca.jpg","carrusel_blog.jpg","carrusel_inscribete.jpg","carrusel_acuerdos_internacionales.jpg","carrusel_empresas_colaboradoras.jpg","carrusel_admisiones.jpg"];
	   
var enlaces_carrusel=["http://www.google.es","http://www.google.es","http://www.google.es","http://www.google.es","http://www.google.es","http://www.google.es","http://www.google.es"];
var precargas_carrusel=new Array;
var ruta="http://aliter.org/nueva_web/carrusel/";

var programa_cursos_superiores_unidad=["presentacion","objetivos","titulacion","perfil","duracion","becas","convocatorias","horario","patrocinador"];
var programa_master_unidad=["presentacion","objetivos","titulacion","perfil","duracion","becas","convocatorias","horario","patrocinador"];
var opciones_departamentos=["academico","institucional","internacional","estudios","admisiones"];
var programa_admisiones=["introduccion","proceso","documentacion","acceso"];
var opciones_antiguos_alumnos=["introduccion","graduados","destacados"];
var pestanias_acceso=["pestania_especifica","pestania_ingles","pestania_general"];
var empresas_colaboradoras=["biotecnologia","relaciones_internacionales_y_comercio_exterior","nanotecnologia","vitinicola"];
var servicios_area_cultural=["exposiciones","conciertos","deporte","espectaculos"];

var cuantas_cabeceras=3;
var cuantas_cabeceras_interiores=2;
var inicio_contador=false;
var contador=0;
var segundos=0;
var minutos=0;
var horas=0;

function botones(cual,estado){
	switch(estado){
		case 'sobre':
	document[cual].src="img/"+cual+"_sel.jpg";
	break;
	case 'normal':
	document[cual].src="img/"+cual+".jpg";
	break;
	}
	
}
function cambiarOpacidad(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}



function reducir(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    	if (opacity >= 0) {
			cambiarOpacidad(obj, opacity);
			opacity -= 5;
			window.setTimeout("reducir('"+objId+"',"+opacity+")", 50);
		}else{
			//window.status=ruta+elementos_carrusel[Math.floor(Math.random()*cuantas_fotos_carrusel)];
			nombre_anterior=obj.src.substring(obj.src.lastIndexOf("/")+1,obj.src.length);
			//alert(nombre_anterior);
			nueva_foto=aleatorio();
			obj.src=elegir_foto(nueva_foto);
			obj.name=nueva_foto;
			meterdato(nombre_anterior);
			window.setTimeout("ampliar('"+objId+"',"+0+")",500);
		}
	}
}



function ampliar(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
	if (opacity <= 100) {
			cambiarOpacidad(obj, opacity);
			opacity += 5;
			window.setTimeout("ampliar('"+objId+"',"+opacity+")", 50);
		}else{
			window.setTimeout("reducir('"+objId+"',"+opacity+")", (Math.floor(Math.random()*11)*4000)+100);
		}
  }
}
/*function cambioTrans(objId,opacity,direccion) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
	if(direccion=="sobre"){
    	if (opacity >= 0) {
			cambiarOpacidad(obj, opacity);
			opacity -= 5;
			window.setTimeout("cambioTrans('"+objId+"',"+opacity+",'"+direccion+"')", 50);
		}else{
			//window.status=ruta+elementos_carrusel[Math.floor(Math.random()*cuantas_fotos_carrusel)];
			obj.src=elegir_foto();
			direccion="fuera";
			window.setTimeout("cambioTrans('"+objId+"',"+0+",'"+direccion+"')", 50);
		}
	}
	if(direccion=="fuera"){
		if (opacity <= 100) {
			cambiarOpacidad(obj, opacity);
			opacity += 5;
			window.setTimeout("cambioTrans('"+objId+"',"+opacity+",'"+direccion+"')", 50);
		}else{
			direccion="sobre";
			window.setTimeout("cambioTrans('"+objId+"',"+opacity+",'"+direccion+"')", 8000);
		}
	}
  }
}*/
function iniciar_carrusel(){
	moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');  
	ie = (typeof window.ActiveXObject != 'undefined');
	//alert ( "es mozilla  "+moz+" o explorer "+ie);
	cargar_carrusel();
	tope=5;
	for(i=1;i<tope;i++){
		elememto="foto"+i;
		cambiarOpacidad(document.getElementById(elememto),0);
		document.getElementById(elememto).src=elegir_foto();
		lapso=(Math.floor(Math.random()*11)*4000)+100;
		window.setTimeout("ampliar('"+elememto+"',"+100+")",50);
		//window.setTimeout("ampliar('"+elememto+"',"+100+")",lapso);
		//alert(elementos_carrusel[i]);
		//document.getElementById("foto1")
	}
	cambiar_foto_inicio();
}
function elegir_foto(numero){	
	return ruta+elementos_carrusel.splice(numero,1);
	
}
function aleatorio(){
	var cuantas_fotos_carrusel=elementos_carrusel.length;
	return Math.floor(Math.random()*(cuantas_fotos_carrusel));
}
function cargar_carrusel(){
	for (i in elementos_carrusel){
		precargas_carrusel[i]=new Image();
		precargas_carrusel[i].src=ruta+elementos_carrusel[i];
	}
}
function meterdato(cual){
	elementos_carrusel.push(cual);
}
function enlace(cual){
	//alert(enlaces_carrusel[cual]);
	//this.style.cursor="hand";
	window.open(enlaces_carrusel[cual]);
}

function cambiar_apartado_curso(cual){
	var boton=cual+'_boton';
		//alert(boton);
	deseleccionar_todos_apartados();
	document.getElementById(cual).className="master_descripcion";
	document.getElementById(boton).className="master_cabecera_apartado_sel";
}
/*function deseleccionar_todos_apartados(){
	for (i=0;i<opciones_cursos.length;i++){
		document.getElementById(opciones_cursos[i]).className="master_descripcion_oculto";
		document.getElementById(opciones_cursos[i]+"_boton").className="master_cabecera_apartado";
		
	}
}*/
function cambiar_apartado_departamento(cual){
		var boton=cual+'_boton';
		//alert(boton);
	deseleccionar_todos_departamentos();
	document.getElementById(cual).className="departamentos_descripcion";
	document.getElementById(boton).className="departamentos_cabecera_apartado_sel";
}
function deseleccionar_todos_departamentos(){
	for (i=0;i<opciones_departamentos.length;i++){
		document.getElementById(opciones_departamentos[i]).className="departamentos_descripcion_oculto";
		document.getElementById(opciones_departamentos[i]+"_boton").className="departamentos_cabecera_apartado";
		
	}
}

function cambiar_apartado(cual,que_seccion){
		que_seccion=eval(reemplazar(que_seccion));
	mi_id_boton=cual.id;
	tope=mi_id_boton.length;
	mi_id=mi_id_boton.substring(0,tope-6);
	
		//alert(boton);
	deseleccionar_todos_apartados(que_seccion);
	document.getElementById(mi_id).className="seccion_descripcion";
	document.getElementById(mi_id_boton).className="seccion_cabecera_apartado_sel";
	if(document.getElementById(mi_id).offsetHeight<380){
		document.getElementById(mi_id).style.height="380px";
	}
}

function deseleccionar_todos_apartados(que_seccion){
	las_secciones=que_seccion;
	for (i=0;i<las_secciones.length;i++){
		document.getElementById(las_secciones[i]).className="seccion_descripcion_oculto";
		document.getElementById(las_secciones[i]+"_boton").className="seccion_cabecera_apartado";		
	}
}

function reemplazar(que){
	do {
    que = que.replace('-','_');
} while(que.indexOf('-') >= 0);

return que;
}


function cambiar_apartado_antiguos_alumnos(cual){
		var boton=cual+'_boton';
		//alert(boton);
	deseleccionar_todos_antiguos_alumnos();
	document.getElementById(cual).className="antiguos_alumnos_descripcion";
	document.getElementById(boton).className="antiguos_alumnos_cabecera_apartado_sel";
}

function deseleccionar_todos_antiguos_alumnos(){
	for (i=0;i<opciones_admisiones.length;i++){
		document.getElementById(opciones_antiguos_alumnos[i]).className="antiguos_alumnos_descripcion_oculto";
		document.getElementById(opciones_antiguos_alumnos[i]+"_boton").className="antiguos_alumnos_cabecera_apartado";		
	}
}


function cambiar_foto_inicio(){
	var num=Math.floor(Math.random()*cuantas_cabeceras)+1;
	var num2=Math.floor(Math.random()*cuantas_cabeceras_interiores)+1;
	//alert(num);
	//var foto=document.getElementById("inicio_bienvenida");
	//alert(foto);
		cambiarOpacidad(document.getElementById("foto_inicio"), 0);
	document.getElementById("foto_inicio").src="cabeceras/cabecera"+num+".jpg";
	document.getElementById("foto_inicio").onload=function(){
		document.getElementById("inicio_bienvenida").style.display="block";
		mostrar_foto("foto_inicio",0,"aparecer");
	}
		
		cambiarOpacidad(document.getElementById("foto_inicio_inf"), 0);
	document.getElementById("foto_inicio_inf").src="cabeceras/inicio_inf_fondo"+num2+".jpg";
	document.getElementById("foto_inicio_inf").onload=function(){
		mostrar_foto("foto_inicio_inf",0,"aparecer");
	}
}
function mostrar_foto(objId,opacity,direccion) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
	if(direccion=="aparecer"){
	if (opacity <= 105) {
			cambiarOpacidad(obj, opacity);
			opacity += 5;
			window.setTimeout("mostrar_foto('"+objId+"',"+opacity+",'"+direccion+"')", 50);
		}
	}
  }
}

function solicitud_acceso(formulario){
	//alert ( "es mozilla  "+moz+" o explorer "+ie);
	var usuario=formulario.que_usuario.value;
	var clave=formulario.que_contrasenia.value;
	//alert ( "es mozilla  "+usuario+" o explorer "+clave);
	moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');  
	ie = (typeof window.ActiveXObject != 'undefined');
	var archivo="http://www.aliter.org/nueva_web/func/peticion_pruebas.php?usr="+usuario+"&pas="+clave;
	if(moz){
xmlhttp=new XMLHttpRequest();
}else{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    //document.getElementById("admision_pruebas").innerHTML=xmlhttp.responseText;
	document.getElementById("acceso").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET",archivo,true);
xmlhttp.send();
}




function envio_acceso(formulario,usuario){
	//alert ( "es mozilla  "+moz+" o explorer "+ie);
	var especifica=formulario.especifica.value;
	var p1=formulario.p1.value;
	var p2=formulario.p2.value;
	var p3=formulario.p3.value;
	var p4=formulario.p4.value;
	var p5=formulario.p5.value;
	var general_1= respuesta_radio(formulario.general_1);
	var general_2= respuesta_radio(formulario.general_2);
	var general_3= respuesta_radio(formulario.general_3);
	var general_4= respuesta_radio(formulario.general_4);
	var general_5= respuesta_radio(formulario.general_5);
	var general_6= respuesta_radio(formulario.general_6);
	var general_7= respuesta_radio(formulario.general_7);
	var general_8= respuesta_radio(formulario.general_8);
	var general_9= respuesta_radio(formulario.general_9);
	var general_10= respuesta_radio(formulario.general_10);
	var general_11= respuesta_radio(formulario.general_11);
	var general_12= respuesta_radio(formulario.general_12);
	var general_13= respuesta_radio(formulario.general_13);
	var general_14= respuesta_radio(formulario.general_14);
	var general_15= respuesta_radio(formulario.general_15);
	var general_16= respuesta_radio(formulario.general_16);
	var general_17= respuesta_radio(formulario.general_17);
	var general_18= respuesta_radio(formulario.general_18);
	var general_19= formulario.general_19.value;
	var general_20= formulario.general_20.value;
	var general_21= formulario.general_21.value;
	var general_22= formulario.general_22.value;
	var general_23= formulario.general_23.value;
	 //alert (general_1);
	var que_usuario=usuario;
	//alert ( "es mozilla  "+usuario+" o explorer "+clave);
	moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');  
	ie = (typeof window.ActiveXObject != 'undefined');
	var archivo="http://www.aliter.org/nueva_web/func/envio_prueba.php?usuario="+que_usuario+"&especifica="+especifica+"&p1="+p1+"&p2="+p2+"&p3="+p3+"&p4="+p4+"&p5="+p5+"&general_1="+general_1+"&general_2="+general_2+"&general_3="+general_3+"&general_4="+general_4+"&general_5="+general_5+"&general_6="+general_6+"&general_7="+general_7+"&general_8="+general_8+"&general_9="+general_9+"&general_10="+general_10+"&general_11="+general_11+"&general_12="+general_12+"&general_13="+general_13+"&general_14="+general_14+"&general_15="+general_15+"&general_16="+general_16+"&general_17="+general_17+"&general_18="+general_18+"&general_19="+general_19+"&general_20="+general_20+"&general_21="+general_21+"&general_22="+general_22+"&general_23="+general_23;
	if(moz){
xmlhttp=new XMLHttpRequest();
}else{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("admision_pruebas").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET",archivo,true);
xmlhttp.send();
}
function acceder_prueba(cual){
	if (inicio_contador==false){
		inicio_contador=true;
		reloj();
	}
	mi_id_boton=cual.id;
	tope=mi_id_boton.length;
	mi_id=mi_id_boton.substring(0,tope-6);	
		//alert(mi_id);
	deseleccionar_pestanias();
	document.getElementById(mi_id).className="prueba_on";
	document.getElementById(mi_id_boton).className="prueba_etiqueta";
}

function deseleccionar_pestanias(){
	for (i=0;i<pestanias_acceso.length;i++){
		document.getElementById(pestanias_acceso[i]).className="prueba_off";
		document.getElementById(pestanias_acceso[i]+"_boton").className="prueba_etiqueta_off";		
	}
}

function reloj(){
	segundos++;
	if(segundos>60){
		minutos++;
		segundos=0;
	}
	if(minutos>60){
		horas++;
		minutos=0;
	}
	if(horas>1){
		document.getElementById("reloj").innerHTML="tiempo agotado";
	}else{	
	if(minutos<10){
		minutos_texto="0"+minutos;
	}else{
		minutos_texto=minutos;
	}
	if(segundos<10){
		segundos_texto="0"+segundos;
	}else{
		segundos_texto=segundos;
	}
	document.getElementById("reloj").innerHTML="0"+horas+":"+minutos_texto+":"+segundos_texto;
	window.setTimeout("reloj()",1000);
	}
}

function contarNum(cual)
{
	que_texto=cual.value;
	num_letras=que_texto.length;
	document.getElementById("pregunta_"+cual.name).innerHTML="caracteres: "+num_letras;
	cual.value=que_texto.substring(0,199);
	}
	
	
function mostrar_blog(que_id)
{
	que_mostrar=document.getElementById(que_id);
	que_mostrar.style.visibility="visible";
	que_mostrar.style.display="block";
	
}
function respuesta_radio(boton)
{
	for(i=0;i<boton.length;i++){
		if(boton[i].checked){
			return boton[i].id;
			breack;
		}
	}
}


function mostrar_fotos_foro(que_id){
	if(document.getElementById(que_id).innerHTML=="mostrar fotos"){
		document.getElementById(que_id).innerHTML="ocultar fotos";
	document.getElementById(que_id+"_fotos").style.display="block";
	}else{
		document.getElementById(que_id).innerHTML="mostrar fotos";
	document.getElementById(que_id+"_fotos").style.display="none";
	}
}

function estado_sobre(que_id){
	document.getElementById(que_id).style.cursor="pointer";
}
function estado_fuera(que_id){
	document.getElementById(que_id).style.cursor="default";
}
//]]!>
