// Check Browser
var browserName = navigator.appName;
var browserVer = parseFloat(navigator.appVersion);
var browserMac = navigator.appVersion.indexOf("Macintosh");
var browserWin = navigator.appVersion.indexOf("Win");
var version = "null";

if (browserName == "Netscape"
	&& browserVer >= 3) version = "n3";
if (browserName == "Microsoft Internet Explorer"
	&& browserVer >= 3.01
	&& browserMac != -1) version = "ie3m";
if (browserName == "Microsoft Internet Explorer"
	&& browserVer >= 4) version = "ie4";

// Assign Variable

var supported = (version == "n3"
	|| version == "ie3m"
	|| version == "ie4") ? true : false;

// Load Images
if (supported)
{
	// Add Preloaded Images here with object name following
	// the following naming convention...
	// "menu" + LABEL + NUMBER + ("on")
	// where LABEL is the unique menu group identifier
	// NUMBER is the menu item number starting at 1
	// (on) is tagged to the end of the object name in the 
	// case of an "active" image.
	menufooter1 = new Image();
	menufooter1.src = "http://www.wttw.com/img/menu/menu_0_1_1.gif";
	menufooter1on = new Image();
	menufooter1on.src = "http://www.wttw.com/img/menu/menu_0_1_1_on.gif";
	
	menufooter2 = new Image();
	menufooter2.src = "http://www.wttw.com/img/menu/menu_0_1_2.gif";
	menufooter2on = new Image();
	menufooter2on.src = "http://www.wttw.com/img/menu/menu_0_1_2_on.gif";
	
	menufooter3 = new Image();
	menufooter3.src = "http://www.wttw.com/img/menu/menu_0_1_3.gif";
	menufooter3on = new Image();
	menufooter3on.src = "http://www.wttw.com/img/menu/menu_0_1_3_on.gif";
	
	menufooter4 = new Image();
	menufooter4.src = "http://www.wttw.com/img/menu/menu_0_1_4.gif";
	menufooter4on = new Image();
	menufooter4on.src = "http://www.wttw.com/img/menu/menu_0_1_4_on.gif";
	
	menufooter5 = new Image();
	menufooter5.src = "http://www.wttw.com/img/menu/menu_0_1_5.gif";
	menufooter5on = new Image();
	menufooter5on.src = "http://www.wttw.com/img/menu/menu_0_1_5_on.gif";
	
	menufooter6 = new Image();
	menufooter6.src = "http://www.wttw.com/img/menu/menu_0_1_6.gif";
	menufooter6on = new Image();
	menufooter6on.src = "http://www.wttw.com/img/menu/menu_0_1_6_on.gif";
	
	menusecond1 = new Image();
	menusecond1.src = "http://www.wttw.com/img/menu/lmenu_42_1.gif";
	menusecond1on = new Image();
	menusecond1on.src = "http://www.wttw.com/img/menu/lmenu_42_1_on_g.gif";
	
	menusecond2 = new Image();
	menusecond2.src = "http://www.wttw.com/img/menu/lmenu_42_9.gif";
	menusecond2on = new Image();
	menusecond2on.src = "http://www.wttw.com/img/menu/lmenu_42_9_on.gif";
	
	menusecond3 = new Image();
	menusecond3.src = "http://www.wttw.com/img/menu/lmenu_42_2.gif";
	menusecond3on = new Image();
	menusecond3on.src = "http://www.wttw.com/img/menu/lmenu_42_2_on.gif";
	
	menusecond4 = new Image();
	menusecond4.src = "http://www.wttw.com/img/menu/lmenu_42_3.gif";
	menusecond4on = new Image();
	menusecond4on.src = "http://www.wttw.com/img/menu/lmenu_42_3_on.gif";
	
	menusecond5 = new Image();
	menusecond5.src = "http://www.wttw.com/img/menu/lmenu_42_4.gif";
	menusecond5on = new Image();
	menusecond5on.src = "http://www.wttw.com/img/menu/lmenu_42_4_on.gif";
	
	menusecond6 = new Image();
	menusecond6.src = "http://www.wttw.com/img/menu/lmenu_42_6.gif";
	menusecond6on = new Image();
	menusecond6on.src = "http://www.wttw.com/img/menu/lmenu_42_6_on.gif";
	
	menusecond7 = new Image();
	menusecond7.src = "http://www.wttw.com/img/menu/lmenu_42_7.gif";
	menusecond7on = new Image();
	menusecond7on.src = "http://www.wttw.com/img/menu/lmenu_42_7_on.gif";
	
	menuthird1 = new Image();
	menuthird1.src = "http://www.wttw.com/img/menu/lmenu_42_1_1.gif";
	menuthird1on = new Image();
	menuthird1on.src = "http://www.wttw.com/img/menu/lmenu_42_1_1_on.gif";
	
	menusecond1 = new Image();
	menusecond1.src = "http://www.wttw.com/img/c2n/menu/42_1.gif";	
	menusecond1on = new Image();
	menusecond1on.src = "http://www.wttw.com/img/c2n/menu/42_1_on.gif";
	menusecond2 = new Image();
	menusecond2.src = "http://www.wttw.com/img/c2n/menu/42_9.gif";
	menusecond2on = new Image();
	menusecond2on.src = "http://www.wttw.com/img/c2n/menu/42_9_on.gif";
	menusecond3 = new Image();
	menusecond3.src = "http://www.wttw.com/img/c2n/menu/42_2.gif";
	menusecond3on = new Image();
	menusecond3on.src = "http://www.wttw.com/img/c2n/menu/42_2_on.gif";
	menusecond4 = new Image();
	menusecond4.src = "http://www.wttw.com/img/c2n/menu/42_3.gif";
	menusecond4on = new Image();
	menusecond4on.src = "http://www.wttw.com/img/c2n/menu/42_3_on.gif";
	menusecond5 = new Image();
	menusecond5.src = "http://www.wttw.com/img/c2n/menu/42_4.gif";
	menusecond5on = new Image();
	menusecond5on.src = "http://www.wttw.com/img/c2n/menu/42_4_on.gif";
	menusecond6 = new Image();
	menusecond6.src = "http://www.wttw.com/img/c2n/menu/42_6.gif";
	menusecond6on = new Image();
	menusecond6on.src = "http://www.wttw.com/img/c2n/menu/42_6_on.gif";
	menusecond7 = new Image();
	menusecond7.src = "http://www.wttw.com/img/c2n/menu/42_7.gif";
	menusecond7on = new Image();
	menusecond7on.src = "http://www.wttw.com/img/c2n/menu/42_7_on.gif";
	
	// Indexes
	// These are the indicies in the the arrays below.
	// These should start at zero, and be contiguous
	footerindex  = 0;
	secondindex   = 1;
	thirdindex = 2;
	fourthindex = 3;

	// Current Menu Selections
	// Lets us know where we are to start.
	// Can be overridden by the initial "menusetit" function call.
	select = new Array(0,1,0,0);

	prevactive = new Array(0,0,0,0);

	// Associates a series of rollover images
	// with a tagline.
	tagline    = new Array(0,0,0,0);
	hastagline = new Array(0,0,0,0);

	// Menu Sizes
	// Base on the number of images above
	size = new Array(6,7,1,0);
	
	// Initialize TimerIDs
	// Start 'em all out at ZERO
	timer = new Array(0,0,0,0);

	// Delay in MS for "Snap Back"
	// Raise this number for a Cool Delayed
	// "SnapBack" Effect
	delay = 100;
}

