var windowWidth;
var windowHeight;
var origWidth;
var origHeight;
var xcenter;
var ycenter;
var prefix;
var suffix;
var leftRef;
var topRef;
var is;

function BYS_browserCheck() {

	var b = navigator.appName;
	
	if (b == "Netscape"){
		this.b = "ns";
	}
	else if (b == "Microsoft Internet Explorer"){
		this.b = "ie";
	}
	else{
		this.b = b;
	}
	
	this.v = parseFloat(navigator.appVersion);
	
	// Netscape 4
	if ((this.b=="ns") && (this.v>=4) && (this.v<5)){
		this.ns4 = true;
		windowWidth=window.innerWidth;
		windowHeight=window.innerHeight;
		prefix = 'document.';
		suffix = '';
		leftRef = ".pageX";
		topRef = ".pageY";
	}
	
	// Netscape 6
	if ((this.b=="ns") && (this.v>=5)){
		this.ns6 = true;
		windowWidth=window.innerWidth;
		windowHeight=window.innerHeight;
		prefix = 'document.getElementById("';
		suffix = '").style';
		leftRef = ".left";
		topRef = ".top";
	}
	
	// Explorer
	if (this.b=="ie" && this.v>=4){
		this.ie = true;
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
    	prefix = 'document.all.';
    	suffix = '.style';
		leftRef = ".pixelLeft";
		topRef = ".pixelTop";
	}
	
	this.min = (this.v>=4);
	
	var plat = navigator.platform;
	
	if (plat == "Win32")
		this.win = true;
	
	if (plat == "MacPPC")
		this.mac = true;
}

// void BYS_position(string id, int x, int y);
function BYS_position(id, x, y){
	BYS_setX(id, x);
	BYS_setY(id, y);
}

// int BYS_getX(string id);
function BYS_getX(id){
	eval("x = "+prefix+id+suffix+leftRef);
	return x;
}

// void BYS_setX(string id, int x);
function BYS_setX(id, x){
	eval (prefix+id+suffix+leftRef+" = "+x);
}

// int BYS_getY(string id);
function BYS_getY(id){
	eval("y = "+prefix+id+suffix+topRef);
	return parseInt(y);
}

// void BYS_setY(string id, int y);
function BYS_setY(id, y){
	eval (prefix+id+suffix+topRef+" = "+y);
}

// int BYS_getZ(string id);
function BYS_getZ(id){
	eval ("zindex = "+prefix+id+suffix+".zIndex");
	return zindex;
}

// void BYS_setZ(string id, int zindex);
function BYS_setZ(id, zindex){
	eval (prefix+id+suffix+".zIndex = "+zindex);
}

// void BYS_swapZ(string id1, string id2);
function BYS_swapZ(id1, id2){
}

// void BYS_show(string id);
function BYS_show(id){
	eval(prefix+id+suffix+'.visibility = "visible"');
}

// void BYS_hide(string id);
function BYS_hide(id){
	eval(prefix+id+suffix+'.visibility = "hidden"');
}

// string getVisibility(string id)
function getVisibility(id){
	eval("visibility = "+prefix+id+suffix+".visibility");
	if (visibility == "BYS_show"){
		visibility = "visible";
	}
	if (visibility == "BYS_hide"){
		visibility = "hidden";
	}
	return visibility;
}

// int BYS_getWidth(string id);
function BYS_getWidth(id){
	if (is.ns4){
		width = document.layers[id].clip.width;
		}
	else if (is.ns6) { 
		width = document.getElementById(id).offsetWidth;
	} 
	else{
		eval ("width = "+id+".offsetWidth");
		}
	return width;
}

// int BYS_getHeight(string id);
function BYS_getHeight(id){
	if (is.ns4) {
		eval ("height = document.layers."+id+".clip.height");
	} 
	else if (is.ns6) { 
		height = document.getElementById(id).offsetHeight;
	} 
	else {
		eval ("height = "+id+".offsetHeight");
	}
	return height;
}

// void BYS_clip(string id, int top, int right, int bottom, int left);
function BYS_clip(id, top, right, bottom, left){
	if (is.ie || is.ns6) {
		eval(prefix+id+suffix+".clip = 'rect("+top+"px "+right+"px "+bottom+"px "+left+"px)'");
	} 
	else { // ns4
		eval (prefix+id+suffix+".clip.top = "+top);
		eval (prefix+id+suffix+".clip.bottom = "+bottom);
		eval (prefix+id+suffix+".clip.right = "+right);
		eval (prefix+id+suffix+".clip.left = "+left);
	}
}

