/* Browser check */
IS_DOM = (document.getElementById) ? true : false;
IS_IE = (document.all) ? true : false;
IS_IE50 = (navigator.userAgent.indexOf("IE 5.0") != -1);
IS_Mac = (navigator.appVersion.indexOf("Mac") != -1);

// preload level 1 buttons
var btnLevel1 = new Array();
function preloadButtons()
{
    btnLevel1 = ["", "company", "offerings", "relationships"];
    for (i = 0; i < btnLevel1.length; i++)
    {
        eval("menu" + i + "on = new Image();"); eval("menu" + i + "off = new Image();");
        eval("menu" + (i) + "on.src = \"" + sFolderLevel + "img/navigation/" + btnLevel1[i] + "_r.gif\";");
        eval("menu" + (i) + "off.src = \"" + sFolderLevel + "img/navigation/" + btnLevel1[i] + "_0.gif\";");
        if (sSelectedL1 == btnLevel1[i])
        {
            eval("menu" + (i) + "on.src = \"" + sFolderLevel + "img/navigation/" + btnLevel1[i] + "_r.gif\";");
            eval("menu" + (i) + "off.src = \"" + sFolderLevel + "img/navigation/" + btnLevel1[i] + "_r.gif\";");
        }
    }
}

// General Site Functions
function imgOn(imgName) {
  if (IS_DOM) {
    document.getElementById(imgName).src = eval(imgName + "on.src");
  }
}
 
function imgOff(imgName) {
  if (IS_DOM) {
    document.getElementById(imgName).src = eval(imgName + "off.src");
  }
}

// image swapper
function changeImages() 
{
  if (document.getElementById) {
    for (var i = 0; i < changeImages.arguments.length; i += 2) { 
  		document.getElementById(changeImages.arguments[i]).src = eval(changeImages.arguments[i + 1] + ".src"); 
	}
  }
}

// image-swapping function for input image type
function changeInputImage(imageName,newImageSource) {
		if (document.getElementById) {
			document.getElementById(imageName).src = newImageSource;
		}
	}

// Get an ID 
function getThis(sId)
{
	var oObject;
	oObject = false;
	
	if (IS_DOM) {
		if (document.getElementById(sId)) {
			oObject = document.getElementById(sId);
		}
	}
	
	return oObject;
}

// accessible popup functions, this will work with or without javascript enabled
// reference like this "<a href="popup.htm" onclick="popUp(this.href,'console',400,200);return false;" target="newWin" title="This link will pop open a new window">This is my link</a>"
	function popUp(strURL,strType,strHeight,strWidth,strWindow)
	{
	  var strOptions="";
	  if (strType=="console") {
	    strOptions="resizable,height=" + strHeight + ",width=" + strWidth;
	  }
	  if (strType=="fixed") {
	    strOptions="status,height=" + strHeight + ",width=" + strWidth;
	  }
	  if (strType=="elastic") {
	    strOptions="toolbar,menubar,scrollbars,resizable,location,height=" + strHeight + ",width=" + strWidth;
	  }
	  window.open(strURL, strWindow, strOptions);
	}

	// proper way to close a popup window, to be referenced in the popup window
	// if (window.opener) document.write('<strong><a href="#" onclick="self.close();">Close this window</a></strong>');


/*
	tableruler()
	written by Chris Heilmann for alistapart.
	enables a rollover of rows for each table with the classname "hlrows"
*/

function tableruler()
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++)
		{
			if(tables[i].className=='ruler')
			{
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++)
				{
					if(trs[j].parentNode.nodeName=='TBODY')
					{
						trs[j].onmouseover=function(){this.className='ruled';return false}
						trs[j].onmouseout=function(){this.className='';return false}
					}
				}
			}
		}
	}
}



