function leeElementoPagina(strNombre)
{
	if (!document.all)
		obj=document.all[strNombre]
	else
		obj=document.getElementById(strNombre)
	return obj
}

function ponBgcolorPagina(strNombre, strColor)
{
	var obj=leeElementoPagina(strNombre)
	if (!obj) return
	obj.bgColor=strColor
}

function ponColorPagina(strNombre, strColor)
{
	var obj=leeElementoPagina(strNombre)
	if (!obj) return
	obj.color=strColor
}

function ponVisibilidadPagina(strNombre, blnVisibilidad)
{
	var obj=leeElementoPagina(strNombre);

	if (!obj) return
	obj.style.visibility = blnVisibilidad ? "visible" : "hidden"
}

function imprimePagina(strUrl)
{
	var obj=window.open(strUrl,null,'width=10,height=10');
	obj.moveBy(3000, 3000);
}

function enviaPagina(strUrl)
{
	window.open('mailto:?subject=Le han recomendado esta página desde la Web de Alameda&body=http://webclientes'+strUrl,'_blank');	
}


function abreimagen(imagen)
	{		
		var cad1, cad2, img, pos1, pos2;
						
		var ruta= imagen.src;	//Obtengo la ruta
		pos1=ruta.lastIndexOf(".",ruta.lenght);	//Busco la posición donde está '.'
		pos2=ruta.lastIndexOf("/",ruta.lenght);	//Busco la posición donde está '/'
		
		cad1= ruta.substring(0,pos1);	//desde el punto hacia el principio es la 1ª cadena
		cad2= ruta.substring(pos1, ruta.length)	//desde el punto hasta el final la segunda		
		
		img=ruta.substring(pos2+1, ruta.length) //desde la barra ultima hasta el final para quedarnos con el fichero de imagen
		
		ruta=cad1+"_g"+cad2;	//Compongo la nueva ruta con la imagen en GRANDE
		
		ampliar=abre_url('ampliar.asp?ima='+ruta+'&com='+imagen.alt, 40, 30, 100, 100);
		
	}
	
function abreimagen2(url)
	{		
		ampliar=abre_url(url, 40, 30, 100, 100);
		
	}

	
function abre_url(url, ancho, alto, leftPos, topPos)
{
	var w = 800, h = 600;

	if (document.all || document.layers)
	{
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	if (leftPos==undefined) leftPos = (w-ancho)/2;
	if (topPos==undefined) topPos = (h-alto)/2;
	return window.open(url,null,'scrollbars=no,resizable=no,status=no,width='+ancho+',height='+alto + ',top=' + topPos + ',left=' + leftPos);
}


function hoverImgMenu(url,id)
{
    var src;
    document.images["menu_"+id].src=url+"opcion_"+ id +"_h.jpg";
}
function outImgMenu(url,id)
{
    var src;
    document.images["menu_"+id].src=url+"opcion_"+ id +".jpg";
}

function ocultar(nombreCapa)
{ 
    document.getElementById(nombreCapa).className="oculta"; 
} 

function ocultaCapas(id, aref)
{
    var i, finalizado,buscaId;
    i=1;
    finalizado=false;
    
    document.getElementById(aref+"_a").className='a_marcado';
    document.getElementById(aref+"_a2").className='a_marcado';
    document.getElementById(id).className='';
    while(!finalizado)
    {
        buscaId='pagina_'+i;
        if (document.getElementById('pagina_'+i)==null)
        {
            finalizado=true;
        }else if(buscaId!=id){
            document.getElementById('pagina_'+i).className='oculta';
            document.getElementById('pagina_'+i+'_a').className='enlace_nivel';
            document.getElementById('pagina_'+i+'_a2').className='enlace_nivel';
        }
        i=i+1;
    }
}
function despliega(opc)
{
    var i, finalizado,buscaId;
    i=1;
    finalizado=false;
    if (document.getElementById(opc).className==''){
        document.getElementById(opc).className='oculta';
    }else{
        document.getElementById(opc).className='';
    }
        
      
    if ((document.getElementById('evento'+opc).className!=null)&&(document.getElementById('evento'+opc).className=='eventoDesplegado')){
        document.getElementById('evento'+opc).className='evento';
    }else{
        document.getElementById('evento'+opc).className='eventoDesplegado';   
    } 
    
    while(!finalizado)
    {
        buscaId='opcion_'+i;
        if (document.getElementById('opcion_'+i)==null)
        {
            finalizado=true;
        }else if(buscaId!=opc){
            document.getElementById('opcion_'+i).className='oculta';
        }
        i=i+1;
    }

}

function despliegaOrganizacion(opc)
{
    var i, finalizado,buscaId;
    i=1;
    finalizado=false;
    if (document.getElementById(opc).className==''){
        document.getElementById(opc).className='oculta';
    }else{
        document.getElementById(opc).className='';
    }        
         
    if ((document.getElementById('organizador'+opc).className!=null)&&(document.getElementById('organizador'+opc).className=='organizadorDesplegado')){
        document.getElementById('organizador'+opc).className='organizador';
    }else{
        document.getElementById('organizador'+opc).className='organizadorDesplegado';
    }  
           
    while(!finalizado)
    {
        buscaId='opcion_'+i;
        if (document.getElementById('opcion_'+i)==null)
        {
            finalizado=true;
        }else if(buscaId!=opc){
            document.getElementById('opcion_'+i).className='oculta';
        }
        i=i+1;
    }

}
function despliegaDocs(opc, max)
{
    var i;
    i=1;
    if (document.getElementById('capaDocs'+opc)!=null){
        if (document.getElementById('capaDocs'+opc).className==''){
            document.getElementById('capaDocs'+opc).className='oculta';
        }else{
            document.getElementById('capaDocs'+opc).className='';
        }
    }
    while(i<=max)
    {
        buscaId='capaDocs'+i;
        if (document.getElementById(buscaId)==null)
        {
            finalizado=true;
        }else if(i!=opc){
            document.getElementById(buscaId).className='oculta';
        }
        i=i+1;
    }
}
function despliegaCapa(id, cadena)
{
    var i, idActual, fin;
    i=1;
    fin=0;
    buscaId=cadena+'_'+id;
    if (document.getElementById(buscaId)!=null)
    {
        if (document.getElementById(buscaId).className=='')
        {
            document.getElementById(buscaId).className='oculta';
        }else{
            document.getElementById(buscaId).className='';
        }
    }
    while (fin!=1)
    {
        idActual=cadena+'_'+i;
        if (idActual!=buscaId)
        {
           if (document.getElementById(idActual)==null)
           {
                fin=1; 
           }else
           {     
                document.getElementById(idActual).className='oculta';  
           }
        }
        i=i+1;
    }
}
