//NS4 is not desired :)

tmn_width			=  81;
tmn_height			=  29;

var selLyrIndex 	= null;
var topSubmenuLyrs = [];

topSubmenuLyrs[0] = null;
topSubmenuLyrs[1] = ["lyrTM_OFF_PRODUCTS",  "lyrTM_ON_PRODUCTS"  ];
topSubmenuLyrs[2] = ["lyrTM_OFF_SUPPORT",   "lyrTM_ON_SUPPORT"   ];
topSubmenuLyrs[3] = ["lyrTM_OFF_CORPORATE", "lyrTM_ON_CORPORATE" ];

isLoaded["lyrTMN"] 				= true;
isLoaded["lyrTM_OFF_PRODUCTS"] 	= false;
isLoaded["lyrTM_ON_PRODUCTS"] 	= false;
isLoaded["lyrTM_OFF_SUPPORT"] 	= false;
isLoaded["lyrTM_ON_SUPPORT"] 	= false;
isLoaded["lyrTM_OFF_CORPORATE"] = false;
isLoaded["lyrTM_ON_CORPORATE"] 	= false;

//submenus

//corporate submenu
c = [];
c[0] = [   4,   5, 107, 23];
c[1] = [   4,  23, 107, 41];
c[2] = [   4,  41, 107, 59];
c[3] = [   4,  59, 107, 77];
c[4] = [ 107,   5, 205, 23];
c[5] = [ 107,  23, 205, 41];

//support submenu
u = [];                      
u[0] = [  4, 5,146,23];
u[1] = [  4,23,146,41];
u[2] = [  4,41,146,59];
u[3] = [  4,59,146,77];
u[4] = [146,5, 238,41];

//products submenu
p = [];     
p[0] = [  4, 5,146,23];
p[1] = [  4,23,146,41];
p[2] = [  4,41,146,59];
p[3] = [146, 5,260,41];

onload = function(){
	if(IE || NS6){
		document.onmousemove = handleMouseMove;
	}
	if(window.initScroll)
		initScroll();
}

function handleMouseMove(e){
	if(IE){
		if(event.clientX < 333 || event.clientX > 740 || 
			event.clientY > 158 || event.clientY < 1){
			closeTopMenu();
		}
	}
	else if(NS6){
		if(e.pageX < 333 || e.pageX > 740 || e.pageY > 140 || e.pageY < 1){
			closeTopMenu();
		}
	}
}

function cropTo(lyrId, x1, y1, x2, y2){
	if (!isLoaded[lyrId])
		return;
	if(IE){
		lyr = document.all[lyrId];
		lyr.style.clip = "rect(" + y1 + "px " + x2 + "px " + y2 + "px " + x1 + "px)";
	}
	else if(NS6){
		lyr = document.getElementById(lyrId);
		lyr.style.clip = "rect(" + y1 + "px " + x2 + "px " + y2 + "px " + x1 + "px)";
	}
}

function showLyr(lyrId){
	if (!isLoaded[lyrId])
		return;
	if(IE) 			document.all[lyrId].style.visibility = "visible";
	else if(NS6) 	document.getElementById(lyrId).style.visibility = "visible";
}

function hideLyr(lyrId){
	if (!isLoaded[lyrId])
		return;
	if(IE)			document.all[lyrId].style.visibility = "hidden";
	else if(NS6)	document.getElementById(lyrId).style.visibility = "hidden";
}

// over and out functions

function tmn_over(n){
	document.onmousemove = handleMouseMove;
	cropTo("lyrTMN", n*tmn_width, 0, (n+1)*tmn_width, tmn_height);
	showLyr("lyrTMN");
	
	if(selLyrIndex != null){
		hideLyr(topSubmenuLyrs[selLyrIndex][0]);
		hideLyr(topSubmenuLyrs[selLyrIndex][1]);
	}
	
	if(topSubmenuLyrs[n] != null && isLoaded[topSubmenuLyrs[n][0]]){
		showLyr(topSubmenuLyrs[n][0]);
		selLyrIndex = n;
	}
	else
		selLyrIndex = null;
}
var menutimer
function tmn_out(n){
	if(topSubmenuLyrs[n] == null){
		hideLyr("lyrTMN");
	}
//	menutimer = setTimeout("closeTopMenu()",500);
}

// mn_over and mn_out - responsible for the left menus

function mn_over(n){
	cropTo("lyrMN", 0, mn_offsetTop + n*mn_height - 2, 222, (n+1)*mn_height + mn_offsetTop );
	showLyr("lyrMN");
}

function mn_out(){
	hideLyr("lyrMN");
}

function tm_products_over(n){
	cropTo("lyrTM_ON_PRODUCTS", p[n][0], p[n][1], p[n][2], p[n][3]);
	showLyr("lyrTM_ON_PRODUCTS");
}

function tm_products_out(){
	hideLyr("lyrTM_ON_PRODUCTS");
}

function tm_support_over(n){
	cropTo("lyrTM_ON_SUPPORT", u[n][0], u[n][1], u[n][2], u[n][3]);
	showLyr("lyrTM_ON_SUPPORT");
}

