// Gives the inputItem focus
function setFocus(inputItem)
{
	inputItem.focus();
}

// Clicks the passed in button if enter key was pressed
function DefaultButton(btn, event)
{
	//alert("got here");
	if (document.all)
	{
		if (event.keyCode == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
	else if (document.getElementById)
	{
		if (event.which == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
	else if(document.layers)
	{
		if(event.which == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
}

function createMainLink (theName,theID,theWidth,theHeight,thebackground,theLink) {
	//if(document.layers) document.write('<td background="'+thebackground+'" align="center" valign="top" class="topNavNetscape"><ilayer id="'+theID+'ButtonParent" visibility="hide"><layer id="'+theID+'Button" width="'+theWidth+'" height="'+theHeight+'">');
	//else
	document.write('<td background="'+thebackground+'" valign="top" align="center" class="topNav" width="'+theWidth+'" height="'+theHeight+'" id="'+theID+'Button">');

	document.write('<img src="/images/spacer.gif" width="1" height="3" alt=""><br>');
	if(theLink) document.write('<a href="'+theLink+'" target="_blank">');
	document.write('<center>'+theName+'</center>');
	if(theLink) document.write('</a>');

	//if(document.layers) document.write('</layer></ilayer>');
	document.write('</td>');
}

function createSubLink (theSubName,theSubID,theSubWidth,theSubHeight,theSubLink,theParentID,hasChild,isAltColor) {
	if(isAltColor) {
		bgColor = dropdownBGcolorAlt;
		bgColorOver = dropdownBGcolorOverAlt;
		bgClass = "dropdownAlt";
	} else {
		bgColor = dropdownBGcolor;
		bgColorOver = dropdownBGcolorOver;
		bgClass = "dropdown";
	}
	var theOutput = "";
	theOutput += '<tr><td><img src="/images/spacer.gif" width="1" height="'+theSubHeight+'" alt=""></td>';
	if(document.layers) {
		theOutput += '<td valign="middle" class="'+bgClass+'Netscape"><ilayer id="'+theSubID+'ButtonParent"><layer id="'+theSubID+'Button" width="'+theSubWidth+'" height="'+theSubHeight+'">';
	} else {
		theOutput += '<td valign="top" class="'+bgClass+'" width="'+theSubWidth+'" height="'+theSubHeight+'" id="'+theSubID+'Button">';
	}
	if(document.layers) theOutput += '<img src="/images/spacer.gif" width="1" height="2" alt=""><br>';
	if(theSubLink && !hasChild) theOutput += '<a href="'+theSubLink+'" onmouseover="subRollover(\''+theSubID+'Button\',\''+theParentID+'\',\''+bgColorOver+'\');" onmouseout="subRollover(\''+theSubID+'Button\',\''+theParentID+'\',\''+bgColor+'\');">';
	else if(theSubLink && hasChild) theOutput += '<a href="'+theSubLink+'">';
	theOutput += "<div class='indent'>" + theSubName + "</div>";
	if(theSubLink) theOutput += '</a>';
	if(document.layers) theOutput += '</layer></ilayer>';
	theOutput += '</td><td><img src="/images/spacer.gif" width="1" height="1" alt=""></td>';
	theOutput += '</tr>';
	return theOutput;
}

function mainRollover(theRollover,theState) {
	theImageName=document.images[theRollover].src;
	theImageName=theImageName.substr(0,theImageName.length-4);
	if (theImageName.indexOf("_over") != -1) theImageName = theImageName.substr(0,theImageName.length-5);
	theImageName = theImageName + theState + ".gif";
	document.images[theRollover].src = theImageName;
}


function subRollover(theRollover,theRolloverParent,theBackgroundColor) {
	if(ns4) document[theRolloverParent].document[theRollover + "Parent"].document[theRollover].bgColor = theBackgroundColor;
	else {
		var whichBackground = getReference(theRollover);
		whichBackground.backgroundColor = theBackgroundColor;
	}
}

// IE3 safe image switching code
var goodBrowser = 0;

if(document.images){
        // enable rollovers
        goodBrowser = 1;
        
        //image preloading stuff
        //put your images that will be used into a comma delimited
        //list on the next line... follow the example =)
        var preLoad = new Array('/images/page_nav_about_over.gif','/images/page_nav_brands_over.gif','/images/page_nav_customerService_over.gif','/images/page_nav_kids_over.gif','/images/page_nav_investorsNews_over.gif','/images/auragenOn.gif');

        //don't touch this (it does the pre-loading for you)
        for(var i = 0; i < preLoad.length;i++){
                var k = new Image();
                k.src = preLoad[i];
        }
        
}

function flipper(){
        if(goodBrowser == 1){
                for(var i = 0; i < flipper.arguments.length; i += 2){
                document.images[flipper.arguments[i]].src = flipper.arguments[i+1];
                }
        }

}

function popWindow(theURL,theName,theOptions){
        var newWin = window.open(theURL,theName,theOptions);
        newWin.focus();
}