// JavaScript Document
function saludar(){
	alert("hola");
}
function $(v,o) { return((typeof(o)=='object'?o:document).getElementById(v)); }
function $S(o) { return((typeof(o)=='object'?o:$(o)).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function abPos(o) { var o=(typeof(o)=='object'?o:$(o)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); }
function XY(e,v) { var o=agent('msie')?{'X':event.clientX+document.documentElement.scrollLeft,'Y':event.clientY+document.documentElement.scrollTop}:{'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); }

	star={};
	
	star.mouse=function(e,o) { if(star.stop || isNaN(star.stop)) { star.stop=0;
	
		document.onmousemove=function(e) { var n=star.num;
		
			var p=abPos($('star'+n)), x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y; star.num=o.id.substr(4);
	
			if(oX<1 || oX>84 || oY<0 || oY>19) { star.stop=1; star.revert(); }
			
			else {
	
				$S('starCur'+n).width=oX+'px';
				$S('starUser'+n).color='#111';
				$('starUser'+n).innerHTML=Math.round(oX/84*100);
			}
		};
	} };
	
	star.update=function(e,o) { var n=star.num, v=parseInt($('starUser'+n).innerHTML);
	
		n=o.id.substr(4); $('starCur'+n).title=v;
	
		req=new XMLHttpRequest(); req.open('GET','?vote='+(v/100),false); req.send(null);    
	
	};
	
	star.revert=function() { var n=star.num, v=parseInt($('starCur'+n).title);
	
		$S('starCur'+n).width=Math.round(v*84/100)+'px';
		$('starUser'+n).innerHTML=(v>0?Math.round(v):'');
		$('starUser'+n).style.color='#888';
		
		document.onmousemove='';
	
	};
	
	star.num=0;

function wopen(url, name, w, h)
{
	w += 32;
	h += 96;
	wleft = (screen.width - w) / 2;
	wtop = (screen.height - h) / 2;
	var win = window.open(url,
	name,
	'width=' + w + ', height=' + h + ', ' +
	'left=' + wleft + ', top=' + wtop + ', ' +
	'location=no, menubar=no, ' +
	'status=no, toolbar=no, scrollbars=no, resizable=no');
	// Just in case width and height are ignored
	win.resizeTo(w, h);
	// Just in case left and top are ignored
	win.moveTo(wleft, wtop);
	win.focus();
}
function wopen2(url, name, w, h)
{
	w += 32;
	h += 96;
	wleft = (screen.width - w) / 2;
	wtop = (screen.height - h) / 2;
	var win = window.open(url,
	name,
	'width=' + w + ', height=' + h + ', ' +
	'left=' + wleft + ', top=' + wtop + ', ' +
	'location=no, menubar=no, ' +
	'status=no, toolbar=no, scrollbars=yes, resizable=no');
	// Just in case width and height are ignored
	win.resizeTo(w, h);
	// Just in case left and top are ignored
	win.moveTo(wleft, wtop);
	win.focus();
}
function wopen3(url, name)
{
	wleft = (screen.width) / 2;
	wtop = (screen.height) / 2;
	var win = window.open(url,
	name,
	'width=' + screen.width + ', height=' + screen.height + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' +
	'location=no, menubar=no, fullscreen=no, status=no, toolbar=auto, scrollbars=yes, resizable=no, maximized=yes');
	// Just in case width and height are ignored
	//win.resizeTo(w, h);
	// Just in case left and top are ignored
	win.moveTo(0,0);
	win.focus();
}
function transformaFormularioPost(oForm){
	var aParams = new Array();
	for (var i=0; i <oForm.elements.length; i++){
		var comilla1 =/\'/g;
		var comilla2 = /\"/g;
		var sParam = encodeURIComponent(oForm.elements[i].name);
		sParam += "=";
		var con = encodeURIComponent(oForm.elements[i].value);
	//	con =con.replace(comilla1,"");
	//	con =con.replace(comilla2,"");
		sParam += encodeURIComponent(con);
		aParams.push(sParam);
		
	}
	return aParams.join("&");
}

function subeimagen(f){ 
	document.getElementById('formUpload').innerHTML="<img align='left' src='images/loading.gif'>"; 
	f.submit();
}


function resultadoUploadImg(estado, file, nfinal, tamanio) { 
	if (estado == 0){
		var mensaje = '<b>Foto Enviada Correctamente. </b>';
		document.fnRegistro.foto.value="";
		document.fnRegistro.nfoto.value=nfinal;
		document.fnRegistro.noriginal.value=file;
		document.fnRegistro.tamanio.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular esta imagen<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/img_usuarios/'+nfinal+'</span>';
	}
	if (estado == 1)
		var mensaje = 'Error 1 ! - El Archivo no llego al servidor';
	if (estado == 2)
		var mensaje = 'Error 2 ! - Formato Erroneo.';
	if (estado == 3)
		var mensaje = 'Error 3 ! - No se pudo copiar Archivo.';
		
	if (estado == 10){
		var mensaje = '<b>Foto Enviada Correctamente. </b>';
		document.fmRegistro.fotografia.value="";
		document.fmRegistro.nfoto.value=nfinal;
		document.fmRegistro.noriginal.value=file;
		document.fmRegistro.tamanio.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular esta imagen<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/img_usuarios/'+nfinal+'</span>';
	}
	if (estado == 11)
		var mensaje = 'Error 1 ! - El Archivo no llego al servidor';
	if (estado == 12)
		var mensaje = 'Error 2 ! - Formato Erroneo.';
	if (estado == 13)
		var mensaje = 'Error 3 ! - No se pudo copiar Archivo.';
		
	
	document.getElementById('formUpload').innerHTML=mensaje;
}


function subearchivo(f){ 
	document.getElementById('formUpload').innerHTML="<img align='left' src='images/loading.gif'>"; 
	f.submit();
}

function resultadoUpload(estado, file, nfinal, tamanio) {
	if (estado == 0){
		var mensaje = '<b>Documento Enviado Correctamente. </b>';
		document.fnIdentificacion.archivo.value="";
		document.fnIdentificacion.narchivo.value=nfinal;
		document.fnIdentificacion.noriginal.value=file;
		document.getElementById('pdf').style.display='block';
		mensaje+='Pinche en el PDF para visualizar el documento';
	}
	if (estado == 1)
		var mensaje = 'Error 1 ! - El Archivo no llego al servidor';
	if (estado == 2)
		var mensaje = 'Error 2 ! - Formato Erroneo.';
	if (estado == 3)
		var mensaje = 'Error 3 ! - No se pudo copiar Archivo.';
	
	if (estado == 10){
		var mensaje = '<b>Documento Enviado Correctamente. </b>';
		document.fnIdentificacion.archivo2.value="";
		document.fnIdentificacion.narchivo2.value=nfinal;
		document.fnIdentificacion.noriginal2.value=file;
		document.getElementById('pdf2').style.display='block';
		mensaje+='Pinche en el PDF para visualizar el documento';
	}
	if (estado == 12)
		var mensaje = 'Error 12 ! - Formato Erroneo.';
	if (estado == 13)
		var mensaje = 'Error 13 ! - No se pudo copiar Archivo.';
		
	if (estado == 20){
		var mensaje = '<b>Documento Enviado Correctamente. </b>';
		document.fnIdentificacion.archivo3.value="";
		document.fnIdentificacion.narchivo3.value=nfinal;
		document.fnIdentificacion.noriginal3.value=file;
		document.getElementById('pdf3').style.display='block';
		mensaje+='Pinche en el PDF para visualizar el documento';
	}
	if (estado == 22)
		var mensaje = 'Error 22 ! - Formato Erroneo.';
	if (estado == 23)
		var mensaje = 'Error 23 ! - No se pudo copiar Archivo.';
		
	
	document.getElementById('formUpload').innerHTML=mensaje;
}

function abrirDocumento(url){ 
	window.open("data/proyectos_cooperacion/"+url,"","","");	
}

function subeDocExp(f){ 
	document.getElementById('resultadoUploadExp').innerHTML="<img align='left' src='images/loading.gif'>"; 
	f.submit();
}

function subeDocExp2(f){ 
	document.getElementById('resultadoUploadExp').innerHTML="<img align='left' src='../images/loading.gif'>"; 
	f.submit();
}

function subeDocExp3(f, tipo){ 
	if(tipo=="video"){
		document.getElementById('resultadoUploadExpV').innerHTML="<img align='left' src='images/loading.gif'>"; 
	}
	else if(tipo=="presentacion"){
		document.getElementById('resultadoUploadExpP').innerHTML="<img align='left' src='images/loading.gif'>"; 
	}
	else if(tipo=="foto"){
		document.getElementById('resultadoUploadExpF').innerHTML="<img align='left' src='images/loading.gif'>"; 
	}
	else if(tipo=="documento"){
		document.getElementById('resultadoUploadExpD').innerHTML="<img align='left' src='images/loading.gif'>"; 
	}
	f.submit();
}

function resultadoUploadExp(estado, file, nfinal, tamanio) { 
	if (estado == 0){
		var mensaje = '<b>Video Enviado Correctamente.</b>';
		document.fnExperiencia.archivo_v.value=file;
		document.fnExperiencia.nvideo.value=nfinal;
		document.fnExperiencia.tamanio_v.value=tamanio;
		mensaje+='Su video estara disponible en un rato, en la siguiente direccion:<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/experiencias/videos/'+nfinal+'</span>';
	}
	if (estado == 1)
		var mensaje = 'Error 1 ! - El Video no llego al servidor';
	if (estado == 2)
		var mensaje = 'Error 2 ! - Formato Erroneo.';
	if (estado == 3)
		var mensaje = 'Error 3 ! - No se pudo copiar Video.';
	
	if (estado == 10){
		var mensaje = '<b>Presentacion Enviada Correctamente.</b>';
		document.fnExperiencia.archivo_p.value=file;
		document.fnExperiencia.npresentacion.value=nfinal;
		document.fnExperiencia.tamanio_p.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular este documento<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/experiencias/presentaciones/'+nfinal+'</span>';
	}
	if (estado == 12)
		var mensaje = 'Error 12 ! - Formato Erroneo.';
	if (estado == 13)
		var mensaje = 'Error 13 ! - No se pudo copiar Archivo.';
		
	if (estado == 20){ 
		var mensaje = '<b>Foto Enviada Correctamente.</b>'; 
		document.fnExperiencia.archivo_f.value=file;
		document.fnExperiencia.nfoto.value=nfinal;
		document.fnExperiencia.tamanio_f.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular esta foto<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/experiencias/fotos/'+nfinal+'</span>';
	}
	if (estado == 22)
		var mensaje = 'Error 22 ! - Formato Erroneo.';
	if (estado == 23)
		var mensaje = 'Error 23 ! - No se pudo copiar Foto.';
		
	if (estado == 30){
		var mensaje = '<b>Documento Enviado Correctamente.</b>';
		document.fnExperiencia.archivo_doc.value=file;
		document.fnExperiencia.ndoc.value=nfinal;
		document.fnExperiencia.tamanio_doc.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular este documento<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/experiencias/documentos/'+nfinal+'</span>';
	}
	if (estado == 32)
		var mensaje = 'Error 32 ! - Formato Erroneo.';
	if (estado == 33)
		var mensaje = 'Error 33 ! - No se pudo copiar Documento.';
		
	document.getElementById('resultadoUploadExp').innerHTML=mensaje;
}


function resultadoUploadExp2(estado, file, nfinal, tamanio) { 
	if (estado == 0){
		var mensaje = '<b>Video Enviado Correctamente.</b>';
		document.fnDocumentos.archivo_v.value=file;
		document.fnDocumentos.nvideo.value=nfinal;
		document.fnDocumentos.tamanio_v.value=tamanio;
		mensaje+='Su video estara disponible en un rato, en la siguiente direccion:<br>';
		mensaje+='<span style=\'font-size:12px\'>http://www.experiencias.org/data/experiencias/videos/'+nfinal+'</span>';
	}
	if (estado == 1)
		var mensaje = 'Error 1 ! - El Video no llego al servidor';
	if (estado == 2)
		var mensaje = 'Error 2 ! - Formato Erroneo.';
	if (estado == 3)
		var mensaje = 'Error 3 ! - No se pudo copiar Video.';
	
	if (estado == 10){
		var mensaje = '<b>Presentacion Enviada Correctamente.</b>';
		document.fnDocumentos.archivo_p.value=file;
		document.fnDocumentos.npresentacion.value=nfinal;
		document.fnDocumentos.tamanio_p.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular este documento<br>';
		mensaje+='<span style=\'font-size:12px\'>http://www.experiencias.org/data/experiencias/presentaciones/'+nfinal+'</span>';
	}
	if (estado == 12)
		var mensaje = 'Error 12 ! - Formato Erroneo.';
	if (estado == 13)
		var mensaje = 'Error 13 ! - No se pudo copiar Archivo.';
		
	if (estado == 20){ 
		var mensaje = '<b>Foto Enviada Correctamente.</b>'; 
		document.fnDocumentos.archivo_f.value=file; alert('asfd');
		document.fnDocumentos.nfoto.value=nfinal;
		document.fnDocumentos.tamanio_f.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular esta foto<br>';
		mensaje+='<span style=\'font-size:12px\'>http://www.experiencias.org/data/experiencias/fotos/'+nfinal+'</span>';
	}
	if (estado == 22)
		var mensaje = 'Error 22 ! - Formato Erroneo.';
	if (estado == 23)
		var mensaje = 'Error 23 ! - No se pudo copiar Foto.';
		
	if (estado == 30){ 
		var mensaje = '<b>Documento Enviado Correctamente.</b>'; 
		document.fnDocumentos.archivo_doc.value=file; 
		document.fnDocumentos.ndoc.value=nfinal;
		document.fnDocumentos.tamanio_doc.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular este documento<br>';
		mensaje+='<span style=\'font-size:12px\'>http://www.experiencias.org/data/experiencias/documentos/'+nfinal+'</span>';
	}
	if (estado == 32)
		var mensaje = 'Error 32 ! - Formato Erroneo.';
	if (estado == 33)
		var mensaje = 'Error 33 ! - No se pudo copiar Documento.';
		
	document.getElementById('resultadoUploadExp').innerHTML=mensaje;
}

function resultadoUploadExp3(estado, file, nfinal, tamanio) {  
	if (estado == 0){
		var mensaje = '<b>Video Enviado Correctamente.</b>';
		document.fnExperiencia.archivo_v.value=file;
		document.fnExperiencia.nvideo.value=nfinal;
		document.fnExperiencia.tamanio_v.value=tamanio;
		mensaje+='Su video estara disponible en un rato, en la siguiente direccion:<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/experiencias/videos/'+nfinal+'</span>';
		document.getElementById('resultadoUploadExpV').innerHTML=mensaje;
	}
	if (estado == 1){
		var mensaje = 'Error 1 ! - El Video no llego al servidor';
		document.getElementById('resultadoUploadExpV').innerHTML=mensaje;
	}
	if (estado == 2){
		var mensaje = 'Error 2 ! - Formato Erroneo.';
		document.getElementById('resultadoUploadExpV').innerHTML=mensaje;
	}
	if (estado == 3){
		var mensaje = 'Error 3 ! - No se pudo copiar Video.';
		document.getElementById('resultadoUploadExpV').innerHTML=mensaje;
	}
	
	if (estado == 10){
		var mensaje = '<b>Presentacion Enviada Correctamente.</b>';
		document.fnExperiencia.archivo_p.value=file;
		document.fnExperiencia.npresentacion.value=nfinal;
		document.fnExperiencia.tamanio_p.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular este documento<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/experiencias/presentaciones/'+nfinal+'</span>';
		document.getElementById('resultadoUploadExpP').innerHTML=mensaje;
	}
	if (estado == 12){
		var mensaje = 'Error 12 ! - Formato Erroneo.';
		document.getElementById('resultadoUploadExpP').innerHTML=mensaje;
	}
	if (estado == 13){
		var mensaje = 'Error 13 ! - No se pudo copiar Archivo.';
		document.getElementById('resultadoUploadExpP').innerHTML=mensaje;
	}
		
	if (estado == 20){ 
		var mensaje = '<b>Foto Enviada Correctamente.</b>'; 
		document.fnExperiencia.archivo_f.value=file;
		document.fnExperiencia.nfoto.value=nfinal;
		document.fnExperiencia.tamanio_f.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular esta foto<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/experiencias/fotos/'+nfinal+'</span>';
		document.getElementById('resultadoUploadExpF').innerHTML=mensaje;
	}
	if (estado == 22){
		var mensaje = 'Error 22 ! - Formato Erroneo.';
		document.getElementById('resultadoUploadExpF').innerHTML=mensaje;
	}
	if (estado == 23){
		var mensaje = 'Error 23 ! - No se pudo copiar Foto.';
		document.getElementById('resultadoUploadExpF').innerHTML=mensaje;
	}
		
	if (estado == 30){
		var mensaje = '<b>Documento Enviado Correctamente.</b>';
		document.fnExperiencia.archivo_doc.value=file;
		document.fnExperiencia.ndoc.value=nfinal;
		document.fnExperiencia.tamanio_doc.value=tamanio;
		mensaje+='Copie la siguiente direccion para vincular este documento<br>';
		mensaje+='<span style=\'font-size:13px\'>http://www.experiencias.org/data/experiencias/documentos/'+nfinal+'</span>';
		document.getElementById('resultadoUploadExpD').innerHTML=mensaje;
	}
	if (estado == 32){
		var mensaje = 'Error 32 ! - Formato Erroneo.';
		document.getElementById('resultadoUploadExpD').innerHTML=mensaje;
	}
	if (estado == 33){
		var mensaje = 'Error 33 ! - No se pudo copiar Documento.';
		document.getElementById('resultadoUploadExpD').innerHTML=mensaje;
	}
		
	
}


function arreglaTexto(texto){
	return unescape(texto.replace(/\+/gi," "));
}

function emailValido(correo) { 
  var largo=correo.split('@').length;
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(correo)) {
    return (true)
  } 
  else {
   
    return (false);
  }
  
}

function validarFecha(fecha){
	if(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(fecha)){
		return (true);
	}else{
		return (false);
	}
}

function irPaso2(){ 
	var pais=document.getElementById('pais').value;
	var provincia=document.getElementById('provincia').value;
	var municipio=document.getElementById('municipio').value;
	if(pais=="-1" || provincia=="-1" || municipio=="-1"){
		alert("Faltan campos por rellenar");
		return false;
	}
	
		document.getElementById('paso2').style.visibility='visible';
		document.getElementById('pais').disabled='disabled';
		document.getElementById('provincia').disabled='disabled';
		document.getElementById('municipio').disabled='disabled';
		document.getElementById('siguiente1').disabled='disabled';

}

function irPaso3(){ 
	var nombre=document.getElementById('nombre').value;
	var apellidos=document.getElementById('apellidos').value;
	var cargo=document.getElementById('cargo').value;
	var desccargo=document.getElementById('desccargo').value;
	var email1=document.getElementById('email1').value;
	var email2=document.getElementById('email2').value;
	
	if(nombre=="" || apellidos=="" || cargo=="-1" || desccargo=="" || email1=="" || email2==""){
		alert("Faltan campos por rellenar");
		return;
	}
	if(email1!=email2){
		alert("Los emails no coinciden");
		return false;
	}
	else{
		if(!emailValido(email1)){
			alert("Email incorrecto");
			return false;
		}
	}
	
		document.getElementById('paso3').style.visibility='visible';
		document.getElementById('nombre').disabled='disabled';
		document.getElementById('apellidos').disabled='disabled';
		document.getElementById('cargo').disabled='disabled';
		document.getElementById('email1').disabled='disabled';
		document.getElementById('email2').disabled='disabled';
		document.getElementById('foto').disabled='disabled';
		document.getElementById('archivo').disabled='disabled';
		document.getElementById('examinar').disabled='disabled';
		document.getElementById('siguiente2').disabled='disabled';
	
}

function ocultarCapa(capa){
	document.getElementById(capa).style.display='none';
	document.getElementById(capa).style.visibility='hidden';	
}

function mostrarCapa(capa){ 
	document.getElementById(capa).style.display='block';
	document.getElementById(capa).style.visibility='visible';	
}

function cambiarPass(formu){ 
	var pass_antigua=formu.pass_antigua.value;
	var pass_nueva1=formu.pass_nueva1.value;
	var pass_nueva2=formu.pass_nueva2.value;
	var idusuario=formu.idusuario.value;
	var variables=transformaFormularioPost(formu);
	
	if(pass_antigua=="" || pass_nueva1=="" || pass_nueva2==""){
		alert("Todos los datos son obligatorios");
		return false;
	}
	
	if(pass_nueva1!=pass_nueva2){
		alert("Las contrase"+String.fromCharCode(241)+"as no coinciden");	
		return false;
	}
	
	cambiarPass_("<div align=left><img src='images/loading.gif'></div>");
	doAjax("scripts/cambiarpass.scr.php", variables, "cambiarPass_", "post" , 0);
}

function cambiarPass_(html){
	parent.document.getElementById("passcambiada").innerHTML=html;		
}

function modificarRegistro(formu){ 
	var idusuario=formu.idusuario.value;
	var nombre=formu.nombre.value;
	var apellidos=formu.apellidos.value;
	var idcargo=formu.idcargo.value; 
	var desccargo=formu.desccargo.value;	
	var email1=formu.email1.value;
	var email2=formu.email2.value;
	var nfoto=formu.nfoto.value;
	var tamanio=formu.tamanio.value;
	var emailalcaldia1=formu.emailalcaldia1.value;
	var emailalcaldia2=formu.emailalcaldia2.value;
	var direccionalcaldia=formu.direccionalcaldia.value;
	var telefonoalcaldiapref=formu.telefonoalcaldiapref.value;
	var telefonoalcaldia=formu.telefonoalcaldia.value;
	var variables=transformaFormularioPost(formu);
		
	if(nombre=="" || apellidos=="" || idcargo=="-1" || desccargo=="" || email1=="" || emailalcaldia1=="" || direccionalcaldia=="" ||  telefonoalcaldiapref=="" || telefonoalcaldia==""){
		alert("Faltan datos por rellenar");	
		return false;
	}
	
	if(email1!=email2){
		alert("Los emails no coinciden");
		return false;
	}
	else{
		if(!emailValido(email1)){
			alert("Email incorrecto");
			return false;
		}
	}
		
	if(emailalcaldia1!=emailalcaldia2){
		alert("Los emails de la alcaldia no coinciden");
		return false;
	}
	else{
		if(!emailValido(emailalcaldia1)){
			alert("Email alcaldia incorrecto");
			return false;
		}
	}
	
	modificarRegistro_("<div align=left><img src='images/loading.gif'></div>");
	doAjax("scripts/edusuario.scr.php", variables, "modificarRegistro_", "post" , 0);
}

function modificarRegistro_(html){
	parent.document.getElementById("info").innerHTML=html;		
}

function enviarMunicipio(formu){
	var pais=formu.pais.value;
	var provinvia=formu.provincia.value; 
	var municipio=formu.municipio.value; 
	var nombre=formu.nombre.value;
	var apellidos=formu.apellidos.value;
	var email=formu.email.value;
	
	var variables=transformaFormularioPost(formu);
	if(pais=="" || provinvia=="" || municipio=="" || nombre=="" || apellidos=="" || email==""){
		alert("Todos los datos son obligatorios");	
		return false;
	}
	
	enviarMunicipio_("<div align=left><img src='../images/loading.gif'></div>");
	doAjax("../scripts/enviarMunicipio.scr.php", variables, "enviarMunicipio_", "post" , 0);	
}

function enviarMunicipio_(html){ 
	document.getElementById("envioMunicipio").innerHTML=html;		
}

function enviarDatosExperiencia(formu, tipo){
	var idexperiencia=formu.idexperiencia.value;
	var idexp_datos=formu.idexp_datos.value; 
	if(tipo=="nuevo"){
		var idusuario=formu.idusuario.value;
		var direccion="scripts/nExperiencia/salvar_datosGenerales.scr.php";
	}
	else if(tipo=="actualizar"){		
		var direccion="scripts/edExperiencia/actualizarDatos.scr.php";
	}
	
	var actuacion=formu.actuacion.value;
	var area_desarrollo=formu.area_desarrollo.value;
	var responsable=formu.responsable.value;
	var email_contacto=formu.email_contacto.value;
	var email_contacto2=formu.email_contacto2.value;
	var idtematica=formu.idtematica.value;	
	var fechainicio=formu.fechainicio.value;
	var fechafin=formu.fechafin.value;
	var costo=formu.costo.value;
	var personal=formu.personal.value;
	var resumen=formu.resumen.value;
	var variables=transformaFormularioPost(formu);
	
	if(actuacion=="" || area_desarrollo=="" || responsable=="-1" || email_contacto=="" || idtematica=="" || fechainicio=="" || fechafin=="" || costo=="" || personal=="" || resumen==""){
		alert("Faltan datos por rellenar");	
		return false;
	}
	
	if(email_contacto!=email_contacto2){
		alert("Los emails del contacto no coinciden");
		return false;
	}
	else{
		if(!emailValido(email_contacto)){
			alert("Email contacto incorrecto");
			return false;
		}
	}
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>");
	doAjax(direccion, variables, "enviarExperiencia_", "post" , 0);	
}

function enviarDescripcionExperiencia(formu, tipo){
	var idexperiencia=formu.idexperiencia.value;
	var idexp_detalle=formu.idexp_detalle.value; 
	if(tipo=="nuevo"){
		var idusuario=formu.idusuario.value;
		var direccion="scripts/nExperiencia/salvar_descripcion.scr.php";
	}
	else if(tipo=="actualizar"){ 		
		var documento=formu.documento.value;
		var direccion="scripts/edExperiencia/actualizarDescripcion.scr.php";
	}

	var descripcion = formu.descripcion.value;
	var variables=transformaFormularioPost(formu);
	
	if(descripcion == ""){
		alert("Escriba una descripcion de la experiencia");	
		return false;
	}
	
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax(direccion, variables, "enviarExperiencia_", "post" , 0);
}

function enviarDetalleExperiencia(formu, tipo){ 
	var idexperiencia=formu.idexperiencia.value;
	var idexp_detalle=formu.idexp_detalle.value; 
	if(tipo=="nuevo"){
		var idusuario=formu.idusuario.value;
		var direccion="scripts/nExperiencia/salvar_detalle.scr.php";
	}
	else if(tipo=="actualizar"){ 
		var idobjetivo1=formu.idobjetivo1.value;
		var idobjetivo2=formu.idobjetivo2.value;
		var idobjetivo3=formu.idobjetivo3.value;
		var idobjetivo4=formu.idobjetivo4.value; 
		var idresultado1=formu.idresultado1.value;
		var idresultado2=formu.idresultado2.value;
		var idresultado3=formu.idresultado3.value;
		var idresultado4=formu.idresultado4.value; 
		var objetivos_old=formu.objetivos_old.value;
		var resultados_old=formu.resultados_old.value; 
		var direccion="scripts/edExperiencia/actualizarDetalle.scr.php";
	}

	var objetivo_general = formu.objetivo_general.value;
	var num_objetivos=formu.num_objetivos.value;
	var num_resultados=formu.num_resultados.value;
	var objetivo1=formu.objetivo1.value;
	var objetivo2=formu.objetivo2.value;
	var objetivo3=formu.objetivo3.value;
	var objetivo4=formu.objetivo4.value;
	var resultado1=formu.resultado1.value;
	var indicador1=formu.indicador1.value;
	var resultado2=formu.resultado2.value;
	var indicador2=formu.indicador2.value;
	var resultado3=formu.resultado3.value;
	var indicador3=formu.indicador3.value;
	var resultado4=formu.resultado4.value;
	var indicador4=formu.indicador4.value;
	var obstaculos=formu.obstaculos.value;
	var solucion_obstaculos=formu.solucion_obstaculos.value;
	
	var variables=transformaFormularioPost(formu);
	
	if(num_objetivos==1){
		if(objetivo1==""){
			alert("Faltan datos obligatorios");	
		}
	}
	else if(num_objetivos==2){
		if(objetivo1=="" || objetivo2==""){
			alert("Faltan datos obligatorios");	
		}
	}
	else if(num_objetivos==3){
		if(objetivo1=="" || objetivo2=="" || objetivo3==""){
			alert("Faltan datos obligatorios");	
		}
	}
	else if(num_objetivos==4){
		if(objetivo1=="" || objetivo2=="" || objetivo3=="" || objetivo4==""){
			alert("Faltan datos obligatorios");	
		}
	}
	
	if(num_resultados==1){
		if(resultado1=="" || indicador1==""){
			alert("Faltan datos obligatorios");	
		}
	}
	else if(num_resultados==2){
		if(resultado1=="" || indicador1=="" || resultado2=="" || indicador2==""){
			alert("Faltan datos obligatorios");	
		}
	}
	else if(num_resultados==3){
		if(resultado1=="" || indicador1=="" || resultado2=="" || indicador2=="" || resultado3=="" || indicador3==""){
			alert("Faltan datos obligatorios");	
		}
	}
	else if(num_resultados==4){
		if(resultado1=="" || indicador1=="" || resultado2=="" || indicador2=="" || resultado3=="" || indicador3=="" || resultado4=="" || indicador4==""){
			alert("Faltan datos obligatorios");	
		}
	}
	 
	if(objetivo_general == "" || num_objetivos =="" || obstaculos=="" || solucion_obstaculos==""){
		alert("Faltan datos obligatorios");	
		return false;
	}

	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax(direccion, variables, "enviarExperiencia_", "post" , 0);
}

function enviarValoracionExperiencia(formu, tipo){
	var idexperiencia=formu.idexperiencia.value;
	var idexp_valoracion=formu.idexp_valoracion.value;		
	if(tipo=="nuevo"){
		var idusuario=formu.idusuario.value;
		var direccion="scripts/nExperiencia/salvar_valoracion.scr.php";
	}
	else if(tipo=="actualizar"){
		var puntuacion_eficiencia_old=formu.puntuacion_eficiencia_old.value;
		var puntuacion_viabilidad_old=formu.puntuacion_viabilidad_old.value;
		var puntuacion_sostenibilidad_old=formu.puntuacion_sostenibilidad_old.value;
		var puntuacion_potencial_old=formu.puntuacion_potencial_old.value;
		var direccion="scripts/edExperiencia/actualizarValoracion.scr.php";
	} 
	
	var eficiencia = formu.eficiencia.value;
	formu.puntuacion_eficiencia.value=document.getElementById('starCur0').title;
	var puntuacion_eficiencia=formu.puntuacion_eficiencia.value;
	var viabilidad=formu.viabilidad.value;
	formu.puntuacion_viabilidad.value=document.getElementById('starCur1').title;
	var puntuacion_viabilidad=formu.puntuacion_viabilidad.value;
	var sostenibilidad=formu.sostenibilidad.value;
	formu.puntuacion_sostenibilidad.value=document.getElementById('starCur2').title;
	var puntuacion_sostenibilidad=formu.puntuacion_sostenibilidad.value;
	var potencial=formu.potencial.value;
	formu.puntuacion_potencial.value=document.getElementById('starCur3').title;
	var puntuacion_potencial=formu.puntuacion_potencial.value;
	var condiciones_replica=formu.condiciones_replica.value;
	 
	if(formu.adecua_estrategia[0].checked){
		var si_adecua_estrategia=formu.si_adecua_estrategia.value;
	}
	else{
		var no_adecua_estrategia=formu.no_adecua_estrategia.value;
	}	

	var actores=formu.actores.value;
	var precedentes=formu.precedentes.value;
	var observaciones=formu.observaciones.value;
	
	var variables=transformaFormularioPost(formu); 
	
	
	if(tipo=="nuevo"){
		if(puntuacion_eficiencia =="" || puntuacion_viabilidad=="" || puntuacion_sostenibilidad=="" || puntuacion_potencial==""){
			alert("Faltan datos obligatorios");	
			return false;
		}
	}
	
	if(eficiencia == "" || viabilidad=="" || sostenibilidad =="" || condiciones_replica=="" || potencial=="" || actores =="" || precedentes==""){
		alert("Faltan datos obligatorios");
		return false;
	}
	
	if(!formu.adecua_estrategia[0].checked){
		if(!formu.adecua_estrategia[1].checked){
			alert("Faltan datos obligatorios");
			return false;	
		}
	}
	
	if(si_adecua_estrategia == ""){
		if(no_adecua_estrategia == ""){
			alert("Faltan datos obligatorios");
			return false;	
		}
	}
	
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax(direccion, variables, "enviarExperiencia_", "post" , 0);
}

function guardarVideo(formu, tipo){
	if(tipo=="nuevo"){
		var idusuario=formu.idusuario.value;
		var direccion="scripts/nExperiencia/salvar_documento.scr.php?op=video";
		var noriginal_v=formu.noriginal_v.value;
	}
	else if(tipo=="actualizar"){
		var iddocumento=formu.iddocumento.value;
		var noriginal_v=formu.titulo.value;
		var direccion="scripts/actualizarDocumento.scr.php?op=video";		
	}
	else if(tipo=="nactualizar"){ 
		var idexperiencia=formu.idexperiencia.value;
		var direccion="scripts/salvarDocumento2.scr.php?op=video";
		var noriginal_v=formu.noriginal_v.value;
	}
	
	var nvideo=formu.nvideo.value;
	var tamanio_v=formu.tamanio_v.value;
	
	if(nvideo==""){
		alert("Elija un video");
		return false;
	}	
	else if(noriginal_v==""){
		alert("Escriba un Titulo para el video");	
		return false;
	}
	
	var variables=transformaFormularioPost(formu); 
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax(direccion, variables, "enviarExperiencia_", "post" , 0);
}
function guardarPresentacion(formu, tipo){
	if(tipo=="nuevo"){
		var idusuario=formu.idusuario.value;
		var direccion="scripts/nExperiencia/salvar_documento.scr.php?op=presentacion";
		var noriginal_p=formu.noriginal_p.value;
	}
	else if(tipo=="actualizar"){
		var iddocumento=formu.iddocumento.value;
		var noriginal_p=formu.titulo.value;
		var direccion="scripts/actualizarDocumento.scr.php?op=presentacion";		
	}
	else if(tipo=="nactualizar"){ 
		var idexperiencia=formu.idexperiencia.value;
		var direccion="scripts/salvarDocumento2.scr.php?op=presentacion";
		var noriginal_p=formu.noriginal_p.value;
	}
	
	var npresentacion=formu.npresentacion.value;
	var tamanio_p=formu.tamanio_p.value;
	
	if(npresentacion==""){
		alert("Elija una presentacion");
		return false;
	}
	else if(noriginal_p==""){
		alert("Escriba un Titulo para la presentacion");
		return false;
	}
		
	var variables=transformaFormularioPost(formu); 
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax(direccion, variables, "enviarExperiencia_", "post" , 0);
}
function guardarFoto(formu, tipo){
	if(tipo=="nuevo"){
		var idusuario=formu.idusuario.value;
		var direccion="scripts/nExperiencia/salvar_documento.scr.php?op=foto";
		var noriginal_f=formu.noriginal_f.value;
	}
	else if(tipo=="actualizar"){
		var iddocumento=formu.iddocumento.value;
		var noriginal_f=formu.titulo.value;
		var direccion="scripts/actualizarDocumento.scr.php?op=foto";		
	}
	else if(tipo=="nactualizar"){ 
		var idexperiencia=formu.idexperiencia.value;
		var direccion="scripts/salvarDocumento2.scr.php?op=foto";
		var noriginal_f=formu.noriginal_f.value;
	}
	
	var nfoto=formu.nfoto.value;
	var tamanio_f=formu.tamanio_f.value;
	
	if(nfoto==""){
		alert("Elija una foto");
		return false;
	}	
	else if(noriginal_f==""){
		alert("Escriba un Titulo para la foto");
		return false;
	}
	
		
	var variables=transformaFormularioPost(formu); 
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax(direccion, variables, "enviarExperiencia_", "post" , 0);
}
function guardarDocumento(formu, tipo){ 
	if(tipo=="nuevo"){
		var idusuario=formu.idusuario.value;
		var direccion="scripts/nExperiencia/salvar_documento.scr.php?op=documento";
		var noriginal_doc=formu.noriginal_doc.value;
	}
	else if(tipo=="actualizar"){
		var iddocumento=formu.iddocumento.value;
		var noriginal_doc=formu.titulo.value;
		var direccion="scripts/actualizarDocumento.scr.php?op=documento";		
	}
	else if(tipo=="nactualizar"){ 
		var idexperiencia=formu.idexperiencia.value;
		var direccion="scripts/salvarDocumento2.scr.php?op=documento";
		var noriginal_doc=formu.noriginal_doc.value;
	}
	
	var ndoc=formu.ndoc.value;
	var tamanio_doc=formu.tamanio_doc.value;
	
	if(ndoc==""){
		alert("Elija un documento");
		return false;
	}	
	else if(noriginal_doc==""){
		alert("Escriba un Titulo para el documento");	
		return false;
	}
	
		
	var variables=transformaFormularioPost(formu); 
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax(direccion, variables, "enviarExperiencia_", "post" , 0);
}

function editarDocumentos(formu){
	var iddocumento=formu.iddocumento.value;
	var titulo=formu.titulo.value;
	var iddocumento=formu.iddocumento.value;
	var nombre=formu.nombre.value;
	var noriginal=formu.noriginal.value;
	var tamanio=formu.tamanio.value;
}

function finalizarExperiencia(formu){
	var idexperiencia=formu.idexperiencia.value;
	var idusuario=formu.idusuario.value;
	var variables=transformaFormularioPost(formu); 
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax("scripts/nExperiencia/finalizar.scr.php", variables, "enviarExperiencia_", "post" , 0);
}

function enviarAsistencia(formu){
	var idusuario=formu.idusuario.value;
	var idtematica=formu.idtematica.value;
	var descripcion=formu.descripcion.value;
	var entidad=formu.entidad.value;
	var contacto=formu.contacto.value;
	var cargo=formu.cargo.value;
	var telefono=formu.telefono.value;
	var email=formu.email.value;
	var email2=formu.email2.value;
	
	if(idtematica=="-1" || descripcion=="" || entidad=="" || contacto=="" || cargo=="" || telefono==""){
		alert("Todos los datos son obligatorios");
		return false;
	}	
	
	if(!formu.acepto.checked){
		alert("Debe de aceptar las condiciones");
		return false;
	}
	
	if(email!=email2){
		alert("Los emails del contacto no coinciden");
		return false;
	}
	else{
		if(!emailValido(email)){
			alert("Email contacto incorrecto");
			return false;
		}
	}
	
	var variables=transformaFormularioPost(formu); 
	enviarExperiencia_("<div align=left><img src='images/loading.gif'></div>"); 
	doAjax("scripts/salvarAsistencia.scr.php", variables, "enviarExperiencia_", "post" , 0);
}

function enviarExperiencia_(html){
	parent.document.getElementById("experiencia").innerHTML=html;	
}

function enviarIdentificacion2(formu){  
	var idalcaldia=formu.idalcaldia.value;
	var area_cooperacion="";
	var nombre_res="";
	var cargo_res="";
	var des_cargo_res="";
	var telefono_res="";
	var email_res="";
	var email_res1="";
	var web_res=""; 
			
	var cooperacion=formu.cooperacion.value;
	var paises_coo=formu.paises_coo.value;
	var relaciones=formu.relaciones.value;
	var tematicas=formu.tematicas.value;

	var descripcion1=formu.descripcion1.value;
	var descripcion2=formu.descripcion2.value;
	var descripcion3=formu.descripcion3.value;
	var descripcion4=formu.descripcion4.value;
	var descripcion5=formu.descripcion5.value;
	var descripcion6=formu.descripcion6.value;
	var descripcion7=formu.descripcion7.value;
	var descripcion8=formu.descripcion8.value;
	var descripcion9=formu.descripcion9.value;
	var descripcion10=formu.descripcion10.value;
	var descripcion11=formu.descripcion11.value;
	
	var otro_proyecto=formu.otro_proyecto.value;
	
	
	if(formu.area_cooperacion[0].checked){
		area_cooperacion="si";
		nombre_res=formu.nombre_res.value;
		cargo_res=formu.cargo_res.value;
		des_cargo_res=formu.des_cargo_res.value;
		telefono_res=formu.telefono_res.value;
		email_res=formu.email_res.value;
		email_res1=formu.email_res1.value;
		web_res=formu.web_res.value;
	
		if(nombre_res=="" || cargo_res=="" || des_cargo_res=="" || email_res==""|| web_res==""){
				alert("Faltan campos por rellenar");
				return false;
		}
		
		if(email_res!=email_res1){
			alert("Los emails no coinciden");
			return false;
		}
		else{
			if(!emailValido(email_res)){
				alert("Email incorrecto");
				return false;
			}
		}	
	}
	else{ 
		area_cooperacion="no";	
	}
	
	if(cooperacion=="" || paises_coo=="" || relaciones=="" || tematicas==""){
		alert("Faltan campos por rellenar");
		return false;
	}
	
	var variables=transformaFormularioPost(formu);
	
	enviarIdentificacion_("<div align=left><img src='images/loading.gif'></div>");
	doAjax("scripts/salvar_iden2.scr.php", variables, "enviarIdentificacion_", "post" , 0);
}

function enviarIdentificacion3(formu){ 
	var idalcaldia=formu.idalcaldia.value;
	var denominacion=formu.denominacion.value;
	var tipo_coo=formu.tipo_coo.value;
	var tipo_proy=formu.tipo_proy.value;
	var destinatarios=formu.destinatarios.value;
	var localidades_des=formu.localidades_des.value;
	
	var narchivo="";
	var narchivo2="";
	var narchivo3="";
	if(formu.pais.value=="28"){ 
		if(formu.formulario_solicitud.checked){
			narchivo=formu.narchivo.value; 
		}
		if(formu.perfil_proyecto.checked){
			narchivo2=formu.narchivo2.value; 
		}
		if(formu.otros.checked){
			narchivo3=formu.narchivo3.value; 
		}
	}
	
	var observaciones=formu.observaciones.value;
	var fecha_inicial=formu.fecha_inicial.value;
	var fecha_limite=formu.fecha_limite.value;
	
	var coste_min=formu.coste_min.value;
	var coste_max=formu.coste_max.value; 
	var financiadora=formu.financiadora.value; 
	
	if(denominacion=="" || fecha_limite=="" || tipo_proy=="" || destinatarios=="" || localidades_des=="" || fecha_inicial=="" || localidades_des=="" || coste_min=="" || coste_max=="" || financiadora==""){
		alert("Faltan campos por rellenar");
		return false;
	}
	/*else if((!formu.formulario_solicitud.checked) || (!formu.perfil_proyecto.checked) || (!formu.otros.checked)){
		alert("Elija algun procedimiento para la presentacion de solicitudes");
		return false;

	}*/
	
	var variables=transformaFormularioPost(formu);
	
	enviarIdentificacion_("<div align=left><img src='images/loading.gif'></div>");
	doAjax("scripts/salvar_iden3.scr.php", variables, "enviarIdentificacion_", "post" , 0);
}

function enviarIdentificacion4(formu){  
	var idalcaldia=formu.idalcaldia.value;
	var temas=formu.temas.value;
	
	var descripcion1=formu.descripcion1.value;
	var descripcion2=formu.descripcion2.value;
	var descripcion3=formu.descripcion3.value;
	var descripcion4=formu.descripcion4.value;
	var descripcion5=formu.descripcion5.value;
	var descripcion6=formu.descripcion6.value;
	var descripcion7=formu.descripcion7.value;
	var descripcion8=formu.descripcion8.value;
	var descripcion9=formu.descripcion9.value;
	var descripcion10=formu.descripcion10.value;
	var descripcion11=formu.descripcion11.value;
	
	if(temas==""){
		alert("Faltan campos por rellenar");
		return false;
	}
		
	var variables=transformaFormularioPost(formu);
	
	enviarIdentificacion_("<div align=left><img src='images/loading.gif'></div>");
	doAjax("scripts/salvar_iden4.scr.php", variables, "enviarIdentificacion_", "post" , 0);
}

function enviarIdentificacion_(html){ 
	parent.document.getElementById("identificacion").innerHTML=html;		
}

function enviarContacto(formu){
	var mensaje=formu.mensaje.value;
	var idusuario=formu.idusuario.value;
	
	if(mensaje==""){
		alert("Escriba un mensaje");
		return false;
	}
	
	var variables=transformaFormularioPost(formu);
	
	enviarContacto_("<div align=left><img src='../images/loading.gif'></div>");
	doAjax("../scripts/enviarContacto.scr.php", variables, "enviarContacto_", "post", 0);
}

function enviarContacto_(html){
	parent.document.getElementById('envioContacto').innerHTML=html;
}

function elijoAT(idasistencia){  
	elijoAT_("<div align=left><img src='images/loading.gif'></div>");
	doAjax("scripts/enviarCorreoAT.scr.php", "idat="+idasistencia+"", "elijoAT_", "post", 0);
}

function elijoAT_(html){
	parent.document.getElementById('enviarCorreo').innerHTML=html;
}

function elijoExperiencia(idexperiencia){  
	elijoExperiencia_("<div align=left><img src='images/loading.gif'></div>");
	doAjax("scripts/enviarCorreoExperiencia.scr.php", "idexp="+idexperiencia+"", "elijoExperiencia_", "post", 0);
}

function elijoExperiencia_(html){
	parent.document.getElementById('enviarCorreo').innerHTML=html;
}

function cambiaCheck(formu){
	var tematicas="";
	for(var i=0; i < formu.elements.length; i++){ 
		if(formu.elements[i].name == "proy_tematicas"){
			if(formu.elements[i].checked){  
				tematicas+=formu.elements[i].value+"-";
			}
		}
	}
	document.getElementById("tematicas").value=tematicas;	
}

function cambiaCheckTemas(formu){
	var tematicas="";
	for(var i=0; i < formu.elements.length; i++){ 
		if(formu.elements[i].name == "asistencia"){
			if(formu.elements[i].checked){  
				tematicas+=formu.elements[i].value+"-";
			}
		}
	}
	document.getElementById("temas").value=tematicas;	
}


function salvarNumProy(formu){ 
	var idcooperacion=formu.idcooperacion.value;
	var num_proy=formu.num_proy.value;
	
	if(num_proy=="-1"){
		alert("Elija el numero de proyectos de cooperacion");	
		return false;
	}
	var variables=transformaFormularioPost(formu);
	salvarNumProy_("<div align=left><img src='images/loading.gif'></div>");
	doAjax("scripts/guardarNumeroProyectos.scr.php", variables, "salvarNumProy_", "post" , 0);
}	

function salvarNumProy_(html){ 
	parent.document.getElementById("identificacion").innerHTML=html;		
}	

function generaObjetivos(num){ 
	if(num==1){
		document.getElementById('obj1').style.visible='visible';
		document.getElementById('obj1').style.display='block';
		document.getElementById('obj2').style.visible='hidden';
		document.getElementById('obj2').style.display='none';
		document.getElementById('obj3').style.visible='hidden';
		document.getElementById('obj3').style.display='none';
		document.getElementById('obj4').style.visible='hidden';
		document.getElementById('obj4').style.display='none';
		if(screen.width=='1280'){
			document.getElementById('ayudaresultado').style.top='82%';
			document.getElementById('ayudaresultado').style.left='28%';
			document.getElementById('ayudaindicador').style.top='82%';
		}
		else{
			document.getElementById('ayudaresultado').style.top='124%';
			document.getElementById('ayudaresultado').style.left='23%';
			document.getElementById('ayudaindicador').style.top='124%';
		}
	}
	else if(num==2){
		document.getElementById('obj1').style.visible='visible';
		document.getElementById('obj1').style.display='block';
		document.getElementById('obj2').style.visible='visible';
		document.getElementById('obj2').style.display='block';
		document.getElementById('obj3').style.visible='hidden';
		document.getElementById('obj3').style.display='none';
		document.getElementById('obj4').style.visible='hidden';
		document.getElementById('obj4').style.display='none';
		if(screen.width=='1280'){
			document.getElementById('ayudaresultado').style.top='92%';
			document.getElementById('ayudaresultado').style.left='28%';
			document.getElementById('ayudaindicador').style.top='92%';
		}
		else{
			document.getElementById('ayudaresultado').style.top='136%';
			document.getElementById('ayudaresultado').style.left='23%';
			document.getElementById('ayudaindicador').style.top='136%';
		}
	}
	else if(num==3){
		document.getElementById('obj1').style.visible='visible';
		document.getElementById('obj1').style.display='block';
		document.getElementById('obj2').style.visible='visible';
		document.getElementById('obj2').style.display='block';
		document.getElementById('obj3').style.visible='visible';
		document.getElementById('obj3').style.display='block';
		document.getElementById('obj4').style.visible='hidden';
		document.getElementById('obj4').style.display='none';
		if(screen.width=='1280'){
			document.getElementById('ayudaresultado').style.top='102%';
			document.getElementById('ayudaresultado').style.left='28%';
			document.getElementById('ayudaindicador').style.top='102%';
		}
		else{
			document.getElementById('ayudaresultado').style.top='148%';
			document.getElementById('ayudaresultado').style.left='23%';
			document.getElementById('ayudaindicador').style.top='148%';
		}
	}
	else if(num==4){
		document.getElementById('obj1').style.visible='visible';
		document.getElementById('obj1').style.display='block';
		document.getElementById('obj2').style.visible='visible';
		document.getElementById('obj2').style.display='block';
		document.getElementById('obj3').style.visible='visible';
		document.getElementById('obj3').style.display='block';
		document.getElementById('obj4').style.visible='visible';
		document.getElementById('obj4').style.display='block';
		if(screen.width=='1280'){
			document.getElementById('ayudaresultado').style.top='112%';
			document.getElementById('ayudaresultado').style.left='28%';
			document.getElementById('ayudaindicador').style.top='112%';
		}
		else{
			document.getElementById('ayudaresultado').style.top='160%';
			document.getElementById('ayudaresultado').style.left='23%';
			document.getElementById('ayudaindicador').style.top='160%';
		}
	}
}

function generaResultados(num){ 
	if(num==1){
		document.getElementById('res1').style.visible='visible';
		document.getElementById('res1').style.display='block';
		document.getElementById('res2').style.visible='hidden';
		document.getElementById('res2').style.display='none';
		document.getElementById('res3').style.visible='hidden';
		document.getElementById('res3').style.display='none';
		document.getElementById('res4').style.visible='hidden';
		document.getElementById('res4').style.display='none';
	}
	else if(num==2){
		document.getElementById('res1').style.visible='visible';
		document.getElementById('res1').style.display='block';
		document.getElementById('res2').style.visible='visible';
		document.getElementById('res2').style.display='block';
		document.getElementById('res3').style.visible='hidden';
		document.getElementById('res3').style.display='none';
		document.getElementById('res4').style.visible='hidden';
		document.getElementById('res4').style.display='none';
	}
	else if(num==3){
		document.getElementById('res1').style.visible='visible';
		document.getElementById('res1').style.display='block';
		document.getElementById('res2').style.visible='visible';
		document.getElementById('res2').style.display='block';
		document.getElementById('res3').style.visible='visible';
		document.getElementById('res3').style.display='block';
		document.getElementById('res4').style.visible='hidden';
		document.getElementById('res4').style.display='none';
	}
	else if(num==4){
		document.getElementById('res1').style.visible='visible';
		document.getElementById('res1').style.display='block';
		document.getElementById('res2').style.visible='visible';
		document.getElementById('res2').style.display='block';
		document.getElementById('res3').style.visible='visible';
		document.getElementById('res3').style.display='block';
		document.getElementById('res4').style.visible='visible';
		document.getElementById('res4').style.display='block';
	}
}

function overEstrella(obj, caja){
	var valor=document.getElementById(caja).value;
	if(valor==""){
		if(obj=="estrella1"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star_azul.png";
			document.getElementById('estrella3'+caja).src="images/star_azul.png";
			document.getElementById('estrella4'+caja).src="images/star_azul.png";
			document.getElementById('estrella5'+caja).src="images/star_azul.png";
		}
		else if(obj=="estrella2"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star.png";
			document.getElementById('estrella3'+caja).src="images/star_azul.png";
			document.getElementById('estrella4'+caja).src="images/star_azul.png";
			document.getElementById('estrella5'+caja).src="images/star_azul.png";
		}
		else if(obj=="estrella3"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star.png";
			document.getElementById('estrella3'+caja).src="images/star.png";
			document.getElementById('estrella4'+caja).src="images/star_azul.png";
			document.getElementById('estrella5'+caja).src="images/star_azul.png";
		}
		else if(obj=="estrella4"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star.png";
			document.getElementById('estrella3'+caja).src="images/star.png";
			document.getElementById('estrella4'+caja).src="images/star.png";
			document.getElementById('estrella5'+caja).src="images/star_azul.png";
		}
		else if(obj=="estrella5"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star.png";
			document.getElementById('estrella3'+caja).src="images/star.png";
			document.getElementById('estrella4'+caja).src="images/star.png";
			document.getElementById('estrella5'+caja).src="images/star.png";
		}
	}
	else{
		if(valor=="1"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star_azul.png";
			document.getElementById('estrella3'+caja).src="images/star_azul.png";
			document.getElementById('estrella4'+caja).src="images/star_azul.png";
			document.getElementById('estrella5'+caja).src="images/star_azul.png";
		}
		else if(valor=="2"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star.png";
			document.getElementById('estrella3'+caja).src="images/star_azul.png";
			document.getElementById('estrella4'+caja).src="images/star_azul.png";
			document.getElementById('estrella5'+caja).src="images/star_azul.png";
		}
		else if(valor=="3"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star.png";
			document.getElementById('estrella3'+caja).src="images/star.png";
			document.getElementById('estrella4'+caja).src="images/star_azul.png";
			document.getElementById('estrella5'+caja).src="images/star_azul.png";
		}
		else if(valor=="4"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star.png";
			document.getElementById('estrella3'+caja).src="images/star.png";
			document.getElementById('estrella4'+caja).src="images/star.png";
			document.getElementById('estrella5'+caja).src="images/star_azul.png";
		}
		else if(valor=="5"){
			document.getElementById('estrella1'+caja).src="images/star.png";
			document.getElementById('estrella2'+caja).src="images/star.png";
			document.getElementById('estrella3'+caja).src="images/star.png";
			document.getElementById('estrella4'+caja).src="images/star.png";
			document.getElementById('estrella5'+caja).src="images/star.png";
		}
	}
}

function imagenesAreaPersonal(imagen){
	if(imagen=="imgExperiencias"){
		document.getElementById('imgExperiencias').src="images/registroExperienciasGris.jpg";
		//document.getElementById('imgEstanteria').src="images/estanteriaVirtual.jpg";
		document.getElementById('imgAsistencia').src="images/asistenciaAzul.jpg";
		document.getElementById('imgBanco').src="images/bancoTiempoAzul.jpg";
		//document.getElementById('imgConecta').src="images/conecta20.jpg";
		document.getElementById('imgPerfil').src="images/editarPerfil.jpg";
		document.getElementById('imgMunicipio').src="images/perfilMunicipio.jpg";
	}
	/*else if(imagen=="imgEstanteria"){
		document.getElementById('imgExperiencias').src="images/registroExperiencias.jpg";
		//document.getElementById('imgEstanteria').src="images/estanteriaVirtualGris.jpg";
		document.getElementById('imgAsistencia').src="images/asistenciaAzul.jpg";
		document.getElementById('imgBanco').src="images/bancoTiempoAzul.jpg";
		//document.getElementById('imgConecta').src="images/conecta20.jpg";
		document.getElementById('imgPerfil').src="images/editarPerfil.jpg";
		document.getElementById('imgMunicipio').src="images/perfilMunicipio.jpg";
	}
	else if(imagen=="imgConecta"){
		document.getElementById('imgExperiencias').src="images/registroExperiencias.jpg";
	//	document.getElementById('imgEstanteria').src="images/estanteriaVirtual.jpg";
		document.getElementById('imgAsistencia').src="images/asistenciaAzul.jpg";
		document.getElementById('imgBanco').src="images/bancoTiempoAzul.jpg";
		//document.getElementById('imgConecta').src="images/conecta20Gris.jpg";
		document.getElementById('imgPerfil').src="images/editarPerfil.jpg";
		document.getElementById('imgMunicipio').src="images/perfilMunicipio.jpg";
	}*/
	else if(imagen=="imgPerfil"){
		document.getElementById('imgExperiencias').src="images/registroExperiencias.jpg";
		//document.getElementById('imgEstanteria').src="images/estanteriaVirtual.jpg";
		document.getElementById('imgAsistencia').src="images/asistenciaAzul.jpg";
		document.getElementById('imgBanco').src="images/bancoTiempoAzul.jpg";
		//document.getElementById('imgConecta').src="images/conecta20.jpg";
		document.getElementById('imgPerfil').src="images/editarPerfilGris.jpg";
		document.getElementById('imgMunicipio').src="images/perfilMunicipio.jpg";
	}
	else if(imagen=="imgMunicipio"){
		document.getElementById('imgExperiencias').src="images/registroExperiencias.jpg";
		document.getElementById('imgAsistencia').src="images/asistenciaAzul.jpg";
		document.getElementById('imgBanco').src="images/bancoTiempoAzul.jpg";
		//document.getElementById('imgEstanteria').src="images/estanteriaVirtual.jpg";
		//document.getElementById('imgConecta').src="images/conecta20.jpg";
		document.getElementById('imgPerfil').src="images/editarPerfil.jpg";
		document.getElementById('imgMunicipio').src="images/perfilMunicipioGris.jpg";
	}
	else if(imagen=="imgAsistencia"){
		document.getElementById('imgExperiencias').src="images/registroExperiencias.jpg";
		document.getElementById('imgAsistencia').src="images/asistenciaGris.jpg";
		document.getElementById('imgBanco').src="images/bancoTiempoAzul.jpg";
		//document.getElementById('imgEstanteria').src="images/estanteriaVirtual.jpg";
		//document.getElementById('imgConecta').src="images/conecta20.jpg";
		document.getElementById('imgPerfil').src="images/editarPerfil.jpg";
		document.getElementById('imgMunicipio').src="images/perfilMunicipio.jpg";
	}
	else if(imagen=="imgBanco"){
		document.getElementById('imgExperiencias').src="images/registroExperiencias.jpg";
		document.getElementById('imgAsistencia').src="images/asistenciaAzul.jpg";
		document.getElementById('imgBanco').src="images/bancoTiempoGris.jpg";
		//document.getElementById('imgEstanteria').src="images/estanteriaVirtual.jpg";
		//document.getElementById('imgConecta').src="images/conecta20.jpg";
		document.getElementById('imgPerfil').src="images/editarPerfil.jpg";
		document.getElementById('imgMunicipio').src="images/perfilMunicipio.jpg";
	}
}

function vaciarEstrellas(caja){
	if(document.getElementById(caja).value==""){
		document.getElementById('estrella1'+caja).src="images/star_azul.png";
		document.getElementById('estrella2'+caja).src="images/star_azul.png";
		document.getElementById('estrella3'+caja).src="images/star_azul.png";
		document.getElementById('estrella4'+caja).src="images/star_azul.png";
		document.getElementById('estrella5'+caja).src="images/star_azul.png";
	}
}

function salvarPuntuacion(caja, valor){ 
	document.getElementById(caja).value=valor;	
}

function mostrarAyuda(ayuda){	
	if(ayuda=="resultado"){ 
	   	document.getElementById('ayudaresultado').style.visibility='visible';
	}
	else if(ayuda=="indicador"){
	 	document.getElementById('ayudaindicador').style.visibility='visible';
	}
}

function ocultarAyuda(ayuda){
	if(ayuda=="resultado"){
	   	document.getElementById('ayudaresultado').style.visibility='hidden';
	}
	else if(ayuda=="indicador"){
	 	document.getElementById('ayudaindicador').style.visibility='hidden';
	}
}

function pulsatecla(e, caja){ 
	var tecla="";
	if(navigator.appName == "Microsoft Internet Explorer"){
		tecla=e.keyCode;
	}
	else{
		tecla=e.which;
	}
	if(tecla!=8){ 
		if(((tecla>=48) && (tecla<=57)) || ((tecla>=96) && (tecla<=105))){
			if(caja.value.length>=5){
				var texto=caja.value; 
				var txt=texto.substring(0, 5);
				caja.value=txt;
				return false; 
			}			
		}
		else{
			var texto=caja.value; 
			var txt=texto.substring(0, caja.value.length-1);
			caja.value=txt;
			return false; 
		}
	}	
	
}

function vaciarFile(tipo){
	if(tipo=="video"){		
		document.getElementById('presentacion').value=''; 
		document.getElementById('archivo_p').value=''; 
		document.getElementById('npresentacion').value=''; 
		document.getElementById('tamanio_p').value=''; 
		document.getElementById('foto').value='';	
		document.getElementById('archivo_f').value='';	
		document.getElementById('nfoto').value='';	
		document.getElementById('tamanio_f').value='';
		document.getElementById('documento').value=''; 
		document.getElementById('archivo_doc').value='';
		document.getElementById('ndoc').value='';
		document.getElementById('tamanio_doc').value='';
	}
	else if(tipo=="presentacion"){		
		document.getElementById('video').value=''; 
		document.getElementById('archivo_v').value='';
		document.getElementById('nvideo').value='';
		document.getElementById('tamanio_v').value='';
		document.getElementById('foto').value='';	
		document.getElementById('archivo_f').value='';	
		document.getElementById('nfoto').value='';	
		document.getElementById('tamanio_f').value='';
		document.getElementById('documento').value=''; 
		document.getElementById('archivo_doc').value='';
		document.getElementById('ndoc').value='';
		document.getElementById('tamanio_doc').value='';
	}
	else if(tipo=="foto"){		
		document.getElementById('video').value=''; 
		document.getElementById('archivo_v').value='';
		document.getElementById('nvideo').value='';
		document.getElementById('tamanio_v').value='';
		document.getElementById('presentacion').value=''; 
		document.getElementById('archivo_p').value=''; 
		document.getElementById('npresentacion').value=''; 
		document.getElementById('tamanio_p').value=''; 
		document.getElementById('documento').value=''; 
		document.getElementById('archivo_doc').value='';
		document.getElementById('ndoc').value='';
		document.getElementById('tamanio_doc').value='';
	}
	if(tipo=="documento"){
		document.getElementById('video').value=''; 
		document.getElementById('archivo_v').value='';
		document.getElementById('nvideo').value='';
		document.getElementById('tamanio_v').value='';
		document.getElementById('presentacion').value=''; 
		document.getElementById('archivo_p').value=''; 
		document.getElementById('npresentacion').value=''; 
		document.getElementById('tamanio_p').value=''; 
		document.getElementById('foto').value='';	
		document.getElementById('archivo_f').value='';	
		document.getElementById('nfoto').value='';	
		document.getElementById('tamanio_f').value='';	
	}
}
function enviarNoticia(op){
	if(op==0){
		var capa=parent.document.getElementById("cpfEnvioAmigo");
		$toggle('cpfEnvioAmigo');
	}else{		
		document.getElementById("fEnvioAmigo").reset();
		document.getElementById("btnEnviar").innerHTML='<span onClick="enviaNoticia(formEnvioAmigo)" style="border:solid 1px #adadad; background-color:#dadada; padding:2px; cursor:pointer">Enviar</span>';
		var capa=parent.document.getElementById("cpfEnvioAmigo");
		$toggle('cpfEnvioAmigo');		
	}
}

