////////////////////////////////////////////////////////////////
//        FUNCIONES QUE CONTROLAN EL MENU DE CABECERA         //
////////////////////////////////////////////////////////////////
var a = 0;
var menu_activo=0;
var IE = document.all?true:false;

function muestra_menu(id)
  {
   var DivRef = document.getElementById('submenu' + id);
   //var IfrRef = document.getElementById('Divframe' + id);
    
    
    if((menu_activo!=0)&&(menu_activo!=id) ){
	   oculta_menu(menu_activo);
	   a=0;
    }
    menu_activo=id;
    DivRef.style.display = "block";
    /*IfrRef.style.width = DivRef.offsetWidth;
    IfrRef.style.height = DivRef.offsetHeight;
    IfrRef.style.top = DivRef.style.top;
    IfrRef.style.left = DivRef.style.left;
    IfrRef.style.zIndex = DivRef.style.zIndex - 1;
    IfrRef.style.display = "block";
    IfrRef.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
     */
  }
  

function oculta_menu(id)
  {
   //evt = (evt) ? evt : event
   var DivRef = document.getElementById('submenu' + id);
   //var IfrRef = document.getElementById('Divframe' + id);
   
   DivRef.style.display = "none";
//   IfrRef.style.display = "none";
  }
    

function oculta_menus(){
	 for(x=1;x<=6;x++){
	 	oculta_menu(x);
	 }
}

////////////////////////////////////////////////////////////////
//              FUNCIONES GENERALES DE IBERCAJA               //
////////////////////////////////////////////////////////////////

function abre_ventana(sURL, sName, iWidth, iHeight, bResizable, bScrollbars)
{
        var iTop  = (screen.height - iHeight) / 2 ;
        var iLeft = (screen.width  - iWidth) / 2 ;

        var sOptions = "toolbar=no" ;
        sOptions += ",width=" + iWidth ;
        sOptions += ",height=" + iHeight ;
        sOptions += ",resizable="  + (bResizable  ? "yes" : "no") ;
        sOptions += ",scrollbars=" + (bScrollbars ? "yes" : "no") ;
        sOptions += ",left=" + iLeft ;
        sOptions += ",top=" + iTop ;

        var oWindow = window.open(sURL, sName, sOptions)
        oWindow.focus();

        return oWindow ;
}


var w = null;
var h = null;
function ventana(url,w,h,centered) {
    var aux=new String(document.location);
	pos=aux.indexOf("?");
	aux2=aux.slice(pos+1);
	if (url.indexOf("?")>0)
	   url=url + "&" + aux2
	else if(url.indexOf("#")>0)
	{
	   aux3=url.split("#")
	   url=aux3[0]+ "?" + aux2 + "#" + aux3[1]
	}
	else
	   url=url + "?" + aux2

	if ((url != "") && (url.length > 3))  {
		if ((isNaN(w*1)) || (w==null)) w = 780;
		if ((isNaN(h*1)) || (h==null)) h = 580;
		var pos = "";
		if(centered){
			var sw = screen.width, sh = screen.height;

			if (document.all || document.layers) {
				sw = screen.availWidth;
				sh = screen.availHeight;
			}

			var leftPos = (sw-w)/2, topPos = (sh-h)/2;
			pos += ",top = " + topPos;
			pos += ",left = " + leftPos;
		}
		
		return window.open(url,"ibercaja","width="+w+",height="+h+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0"+pos);
	}
	return null;
}

function imprime_contenido(id)
{
  ventana("/imprime.php",800,600,true);
}

function imprime_contenido_salaprensa(id)
{
  ventana("/salaprensa/imprime.php",800,600,true);  
}

function carga(url)
{
	opener.document.location=url;
	window.close();
}




function ventanacenter(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
 if(window.screen)if(isCenter)if(isCenter=="true"){
   var myLeft = (screen.width-myWidth)/2;
   var myTop = (screen.height-myHeight)/2;
   features+=(features!='')?',':'';
   features+=',left='+myLeft+',top='+myTop;
 }
 window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}