function menuactivate(menu,on)
{
	if (supported)
	{						
		var menusize   = eval("size["       + menu + "index]");
		var menuselect = eval("select["     + menu + "index]");
		var menuprev   = eval("prevactive[" + menu + "index]");
		var index      = eval(menu + "index");

		clearTimeout(eval("timer[" + menu + "index]"));

		if (hastagline[index] != 0)
		{
			menuactivate(menu + "tagline", on);
		}
		

		// Turn off the "Current Section" image
		if ((menuselect != 0) && (menuselect != on) && (tagline[index] == 0))
		{
			imgName = "menu" + menu + menuselect;
			roll = eval(imgName + ".src");
			document.images[imgName].src = roll;
		}

		// Turn off the Previous Rollover
		if ((menuprev != 0) && (tagline[index] == 0))
		{
			imgName = "menu" + menu + menuprev;
			roll = eval(imgName + ".src");
			document.images[imgName].src = roll;
		}
		
		// Turn on the one we're rolling over						
		imgName = "menu" + menu + on;
		roll = eval(imgName + "on.src");
		
		if(tagline[index] == 0)
		{
			document.images[imgName].src = roll;
		}
		
		else
		{
			document.images[menu].src = roll;
		}
	}
}

function menudestroy(menu,off)
{
	if (supported)
	{
		var menuselect = eval("select[" + menu + "index]");
		index          = eval(menu + "index"); 
								
		// Build the Timed Function Call
		var call = "resetImage(\'" + menu + "\')";
	
		
		// Set Timer for the reseting of images
		timer[index] = setTimeout(call,delay);
		
		prevactive[index] = off;
	}
}

