// Orange nav v1.0
// written by Stephen Brown
// AKQA
// 10th Novemeber 2000

// this nav includes the following functions:

// 	create_menus
// 	show_menu
// 	hide_menu
// 	show_sub
// 	hide_sub
// 	hide_all
// 	menuOver
// 	menuOut
// 	ns_hidehilights
// 	set_timeout
// 	clear_timer
// 	write_nav

// the following functions will show / hide Flash Animations
// when the navigation menu opens:

// 	show_flash
// 	hide_flash
// 	start_layer (top, left, width)
// 	end_layer
// 	startFlash (top, left, flashfile, flashwidth, flashheight, giffile, gifwidth, gifheight)
// 	endFlash (thislayer)

// Cookie information for the e-sales shopping basket
// 	GetCookie
// 	insertBasket

// netscape / IE 3 and less detect
// nsie3_det

// NEW Functions for Global Body TAGS
// These two functions are left blank, to stop errors should you not wish to
// create one on your document, the reason for these is that you can add
// functions and script to the ONLOAD and ONUNLOAD properties of the BODY
// without actually amending the body TAG itself.

var disableNav = 0;

function DisableNavigation() {
	disableNav = 1;
}

function ora_doc_onload() {}
function ora_doc_onunload() {}
// These are the main functions that can be amended when ONLOAD and ONUNLOAD
// are to be changed for global site
function ora_body_onload() {
	ora_doc_onload(); // DO NOT REMOVE
}
function ora_body_onunload() {
	ora_doc_onunload(); // DO NOT REMOVE
}