function tm_support_out(){
	hideLyr("lyrTM_ON_SUPPORT");
}

function tm_corporate_over(n){
	cropTo("lyrTM_ON_CORPORATE", c[n][0], c[n][1], c[n][2], c[n][3]);
	showLyr("lyrTM_ON_CORPORATE");
}

function tm_corporate_out(){
	hideLyr("lyrTM_ON_CORPORATE");
}

function closeTopMenu(){
	hideLyr("lyrTMN");
	hideLyr(topSubmenuLyrs[1][0]);
	hideLyr(topSubmenuLyrs[1][1]);
	hideLyr(topSubmenuLyrs[2][0]);
	hideLyr(topSubmenuLyrs[2][1]);
	hideLyr(topSubmenuLyrs[3][0]);
	hideLyr(topSubmenuLyrs[3][1]);
	tm_products_out();
	
}

function generateMapsHTML(){
	if(IE || NS6)
	return "<map name=topMenuMap2>\n"+
	"	<area shape=rect coords=\"  0,0, 81,29\" href=\"/\" 								onmouseout=\"tmn_out(0)\">\n"+
	"	<area shape=rect coords=\" 82,0,162,29\" href=\"/p_main.htm\" 					onmouseout=\"tmn_out(1)\">\n"+
	"	<area shape=rect coords=\"163,0,243,29\" href=\"/st_main.htm\" 				onmouseout=\"tmn_out(2)\">\n"+
	"	<area shape=rect coords=\"244,0,324,29\" href=\"/c_main.htm\" 					onmouseout=\"tmn_out(3)\">\n"+
	"</map>\n"+
	
	"<map name=topMenuProducts>\n"+
	"	<area shape=rect coords=\"   4,   5, 146, 23\" href=\"/p_vp_billing.htm\"		onmouseover=\"tm_products_over(0)\">\n"+
	"	<area shape=rect coords=\"   4,  23, 146, 41\" href=\"/p_crm_contact_center.htm\" 			onmouseover=\"tm_products_over(1)\">\n"+
	
	"	<area shape=rect coords=\"146,5,260,41\"  href=\"javascript:void(open('report_form.htm', 'report_form', 'width=350,height=430,'))\" onmouseover=\"tm_products_over(3)\">\n"+
	"</map>\n"+                                                                    
	
	"<map name=topMenuProducts2>\n"+                                               
	"	<area shape=rect coords=\"   4,   5, 146, 23\" href=\"/p_vp_billing.htm\"		onmouseout=\"tm_products_out()\">\n"+
	"	<area shape=rect coords=\"   4,  23, 146, 41\" href=\"/p_crm_contact_center.htm\" 			onmouseout=\"tm_products_out()\">\n"+
	
	"   <area shape=rect coords=\"146,5,260,41\"  href=\"javascript:void(open('report_form.htm', 'report_form', 'width=350,height=430,'))\" onmouseout=\"tm_products_out()\">\n"+
	"</map>\n"+
	
	"<map name=topMenuSupport>\n"+
	"	<area shape=rect coords=\"  4, 5,146,23\" href=\"/st_main.htm\" 				onmouseover=\"tm_support_over(0)\">\n"+
	"	<area shape=rect coords=\"  4,23,146,41\" href=\"/st_policy.htm\" 			onmouseover=\"tm_support_over(1)\">\n"+
	"	<area shape=rect coords=\"  4,41,146,59\" href=\"/st_dl.htm\" 					onmouseover=\"tm_support_over(2)\">\n"+
	"	<area shape=rect coords=\"  4,59,146,77\" href=\"/st_brochures.htm\" 		onmouseover=\"tm_support_over(3)\">\n"+
	"	<area shape=rect coords=\"146,5,238,41\"  href=\"javascript:void(open('report_form.htm', 'report_form', 'width=350,height=430,'))\" onmouseover=\"tm_support_over(4)\">\n"+
	"</map>\n"+
	
	"<map name=topMenuSupport2>\n"+
	"	<area shape=rect coords=\"  4, 5,146,23\" href=\"/st_main.htm\" 				onmouseout=\"tm_support_out()\">\n"+
	"	<area shape=rect coords=\"  4,23,146,41\" href=\"/st_policy.htm\" 			onmouseout=\"tm_support_out()\">\n"+
	"	<area shape=rect coords=\"  4,41,146,59\" href=\"/st_dl.htm\" 					onmouseout=\"tm_support_out()\">\n"+
	"	<area shape=rect coords=\"  4,59,146,77\" href=\"/st_brochures.htm\" 		onmouseout=\"tm_support_out()\">\n"+
	"	<area shape=rect coords=\"146,5,238,41\"  href=\"javascript:void(open('report_form.htm', 'report_form', 'width=350,height=430,'))\" onmouseout=\"tm_support_out()\">\n"+
	"</map>\n"+
	
	"<map name=topMenuCorporate>\n"+
	"	<area shape=rect coords=\"  4, 5,107,23\" href=\"/c_main.htm\" 				onmouseover=\"tm_corporate_over(0)\">\n"+
	"	<area shape=rect coords=\"  4,23,107,41\" href=\"/c_press.htm\" 				onmouseover=\"tm_corporate_over(1)\">\n"+
	"	<area shape=rect coords=\"  4,41,107,59\" href=\"/c_coverage.htm\" 			onmouseover=\"tm_corporate_over(2)\">\n"+
	"	<area shape=rect coords=\"  4,59,107,77\" href=\"/c_contact_us.htm\" 		onmouseover=\"tm_corporate_over(3)\">\n"+
	"	<area shape=rect coords=\"108, 5,205,23\" href=\"/c_resellers.htm\" 			onmouseover=\"tm_corporate_over(4)\">\n"+
	"	<area shape=rect coords=\"108,23,205,41\" 	href=\"/c_jobs.htm\" 			onmouseover=\"tm_corporate_over(5)\">\n"+
	"</map>\n"+
	
	"<map name=topMenuCorporate2>\n"+
	"	<area shape=rect coords=\"  4, 5,107,23\" href=\"/c_main.htm\" 				onmouseout=\"tm_corporate_out()\">\n"+
	"	<area shape=rect coords=\"  4,23,107,41\" href=\"/c_press.htm\" 				onmouseout=\"tm_corporate_out()\">\n"+
	"	<area shape=rect coords=\"  4,41,107,59\" href=\"/c_coverage.htm\" 			onmouseout=\"tm_corporate_out()\">\n"+
	"	<area shape=rect coords=\"  4,59,107,77\" href=\"/c_contact_us.htm\" 		onmouseout=\"tm_corporate_out()\">\n"+
	"	<area shape=rect coords=\"108, 5,205,23\" href=\"/c_resellers.htm\" 			onmouseout=\"tm_corporate_out()\">\n"+
	"	<area shape=rect coords=\"108,23,205,41\" href=\"/c_jobs.htm\" 					onmouseout=\"tm_corporate_out()\">\n"+
	"</map>";
}


