function returnObjById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}
enableMenu = function()
{
    var nav = returnObjById('nav');
    for (h = 0; h < nav.childNodes.length; h++)
    {
        if (nav.childNodes[h].nodeName == "UL")
        {
            navRoot = nav.childNodes[h];
            for (i = 0; i < navRoot.childNodes.length; i++)
            {
                node = navRoot.childNodes[i];
                if (node.nodeName == "LI")
                {
                    node.onmouseover = function()
                    {
                        this.className += " over";
                    }
                    node.onmouseout = function()
                    {
                        this.className = this.className.replace(/over/i, "");
                    }
                }
            }
        }
    }
}
loadImages = function()
{
    var imageLocationObj = returnObjById('ctl00_imageLocationHiddenField');
    if (imageLocationObj == null)
    {
        imageLocationObj = returnObjById('imageLocationHiddenField');
    }
    if (imageLocationObj != null)
    {
        var imageLocation = imageLocationObj.value;
        var i = 0;
        
        imageObj = new Image();

        images = new Array();
        images[0]=imageLocation+"nav_products_hover.gif";
        images[1]=imageLocation+"nav_services_hover.gif";
        images[2]=imageLocation+"nav_markets_hover.gif";
        images[3]=imageLocation+"nav_news_hover.gif";
        images[4]=imageLocation+"nav_resources_hover.gif";
        images[5]=imageLocation+"nav_about_hover.gif";
        images[6]=imageLocation+"btn_read_more_hover.jpg";
        images[7]=imageLocation+"btn_search_hover.jpg";
        images[8]=imageLocation+"btn_submit_hover.jpg";
        images[9]=imageLocation+"nav_product_2_large.jpg";
        images[10]=imageLocation+"nav_product_3_large.jpg";
        images[11]=imageLocation+"nav_product_4_large.jpg";
        images[12]=imageLocation+"nav_product_5_large.jpg";
        images[13]=imageLocation+"nav_product_6_large.jpg";
        
        for(i=0; i<images.length; i++) 
        {
            imageObj.src=images[i];
        }
    }
}
loader = function()
{
    enableMenu();
    loadImages();
}
window.onload=loader;

/* Gets the window position for IE and Firefox, at least */
function windowLeft() {return typeof window.screenLeft != 'undefined' ? window.screenLeft : typeof window.screenX != 'undefined' ?  window.screenX : 0;} 
function windowTop() {return typeof window.screenTop != 'undefined' ? window.screenTop : typeof window.screenY != 'undefined' ?  window.screenY : 0;} 

function popUp(url, width, height, menubar, name, top, left) 
{
	var strName;
	if(!top)
	{
		if(height)
		{
			top = (screen.height / 2 - height / 2);
			if(document.body.offsetHeight == height)
			{
				top += 50;
				if(Math.abs(windowTop() - top) < 50)
				{
					top += 50;
				}
			}
		}
		else
			top = 50;
	}
	if(!left)
	{
		if(width)
		{
			left = (screen.width / 2 - width / 2);
			if(document.body.offsetWidth == width)
			{
				left += 50;
				if(Math.abs(windowLeft() - left) < 50)
				{
					left += 50;
				}
			}
		}
		else
			left = 100;
	}
	if(name) strName = name; else strName = "popup"
	if(menubar)
	{
		var winObj = window.open(url,strName,'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=no,resizable=yes,copyhistory=yes,left=' + left + ',top=' + top + ',width=' + width + ',height=' + height);
		winObj.focus();
	}
	else
	{
		var winObj = window.open(url,strName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=' + left + ',top=' + top + ',width=' + width + ',height=' + height);
		winObj.focus();
	}
}

function popUpDrilldown(url,name, width, height)
{
	if (width == null)
		width = 800;
	if (height == null)
		height = 600;
	popUp(url, width, height, false, name);
}

function popUpConfirmation(url,name)
{
	popUp(url, 360, 240, false, name);
}

function popUpLookup(url,hiddenName)
{
	var retVal = false;
	var returnId = "";
	returnId = window.showModalDialog(url,'','dialogHeight:400px;dialogWidth:500px');
	if(returnId != "" && returnId != undefined)
	{
		var hiddenField = document.getElementById(hiddenName);
		hiddenField.value = returnId;
		retVal = true;
	}
	return(retVal);
}

function printPreview() {
    window.open(window.location + '?print=1');
}