function pop(file,w,h,s) { 
	window.open(file,'_snew','menubar=no, scrollbars=' + s + ',resizable=no,top=' + (screen.height/2-h/2) + ',left=' + (screen.width/2-w/2) + ',width=' + (w) + ',height=' + (h));
}

function Capture_Enter()
{
	if (window.event.keyCode == 13)
	{
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}
}


function hidediv() 
{ 
	if (document.getElementById) 
	{ // DOM3 = IE5, NS6 
		document.getElementById('pnlSpecialOffer').style.visibility = 'hidden'; 
	} 
	else 
	{ 
		if (document.layers) 
		{ // Netscape 4 
			document.pnlSpecialOffer.visibility = 'hidden'; 
		} 
		else 
		{ // IE 4 
			document.all.pnlSpecialOffer.style.visibility = 'hidden'; 
		} 
	} 
} 

function showdiv() 
{ 
	if (document.getElementById) 
	{ // DOM3 = IE5, NS6 
		document.getElementById('pnlSpecialOffer').style.visibility = 'visible'; 
	} 
	else 
	{ 
		if (document.layers) 
		{ // Netscape 4 
			document.pnlSpecialOffer.visibility = 'visible'; 
		} 
		else 
		{ // IE 4 
			document.all.pnlSpecialOffer.style.visibility = 'visible'; 
		} 
	} 
} 

function hidescriptdiv() 
{ 
	if (document.getElementById) 
	{ // DOM3 = IE5, NS6 
		document.getElementById('pnlScriptPopup').style.visibility = 'hidden'; 
	} 
	else 
	{ 
		if (document.layers) 
		{ // Netscape 4 
			document.pnlScriptPopup.visibility = 'hidden'; 
		} 
		else 
		{ // IE 4 
			document.all.pnlScriptPopup.style.visibility = 'hidden'; 
		} 
	} 
} 

function showscriptdiv() 
{ 
	if (document.getElementById) 
	{ // DOM3 = IE5, NS6 
		document.getElementById('pnlScriptPopup').style.visibility = 'visible'; 
	} 
	else 
	{ 
		if (document.layers) 
		{ // Netscape 4 
			document.pnlScriptPopup.visibility = 'visible'; 
		} 
		else 
		{ // IE 4 
			document.all.pnlScriptPopup.style.visibility = 'visible'; 
		} 
	} 
} 
	
function changeColor(id, id2, color) 
{ 
	document.getElementById(id).style.background = color;
	document.getElementById(id2).focus();
	document.getElementById(id2).select();
}


function topMenuToggle(menuItem) {
    var toChange;
    if (document.getElementById) {
        var toChange = document.getElementById(menuItem);
    } else if (document.all) {
        var toChange = document.all[menuItem];
    }
    if (toChange.className == "topMenuOff") {
        toChange.className = "topMenuOn";
    } else {
        toChange.className = "topMenuOff";
    }
}

function getWindowHeight() {
    var windowHeight = 0;
    if (typeof (window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    } else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        } else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            } else {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}

function setContentHeight() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        if (windowHeight > 0) {

            // ------------------ HEADER AND FOOTER TYPE ----------------------

            var headerElement = document.getElementById('header');
            var footerElement = document.getElementById('footer');
            footerElement.style.display = 'block';
            
            var headerHeight = headerElement.offsetHeight;
            var footerHeight = footerElement.offsetHeight;

            // ------------------ FIND TALLEST ELEMENT ----------------------

            var homeLeftElement = document.getElementById('homeLeft');
            var homeLeftHeight = getElementHeight(homeLeftElement) + 139;

            var homeMiddleElement = document.getElementById('homeMiddle');
            var homeMiddleHeight = getElementHeight(homeMiddleElement) + 139;

            var rightElement = document.getElementById('right');
            var rightHeight = getElementHeight(rightElement) + 14;

            var leftWideElement = document.getElementById('leftWide');
            var leftWideHeight = getElementHeight(leftWideElement) + 95;

            var rightSearchElement = document.getElementById('rightSearch');
            var rightSearchHeight = getElementHeight(rightSearchElement) + 95;

            var leftSearchElement = document.getElementById('leftSearch');
            var leftSearchHeight = getElementHeight(leftSearchElement) + 95;

            var fullPageElement = document.getElementById('fullPage');
            var fullPageHeight = getElementHeight(fullPageElement) + 95;
	    
	    var fullPageAdvertiserElement = document.getElementById('fullPageAdvertiser');
            var fullPageAdvertiserHeight = getElementHeight(fullPageAdvertiserElement) + 95;

            var contentHeight = Math.max(homeLeftHeight, homeMiddleHeight, rightHeight, leftWideHeight, rightSearchHeight, leftSearchHeight, fullPageHeight, fullPageAdvertiserHeight);
            var pageHeight = contentHeight + headerHeight;

            // ------------------ RESIZE CONTAINER PROPERLY, PUSHING FOOTER DOWN ----------------------

            var containerElement = document.getElementById('mainContainer');
            if ((windowHeight - pageHeight) > footerHeight) {
                containerElement.style.height = windowHeight - footerHeight + 10 + 'px';
            } else {
            containerElement.style.height = pageHeight + 10 + 'px';
            }

            

        }
    }
}

function getElementHeight(element) {

    if (element == null) {
        return 0;
    } else {
        return element.offsetHeight;
    }
    
}