var firstLoad=false;
var imgPathPrefix="../images/";

var menuItemBgImg=imgPathPrefix + "trans.gif";
var menuItemCss='textmenubrowse';
var verSpace=2;
var menuItems1;

/*----------------------USAGE----------------------------------------------------
menuItems=new menuItem(menuID, menuText, width, height, left, CSSclass, menuBackGroundColor, menuBackGroundHightlightColor, menuForeGroundColor, menuForeGroundHightlightColor, link, rightArrowImageSrc, rightArrowImageWidth, rightArrowImageHeight)
*/
menuItems1=new Array();
menuItems1[menuItems1.length]=new menuItem("domestic", "Domestic", 136, 14, 0, "textmenubrowse", '#ffffff', '#cc0000', '#ff0000', '#ffffff', "../sales/domestic.aspx", imgPathPrefix + "arrow_red.gif", 14, 14);
menuItems1[menuItems1.length]=new menuItem("international", "International", 136, 14, 0, "textmenubrowse", '#ffffff', '#330066', '#330066', '#ffffff', "../sales/international.aspx?linkSection=none", imgPathPrefix + "arrow3.gif", 14, 14);



function initMenuSales(groupIndex, itemID, isProgram){
	if(document.layers){
		buildNS4Menu1(document.browseMenu1, menuItems1, false);
	}
	else{
		buildIEMenu1(document.getElementById('targetLoc1'), menuItems1, false);
	}
		
	if (groupIndex != -1){
		if(document.layers){
			setNS4Focus1(groupIndex);
		}
		else{
			setIEFocus1(itemID);
		}
	}
	positionMenu();
	window.onResize=positionMenu;
	
	if (isProgram == 1)
		initBackGround();
}

function positionMenu(){

	
	if(document.layers){
		document.browseMenu1.top=document.targetLoc1.pageY;
		document.browseMenu1.left=document.targetLoc1.pageX;

	}
}

function menuItem(id, text, w, h, l, css, bgColor, hlColor, fColor, fHColor, link, arrowImg, arrowImgW, arrowImgH){
	this.id=id;
	this.text=text;
	this.w=w;
	this.h=h;
	this.left=l;
	this.css=css;
	this.bgColor=bgColor;
	this.hlColor=hlColor;
	this.fColor=fColor;
	this.fHColor=fHColor;
	this.link=link;
	this.arrowImg=arrowImg;
	this.arrowImgW=arrowImgW;
	this.arrowImgH=arrowImgH;
	this.isHighlight=0;
}

function buildNS4Menu1(container, menuItems){
	
	var menuStr='';
	var index;
	var nextTop=0;
	
	for(index=0; index<menuItems.length; index++){
		menuItem=menuItems[index];
		menuStr+="<layer class=" + menuItem.css + " id=" + menuItem.id + " width=" + menuItem.w + " height=" + menuItem.h + " left=" + menuItem.left + " top=" + nextTop + ">\n";
		menuStr+="<b><font color=" + menuItem.fHColor + ">" + menuItem.text + "</font></b></layer>\n";
		menuStr+="<layer class=" + menuItem.css + " id=" + menuItem.id + "2 width=" + menuItem.w + " height=" + menuItem.h + " left=" + menuItem.left + " top=" + nextTop + ">\n";
		menuStr+="<b><font color=" + menuItem.fColor + ">" + menuItem.text + "</b></layer>\n";		
		menuStr+="<layer onmouseover=\"highlightNS41(" + index +");\" onmouseout=\"highlightNS41(" + index + ");\" id=" + menuItem.id + "link width=" + menuItem.w + " height=" + menuItem.h + " left=" + menuItem.left + " top=" + nextTop + ">\n";
		menuStr+="<a href=" + menuItem.link + "><img src=" + menuItemBgImg + " width=" + menuItem.w + " height=" + menuItem.h + " border=0></a></layer>\n";
		menuStr+="<layer id=" + menuItem.id + "button width=" + menuItem.arrowImgW + " height=" + menuItem.arrowImgH + " left=" + menuItem.w + " top=" + nextTop + ">\n";
		menuStr+="<a href=" + menuItem.link + " onmouseover=\"highlightNS41(" + index +");\" onmouseout=\"highlightNS41(" + index + ");\"><img src=" + menuItem.arrowImg + " width=" + menuItem.arrowImgW + " height=" + menuItem.arrowImgH + " border=0></a></layer>\n";
		nextTop+=menuItem.h + verSpace;
	}
	

	with(container.document){
		open();
		write(menuStr);
		close();
		
	
		
	
	}

	firstLoad=1;
}