// setting up new Arrays for Orange dHTML menu
function create_menus() {
	if(buttonsAdded == false) {
		addSizeButtons();
		buttonsAdded = true;
	}
	args = create_menus.arguments;
	var ID = args[0];
	var direction;
	var javaStart;
	var javaEnd;

	if(document.layers) {
		// Netscape Navigator/Communicator Menu
		for(i=0; i<dMenu[ID].length; i++) {
			direction=(dSubMenu[ID].direction=="left")?"left":"right";
			// Navigation Menu Item
			document.write('<LAYER NAME="dNav'+ID+i+'" Z-INDEX="100" BGCOLOR="#FF6600" POSITION="absolute" VISIBILITY="hide" LEFT="'+dMenu[ID].nsleft+'" TOP="'+dMenu[ID].top+'" WIDTH="'+dMenu[ID].nswidth+'" HEIGHT="20" OnMouseOver="menuOver('+ID+','+i+');" OnMouseOut="menuOut('+ID+','+i+');">\n');
			document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="'+dMenu[ID].nswidth+'">\n');
			document.write('<TR>\n');
			document.write('<TD VALIGN="TOP">\n');
			if(dSubMenu[ID][i][0] && direction == "left") {
				document.write('<IMG SRC="http://'+orangehost+'/images/'+direction+'_tri.gif" WIDTH=10 HEIGHT="20" BORDER=0>\n');
			} else {
				document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH=10 HEIGHT="20" BORDER=0>\n');
			}
			document.write('</TD><TD VALIGN="TOP" NOWRAP>\n');
			document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH="'+(dMenu[ID].nswidth-20)+'" HEIGHT=2 BORDER=0><BR>\n');

			var thisHREF = dMenu[ID].links[i];
			var thisTarget = "";
			if(thisHREF.indexOf("javascript:") != -1) {
				if(thisHREF.indexOf("window.open") != -1) {
					thisHREF = thisHREF.substring(24, thisHREF.indexOf("')"));
					thisTarget = ' TARGET="_blank"';
				}
			}

			document.write('<A HREF="javascript:ora_navTrackLink(-1,\''+escape(thisHREF)+'\',\''+dMenu[ID][i]+'\');" CLASS="whitelink"'+thisTarget+'><FONT SIZE="-1">\n');
			document.write(dMenu[ID][i]);
			document.write('</FONT></A>\n');
			document.write('</TD><TD>\n');
			if(dSubMenu[ID][i][0] && direction == "right") {
				document.write('<IMG SRC="http://'+orangehost+'/images/'+direction+'_tri.gif" WIDTH=10 HEIGHT=18 BORDER=0>\n');
			} else {
				document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH=10 HEIGHT=18 BORDER=0>\n');
			}
			document.write('</TD>\n');
			document.write('</TR>\n');
			document.write('</TABLE>\n');
			document.write('</LAYER>\n');

			// Over Navigation Menu Item
			document.write('<LAYER NAME="dNav'+ID+i+'Over" Z-INDEX="100" BGCOLOR="#000000" POSITION="absolute" VISIBILITY="hide" LEFT="'+dMenu[ID].nsleft+'" TOP="'+dMenu[ID].top+'" WIDTH="'+dMenu[ID].nswidth+'" HEIGHT="20" OnMouseOver="menuOver('+ID+','+i+');" OnMouseOut="menuOut('+ID+','+i+');">\n');
			document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="'+dMenu[ID].nswidth+'">\n');
			document.write('<TR>\n');
			document.write('<TD VALIGN="TOP">\n');
			if(dSubMenu[ID][i][0] && direction == "left") {
				document.write('<IMG SRC="http://'+orangehost+'/images/'+direction+'_tri.gif" WIDTH=10 HEIGHT="20" BORDER=0>\n');
			} else {
				document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH=10 HEIGHT="20" BORDER=0>\n');
			}
			document.write('</TD><TD VALIGN="TOP" NOWRAP>\n');
			document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH="'+(dMenu[ID].nswidth-20)+'" HEIGHT=2 BORDER=0><BR>\n');
			document.write('<A HREF="javascript:ora_navTrackLink(-1,\''+escape(thisHREF)+'\',\''+dMenu[ID][i]+'\');" CLASS="whitelink"'+thisTarget+'><FONT SIZE="-1">\n');
			document.write(dMenu[ID][i]);
			document.write('</FONT></A>\n');
			document.write('</TD><TD>\n');
			if(dSubMenu[ID][i][0] && direction == "right") {
				document.write('<IMG SRC="http://'+orangehost+'/images/'+direction+'_tri.gif" WIDTH=10 HEIGHT=18 BORDER=0>\n');
			} else {
				document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH=10 HEIGHT=18 BORDER=0>\n');
			}
			document.write('</TD>\n');
			document.write('</TR>\n');
			document.write('</TABLE>\n');
			document.write('</LAYER>\n');

			if(dSubMenu[ID][i].length) {
				var top=dMenu[ID].top;
				for(j=0; j<dSubMenu[ID][i].length; j++) {
					var submenuleft=(dMenu[ID].nsleft+dMenu[ID].nswidth);
					if(direction == "left") {
						submenuleft=(dMenu[ID].nsleft-dSubMenu[ID].nswidth);
					}
					// Navigation Menu Item
					document.write('<LAYER NAME="dNav'+ID+i+'O'+j+'" Z-INDEX="100" BGCOLOR="#FF6600" POSITION="absolute" VISIBILITY="hide" LEFT="'+submenuleft+'" TOP="'+top+'" WIDTH="'+dSubMenu[ID].nswidth+'" HEIGHT="20" OnMouseOver="menuOver('+ID+','+i+','+j+');">\n');
					document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="'+dSubMenu[ID].nswidth+'">\n');
					document.write('<TR>\n');
					document.write('<TD VALIGN="TOP">\n');
					document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH=10 HEIGHT="20" BORDER=0>\n');
					document.write('</TD><TD VALIGN="TOP" NOWRAP>\n');
					document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH="'+(dSubMenu[ID].nswidth-20)+'" HEIGHT=2 BORDER=0><BR>\n');
					var thisSubHREF = dSubMenu[ID][i].links[j];
					var thisTarget = "";
					if(thisSubHREF.indexOf("javascript:") != -1) {
						if(thisSubHREF.indexOf("window.open") != -1)
						{
							thisSubHREF = thisSubHREF.substring(24, thisSubHREF.indexOf("')"));
							thisTarget = ' TARGET="_blank"';
						}
					}

					document.write('<A HREF="javascript:ora_navTrackLink(-1,\''+escape(thisSubHREF)+'\',\''+dSubMenu[ID][i][j]+'\');" CLASS="whitelink"'+thisTarget+'><FONT SIZE="-1">\n');
					document.write(dSubMenu[ID][i][j]);
					document.write('</FONT></A>\n');
					document.write('</TD><TD>\n');
					document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH=10 HEIGHT=18 BORDER=0>\n');
					document.write('</TD>\n');
					document.write('</TR>\n');
					document.write('</TABLE>\n');
					document.write('</LAYER>\n');

					// Over Navigation Menu Item
					document.write('<LAYER NAME="dNav'+ID+i+'O'+j+'Over" Z-INDEX="100" BGCOLOR="#000000" POSITION="absolute" VISIBILITY="hide" LEFT="'+submenuleft+'" TOP="'+top+'" WIDTH="'+dSubMenu[ID].nswidth+'" HEIGHT="20" OnMouseOut="menuOut('+ID+','+i+','+j+');">\n');
					document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="'+dSubMenu[ID].nswidth+'">\n');
					document.write('<TR>\n');
					document.write('<TD VALIGN="TOP">\n');
					document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH=10 HEIGHT="20" BORDER=0>\n');
					document.write('</TD><TD VALIGN="TOP" NOWRAP>\n');
					document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH="'+(dSubMenu[ID].nswidth-20)+'" HEIGHT=2 BORDER=0><BR>\n');
					document.write('<A HREF="javascript:ora_navTrackLink(-1,\''+escape(thisSubHREF)+'\',\''+dSubMenu[ID][i][j]+'\');" CLASS="whitelink"'+thisTarget+'><FONT SIZE="-1">\n');
					document.write(dSubMenu[ID][i][j]);
					document.write('</FONT></A>\n');
					document.write('</TD><TD>\n');
					document.write('<IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH=10 HEIGHT=18 BORDER=0>\n');
					document.write('</TD>\n');
					document.write('</TR>\n');
					document.write('</TABLE>\n');
					document.write('</LAYER>\n');
					top+=20;
				}
			}
			dMenu[ID].top+=20;
		}
	} else if(document.all || document.getElementById) {
		// Internet Explorer Menu
		for(i=0; i<dMenu[ID].length; i++) {
			direction=dSubMenu[ID].direction=="left"?"left":"right";
			var thisHREF = dMenu[ID].links[i];
			// Convert js_ to javascript:
			if(thisHREF.indexOf("js_") != -1) {
				thisHREF = "javascript:" + thisHREF.substring(3);
			}
			var altText = ID+'_'+i;
			altText = ''; // comment this out to enable tracing
			document.write('<div id="dNav'+ID+''+i+'" style="z-index:100; background:#ff6600; position:absolute; visibility:hidden; left:'+dMenu[ID].left+'; top:'+dMenu[ID].top+'; width:'+dMenu[ID].width+'; height:20;" onmouseover="menuOver('+ID+','+i+');" onmouseout="menuOut('+ID+','+i+');" onclick="ora_navTrackLink(-1,\''+escape(thisHREF)+'\',\''+dMenu[ID][i]+'\');">');
			document.write('<table cellpadding="0" cellspacing="0" border="0" width="'+dMenu[ID].width+'">\n');
			document.write('<tr>');
			document.write('<td valign="top">');
			if(dSubMenu[ID][i][0] && direction == "left") {
				document.write('<img name="dImage'+ID+i+'" src="http://'+orangehost+'/images/'+direction+'_tri.gif" width="10" height="20" border="0" alt="'+altText+'" />');
			} else {
				document.write('<img src="http://'+orangehost+'/images/clear.gif" width="10" height="20" border="0" alt="'+altText+'" />');
			}
			document.write('</td><td valign="top" nowrap="nowrap" class="whitelink" id="dTable'+ID+''+i+'">');
			document.write('<img src="http://'+orangehost+'/images/clear.gif" width="'+(dMenu[ID].width-20)+'" height="2" border="0" alt="'+altText+'" /><br />');
			document.write(dMenu[ID][i]);
			document.write('</td><td>');
			if(dSubMenu[ID][i][0] && direction == "right") {
				document.write('<img name="dImage'+ID+i+'" src="http://'+orangehost+'/images/'+direction+'_tri.gif" width="10" height="18" border="0" alt="'+altText+'" />');
			} else {
				document.write('<img src="http://'+orangehost+'/images/clear.gif" width="10" height="18" border="0" alt="'+altText+'" />');
			}
			document.write('</td>');
			document.write('</tr>\n');
			document.write('</table>\n');
			document.write('</div>\n');

			// Sub Menu Generation
			if(dSubMenu[ID][i][0]) {
				var top=dMenu[ID].top;
				for(j=0; j<dSubMenu[ID][i].length; j++) {
					var submenuleft=(dMenu[ID].left+dMenu[ID].width);
					if(direction == "left") {
						submenuleft=(dMenu[ID].left-dSubMenu[ID].width);
					}
					var thisSubHREF = dSubMenu[ID][i].links[j];
					var altSubText = +ID+'_'+i+'_'+j;
					altSubText = ''; // comment this out to enable tracing
					document.write('<div id="dNav'+ID+''+i+'O'+j+'" style="z-index:100; background:#FF6600; position:absolute; visibility:hidden; left:'+submenuleft+'; top:'+top+'; width:'+dSubMenu[ID].width+'; height:20;" onmouseover="menuOver('+ID+','+i+','+j+');" onmouseout="menuOut('+ID+','+i+','+j+');" onclick="ora_navTrackLink(-1,\''+escape(thisSubHREF)+'\',\''+dSubMenu[ID][i][j]+'\');">');
					document.write('<table cellpadding="0" cellspacing="0" border="0" width="'+dSubMenu[ID].width+'">\n');
					document.write('<tr>');
					document.write('<td valign="top">');
					document.write('<img src="http://'+orangehost+'/images/clear.gif" width="10" height="20" border="0" alt="'+altSubText+'" />');
					document.write('</td><td valign="top" nowrap="nowrap" class="whitelink" id="dTable'+ID+''+i+'O'+j+'">');
					document.write('<img src="http://'+orangehost+'/images/clear.gif" width="'+(dSubMenu[ID].width-20)+'" height="2" border="0" alt="'+altSubText+'" /><br />');
					document.write(dSubMenu[ID][i][j]);
					document.write('</td><td>');
					document.write('<img src="http://'+orangehost+'/images/clear.gif" width="10" height="18" border="0" alt="'+altSubText+'" />');
					document.write('</td>');
					document.write('</tr>\n');
					document.write('</table>\n');
					document.write('</div>\n');
					top+=20;
				}
			}
			dMenu[ID].top+=20;
		}
	}
}
function show_menu(menu) {
	if (isMac || isOpera || disableNav) {
		return;
	}		
	hide_all(1);
	if(document.layers) {
		ns_hidehilights(menu);
	}
	clear_timer();
	if(document.all) {
		for(i=0; i<dMenu[menu].length; i++) {
			document.all['dNav'+menu+i].style.visibility='visible';
		}
	} else if(document.getElementById) {
		for(i=0; i<dMenu[menu].length; i++) {
			document.getElementById('dNav'+menu+i).visibility='visible';
		}
	} else if(document.layers) {
		for(i=0; i<dMenu[menu].length; i++) {
			document.layers['dNav'+menu+i].visibility='show';
		}
	}
}
function hide_menu(menu) {
	if (isMac || isOpera || disableNav) {
		return;
	}
	if(document.all) {
		for(i=0; i<dMenu[menu].length; i++) {
			document.all['dNav'+menu+i].style.visibility='hidden';
		}
	} else if(document.getElementById) {
		for(i=0; i<dMenu[menu].length; i++) {
			document.getElementById('dNav'+menu+i).style.visibility='hidden';
		}
	} else if(document.layers) {
		for(i=0; i<dMenu[menu].length; i++) {
			document.layers['dNav'+menu+i].visibility='hide';
			document.layers['dNav'+menu+i+'Over'].visibility='hide';
		}
	}
	return menu;
}
function show_sub(menu,item) {
	if (isMac || isOpera) {
		return;
	}
	if(document.all && dSubMenu[menu][item][0] != "undefined") {
		for(i=0; i<dSubMenu[menu][item].length; i++) {
			document.all['dNav'+menu+item+'O'+i].style.visibility='visible';
			document.all['dNav'+menu+item].style.background="#000000";
		}
	} else if(document.getElementById && dSubMenu[menu][item][0] != "undefined") {
		for(i=0; i<dSubMenu[menu][item].length; i++) {
			document.getElementById('dNav'+menu+item+'O'+i).style.visibility='visible';
			document.getElementById('dNav'+menu+item).style.background="#000000";
		}
	} else if(document.layers && dSubMenu[menu][item][0] != "undefined") {
		for(i=0; i<dSubMenu[menu][item].length; i++) {
			document.layers['dNav'+menu+item+'O'+i].visibility='show';
		}
	}
}
function hide_sub(menu,item) {
	if (isMac || isOpera) {
		return;
	}
	if(document.all) {
		if(document.all['dNav'+menu+item+'O'+'0']) {
			for(i=0; i<dSubMenu[menu][item].length; i++) {
				document.all['dNav'+menu+item+'O'+i].style.visibility='hidden';
				document.all['dNav'+menu+item].style.background="#FF6600";
				document.all['dTable'+menu+item].className="whitelink";
			}
		}
	} else if(document.getElementById) {
		if(document.getElementById('dNav'+menu+item+'O'+'0')) {
			for(i=0; i<dSubMenu[menu][item].length; i++) {
				document.getElementById('dNav'+menu+item+'O'+i).style.visibility='hidden';
				document.getElementById('dNav'+menu+item).style.background="#FF6600";
				document.getElementById('dTable'+menu+item).className="whitelink";
			}
		}
	} else if(document.layers) {
		if(document.layers['dNav'+menu+item+'O'+'0']) {
			for(i=0; i<dSubMenu[menu][item].length; i++) {
				document.layers['dNav'+menu+item+'O'+i].visibility='hide';
				document.layers['dNav'+menu+item+'O'+i+'Over'].visibility='hide';
			}
		}
	}
	return item;
}
function hide_all(flash) {
	for(i=0; i<dMenu.length; i++) {
		i = hide_menu(i);
	}
	var dsmi;
	for(k=0; k<dSubMenu.length; k++) {
		dsmi = dSubMenu[k].length;
		for(j=0; j<dsmi; j++) {
			hide_sub(k,j);
		}
	}
	if(flash) hide_flash()
	else show_flash();
}
function menuOver(menu,item,sub) {
	if (isMac || isOpera) {
		return;
	}
	if(document.layers) ns_hidehilights(menu,item);
	clear_timer();
	if(sub || sub == 0) {
		show_sub(menu,item);
		if(document.all) {
			document.all['dNav'+menu+item+'O'+sub].style.background="#000000";
		} else if(document.getElementById) {
			document.getElementById('dNav'+menu+item+'O'+sub).style.background="#000000";
		} else if(document.layers) {
			document.layers['dNav'+menu+item+'O'+sub].visibility='hide';
			document.layers['dNav'+menu+item+'O'+sub+'Over'].visibility='show';
			document.layers['dNav'+menu+item+'Over'].visibility='show';
		}
	} else {
		if(document.all) {
			document.all['dNav'+menu+item].style.background="#000000";
			if(dMenu[menu][item].length>0) {
				hide_sub(openmenu,openitem);
				show_sub(menu,item);
			}
		} else if(document.getElementById) {
			document.getElementById['dNav'+menu+item].style.background="#000000";
			if(dMenu[menu][item].length>0) {
				hide_sub(openmenu,openitem);
				show_sub(menu,item);
			}
		} else if(document.layers) {
			document.layers['dNav'+menu+item].visibility='hide';
			document.layers['dNav'+menu+item+'Over'].visibility='show';
			if(dMenu[menu][item].length>0) {
				hide_sub(openmenu,openitem);
				show_sub(menu,item);
			}
		}
	}
	openmenu=menu;
	openitem=item;
}
function menuOut(menu,item,sub) {
	if (isMac || isOpera) {
		return;
	}
	if(document.layers) ns_hidehilights(menu,item);
	if(sub || sub == 0) {
		if(document.all) {
			document.all['dNav'+menu+item+'O'+sub].style.background="#FF6600";
			document.all['dTable'+menu+item+'O'+sub].className="whitelink";
		} else if(document.getElementById) {
			document.getElementById('dNav'+menu+item+'O'+sub).style.background="#FF6600";
			document.getElementById('dTable'+menu+item+'O'+sub).className="whitelink";
		} else if(document.layers) {
			document.layers['dNav'+menu+item+'O'+sub].visibility='show';
			document.layers['dNav'+menu+item+'O'+sub+'Over'].visibility='hide';
			document.layers['dNav'+menu+item+'Over'].visibility='show';
		}
	} else {
		if(document.all) {
			document.all['dNav'+menu+item].style.background="#FF6600";
			document.all['dTable'+menu+item].className="whitelink";
			if(dMenu[menu][item].length>0) {
				hide_sub(menu,item);
			}
		} else if(document.getElementById) {
			document.getElementById('dNav'+menu+item).style.background="#FF6600";
			document.getElementById('dTable'+menu+item).className="whitelink";
			if(dMenu[menu][item].length>0) {
				hide_sub(menu,item);
			}
		} else if(document.layers) {
			document.layers['dNav'+menu+item].visibility='show';
			document.layers['dNav'+menu+item+'Over'].visibility='hide';
			if(dMenu[menu][item].length>0) {
				hide_sub(menu,item);
			}
		}
	}
	set_timeout();
}
function ns_hidehilights(menu,item) {
	for(i=0; i<dMenu[menu].length; i++) {
		document.layers['dNav'+menu+i+'Over'].visibility='hide';
		document.layers['dNav'+menu+i].visibility='show';
	}

	if(item) {
		for(i=0; i<dSubMenu[menu][item].length; i++) {
			document.layers['dNav'+menu+item+'O'+i+'Over'].visibility='hide';
		}
	}
}
function set_timeout() {
	closewindows = setTimeout('hide_all();',500);
}
function clear_timer(menu) {
	clearTimeout(closewindows);
}
function write_nav() {
	var strNav = '';
	strNav += '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="100%" HEIGHT="18">\n';
	strNav += '<TR>\n';
	strNav += ora_navOutputRow(5, 10);
	strNav += '</TR>\n';
	strNav += '<TR><TD COLSPAN="'+(TopNavNames.length*2)+'"><IMG SRC="http://'+orangehost+'/images/clear.gif" WIDTH="100%" HEIGHT="1" BORDER="0"></TD></TR>\n';
	strNav += '</TABLE>\n';
	document.write(strNav);
}
function ora_navOutputRow(LEFTSPACER, HSPACER) {
	var strNav = '';
	for(var i=0; i<TopNavNames.length; i++) {
		strNav += '<TD VALIGN="MIDDLE" NOWRAP><IMG SRC="http://'+orangehost+'/images/';
		strNav += (i==0) ? 'clear' : 'left';
		strNav += '.gif" WIDTH="';
		strNav += (i==0) ? LEFTSPACER : '1';
		strNav += '" HEIGHT="17" BORDER="0" HSPACE="'+HSPACER+'"></TD>\n';
		strNav += '<TD VALIGN="MIDDLE" NOWRAP';
		strNav += (i==TopNavNames.length-1) ? ' WIDTH="100%">' : '>';
		strNav += '<A CLASS="whitelink" HREF="javascript:ora_navLink('+i+');" OnMouseOver="show_menu('+i+'); window.status=\''+ora_navGetName(i)+'\'; return true;" OnMouseOut="set_timeout(); window.status=\'\'; return true;">';
		strNav += ora_navGetName(i);
		strNav += '</A></TD>\n';
	}
	return strNav;
}
function show_flash() {
	if(document.all) {
		for(fc=count-1; fc>=0; fc--) {
			params=FlashLayers[fc];
			if(!document.all[params].neverShow) {
				document.all[params].style.visibility="visible";
			}
		}
	} else if(document.getElementById) {
		for(fc=count-1; fc>=0; fc--) {
			params=FlashLayers[fc];
			if(!document.getElementById(params).neverShow) {
				document.getElementById(params).style.visibility="visible";
			}
		}
	} else if(document.layers) {
		var params;
		for(fc=count-1; fc>=0; fc--) {
			params=FlashLayers[fc];
			if(!document.layers[params].neverShow) {
				document.layers[params].visibility="visible";
			}
		}
	}
}
function hide_forever(flash) {
	var params;
	hide_flash();
	for(fc=count-1; fc>=0; fc--) {
		params=FlashLayers[fc];
		if(document.all) {
			document.all[params].neverShow = "true";
		} else if(document.getElementById) {
			document.getElementById(params).neverShow = "true";
		} else if(document.layers) {
			document.layers[params].neverShow = "true";
		}
	}
}
function hide_flash() {
	if(document.all) {
		if(!count || count == 0) {
			// Count Flash Layers
			for(params in document.all) {
				if(params.substring(0,5) == "Flash") {
					FlashLayers[count] = params;
					count++;
				}
			}
		}
		for(fc=count-1; fc>=0; fc--) {
			document.all[FlashLayers[fc]].style.visibility="hidden";
		}
	} else if(document.getElementById) {
		if(!count || count == 0) {
			// Count Flash Layers
			for(params in document.getElementById) {
				if(params.substring(0,5) == "Flash") {
					FlashLayers[count] = params;
					count++;
				}
			}
		}
		for(fc=count-1; fc>=0; fc--) {
			document.getElementById(FlashLayers[fc]).style.visibility="hidden";
		}
	} else if(document.layers) {
		if(!count) {
			// Count Flash Layers
			for(params in document.layers) {
				if(params.substring(0,5) == "Flash") {
					FlashLayers[count] = params;
					count++;
				}
			}
		}
		for(fc=count-1; fc>=0; fc--) {
			document.layers[FlashLayers[fc]].visibility="hidden";
		}
	}
}
function start_layer(layername,top,left,width,wmodeEnabled) {
	if(wmodeEnabled) {
		layername = "HomeSWF"+layername;
	} else {
		layername="Flash"+layername;
	}
	if(document.layers) {
		if(top) { top = " TOP=\""+top+"\""; } else { top = " TOP=\"98\""; }
		if(left) { left = " LEFT=\""+left+"\""; } else { left = " LEFT=\"0\""; }
		document.write('<LAYER ID="'+layername+'" Z-INDEX="97" POSITION="absolute" '+top+left+' WIDTH='+width+'>');
	} else {
		if(!left) { left = 0; }
		document.write('<DIV ID="'+layername+'" STYLE="z-index:97; position:absolute; top:'+top+'; left:'+left+'; width:'+width+';">');
	}
}
function end_layer() {
	if(document.layers) {
		document.write('</LAYER>');
	} else {
		document.write('</DIV>');
	}
}
var flashlayers=0;
var CurrentFlashFiles = new Array();
function startFlash(top,left,flashfile,flashwidth,flashheight,giffile,gifwidth,gifheight,wmodeEnabled,wmodeReplacementImage,useMap,hideMac) {
	if(isMac || !isIE || isWin2k || (typeof wmodeEnabled == "undefined")) {
		wmodeEnabled = false;
	}
	if(left=="none") left="";
	newtop = (isMac && navigator.appName != "Netscape")?top-98:top;
	newtop = (isNetscape6 || isIE4)?top+1:newtop;
	gifwidth=(gifwidth)?gifwidth:flashwidth;
	gifheight=(gifheight)?gifheight:flashheight;
	ID=flashfile;
	for(i=0; i<ID.length; i++) {
		if(ID.substring(i,i+1) == "/") ID=ID.substring(0,i) + ID.substring(i+1);
		if(ID.substring(i,i+1) == ".") ID=ID.substring(0,i) + ID.substring(i+1);
	}

	if(!isMac || (isMac && !hideMac)) {
		start_layer(flashlayers,newtop,left,flashwidth,wmodeEnabled);

		var wmode = "";
		if(wmodeEnabled) {
			wmode = ' wmode="transparent"';
		}

		if((isIE || isFlashNS || isDOM) && !isNetscape6) {
			document.write('<EMBED SRC="'+flashfile+'" WIDTH="'+flashwidth+'" HEIGHT="'+flashheight+'" MENU="false" loop="true" QUALITY="BEST" BORDER="0" ALIGN="TOP" swliveConnect="true"'+wmode+'></EMBED>');
		}
		end_layer();
	}
	CurrentFlashFiles[flashlayers] = new Array(top,left,flashfile,flashwidth,flashheight,giffile,gifwidth,gifheight,ID,wmodeEnabled,wmodeReplacementImage,useMap);
	flashlayers++;
}
function endFlash(thislayer) {
	if(isNetscape6 && !CurrentFlashFiles[thislayer][11]) {
		// Only output flash in Netscape6 IF USEMAP has not been specified
		var flashfile = CurrentFlashFiles[thislayer][2];
		var flashwidth = CurrentFlashFiles[thislayer][3];
		var flashheight = CurrentFlashFiles[thislayer][4];
		var wmodeEnabled = CurrentFlashFiles[thislayer][9];
		var wmode = (wmodeEnabled) ? ' wmode="transparent"' : '';

		document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="'+flashwidth+'" HEIGHT="'+flashheight+'" CODEBASE="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0">');
		document.write('<PARAM NAME="MOVIE" VALUE="'+flashfile+'">');
		document.write('<PARAM NAME="PLAY" VALUE="true">');
		document.write('<PARAM NAME="LOOP" VALUE="true">');
		document.write('<PARAM NAME="QUALITY" VALUE="best">');
		if(wmode != "") {
			document.write('<PARAM NAME="WMODE" VALUE="transparent">');
		}
		document.write('<EMBED SRC="'+flashfile+'" WIDTH="'+flashwidth+'" HEIGHT="'+flashheight+'" MENU="false" loop="true" QUALITY="BEST" BORDER="0" ALIGN="TOP" swliveConnect=true'+wmode+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>');
		document.write('</OBJECT>');

	} else if(document.all || document.layers || document.getElementbyId || isMoz2 || isNetscape6) {
		var useMap = (CurrentFlashFiles[thislayer][11]) ? ' USEMAP="#'+CurrentFlashFiles[thislayer][11]+'"' : '';
		var ImageFile = (CurrentFlashFiles[thislayer][9] == false) ? CurrentFlashFiles[thislayer][5] : CurrentFlashFiles[thislayer][9];
		document.write('<IMG SRC="'+ImageFile+'" WIDTH="'+CurrentFlashFiles[thislayer][6]+'" HEIGHT="'+CurrentFlashFiles[thislayer][7]+'" BORDER="0"'+useMap+'><BR>');
	}
}
function insertBasket() {}
function nsie3_det() {
var gotolocation=false;
	if(navigator.appName == "Netscape") {
		if(parseInt(navigator.appVersion) <= 3) {
			gotolocation=true;
		}
	}
	if(navigator.appName.match("Internet Explorer")) {
		if(parseInt(navigator.appVersion) <= 3) {
			gotolocation=true;
		}
	}
	if(gotolocation) {
		window.open("http://"+orangehost+"/ns3.html","Orange","height=375,width=600");
	}
}
nsie3_det();

//eSales redirect form and functions
function esalesRedirect(redirectType, mapRef) { esalesRedirect(redirectType,mapRef,''); }
function esalesRedirect(redirectType, mapRef, values) {
    var strURL = "http://"+esaleshost+"/shop/index";
	document.location.href = strURL;
}

function submitSearch(handle, searchType, searchValue, LeftNavigation) {
    var strURL = "http://"+esaleshost+"/shop/index";
	document.location.href = strURL;
}

function esalesOffer(offerType, offerID) {
	var strURL = "http://"+esaleshost+"/shops";
    if (offerID) {
        strURL += '/offer/'+offerID;
    } else {
        strURL += '/offers'
    }
	document.location.href = strURL;
}

// To use the Image Caching function, use the following syntax:
//	image_cache_arr[num] = new Array(imagepath, state "-over" etc... , extension, images);
// Ex:	image_cache_arr[0] = new Array("/services/images", "yes", "gif", "international", "additional");
//
// Once you have set-up the above array, you can call ImageCache(); to cache the images.
//
var showImagesCached = false;
var imageCache = "";
function ImageCache() {
	if(document.images) {
		for(i=0; i<image_cache_arr.length; i++) {
			var imagepath = image_cache_arr[i][0];
			var mouseoverimages = new Array(image_cache_arr[i].length-1);
			var numofoverstates=(ImageCache.arguments[i]) ? ImageCache.arguments[i] : 0;
			var overstate = new Array();
			for(os=1; os<numofoverstates+1; os++) {
				overstate[os] = image_cache_arr[i][os];
			}
			var ext = "." + image_cache_arr[i][numofoverstates+1];

			for(j=(numofoverstates+2); j<image_cache_arr[i].length; j++) {
				mouseoverimages[image_cache_arr[i][j]] = new Image();
				if(isNSDIV || isIE || isNetscape6) {
					mouseoverimages[image_cache_arr[i][j]].name = image_cache_arr[i][j];
				}
				mouseoverimages[image_cache_arr[i][j]].src = imagepath + image_cache_arr[i][j] + ext;
				imageCache+=mouseoverimages[image_cache_arr[i][j]].src+"\n";
				for(os=1; os<numofoverstates+1; os++) {
					mouseoverimages[image_cache_arr[i][j]].src = imagepath + image_cache_arr[i][j] + overstate[os] + ext;
					imageCache+=mouseoverimages[image_cache_arr[i][j]].src+"\n";
				}
			}
		}
	}
	if (showImagesCached == true) { alert(imageCache); }
}

function addSizeButtons() {
	//setting up small Business Image
	var small = new Image();
	small.src = "http://"+orangehost+"/images/btn_s_business.gif";
	small.name = "smallBusinessButton";
	small.onmouseover = "javascript:MouseOver('smallBusinessButton'); window.status='small business';";
	small.onmouseout = "javascript:MouseOut('smallBusinessButton'); window.status='';";
	small.onclick = "document.location.href='?small'";

	//setting up medium Business Image
	var medium = new Image();
	medium.src = "http://"+orangehost+"/images/btn_m_business.gif";
	medium.name = "mediumBusinessButton";
	medium.onmouseover = "javascript:MouseOver('mediumBusinessButton'); window.status='medium business';";
	medium.onmouseout = "javascript:MouseOut('mediumBusinessButton'); window.status='';";
	medium.onclick = "document.location.href='?medium'";

	//setting up large Business Image
	var large = new Image();
	large.src = "http://"+orangehost+"/images/btn_l_business.gif";
	large.name = "largeBusinessButton";
	large.onmouseover = "javascript:MouseOver('largeBusinessButton'); window.status='large business';";
	large.onmouseout = "javascript:MouseOut('largeBusinessButton'); window.status='';";
	large.onclick = "document.location.href='?large'";

	//setting up corporate Business Image
	var corporate = new Image();
	large.src = "http://"+orangehost+"/images/btn_l_business.gif";
	corporate.name = "corporateBusinessButton";
	corporate.onmouseover = "javascript:MouseOver('corporateBusinessButton'); window.status='corporate business';";
	corporate.onmouseout = "javascript:MouseOut('corporateBusinessButton'); window.status='';";
	corporate.onclick = "document.location.href='?corporate'";

	if(document.layers) {
		document.write('<LAYER ID="SizeButtons" LEFT="589" TOP="99" WIDTH="161" HEIGHT="17" POSITION="ABSOLUTE" VISIBILITY="SHOW" Z-INDEX="100" CURSOR="hand">');
	} else {
		document.write('<DIV ID="SizeButtons" STYLE="left:589; top:99; width:161; height:17; position:absolute; visibility:visible; z-index:100; cursor:hand;">');
	}

	for(type=0; type<2; type++) {
		ImgObj = (type==0) ? small : corporate;
		if(document.layers) {
			document.write('<A HREF="'+ImgObj.onclick+'" OnMouseOver="'+ImgObj.onmouseover+'" OnMouseOut="'+ImgObj.onmouseout+'">');
		}
		document.write('<IMG NAME="'+ImgObj.name+'" SRC="'+ImgObj.src+'"');
		if(document.layers) {
			document.write('></A>');
		}else
		{
			document.write(' OnMouseOver="'+ImgObj.onmouseover+'" OnMouseOut="'+ImgObj.onmouseout+'" OnClick="'+ImgObj.onclick+'">');
		}

	}
	document.write(endLayer);
}
var SitePath = "http://"+orangehost+"/business/";
var endLayer = (document.layers) ? "</LAYER>" : "</DIV>";
var buttonsAdded = true;
function getCookie(name) {
	var cookies = new Array();
	cookies = document.cookie.split(';');
	var value = false;
	for(i=0; i<cookies.length; i++) {
		var cookie = new Array();
		cookie = cookies[i];
		cookie = cookie.split('=');
		if(cookie[0].match(name)) {
			value = cookie[1];
		}
	}
	return value;
}
function setCookie(name, value) {
	var cookieSet = false;
	var cookies = new Array();
	cookies = document.cookie.split(';');
	for(i=0; i<cookies.length; i++) {
		var thisC = new Array();
		thisC = cookies[i];
		thisC = thisC.split('=');
		if(thisC[0] == name) {
			cookies[i] = name+"="+value;
			cookieSet = true;
		}
	}
	var returnCookie="";
	if(cookieSet == false) {
		returnCookie = name+"="+value+";";
	} else {
		for(i=0; i<cookies.length; i++) {
			returnCookie+= cookies[i]+";";
		}
	}
	document.cookie = returnCookie;
}
