﻿// File JScript
    function JSFunChiudi(){

        var oDivPopup=document.getElementById("id_popup_sfondo");
        if (oDivPopup){
	        oDivPopup.style.display='none';
        }
        
        var oDivPopup=document.getElementById("id_popup_soci_deleganti");
        if (oDivPopup){
	        oDivPopup.style.display='none';
        }
        var oDivPopup=document.getElementById("id_popup_soci_delegati");
        if (oDivPopup){
	        oDivPopup.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';
        }
    }

    
    function JSFunSoci(sPopUp){
        JSFunChiudi()
        if (sPopUp){
            JSFunSfondo()
            var oDivPopup=document.getElementById(sPopUp);
            if (oDivPopup){
		        var iLeft=300;
		        var iWidth=((JSFunBrowserWidth()-950)/2);
		        if (iWidth > 0){
			        iLeft=iLeft+iWidth
		        }
		        oDivPopup.style.left=iLeft+"px";
		        oDivPopup.style.top="250px";
		        oDivPopup.style.display="";
            }
        }
    }

    function JSFunEliminaIscrizione(sUrl){
	    JSFunChiudi()
        if (sUrl){
	        location = sUrl
	    }
    }
