﻿// File JScript
    function JSFunChiudi(){

        var oDivSfondo=document.getElementById("id_popup_sfondo");
        if (oDivSfondo){
	        oDivSfondo.style.display='none';
        }
        
        //nasconde tutti i sotto menù
        var oListaGrpMenu = document.getElementsByTagName("div");
        var oDiv, oDivGrpMenu;
        for(i=0; i < oListaGrpMenu.length; i++){
            oDiv = oListaGrpMenu.item(i).getAttribute("id");
            if (oDiv){
                if (oDiv.substring(0,7)=="grpmnu_"){
                    oDivGrpMenu=document.getElementById(oDiv);
                    if (oDivGrpMenu){
	                    oDivGrpMenu.style.display='none';
                    }
                }
            }
        }

    }

    function JSFunBrowserWidth(){
	    if (navigator.userAgent.indexOf('MSIE')>0){
		    return (document.body.clientWidth);
	    }else{
		    return window.outerWidth;
	    }
    }

    function JSFunBrowserHeight(){
	    if (navigator.userAgent.indexOf('MSIE')>0){
		    return (document.body.clientHeight);
	    }else{
		    return window.outerHeight;
	    }
    }

    function JSFunSfondo(){
        var oDivPopup=document.getElementById("id_popup_sfondo");
        if (oDivPopup){

	        var xScroll, yScroll;
	        if (window.innerHeight && window.scrollMaxY) {	
		        //xScroll = document.body.scrollWidth;
		        xScroll = window.innerWidth + window.scrollMaxX;
		        yScroll = window.innerHeight + window.scrollMaxY;
	        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		        xScroll = document.body.scrollWidth;
		        yScroll = document.body.scrollHeight;
	        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		        xScroll = document.body.offsetWidth;
		        yScroll = document.body.offsetHeight;
	        }
        	
	        var windowWidth, windowHeight;
	        if (self.innerHeight) {	// all except Explorer
		        windowWidth = self.innerWidth;
		        windowHeight = self.innerHeight;
	        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		        windowWidth = document.documentElement.clientWidth;
		        windowHeight = document.documentElement.clientHeight;
	        } else if (document.body) { // other Explorers
		        windowWidth = document.body.clientWidth;
		        windowHeight = document.body.clientHeight;
	        }	

	        // for small pages with total height less then height of the viewport
	        if(yScroll < windowHeight){
		        //pageHeight = windowHeight;
	        } else { 
		        //pageHeight = yScroll;
		        windowHeight = yScroll;
	        }

	        // for small pages with total width less then width of the viewport
	        if(xScroll < windowWidth){	
		        //pageWidth = windowWidth;
	        } else {
		        //pageWidth = xScroll;
		        windowWidth = xScroll;
	        }

		    oDivPopup.style.left="0";
		    oDivPopup.style.top="0";
		    oDivPopup.style.width=windowWidth+"px";
		    oDivPopup.style.height=windowHeight+"px";
		    oDivPopup.style.display = 'block';
        }
    }
    
    //user beg
        
    function JSFunBarraMenu(sGruppoMenu){
        var oDivPopup=document.getElementById(sGruppoMenu);
        JSFunChiudi()
        if (oDivPopup){
	        if (oDivPopup.style.display!=""){
                JSFunSfondo()
	            oDivPopup.style.display="";
	        }
        }
    }

    //user end

