function estableceproy(boton){
	var auxnumero="";
	for (var i=(boton.length-1);i>0;i--){
		if (!isNaN(boton.charAt(i))){
		    auxnumero=boton.charAt(i)+String(auxnumero);
		}		
	}
	var auxcasilla="v_codproyecto"+auxnumero;
	var casilla=document.getElementById(auxcasilla);
	document.formuproy.cod_proyecto.value=casilla.value;
	document.formuproy.submit();
}

function abre_imagen(nomdivision,nombreimagen,ruta){
	 //averiguo que pixel es de la esquina superior izquierda
	 var upperlcorner=establecepos();
	 //la altura actual del navegador del cliente
	 var alturapagina=alturabody();
	 var posicionY=((alturapagina/2)-100)+upperlcorner;
	 switch (ruta){
		     case 1://proyectos
			    var direc = "./proyectos/imgs/"+nombreimagen;
				break;
			 case 2://comunicación
			    var direc = "./comunica/imgs_comunica/"+nombreimagen;
			    break;
	 }	 
	 var div_deimagen_imagen=document.getElementById("imagen_de_proy");
	 var num_aux=parseInt(obten_numero(nomdivision));				
	 var div_texto_cabecera=document.getElementById("descripcion_imagen");
	 var div_cierra_div=document.getElementById("cierra_imagen_de_proy");
	 div_deimagen_imagen.style.visibility="visible";
	 div_texto_cabecera.innerHTML='<p>'+nombre_array_talt[num_aux]+'</p>';
	 var imagen=document.getElementById("cargador_img");
     var div_deimagenaux=document.getElementById(nombreimagen);
	 div_deimagen_imagen.style.top=posicionY+'px';
	 imagen.src=direc;
}

function obten_numero(cadena){
	 var aux_cadena='';
	 for (i=0;i<cadena.length;i++){
			if (!isNaN(cadena.charAt(i))){
				aux_cadena=aux_cadena+cadena.charAt(i); 
			}
	 }
	 return aux_cadena;
}

function establecepos(){
    var x,y;
    if (self.pageYOffset) // all except Explorer
    {
	    x = self.pageXOffset;
	    y = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop)
	// Explorer 6 Strict
    {
 	    x = document.documentElement.scrollLeft;
	    y = document.documentElement.scrollTop;
    }
    else if (document.body) // all other Explorers
    {
	    x = document.body.scrollLeft;
	    y = document.body.scrollTop;
    }
    return y;
}

function alturabody(){
	var x,y;
    if (self.innerHeight) // all except Explorer
    {
	   x = self.innerWidth;
	   y = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight)
	  // Explorer 6 Strict Mode
    {
	   x = document.documentElement.clientWidth;
	   y = document.documentElement.clientHeight;
    }
    else if (document.body) // other Explorers
    {
	   x = document.body.clientWidth;
	   y = document.body.clientHeight;
    }
    return y;
}


function desaparece(){
	var div_deimagen_imagen=document.getElementById("imagen_de_proy");
	div_deimagen_imagen.style.visibility="hidden";
}