function resetImage(menu)
{
	var menusize   = eval("size["   + menu + "index]");
	var menuselect = eval("select[" + menu + "index]");
	var index      = eval(menu + "index");
	
	if (hastagline[index] != 0)
	{
		imgName = "menu" + menu + "tagline" + 1;
		roll = eval(imgName + ".src");
		document.images[menu + "tagline"].src = roll;
	}

	// turn off ALL the images if this is not a tagline
	if(tagline[index] == 0)
	{
		for (i = 1; i <= menusize; i++)
		{
			if ( i != menuselect)
			{
				imgName = "menu" + menu + i;
				roll = eval(imgName + ".src");
				document.images[imgName].src = roll;
			}
		}
	}
	
	// Turn off the tagline
	else{
		imgName = "menu" + menu + 1;
		roll = eval(imgName + ".src");
		document.images[menu].src = roll;
	}
	
	
	
	// Only Turn on an Image if we are actually in 
	// a particular section
	if (menuselect != 0)
	{
		imgName = "menu" + menu + menuselect;
		roll = eval(imgName + "on.src");
		
		if(tagline[index] == 0)
		{
			document.images[imgName].src = roll;
		}
		
		else
		{
			document.images[menu].src = roll;
		}
	}
}




function menusetit(menu,set)
{
	if ((supported) && (set != 0))
	{	
		index = eval(menu + "index");	
		select[index] = set;
		menuactivate(menu,set);
	}
}

// Popup Window Code
function popup(winname,winurl,winwidth,winheight,options)
{

  // Center the popup window
  var top   = (screen.availHeight - winheight - 29) / 2;
  var left  = (screen.availWidth - winwidth - 10) / 2;

  var urlPrefix = "";

  var winopt    = "width=" + winwidth + ",height=" + winheight + "," + options + ",toolbar=0,location=0,directories=0,status=0,left="+left+",top="+top;
  newwin    = window.open(winurl,winname,winopt);

}

function popup_withtoolbar(winname,winurl,winwidth,winheight,options)
{

  // Center the popup window
  var top   = (screen.availHeight - winheight - 29) / 2;
  var left  = (screen.availWidth - winwidth - 10) / 2;

  var urlPrefix = "";

  var winopt    = "width=" + winwidth + ",height=" + winheight + "," + options + ",toolbar=1,location=0,directories=0,status=0,left="+left+",top="+top;
  newwin    = window.open(winurl,winname,winopt);

}


function openNewWindow(theURL) 
{
	window.open(theURL,'openNewWindow','HEIGHT=360, WIDTH=360,scrollbars=no,toolbar=no,status=no,menubar=no,location=no,resizable=no');
}

self.name="wttw";




function SetHomePage () 
{    

	var HomePageUrl="http://www.wttw.com";
	var agree=confirm("Would you like to set your homepage to WTTW.com?");
	if (agree)
	{	
		if (document.all) 

		{
			if (document.body.addBehavior) 
			{
				document.body.addBehavior ("#default#homePage");
				document.body.setHomePage(HomePageUrl);
			}
		else 
		{
				window.external.AddFavorite(HomePageUrl, "WTTW.com");
		}
		}
		else {
			popup ("SetHomePage", "main.taf?p=0,2,14", 400, 400, "")
		}
	}   
}


// Button Rollover Code
function rollOver(imgID,ImgName)
{
 if ((navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3)
	 || 
	 (navigator.appName != "Netscape" && parseInt(navigator.appVersion) >= 4))
  document.images[imgID].src = "http://www.wttw.com/img/" + ImgName;
}


// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) ||
	(key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789.").indexOf(keychar) > -1))
   return true;

else
   return false;
}

