window.onresize = Reset_Popups;
window.onscroll = Reset_Popups;

function msSwap(imgName, imgState)
	{document.images[imgName].src = eval(imgName + "_" + imgState + ".src");}

function msSwap_Control(imgName, imgState, imgControlId)
	{document.images[imgControlId].src = eval(imgName + "_" + imgState + ".src");}

function Reset_Popups(action)
    {
    if (action == null || action == "undefined"){action == "";}
    
    var lngBrowserWidth = 100;
    var lngBrowserHeight = 100;
    InterfaceTransition.style.height = lngBrowserHeight;
    InterfaceTransition.style.width = lngBrowserWidth;
    
    lngBrowserWidth = document.body.scrollWidth; //document.body.pageWidth;
    lngBrowserHeight = document.body.scrollHeight; //document.body.pageHeight;
    			
    InterfaceTransition.style.height = lngBrowserHeight;
    InterfaceTransition.style.width = lngBrowserWidth;
    }
    
function Display_Transition(action)
    {
    var zIndexTrans = -1;
    Reset_Popups(action);
        
    if (action == "visible") { zIndexTrans = 5; }
    
    zIndexElem('InterfaceTransition', zIndexTrans);
    displayElem('InterfaceTransition', action);
	}

function Get_ClientWidth() {
	return ClientScroll_FilterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}

function Get_ClientHeight() {
	return ClientScroll_FilterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}

function getObjectTop(refobj) {
    var curtop = 0;
    if (refobj.offsetParent) {
        do {
            curtop += refobj.offsetTop;
        } while (refobj = refobj.offsetParent);
    }
    return curtop;
}

function getObjectLeft(refobj) {
    var curleft = 0;
    if (refobj.offsetParent) {
        do {
            curleft += refobj.offsetLeft;
        } while (refobj = refobj.offsetParent);
    }
    return curleft;
}

function Get_ScrollLeft() {
	return ClientScroll_FilterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}

function Get_ScrollTop() {
	return ClientScroll_FilterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function ClientScroll_FilterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