function buildIEMenu1(container, menuItems, isMedical){
	var menuStr='';
	var index;
	var nextTop=0;
	for(index=0; index<menuItems.length; index++){
		menuItem=menuItems[index];
		menuStr+="<div style=\"position:relative; left:" + menuItem.left + "px; top:" + nextTop + "px\">";
		menuStr+="<table width=100% cellpadding=0 cellspacing=0 border=0><tr>"; 
		menuStr+="<td onclick=\"document.location.href='" + menuItem.link + "'\" id=" + menuItem.id + " class=" + menuItem.css + " width=" + menuItem.w + " style=\"cursor:hand;color:" + menuItem.fColor + "\" onMouseOver=\"highlightIE1('" + menuItem.id + "'," + index + ");";
		if (isMedical)
			menuStr += "overMedical('" + menuItem.id + "'," + index + ");";
		menuStr+="\" onMouseOut=\"highlightIE1('" + menuItem.id + "'," + index + ");"
		if (isMedical)
			menuStr += "outMedical('" + menuItem.id + "'," + index + ");";
		menuStr+="\">" + menuItem.text + "</td>";
		menuStr+="<td width=14 heigth=14><a href=" + menuItem.link + " onMouseOver=\"highlightIE1('" + menuItem.id + "'," + index + ");";
		
		
		if (isMedical)
			menuStr += "overMedical('" + menuItem.id + "'," + index + ");";
		menuStr+="\" onMouseOut=\"highlightIE1('" + menuItem.id + "'," + index + ");";
		if (isMedical)
			menuStr += "outMedical('" + menuItem.id + "'," + index + ");";
		menuStr+="\"><img src=" + menuItem.arrowImg + " width=" + menuItem.arrowImgW + " height=" + menuItem.arrowImgH + " border=0></a></td></tr></table></div>";
		nextTop+=verSpace;
		
	}
	
	container.innerHTML=menuStr;
	firstLoad=1;
	
}

function highlightNS41(menuIndex){
	var menuItem=menuItems1[menuIndex];
	var xLayer=document.browseMenu1.layers[menuItem.id];
	var yLayer=document.browseMenu1.layers[menuItem.id + 2];
	
	
	if(!menuItem.isHighlight){
		xLayer.bgColor=menuItem.hlColor;
		menuItem.isHighlight=1;
		yLayer.moveBelow(xLayer);
	}else{
		xLayer.bgColor=menuItem.bgColor;
		menuItem.isHighlight=0;
		yLayer.moveAbove(xLayer);
	}
}

function highlightIE1(itemID, menuIndex){
	var menuItem=menuItems1[menuIndex];
	var xDiv=document.getElementById(itemID);
	
	if(!menuItem.isHighlight){
		xDiv.style.backgroundColor=menuItem.hlColor;
		xDiv.style.color=menuItem.fHColor;
		menuItem.isHighlight=1;
	}
	else{
		xDiv.style.backgroundColor=menuItem.bgColor;
		xDiv.style.color=menuItem.fColor;
		menuItem.isHighlight=0;	
	}
	

}


function setNS4Focus1(groupIndex){
	var menuItem=menuItems1[groupIndex-1];
	var xLayer=document.browseMenu1.layers[menuItem.id];
	var yLayer=document.browseMenu1.layers[menuItem.id + 2];
	xLayer.bgColor="#CCCCCC";
	
}

function setIEFocus1(itemID){
	var xDiv=document.getElementById(itemID);
	xDiv.style.backgroundColor="#CCCCCC";
}

function initBackGround(){
	var xDiv=document.getElementById('Programs');
	xDiv.style.backgroundColor="#99CCCC";
}