// generates HTML responsible for the top nav menu

function generateLayersHTML(){
	if(IE || NS6)
	return "<div id=lyrTMN 			style='position:absolute;visibility:hidden;top:0px;left:334px;width:407px;height:29px;'><img GALLERYIMG=NO    src=../imgs/tmn_on.gif           width=407 height=29  onload='isLoaded[\"lyrTMN\"]=true' border=0 usemap=\"#topMenuMap2\"></div>"+
	"<div id=lyrTM_OFF_PRODUCTS  	style='position:absolute;visibility:hidden;top:35px;left:333px;width:450px;height:84px;'><img GALLERYIMG=NO   src=../imgs/tm_off_products.gif width=407 height=84 onload='isLoaded[\"lyrTM_OFF_PRODUCTS\"]=true' border=0 usemap=\"#topMenuProducts\"></div>"+
	"<div id=lyrTM_ON_PRODUCTS   	style='position:absolute;visibility:hidden;top:35px;left:333px;width:407px;height:84px;'><img GALLERYIMG=NO   src=../imgs/tm_on_products.gif  width=407 height=84 onload='isLoaded[\"lyrTM_ON_PRODUCTS\"]=true' border=0 usemap=\"#topMenuProducts2\"></div>"+
	"<div id=lyrTM_OFF_SUPPORT   	style='position:absolute;visibility:hidden;top:35px;left:333px;width:407px;height:84px;'><img GALLERYIMG=NO   src=../imgs/tm_off_support.gif   width=407 height=84 onload='isLoaded[\"lyrTM_OFF_SUPPORT\"]=true' border=0 usemap=\"#topMenuSupport\"></div>"+
	"<div id=lyrTM_ON_SUPPORT    	style='position:absolute;visibility:hidden;top:35px;left:333px;width:407px;height:84px;'><img GALLERYIMG=NO   src=../imgs/tm_on_support.gif    width=407 height=84 onload='isLoaded[\"lyrTM_ON_SUPPORT\"]=true'   border=0 usemap=\"#topMenuSupport2\"></div>"+
	"<div id=lyrTM_OFF_CORPORATE 	style='position:absolute;visibility:hidden;top:35px;left:333px;width:407px;height:84px;'><img GALLERYIMG=NO   src=../imgs/tm_off_corporate.gif width=407 height=84 onload='isLoaded[\"lyrTM_OFF_CORPORATE\"]=true' border=0 usemap=\"#topMenuCorporate\"></div>"+
	"<div id=lyrTM_ON_CORPORATE  	style='position:absolute;visibility:hidden;top:35px;left:333px;width:407px;height:84px;'><img GALLERYIMG=NO   src=../imgs/tm_on_corporate.gif  width=407 height=84 onload='isLoaded[\"lyrTM_ON_CORPORATE\"]=true' border=0 usemap=\"#topMenuCorporate2\"></div>";
}

if(!NS4){
	document.write(generateLayersHTML());
	document.write(generateMapsHTML());
}