// menu.js

var popTimer = 0;

var litNow = new Array();
var menu = new Array();

// Support menu
menu[0] = new Array();
menu[0][0] = new Menu(83, 149, 162, 25, 0, 'navlink-border', 'navlink-menu', 'navlink-hilite');
menu[0][1] = new Item('Windows 7', 'http://www.tek911.com/windows7.shtml');
menu[0][2] = new Item('Ticket Support Center', 'http://www.tek911.com/tt.shtml');
menu[0][3] = new Item('Start Remote Session', 'http://www.teksupportnow.com');
menu[0][4] = new Item('Resources & Links', 'http://www.tek911.com/nw.shtml');
menu[0][5] = new Item('Anti Virus Info', 'http://www.tek911.com/av.shtml');
menu[0][6] = new Item('Anti Spyware Info', 'http://www.tek911.com/aspyw.shtml');
menu[0][7] = new Item('Anti Spam Info', 'http://www.tek911.com/aspam.shtml');
menu[0][8] = new Item('Email Support', 'http://www.tek911.com/email.shtml');
menu[0][9] = new Item('Windows/Mac Tips', 'http://www.tek911.com/tips.shtml');
menu[0][10] = new Item('Software/Tools Support', 'http://www.tek911.com/feedback.shtml');
menu[0][11] = new Item('Make Payment Online', 'http://www.tek911.com/pay');
menu[0][12] = new Item('Install Business Card', 'http://www.tek911.com/bcard.shtml');
menu[0][13] = new Item('Contact Us', 'http://www.tek911.com/contact.shtml');
menu[0][14] = new Item('Site Map', 'http://www.tek911.com/sitemap.shtml');


// Services menu
menu[1] = new Array();
menu[1][0] = new Menu(245, 149, 160, 25, 0, 'navlink-border', 'navlink-menu', 'navlink-hilite');
menu[1][1] = new Item('On Site Service', 'http://www.tek911.com/service.shtml');
menu[1][2] = new Item('Remote Support NOW', 'http://www.tek911.com/remote.shtml');
menu[1][3] = new Item('Spyware Removal', 'http://www.tek911.com/aspyw.shtml');
menu[1][4] = new Item('Hardware', 'http://www.tek911.com/hardware.shtml');
menu[1][5] = new Item('Service Plans', 'http://www.tek911.com/plans.shtml');
menu[1][6] = new Item('Email/Web Hosting', 'http://www.tek911.com/webhosting.shtml');
menu[1][7] = new Item('Video Surveil. Systems', 'http://www.tek911.com/video.shtml');
//menu[1][9] = new Item('Windows Vista', 'http://www.tek911.com/vista.shtml');
menu[1][8] = new Item('Make Payment Online', 'http://www.tek911.com/pay');
menu[1][9] = new Item('Online Application', 'http://www.tek911.com/application.shtml');
menu[1][10] = new Item('Domain Name Registration', 'http://www.alrnet.com/registration.shtml');
menu[1][11] = new Item('Software and Tools', 'http://www.tek911.com/software.shtml');
menu[1][12] = new Item('Software Downloads', 'http://www.tek911.com/download.shtml');
menu[1][13] = new Item('Check Web Mail', 'http://alrnet.com/mail/index.php');
menu[1][14] = new Item('Check Gmail', 'http://www.gmail.com');
menu[1][15] = new Item('Administration', 'http://www.tek911.com/admin/index.htm');

// Remote menu
menu[2] = new Array();
menu[2][0] = new Menu(405, 149, 158, 25, 0, 'navlink-border', 'navlink-menu', 'navlink-hilite');
menu[2][1] = new Item('Remote Support NOW', 'http://www.tek911.com/remote.shtml');
menu[2][2] = new Item('Start Session', 'http://www.teksupportnow.com');




function writeNavMenus()
{
	if (document.getElementById==false) return;
	
	for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {

		var str = '';
		var itemX = 0;
		var itemY = 0;
		var menuID = 'menu' + currMenu;

		// The width and height of the menu
		var w = menu[currMenu][0].width;
		var h =  menu[currMenu][0].height;

		var spacing = menu[currMenu][0].spacing;

		for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {

			var itemID = 'menu' + currMenu + 'item' + currItem;


			// Create a div text string with appropriate styles/properties.
			str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + ';">';

			// Add contents of item
			str += '<table width="' + w + '" border="0" cellspacing="0" cellpadding="0"><tr>';
			str += '<td class="'+ menu[currMenu][0].cellClass +'" onclick="(location.href=\'' + menu[currMenu][currItem].href + '\')" height="' + h + '"';
			str += 'onmouseover="(this.className=\'' + menu[currMenu][0].hiliteClass + '\'); popOver(' + currMenu + ')" onmouseout="(this.className=\'' + menu[currMenu][0].cellClass + '\'); popOut(' + currMenu + ')"'
			str += '>';
			str += '<a class="' + menu[currMenu][0].linkClass + '" href="' + menu[currMenu][currItem].href + '">' + menu[currMenu][currItem].text + '</a>';
			str += '</td></tr></table></div>';
			
			itemY += h + spacing;
		}
		
		var newDiv = document.createElement('div');
		document.getElementsByTagName('body').item(0).appendChild(newDiv);
		newDiv.id = menuID;
		newDiv.innerHTML = str;
		newDiv.style.position = 'absolute';
		newDiv.style.left = menu[currMenu][0].x;
		newDiv.style.top = menu[currMenu][0].y;
		newDiv.style.display="none";

	}
}


function Menu(x, y, width, height, spacing, cellClass, linkClass, hiliteClass) {

	// Position and size settings.
	this.x = x;
	this.y = y-20;

	
	
	
	this.width = width; //width of menu
	this.height = height; //height of each item in menu
	this.spacing = spacing; //the space between each item in menu

	// The stylesheet class used for item borders and the text within items.
	this.cellClass = cellClass;
	this.linkClass = linkClass;
	this.hiliteClass = hiliteClass;
}


function Item(text, href) {
	this.text = text;
	this.href = href;
}


function popOver(menuNum) {
	
	clearTimeout(popTimer);
	hideAllBut(menuNum);
	
	var targetID;
	targetID = "menu" + menuNum;
	targetElement = document.getElementById(targetID);
	targetElement.style.display="";
}



function popOut(menuNum) {
	popTimer = setTimeout('hideAll()', 200);
}


function hideAllBut(menuNum) {
	var targetID;
	for (count = 0; count < menu.length; count++) {
		if (count != menuNum) {
			targetID = "menu" + count;
			targetElement = document.getElementById(targetID);
			targetElement.style.display="none";
		}
	}
}


function hideAll() {
	var targetID;
	for (count = 0; count < menu.length; count++) {
		targetID = "menu" + count;
		targetElement = document.getElementById(targetID);
		targetElement.style.display="none";
	}
}

