﻿// JScript File

//function replaceVisibleDivOld (toHide, toVisible)
//{
//    if(document.all||document.getElementById)
//    {
//        toH = document.getElementById(toHide);
//        toV = document.getElementById(toVisible);
//	    var currentPage = document.getElementById("MenuItemClickedHF").value;
//        if((toH != null)&&(toV !=null))
//        {
//	        if 	(((toHide == "selectedPietraChiSiamoDiv") && (currentPage == "chisiamo"))
//	          	|| ((toHide == "selectedPietraProdottiDiv") && (currentPage == "prodotti"))
//	          	|| ((toHide == "selectedPietraRivisteDiv") && (currentPage == "riviste"))
//	          	|| ((toHide == "selectedPietraDoveSiamoDiv") && (currentPage == "dovesiamo"))
//	          	|| ((toHide == "selectedPietraContattiDiv") && (currentPage == "contatti"))
//	          	|| ((toHide == "selectedPietraMappaDiv") && (currentPage == "mappa"))
//	          	|| ((toHide == "selectedPietraSuiteDiv") && (currentPage == "suite"))
//	          	|| ((toHide == "selectedPietraCapannoDiv") && (currentPage == "capanno"))
//	          	|| ((toHide == "selectedPietraBluDiv") && (currentPage == "blu"))
//	          	|| ((toHide == "selectedPietraGiallaDiv") && (currentPage == "gialla")))
//	        {
//	        }
//	        else 
//	        {
//        	    toH.style.visibility='hidden';
//        	    toV.style.visibility='visible';
//	        }
//        }
//    } 
//}

//AdjustScrollbar
//#region
function AdjustScrollbar() 
{ 
    var myHeight = 0; 
    var myWidth = 0; 

    if( typeof( window.innerHeight ) == 'number' ) 
    {
        //Non-IE
        myHeight = window.innerHeight;
        myWidth = window.innerWidth;
    } 
    else if( document.documentElement && document.documentElement.clientHeight ) 
    {
        //IE 6+ in 'standards compliant mode'
        myHeight = document.documentElement.clientHeight;
        myWidth = document.documentElement.clientWidth;
    } 
    else if( document.body && document.body.clientHeight ) 
    {
        //IE 4 compatible
        myHeight = document.body.clientHeight;
        myWidth = document.body.clientWidth;
    }
    
    var wrapper = document.getElementById("Wrapper");
    
    if (myHeight < 620)
    {
        wrapper.style.marginTop = "0px";
        wrapper.style.top = "0px";
    }
    if (myWidth < 820)
    {
        wrapper.style.marginLeft = "0px";
        wrapper.style.left = "0px";
    }
}

//#endregion

function replaceVisibleDiv (toHide, toVisible)
{
    if(document.all||document.getElementById)
    {
        toH = document.getElementById(toHide);
        toV = document.getElementById(toVisible);
        if((toH != null)&&(toV !=null))
        {
	        toH.style.visibility='hidden';
	        toV.style.visibility='visible';
	    }
    } 
}

function showDiv (toVisible)
{
    if(document.all||document.getElementById)
    {
        toV = document.getElementById(toVisible);
        if(toV !=null)
        {
	        toV.style.visibility='visible';
	    }
    } 
}

function hideDiv (toHide)
{
    if(document.all||document.getElementById)
    {
        toH = document.getElementById(toHide);
        if(toH != null)
        {
	        toH.style.visibility='hidden';
	    }
    } 
}


function ChangePage(destination)
{
    window.location.href = destination;
}

//addLoadEvent function
//#region

function addLoadEvent(func) 
{ 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') 
	{ 
		window.onload = func; 
	} 
	else 
	{ 
	    	window.onload = function() 
		{ 
	      		if (oldonload) 
			{ 
	        		oldonload(); 
	      		} 
	      		func(); 
	    	} 
	} 
}
//#endregion

addLoadEvent(AdjustScrollbar);