// void BYS_changeImage(string id, string imgname, string imgobj);
function BYS_changeImage(id, imgname, imgobj){
	if (is.ns4){
		eval ("document.layers."+id+".document."+imgname+".src = "+imgobj+".src");
	}
	else{
		eval ("document."+imgname+".src = "+imgobj+".src");
	}
}
if (document.images) {

	CustomProductson = new Image();
	CustomProductson.src = "images/NAV_CustomProducts_ON.gif";
	CustomProductsoff = new Image();
	CustomProductsoff.src = "images/NAV_CustomProducts_OFF.gif";
	
	StandardProductson = new Image();
	StandardProductson.src = "images/NAV_StandardProducts_ON.gif";
	StandardProductsoff = new Image();
	StandardProductsoff.src = "images/NAV_StandardProducts_OFF.gif";
	
	Fabricationon = new Image();
	Fabricationon.src = "images/NAV_Fabrication_ON.gif";
	Fabricationoff = new Image();
	Fabricationoff.src = "images/NAV_Fabrication_OFF.gif";
	
	WhoWeRepresenton = new Image();
	WhoWeRepresenton.src = "images/NAV_WhoWeRepresent_ON.gif";
	WhoWeRepresentoff = new Image();
	WhoWeRepresentoff.src = "images/NAV_WhoWeRepresent_OFF.gif";
	
	RequestInformationon = new Image();
	RequestInformationon.src = "images/NAV_RequestInformation_ON.gif";
	RequestInformationoff = new Image();
	RequestInformationoff.src = "images/NAV_RequestInformation_OFF.gif";
	
	ContactUson = new Image();
	ContactUson.src = "images/NAV_ContactUs_ON.gif";
	ContactUsoff = new Image();
	ContactUsoff.src = "images/NAV_ContactUs_OFF.gif";
	
	// Preload for UNAV
	
	gasketson = new Image();
	gasketson.src = "images/ICON_GasketsWashersSealers_ON.jpg";
	gasketsoff = new Image();
	gasketsoff.src = "images/ICON_GasketsWashersSealers_OFF.jpg";
	
	tubeson = new Image();
	tubeson.src = "images/ICON_Tubes_ON.jpg";
	tubesoff = new Image();
	tubesoff.src = "images/ICON_Tubes_OFF.jpg";
	
	stopperson = new Image();
	stopperson.src = "images/ICON_StoppersSealsCovers_ON.jpg";
	stoppersoff = new Image();
	stoppersoff.src = "images/ICON_StoppersSealsCovers_OFF.jpg";

	rollerson = new Image();
	rollerson.src = "images/ICON_Rollers_ON.jpg";
	rollersoff = new Image();
	rollersoff.src = "images/ICON_Rollers_OFF.jpg";
	
	coneson = new Image();
	coneson.src = "images/ICON_Cones_ON.jpg";
	conesoff = new Image();
	conesoff.src = "images/ICON_Cones_OFF.jpg";
	
	linerson = new Image();
	linerson.src = "images/ICON_Liners_ON.jpg";
	linersoff = new Image();
	linersoff.src = "images/ICON_Liners_OFF.jpg";
	
	miscellaneouson = new Image();
	miscellaneouson.src = "images/ICON_Miscellaneous_ON.jpg";
	miscellaneousoff = new Image();
	miscellaneousoff.src = "images/ICON_Miscellaneous_OFF.jpg";
	
	mountson = new Image();
	mountson.src = "images/ICON_ShockVibrationMounts_ON.jpg";
	mountsoff = new Image();
	mountsoff.src = "images/ICON_ShockVibrationMounts_OFF.jpg";
	
	bulbson = new Image();
	bulbson.src = "images/ICON_DropperBulbs_ON.jpg";
	bulbsoff = new Image();
	bulbsoff.src = "images/ICON_DropperBulbs_OFF.jpg";
		
}

// Special Rollover for images in DIVs
function turnOn(link,parentlayer) {
	if (is.ns4) eval('document.'+parentlayer+'.document.'+link+'.src = '+link+'on.src'); 
	if (is.ie || is.ns6) eval('document.'+link+'.src = '+link+'on.src'); 
}

// Special Rollout for images in DIVs
function turnOff(link,parentlayer) {
	if (is.ns4) eval('document.'+parentlayer+'.document.'+link+'.src = '+link+'off.src');
	if (is.ie || is.ns6) eval('document.'+link+'.src = '+link+'off.src');
}

// Generic Rollover for images not in DIVs
function turnOn2(imageName) {
	if (document.images) {
		document[imageName].src = eval(imageName + "on.src");
	}
}

// Generic Rollout for images not in DIVs
function turnOff2(imageName) {
	if (document.images) {
		document[imageName].src = eval(imageName + "off.src");
	}
}

function init() {
	is = new BYS_browserCheck();
	BYS_position('unav',576,5);
	BYS_show('unav');
	BYS_position('menugaskets',576,214)
	BYS_position('menutubes',576,214)
	BYS_position('menustoppers',576,214)
	BYS_position('menurollers',576,214)
	BYS_position('menucones',576,214)
	BYS_position('menuliners',576,214)
	BYS_position('menumiscellaneous',576,214)
	BYS_position('menumounts',576,214)
	BYS_position('menubulbs',576,214)
	BYS_show('menugaskets');
}
    
function unav_over(unavname) {
	if (unavname != showing) {
		turnOff(showing,'unav');
		BYS_hide('menu' + showing);
	}
	turnOn(unavname,'unav');
	BYS_show('menu' + unavname);
	clearTimeout(gtimeoutID);
	showing=unavname;
}

function unav_out(unavname) {
	gtimeoutID=setTimeout("revert()", 500);
}

function lnav_over(link,parentlayer) {
	clearTimeout(gtimeoutID);
	turnOn(link,parentlayer);
}

function lnav_out(link,parentlayer) {
	gtimeoutID=setTimeout("revert()", 500);
	turnOff(link,parentlayer);
}

function revert() {
	BYS_hide('menu' + showing);
	turnOff(showing,'unav');
	BYS_show('menugaskets');
	turnOn('gaskets','unav');
	showing='gaskets';
}
// INIT //
var gtimeoutID=0;
var showing='gaskets';
