homeon = new Image();
homeon.src = "images/nav_home_on.gif";
aboutuson = new Image();
aboutuson.src = "images/nav_aboutus_on.gif";
articleson = new Image();
articleson.src = "images/nav_articles_on.gif";
lectureon = new Image();
lectureon.src = "images/nav_lectures_on.gif";
learnon = new Image();
learnon.src = "images/nav_learn_on.gif";


homeoff = new Image();
homeoff.src = "images/nav_home_off.gif";
aboutusoff = new Image();
aboutusoff.src = "images/nav_aboutus_off.gif";
articlesoff = new Image();
articlesoff.src = "images/nav_articles_off.gif";
lectureoff = new Image();
lectureoff.src = "images/nav_lectures_off.gif";
learnoff = new Image();
learnoff.src = "images/nav_learn_off.gif";

<!-- no home subnav -->




<!-- aboutus subnav-->

//preload aboutus nav images
//aboutus1on = new Image();
//aboutus1on.src = "images/snav_about_sws_on.gif";
//aboutus2on = new Image();
//aboutus2on.src = "images/snav_about_sws_on.gif";
aboutus1on = new Image();
aboutus1on.src = "images/snav_about_sws_on.gif";
aboutus2on = new Image();
aboutus2on.src = "images/snav_about_sifu_on.gif";



//aboutus1off = new Image();
//aboutus1off.src = "images/snav_about_sws_off.gif";
//aboutus2off = new Image();
//aboutus2off.src = "images/snav_about_sws_off.gif";
aboutus1off = new Image();
aboutus1off.src = "images/snav_about_sws_off.gif";
aboutus2off = new Image();
aboutus2off.src = "images/snav_about_sifu_off.gif";

<!-- articles subnav-->

//preload articles nav images
//articles1on = new Image();
//articles1on.src = "images/snav_articles_feature_on.gif";
//articles2on = new Image();
//articles2on.src = "images/snav_articles_archive_on.gif";
articles1on = new Image();
articles1on.src = "images/snav_articles_feature_on.gif";
articles2on = new Image();
articles2on.src = "images/snav_articles_archive_on.gif";



//articles1off = new Image();
//articles1off.src = "images/snav_articles_feature_off.gif";
//articles2off = new Image();
//articles2off.src = "images/snav_articles_archive_off.gif";
articles1off = new Image();
articles1off.src = "images/snav_articles_feature_off.gif";
articles2off = new Image();
articles2off.src = "images/snav_articles_archive_off.gif";

<!-- lecture subnav-->

//preload lecture nav images
//lecture1on = new Image();
//lecture1on.src = "images/snav_about_sws_on.gif";
//lecture2on = new Image();
//lecture2on.src = "images/snav_about_sws_on.gif";
lecture1on = new Image();
lecture1on.src = "images/snav_about_sws_on.gif";
lecture2on = new Image();
lecture2on.src = "images/snav_about_kungfu_on.gif";



//lecture1off = new Image();
//lecture1off.src = "images/snav_about_sws_off.gif";
//lecture2off = new Image();
//lecture2off.src = "images/snav_about_sws_off.gif";
lecture1off = new Image();
lecture1off.src = "images/snav_about_sws_off.gif";
lecture2off = new Image();
lecture2off.src = "images/snav_about_kungfu_off.gif";

<!-- learn subnav-->

//preload learn nav images
//learn1on = new Image();
//learn1on.src = "images/snav_about_sws_on.gif";
//learn2on = new Image();
//learn2on.src = "images/snav_about_sws_on.gif";
learn1on = new Image();
learn1on.src = "images/snav_about_sws_on.gif";
learn2on = new Image();
learn2on.src = "images/snav_about_kungfu_on.gif";



//learn1off = new Image();
//learn1off.src = "images/snav_about_sws_off.gif";
//learn2off = new Image();
//learn2off.src = "images/snav_about_sws_off.gif";
learn1off = new Image();
learn1off.src = "images/snav_about_sws_off.gif";
learn2off = new Image();
learn2off.src = "images/snav_about_kungfu_off.gif";



