loc = document.location + "";
folders = (loc.indexOf(":\/\/")!=-1)?loc.split("\/"):loc.split("\\");
foldername="";

if(folders[folders.length-2].indexOf("kineticbooks")==-1&&folders[folders.length-2].indexOf("www")==-1){
	foldername = folders[folders.length-2];
	}
// ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
//
// Coded by Travis Beckham
// http://www.squidfingers.com | http://www.podlob.com
// If want to use this code, feel free to do so, but please leave this message intact.
//
// --- Version Date 8-15-02 --------------------------------------------------------------------------------------------------------------
//
// ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

var w3c = document.getElementById ? true : false;
var iex = document.all ? true : false;
var ns4 = document.layers ? true : false;

function fixNetscape(){
	if(origWidth != window.innerWidth || origHeight != window.innerHeight){
		window.location.reload();
	}
}
if(ns4){
	origWidth = window.innerWidth;
	origHeight = window.innerHeight;
	window.onresize = fixNetscape;
}
function newImage(src){
	img = new Image();
	img.src = src;
	return img;
}
function imageSwap(img,obj,div){
	if(ns4 && div != null){
		document.layers[div].document.images[img].src = obj.src;
	}else{
		document.images[img].src = obj.src;
	}
}
function getStyle(name, nest){
	nest = nest ? 'document.'+nest+'.' : '';
	return w3c ? document.getElementById(name).style : iex ? document.all[name].style : ns4 ? eval(nest+'document.'+name) : false;
}

// ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

Menus = new Object();
var curMenu = null;

MakeMenu = function(name,left,top,rollimg,rollout,rollover,rolldiv){
	this.name = name;
	this.left = left;
	this.top = top;
	this.timer = null;
	this.rollimg = rollimg;
	this.rollout = newImage(rollout);
	this.rollover = newImage(rollover);
	this.rolldiv = (rolldiv != null) ? rolldiv : null;
	this.obj = name+'Object';
	eval(this.obj+'=this');
}
MakeMenu.prototype.show = function(){
	clearTimeout(this.timer);
	getStyle(this.name).visibility = 'visible';
	imageSwap(this.rollimg,this.rollover,this.rolldiv);
	curMenu = this.name;
}
MakeMenu.prototype.hide = function(){
	this.timer = setTimeout(this.obj+'.hideIt()',500);
}
MakeMenu.prototype.hideIt = function(){
	getStyle(this.name).visibility = 'hidden';
	imageSwap(this.rollimg,this.rollout,this.rolldiv);
}
MakeMenu.prototype.startMenu = function(){
	var html;
	if(ns4){
		html = '<layer name="'+this.name+'" left="'+this.left+'" top="'+this.top+'" z-index="1000" visibility="hidden" ';
	}else{
		html = '<div id="'+this.name+'" style="position:absolute; left:'+this.left+'px; top:'+this.top+'px; z-index:1000; visibility:hidden" ';
	}
	html += 'onMouseOver="Menus.'+this.name+'.show()" onMouseOut="Menus.'+this.name+'.hide()">';
	return html;
}
hideCur = function(){
	if(curMenu != null){
		Menus[curMenu].hideIt();
		curMenu = null;
	}
}
endMenu = function(){
	 return ns4 ? '<\/layer>' : '<\/div>';
}
createMenu = function(name,left,top,rollimg,rollout,rollover,rolldiv){
	Menus[name] = new MakeMenu(name,left,top,rollimg,rollout,rollover,rolldiv);
}



if (document.images) {
homepage = new Image();
homepage.src = "/images/buttons_05.gif";
downloads = new Image();
downloads.src = "/images/buttons_02.gif";
support = new Image();
support.src = "/images/buttons_03.gif";
testimonials = new Image();
testimonials.src = "/images/buttons_04.gif";
products = new Image();
products.src = "/images/buttons_01.gif";
purchase = new Image();
purchase.src = "/images/buttons_07.gif";
grantinformation = new Image();
grantinformation.src = "/images/buttons_grant_a.gif";


homepageon = new Image();
homepageon.src = "/images/buttons_05b.gif";
downloadson = new Image();
downloadson.src = "/images/buttons_02b.gif";
supporton = new Image();
supporton.src = "/images/buttons_03b.gif";
testimonialson = new Image();
testimonialson.src = "/images/buttons_04b.gif";
purchaseon = new Image();
purchaseon.src = "/images/buttons_07b.gif";
grantinformationon = new Image();
grantinformationon.src = "/images/buttons_grant_b.gif";


homepageoff = new Image();
homepageoff.src = "/images/buttons_05.gif";
downloadsoff = new Image();
downloadsoff.src = "/images/buttons_02.gif";
supportoff = new Image();
supportoff.src = "/images/buttons_03.gif";
testimonialsoff = new Image();
testimonialsoff.src = "/images/buttons_04.gif";
purchaseoff = new Image();
purchaseoff.src = "/images/buttons_07.gif";
grantinformationoff = new Image();
grantinformationoff.src = "/images/buttons_grant_a.gif";

switch (foldername){
	case "downloads":
		downloads.src = "/images/buttons_02c.gif";
		downloadsoff.src = "/images/buttons_02c.gif";
		break;
	case "support":
		support.src = "/images/buttons_03c.gif";
		supportoff.src = "/images/buttons_03c.gif";
		break;
	case "testimonials":
		testimonials.src = "/images/buttons_04c.gif";
		testimonialsoff.src = "/images/buttons_04c.gif";
		break;
	case "products":
		if(folders[folders.length-1]=='prod_purchinfo.html'){
			//to make purchase blue button appear
			purchase.src = "/images/buttons_07c.gif";
			purchaseoff.src = "/images/buttons_07c.gif";
			}
		else{
			products.src = "/images/buttons_01c.gif";
			//productsoff is defined below in the "createmenu" function call.
			}
		break;
	case "grantinformation":
		grantinformation.src = "/images/buttons_grant_c.gif";
		grantinformationoff.src = "/images/buttons_grant_c.gif";
		break;

	case "physics labs":
		products.src = "/images/buttons_01c.gif";
		//productsoff is defined below in the "createmenu" function call.
		break;

	case "physics textbook":
		products.src = "/images/buttons_01c.gif";
		//productsoff is defined below in the "createmenu" function call.
		break;

	case "math textbook":
		products.src = "/images/buttons_01c.gif";
		//productsoff is defined below in the "createmenu" function call.
		break;

	}
// ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

// object name | left position | top position | rollover image name | normal image src | rollover image src | rollover div name (optional)

createMenu('submenu1', 160,  105, 'products', products.src, '/images/buttons_01b.gif');


// ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~

}

function imgOn(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "on.src");
}
}

function imgOff(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "off.src");
}
}
document.write("<sc"+"ript language=\"javascript\" type=\"text/javascript\" src=\"/scripts/qsearch.js\"></scr"+"ipt>");

// Begin Google analytics code
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17613704-1']);
  _gaq.push(['_setDomainName', '.kineticbooks.com']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

// End Google analytics code
