// where are we in the site?
folderSlashes = "";

for (i=0;i<folderLevel;i++) {
	folderSlashes = folderSlashes + "../";
}

// load the stylesheets
if (document.layers) {
	document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+folderSlashes+"includes/style_ns4.css\">")
}
else {
	document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+folderSlashes+"includes/style_dom.css\">")
}

// preload constant menu buttons
var btnConstant = new Array();
btnConstant = ["","home","aboutus","contact","sitemap","financing","faq"];
for (i=0;i<btnConstant.length;i++) {
	eval("C"+i+"on = new Image();"); eval("C"+i+"off = new Image();");
	if (isHomepage == 1) {
	eval("C"+(i)+"on.src = \""+folderSlashes+"img/buttons/hmp_cnst_btn_"+btnConstant[i]+"_r.gif\";");
	eval("C"+(i)+"off.src = \""+folderSlashes+"img/buttons/hmp_cnst_btn_"+btnConstant[i]+"_0.gif\";");
	}
	else {
	eval("C"+(i)+"on.src = \""+folderSlashes+"img/buttons/cnst_btn_"+btnConstant[i]+"_r.gif\";");
	eval("C"+(i)+"off.src = \""+folderSlashes+"img/buttons/cnst_btn_"+btnConstant[i]+"_0.gif\";");
	}
}

// preload homepage images
if (isHomepage == 1) {
	HfbOn = new Image(); HfbOff = new Image();
	HfbOn.src = "img/buttons/hmp_btn_focus_r.gif";
	HfbOff.src = "img/buttons/hmp_btn_focus_0.gif";
}

// preload go button images
goBtnOn = new Image(); goBtnOff = new Image();
goBtnOn.src = folderSlashes + "img/buttons/btn_go_r.gif";
goBtnOff.src = folderSlashes + "img/buttons/btn_go_0.gif";

// preload arrow button images
focGrayBtnOn = new Image(); focGrayBtnOff = new Image();
focGrayBtnOn.src = folderSlashes + "img/buttons/btn_right-arrow-gray_r.gif";
focGrayBtnOff.src = folderSlashes + "img/buttons/btn_right-arrow-gray_0.gif";
focWhiteBtnOn = new Image(); focWhiteBtnOff = new Image();
focWhiteBtnOn.src = folderSlashes + "img/buttons/btn_right-arrow-white_r.gif";
focWhiteBtnOff.src = folderSlashes + "img/buttons/btn_right-arrow-white_0.gif";

// preload level one buttons (only the "services" button, since it does not have a DHTML menu)
menu3On = new Image(); menu3Off = new Image();
menu3On.src = folderSlashes + "img/buttons/l1_btn_whymod_r.gif";
menu3Off.src = folderSlashes + "img/buttons/l1_btn_whymod_0.gif";

// preload buynow buttons
if (selectedL1 == 1) {
	buynowOn = new Image(); buynowOff = new Image();
	buynowOn.src = folderSlashes + "img/buttons/btn_buynow_r.gif";
	buynowOff.src = folderSlashes + "img/buttons/btn_buynow_0.gif";
}

// preload focus area buttons (contact page)
if (selectedConstant == 3) {
	pleaseContactOn = new Image(); pleaseContactOff = new Image();
	pleaseContactOn.src = folderSlashes + "img/buttons/focus_please-contact-me_r.gif";
	pleaseContactOff.src = folderSlashes + "img/buttons/focus_please-contact-me_0.gif";
	viewOptionsOn = new Image(); viewOptionsOff = new Image();
	viewOptionsOn.src = folderSlashes + "img/buttons/focus_view-purchase-options_r.gif";
	viewOptionsOff.src = folderSlashes + "img/buttons/focus_view-purchase-options_0.gif";
}

// preload arrow buttons (suppliers page)
if (selectedL1 == 4 && selectedL2 == 1) {
	btnOn = new Image(); btnOff = new Image();
	btnOn.src = folderSlashes + "img/buttons/btn_focus-arrow_r.gif";
	btnOff.src = folderSlashes + "img/buttons/btn_focus-arrow_0.gif";
}

// image rollover
function changeImages() {
	for (var i=0; i<changeImages.arguments.length; i+=2) {
	document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src"); 
	}
}

function bgOn(td){
	if(document.getElementById||(document.all && !(document.getElementById))){
		td.style.backgroundColor="#6B639C";
	}
}

function bgOff(td){
	if(document.getElementById||(document.all && !(document.getElementById))){
		td.style.backgroundColor="#BDBDDE";
	}
}

// reloads page in NS4 (refresh problems)
if (document.layers) {
	origWidth = innerWidth;
	origHeight = innerHeight;
}
function reDo() {
	if (innerWidth != origWidth || innerHeight != origHeight) {
	location.reload();
	}
}
if (document.layers) {
	onresize = reDo;
}

function go() {
	var selectObj = document.productMenu.selectProduct;
	if (selectObj.options[selectObj.selectedIndex].value != "stay") {
		location = selectObj.options[selectObj.selectedIndex].value;
	}
}

// opens screenshots in windows
function openScreenshot(img,width,height) {
	sswin = window.open(folderSlashes+'screenshot_window.php?img='+img,'sswin','width='+width+',height='+height);
	sswin.focus();
}