function printpage(searchURL){
	if (window.print != null) {
		window.print();
	} else {
		alert("Sorry, you're browser does not support this functionality.  Please select \"Print\" from the \"File\" menu at the top of your browser.");
	}
}

function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


function checknettuneform(){
	if (acctform.rules.checked == false ){
	alert('Please agree to the Disclaimer.');
	return false;
	}	
	return true;
	
}

function checkform(){
	if (document.frmSearch.STATE.options[document.frmSearch.STATE.selectedIndex].value.length==0){
		alert('Please select a location.');
		document.frmSearch.STATE.focus();
		return false;
	}

	return true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
// Sniff for the two major browsers
	var ie  = (document.all)? true:false
	var ns6 = ((document.getElementById)&&(!ie))? true:false
	

// Sniff for Mac, used for IE Mac browsers
	var mac = (navigator.userAgent.toUpperCase().indexOf("MAC") > -1)? true:false

// Used to test if a value is 'undefined'.  What 'undefined' represents is different for each
// browser, but any variable that has not been defined a value IS 'undefined' in all browsers.
// So, we'll test against this variable to see if another is 'undefined'.
	var undef;

	var bgXcoord = 0;

	var HideText = "";

// var is declared in universal nav offsite code, used to define full path.
// check if it has one.
	if (T1navPath == undef) {
		var T1navPath = "";
	}

	var PreloadComplete = false;
	var HomePreloadComplete = false;

	var MouseOverColor = "#C4C4C4";
	var MouseOffColor = "#DADAD5";


// These links are considered absolute links at this point.
// Adjust topNavMacWidth[] when the contents of this nav change.
/*
var topNavMenu = new Array();

	topNavMenu["Receiver0"] = new Array("TX-NR901P", "../model.cfm?class=Receiver&m=TX-NR901P&p=i");
	topNavMenu["Receiver1"] = new Array("TX-NR801P", "../model.cfm?class=Receiver&m=TX-NR801P&p=i");
	topNavMenu["Receiver2"] = new Array("TX-SR55", "../model.cfm?class=Receiver&m=TX-SR55&p=i");
	topNavMenu["Receiver3"] = new Array("TX-8511P", "../model.cfm?class=Receiver&m=TX-8511P&p=i");
	topNavMenu["Receiver4"] = new Array("NC-500P", "../model.cfm?class=Receiver&m=NC-500P&p=i");
	topNavMenu["Receiver5"] = new Array("All Models", "../prod_class.cfm?class=Receiver");

	topNavMenu["DVD0"] = new Array("DV-CP702P", "../model.cfm?class=DVD&m=DV-CP702P&p=i");
	topNavMenu["DVD1"] = new Array("DV-SP55", "../model.cfm?class=DVD&m=DV-SP55&p=i");
	topNavMenu["DVD2"] = new Array("All Models", "../prod_class.cfm?class=DVD");
	
	topNavMenu["CD0"] = new Array("DX-C34", "../model.cfm?class=Compact Disc&m=DX-C34&p=i");
	topNavMenu["CD1"] = new Array("All Models", "../prod_class.cfm?class=Compact Disc");
	
	topNavMenu["Amplifier0"] = new Array("M-282P", "../model.cfm?class=Amplifier&m=M-282P&p=i");
	topNavMenu["Amplifier1"] = new Array("All Models", "../prod_class.cfm?class=Amplifier");
	
	topNavMenu["Cassette0"] = new Array("TA-RW255P", "../model.cfm?class=Cassette&m=TA-RW255P&p=i");
	topNavMenu["Cassette1"] = new Array("All Models", "../prod_class.cfm?class=Cassette");
	
	var topNavContents = new Array();
	topNavContents["Receiver"] = "";
	topNavContents["DVD"] = "";
	topNavContents["CD"] = "";
	topNavContents["Amplifier"] = "";
	topNavContents["Cassette"] = "";
	topNavContents["Nettune"] = "";
	topNavContents["Systems"] = "";
	topNavContents["Speaker"] = "";
	topNavContents["Digital"] = "";
	topNavContents["Acc"] = "";
	topNavContents["MM"] = "";
	topNavContents["Audiosys"] = "";

	var topNavMacWidth = new Array();
	topNavMacWidth["Receiver"] = "130";
	topNavMacWidth["DVD"] = "130";
	topNavMacWidth["CD"] = "130";
	topNavMacWidth["Amplifier"] = "130";
	topNavMacWidth["Cassette"] = "130";
	topNavMacWidth["Nettune"] = "130";
	topNavMacWidth["Systems"] = "130";
	topNavMacWidth["Speaker"] = "130";
	topNavMacWidth["Digital"] = "130";
	topNavMacWidth["Acc"] = "130";
	topNavMacWidth["MM"] = "130";
	topNavMacWidth["Audiosys"] = "130";
	
*/	

// Layer Build functions.  The IF verifies that, if a layer doesn't exist
// the function will return null instead of a JavaScript error.
	function refLayer(layerName) {
		var LAYref;
		if (ie) {
			if (document.all[layerName]) {
				document.all[layerName].layerWidth = function() { return this.scrollWidth; };
				LAYref = document.all[layerName];
				HideText = "hidden";
			} else {
				LAYref = null;
			}
		} else {
		    // default to NS6+
			if (document.getElementById(layerName)) {
				HTMLElement.prototype.layerWidth = function() { return this.offsetWidth; };
				LAYref = document.getElementById(layerName);
					HideText = "hidden";
			} else {
				LAYref = null;
			}
		}
			return LAYref;
	}


// Functions to determine browser window width/height
	function getInsideWindowWidth() {
		if (ie) {
			return document.body.scrollWidth
		} else {
			return window.innerWidth
		}
	}

	function getInsideWindowHeight() {
		if (ie) {
			return document.body.scrollHeight
		} else {
			return window.innerHeight
		}
	}


// Calculate Offsets from current item.
	function eventXoffset(nsEvt) {
		if (ie) {
			return document.body.scrollLeft - document.body.clientLeft + event.clientX - event.offsetX;
		} else {
			return nsEvt.pageX - nsEvt.layerX
		}
	}

	function eventYoffset(nsEvt) {
		if (ie) {
			return document.body.scrollTop - document.body.clientTop + event.clientY - event.offsetY;
		} else {
			return 150
		}
	}


// Create the objects
	function menuInit() {
		LAYtopNavMenu = refLayer("topNavDIV");
		LAYarrowHL = refLayer("arrowHL");
		PreloadComplete = true;
	}


//****************************************
//** Top Nav DHTML Menu Functions START **
//****************************************

	var NotInMenuNow = true;

	function topNavBuild(menuName) {
		var i, menuHTML, linkURL;
// Build Menu Contents.  Should only be done once.
		i = 0;
		menuHTML = "";

		while (topNavMenu[menuName + i]) {
		//	menuHTML += '<DIV CLASS="menuSpacer" STYLE="width:52px; height:1px;"></DIV>\n';

// If this is a JavaScript command, just use it instead of trying a document.location.href.
			if (topNavMenu[menuName + i][1].toLowerCase().indexOf("javascript:") == 0) {
				linkURL = topNavMenu[menuName + i][1].substr(11);
			} else if (topNavMenu[menuName + i][1].toLowerCase().indexOf("http") == 0) {
				linkURL = "top.location.href='"+topNavMenu[menuName+i][1]+"'";
			} else {
				linkURL = "top.location.href='"+T1navPath+topNavMenu[menuName+i][1]+"'";
			}
			menuHTML += '<DIV CLASS="menuItem" onClick="'+linkURL+'" onMouseOver="changeBGcolor(this, MouseOverColor)" onMouseOut="changeBGcolor(this, MouseOffColor)"'

			if (ie && mac) {
				menuHTML += ' STYLE="width:'+topNavMacWidth[menuName]+'px;"'
			}
			menuHTML += '><NOBR>'+topNavMenu[menuName + i][0]+'&nbsp;</NOBR></DIV>\n';
			i++;
		}

		return menuHTML;
	}



// Top Nav Dropdown functions
// Check PreloadComplete on these just in case
	function showTopNavDD() {
		if (PreloadComplete) {
			NotInMenuNow = false;
			LAYtopNavMenu.style.visibility = "inherit";
		}
	}

	function hideTopNavDD(FirstTry) {
		if (PreloadComplete) {
			if (FirstTry) {
				NotInMenuNow = true;
				setTimeout("hideTopNavDD(false)", 50);
			} else if (NotInMenuNow) {
				LAYtopNavMenu.style.visibility = "hidden";
			}
		}
	}


	function revealTopNavDD(menuName, xCoord, yCoord, evt) {
		var MenuEdge, MDxCoord, MDyCoord;

		if (PreloadComplete) {
		    //** Hide menu and move it off the page.  This resolves menu flicker. **
			NotInMenuNow = true;
			hideTopNavDD(false);
			LAYtopNavMenu.style.left = -200;
			LAYtopNavMenu.style.top = -200;

// If we haven't viewed this menu before, write out its contents and store in array.
			if (topNavContents[menuName] == "") {
				topNavContents[menuName] = topNavBuild(menuName);
			}

			LAYtopNavMenu.innerHTML = topNavContents[menuName];

// Calculate right edge of menu.  If it's past the edge of the centered table, align it so it is.
// This layer is in a table cell, which triggers an IE5 Mac positioning bug.
// To fix it, set these vars to 0.
			if (ie && mac) {
				MDxCoord = 0;
				MDyCoord = 0;
			} else {
				MDxCoord = eventXoffset(evt);
				MDyCoord = eventYoffset(evt);
			}

			LeftPageStart = (getInsideWindowWidth()-778)/2;
			MenuEdge = MDxCoord + xCoord + LAYtopNavMenu.layerWidth() - LeftPageStart;

			if (MenuEdge > 778) {
// The right edge of the menu is beyond the designed-for
// 778 pixel page width.  Adjust MDxCoord appropriately.
				MDxCoord -= (MenuEdge-776);
			}

		    //** Set left & top coordinates. **
			LAYtopNavMenu.style.left = MDxCoord + xCoord;
			LAYtopNavMenu.style.top = MDyCoord + yCoord;

			showTopNavDD();
		}
	}


	function changeBGcolor(LAYer, hexColor) {
		if (PreloadComplete) {
			LAYer.style.backgroundColor = hexColor;
		}
	}



//**************************************
//** Top Nav DHTML Menu Functions END **
//**************************************