//get browser type
var bName = navigator.appName;
var browser;

if(bName == "Netscape") {
	browser = "nn";
}

//image rollover for sub navs.
function subOn(subNav, img) {
	if (browser == 'nn') {
		document.layers[subNav].document.images[img].src = eval(img + "on.src");
	} else {
		window.document.images[img].src = eval(img + "on.src");
	}
}

function subOff(subNav, img) {
	if (browser == 'nn') {
		document.layers[subNav].document.images[img].src = eval(img + "off.src");
	} else {
		window.document.images[img].src = eval(img + "off.src");
	}
}

var mainSwitch = 0;
var isModelsOn = false;
var lastLayer;
var lastImgLayer;
var lastImg;
var x1,x2,y1,y2;

function turnOn() {
	mainSwitch = 1;
}


if (window.captureEvents) {
        window.captureEvents(Event.MOUSEMOVE);
        window.onmousemove = mouseTracker;
} else {
        document.onmousemove = mouseTracker;
        
}

function mouseTracker(e) {
	e = e || window.Event || window.event;
    window.pageX = e.pageX || e.clientX;
    window.pageY = e.pageY || e.clientY;

	setTimeout("",2000);

			y1 = 0;				//pixels above nav
			x1 = 0;				//pixels to left of nav
			y2  = 100;			//pixels below nav
			x2 =  800;			//pixels to right of nav

			my1 = 0;			//pixels above model nav
			mx1 = 0;			//pixels to left of model nav
			my2  = 350;			//pixels below model nav
			mx2 =  200;			//pixels to right of model nav
		
		if (isModelsOn == true) {
			if((window.pageX < (mx1-10) || window.pageX > mx2 || window.pageY < (my1-5) || window.pageY > my2) ) {
				hide('models');
			}
		} else if ((window.pageX < (x1-10) || window.pageX > x2 || window.pageY < (y1-5) || window.pageY > y2) && lastLayer != null) {
				hide(lastLayer);
				changeImage(lastImg,lastImg + 'off','false');
				lastLayer = null;
		}
}

function menuSwitch(aLayer,imgName) {

	if (mainSwitch == 1) {
		if (lastLayer != null) {
			hide(lastLayer);
			changeImage(lastImg,lastImg + 'off','false');
		}
		changeImage(imgName,imgName + 'on','false');
		show(aLayer)
		lastLayer = aLayer;
		lastImg = imgName;
	}
}

function changeImage(imgName,imgObj,isLayerOn) {

	if (mainSwitch == 1) {
		if (isModelsOn == true) {
			hide('models');
		}
		if (isLayerOn == 'true' && lastLayer != null) {
			hide(lastLayer);
			lastLayer = null;
			window.document.images[lastImg].src = eval(lastImg + "off.src");
		}
		window.document.images[imgName].src = eval(imgObj + ".src");
	}
}

// hide element  
function hide(aLayer) {
	if (mainSwitch == 1) {
		if (aLayer == 'models') {
			isModelsOn = false;
			subOff('showroom', 'shop2');
		}
	  	theobjs[aLayer].objHide();
	}
}

// show element
function show(aLayer) {
	if (mainSwitch == 1) {
		if (aLayer == 'models') {
			isModelsOn = true;
			subOn('showroom', 'shop2');
		}
	   	theobjs[aLayer].objShow();
	}
}

//popup window function
//pass the url, the width, and the height
var theWin

function popup(theURL, width, height) {

	if(theWin == null || theWin.closed) {
		theWin = window.open(theURL, "popup", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=" + width + ",height=" + height + ",top=100,left=100");
	} else {
		theWin.close()
		theWin = window.open(theURL, "popup", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=" + width + ",height=" + height + ",top=100,left=100");
	}
}
