// preload L1 images

var path = (!level) ? "" : "../";

var L1Btn = new Array();
L1Btn = ["company","industry","technology","services","support", "news", "webinar", "partners"];
for (i = 0; i < L1Btn.length; i++) {
  eval(L1Btn[i] + "on = new Image();");
  eval(L1Btn[i] + "off = new Image();");
  eval(L1Btn[i] + "on.src = \"" + path + "img/navigation/l1_" + L1Btn[i] + "_1.gif\";");
  eval(L1Btn[i] + "off.src = \"" + path + "img/navigation/l1_" + L1Btn[i] + "_0.gif\";");
 // alert(i);
}


function imgOn(imgName) {
 	document[imgName].src=eval(imgName + "on.src")
}

function imgOff(imgName) {
 	document[imgName].src=eval(imgName + "off.src")
}

ns = (document.layers)? true:false
ie = (document.all)? true:false
ns6 = (navigator.appName == "Netscape" && document.getElementById)? true:false
winIE5 = false;
var browserString = navigator.appVersion;
if (navigator.userAgent.indexOf("Win") > -1 && navigator.appName == "Microsoft Internet Explorer"){
	if (parseInt(browserString.charAt(22)) < 6){
		winIE5 = true;
	}
}
macIE = false;
macNS = false;
var browserString = navigator.appVersion;
if (navigator.userAgent.indexOf("Mac") > -1 && navigator.appName == "Microsoft Internet Explorer"){
	macIE = true;
}else if(navigator.userAgent.indexOf("Mac") > -1 && navigator.appName != "Microsoft Internet Explorer"){
	macNS = true;
}

//alert(navigator.userAgent);
if (navigator.userAgent.indexOf("Firefox")!=-1){
	//alert("Firefox");
	isFirefox = true;
}else{
	isFirefox = false;
}

function doOnLoad(){
	if( !isFirefox ){
		window.focus();	
	}
}

function doResize(){
	if( !isFirefox ){
		location = location;
	}
}

loaded = false;

function hide(id){
	if (ns) document.layers[id].visibility = "hide"
	if (ns6){
		var obj = eval("document.getElementById('" + id + "')")
		obj.style.visibility = "hidden"
	}
	else if (ie) document.all[id].style.visibility = "hidden"
}
function show(id){
	if (ns) document.layers[id].visibility = "show"
	if (ns6){
		var obj = eval("document.getElementById('" + id + "')")
		obj.style.visibility = "visible"
	}
	else if (ie) document.all[id].style.visibility = "visible"
}

function swap(theName,theIMG){
	theIMG = eval(theIMG);
	document[theName].src = theIMG.src;
}

function menuItem(displayText,theLink,theWidth,theTarget,image,theLeft){
	this.displayText= displayText;
	this.theLink	= theLink;
	this.theWidth	= theWidth;
	this.theTarget	= theTarget;
	this.navImage = image;
	this.theLeft = theLeft;
}

/**/

mainNav = new Array();
	mainNav[0] = new menuItem("Company",""+path+"company/default.aspx",126,0,"nav_01",0);
	mainNav[1] = new menuItem("Industry",""+path+"industry/default.aspx",160,0,"nav_02",114);
	mainNav[2] = new menuItem("Technology",""+path+"technology/default.aspx",150,0,"nav_03",218);
	mainNav[3] = new menuItem("Services",""+path+"services/default.aspx",155,0,"nav_04",328);
	mainNav[4] = new menuItem("Support",""+path+"support/default.aspx",120,0,"nav_05",432);
	mainNav[5] = new menuItem("News",""+path+"news/default.aspx",150,0,"nav_06",531);
	mainNav[6] = new menuItem("Webinar",""+path+"services/default.aspx",150,0,"nav_07",681);
	mainNav[7] = new menuItem("Partners",""+path+"partners/default.aspx",120,0,"nav_08",831);
subnav0 = new Array();
    subnav0[0] = new menuItem("About Us",""+path+"company/about.aspx", -1, 0,0);
	subnav0[1] = new menuItem("Our Mission",""+path+"company/mission.aspx", -1, 0,0);
	subnav0[2] = new menuItem("Executive Team",""+path+"company/Executive-Team.aspx", -1, 0,0);
	subnav0[3] = new menuItem("Board of Directors",""+path+"company/board.aspx", -1, 0,0);
	subnav0[4] = new menuItem("Board of Advisors",""+path+"company/advisory-board.aspx", -1, 0,0);
	subnav0[5] = new menuItem("Careers",""+path+"company/Careers.aspx", -1, 0,0);
	subnav0[6] = new menuItem("Contact Us",""+path+"company/contact.aspx", -1, 0,0);		
subnav1 = new Array();
	subnav1[0] = new menuItem("Relief & Reconstruction",""+path+"industry/Recovery-Reconstruction.aspx", -1, 0,0);
	subnav1[1] = new menuItem("Emergency Management",""+path+"industry/Emergency-Management.aspx", -1, 0,0);
	subnav1[2] = new menuItem("Military Operations",""+path+"industry/Military-Operations.aspx", -1, 0,0);
	subnav1[3] = new menuItem("Expeditionary Medicine",""+path+"industry/Expeditionary-Medicine.aspx", -1, 0,0);
	subnav1[4] = new menuItem("Oil, Gas & Minerals",""+path+"industry/Oil-Gas-Minerals.aspx", -1, 0,0);
	subnav1[5] = new menuItem("Custom Solutions",""+path+"industry/custom-solutions.aspx", -1, 0,0);
subnav2 = new Array();
    subnav2[0] = new menuItem("Overview",""+path+"technology/default.aspx", -1, 0,0);
    subnav2[1] = new menuItem("RDMS Collect&trade;",""+path+"technology/RDMS-Collect.aspx", -1, 0,0);
    subnav2[2] = new menuItem("RDMS Communicate&trade;",""+path+"technology/RDMS-Communicate.aspx", -1, 0,0);
    subnav2[3] = new menuItem("RDMS Collaborate&trade;",""+path+"technology/RDMS-Collaborate.aspx", -1, 0,0);
    subnav2[4] = new menuItem("RDMS Logistics&trade;",""+path+"technology/RDMS-Logistics.aspx", -1, 0,0);
	subnav2[5] = new menuItem("Security",""+path+"technology/Security.aspx", -1, 0,0);
subnav3 = new Array();
	subnav3[0] = new menuItem("Rapid Implementation",""+path+"Services/Implementation.aspx", -1, 0,0);
	subnav3[1] = new menuItem("Training & Support",""+path+"Services/Training.aspx", -1, 0,0);
	subnav3[2] = new menuItem("Secure, Reliable Hosting",""+path+"Services/Hosting.aspx", -1, 0,0);
	<!--subnav3[3] = new menuItem("Pro Services",""+path+"Services/Pro-Services.aspx", -1, 0,0);
subnav4 = new Array();
	subnav4[0] = new menuItem("Help Desk",""+path+"support/Default.aspx", -1, 0,0);
	subnav4[1] = new menuItem("Documentation",""+path+"support/Documentation.aspx", -1, 0,0);
    <!--subnav4[0] = new menuItem("Standard",""+path+"support/Standard.aspx", -1, 0,0);
    <!--subnav4[1] = new menuItem("Premium",""+path+"support/Premium.aspx", -1, 0,0);
subnav5 = new Array();
	subnav5[0] = new menuItem("GRT in the News",""+path+"news/news.aspx", -1, 0,0);
    subnav5[1] = new menuItem("Deployments",""+path+"news/Deployments.aspx", -1, 0,0);
    subnav5[2] = new menuItem("Awards",""+path+"news/awards.aspx", -1, 0,0);
	subnav5[3] = new menuItem("GRT Twitter",""+path+"news/grt-twitter.aspx", -1, 0,0);
    subnav5[4] = new menuItem("GRT Newsletter",""+path+"news/newsletter.aspx", -1, 0,0);
    subnav5[5] = new menuItem("RSS Feeds",""+path+"news/rss.aspx", -1, 0,0);
	subnav5[6] = new menuItem("Media Center",""+path+"news/media-center.aspx", -1, 0,0);
subnav6 = new Array();
	subnav6[0] = new menuItem("Sign-Up",""+path+"webinar/default.aspx", -1, 0,0);
subnav7 = new Array();
    subnav7[0] = new menuItem("Partner List",""+path+"partners/Default.aspx", -1, 0,0);

function mainNavWidth(){
	mainWidth = 0;
	for(w = 0; w < mainNav.length; w ++){
		mainWidth += mainNav[w].theWidth;
	}
	return mainWidth;
}

outHTML = "";

function writeNav()
{    
    outHTML+="<div id=\"levelOneNav\">";
        outHTML+="<div id=\"levelOneButtons\">";
            for( i = 0; i < L1Btn.length; i ++ ){            
            	theMouseOver = "dropMenu.showMenu('" + L1Btn[i] + "');";
		        theMouseOut = "dropMenu.hideMenu('" + L1Btn[i] + "');";			        
	            outHTML+="<a id=\"hl" + L1Btn[i] + "\" onmouseover=\"imgOn('" + L1Btn[i] + "');"+theMouseOver+"\" onmouseout=\"imgOff('" + L1Btn[i] + "');"+theMouseOut+"\" href=\""+ path + L1Btn[i] + "/default.aspx\"><img id=\"i"+ L1Btn[i] +"\" name=\""+ L1Btn[i] + "\" src=\""+path+"img/navigation/l1_"+ L1Btn[i] +"_0.gif\" style=\"border-width:0px;\" /></a>";
	        }
	outHTML+="</div></div> <!-- end levelOneNav -->";
	document.write(outHTML);
}

function findPosX(obj){
	var curleft = 0;
	
	if (document.getElementById || document.all){
		while (obj.offsetParent){
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		return curleft;
	}
}
function findPosY(obj){
	var curtop = 0;
	if (document.getElementById || document.all){
		while (obj.offsetParent){
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
		return curtop;
	}else{
		curtop += obj.y;
		return curtop;
	}
}
theWidth = 155;
theTop = 155;
outLayersHTML = "";
function writeMenus(){

	for( k = 0; k < mainNav.length; k ++ ){
		nameID = L1Btn[k];		
		if(ie){
			theLeft = findPosX(document.all("hl" + L1Btn[k]));
		}else if(ns6){
			theLeft = findPosX(document.getElementById("i"+L1Btn[k]));
		}else if(ns){
			theLeft = document.layers["i" + L1Btn[k]].pageX;
		}
		theLeft += 4;
		if(isFirefox){
			theLeft-=4;
		}
		if(mainNav[k].theLeft!=theLeft){
		   theLeft = mainNav[k].theLeft;
		}
		theWidth = mainNav[k].theWidth;
		
		outLayersHTML += "<script language=\"javascript\">new dropMenu('" + nameID + "', 'down', " + theLeft + ", " + theTop + ", " + theWidth + ", 220)</script>";
		outLayersHTML += "<div id='" + nameID + "Container'>";
			outLayersHTML += "<div id='" + nameID + "Content' class='menu'>";
				outLayersHTML += "<div class='options'>";
		        curELE = eval("subnav" + k);
		        for( n = 0; n < curELE.length; n ++ ){
			        outLayersHTML += "<a href=\"" + curELE[n].theLink + "\">" + curELE[n].displayText + "</a>";
		        }
				outLayersHTML += "</div>";
			outLayersHTML += "</div>";
		outLayersHTML += "</div>";
	}
	//alert(outLayersHTML);
	document.write(outLayersHTML);
}

dropMenu.Registry = []
dropMenu.aniLen = 250
dropMenu.hideDelay = 500
dropMenu.minCPUResolution = 10
// constructor

//fires on instantiation of each new menu object
function dropMenu(id, dir, left, top, width, height){
	this.ie = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0
	if (this.ie || this.ns4 || this.dom){
		this.id = id
		this.dir = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType = dir == "right" || dir == "down" ? "-" : "+"
		this.dim = this.orientation == "h" ? width : height
		this.hideTimer = false
		this.aniTimer = false
		this.open = false
		this.over = false
		this.startTime = 0
		this.gRef = "dropMenu_" + id
		eval(this.gRef + "=this")
		dropMenu.Registry[id] = this
		var d = document
		var strCSS = '<style type="text/css">';
		strCSS += '#' + this.id + 'Container { visibility:hidden; '
		strCSS += 'left:' + left + 'px; '
		strCSS += 'top:' + top + 'px; '
		strCSS += 'overflow:hidden; z-index:10000; filter:alpha(Opacity=100); }'
		strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
		strCSS += 'width:' + width + 'px; '
		strCSS += 'height:' + height + 'px; '
		strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '
		strCSS += '}'
		strCSS += '</style>'
		d.write(strCSS)
		this.load()
	}
}
dropMenu.prototype.load = function(){
	var d = document
	var lyrId1 = this.id + "Container"
	var lyrId2 = this.id + "Content"
	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
	var temp
	if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)
	else {
	this.container = obj1
	this.menu = obj2
	this.style = this.ns4 ? this.menu : this.menu.style
	this.homePos = eval("0" + this.dirType + this.dim)
	this.outPos = 0
	this.accelConst = (this.outPos - this.homePos) / dropMenu.aniLen / dropMenu.aniLen 
	// set event handlers.
	if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
	this.menu.onmouseover = new Function("dropMenu.showMenu('" + this.id + "')")
	this.menu.onmouseout = new Function("dropMenu.hideMenu('" + this.id + "')")
	//set initial state
	this.endSlide()
	}
}
dropMenu.showMenu = function(id){
	var reg = dropMenu.Registry
	var obj = dropMenu.Registry[id]
	if (obj.container) {
		obj.over = true
		for (menu in reg) if (id != menu) dropMenu.hide(menu)
			if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
			if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
	}
}
dropMenu.hideMenu = function(id){
	var obj = dropMenu.Registry[id]
	if (obj.container) {
		if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
		obj.hideTimer = window.setTimeout("dropMenu.hide('" + id + "')", dropMenu.hideDelay);
	}
}
dropMenu.hideAll = function(){
	var reg = dropMenu.Registry
	for (menu in reg) {
		dropMenu.hide(menu);
		if (menu.hideTimer) window.clearTimeout(menu.hideTimer);
	}
}
dropMenu.hide = function(id){
	var obj = dropMenu.Registry[id]
	obj.over = false
	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
	obj.hideTimer = 0
	if (obj.open && !obj.aniTimer) obj.startSlide(false)
}
dropMenu.prototype.startSlide = function(open) {
	this[open ? "onactivate" : "ondeactivate"]()
	this.open = open
	if (open) this.setVisibility(true)
	this.startTime = (new Date()).getTime() 
	this.aniTimer = window.setInterval(this.gRef + ".slide()", dropMenu.minCPUResolution)
}
dropMenu.prototype.slide = function() {
	var elapsed = (new Date()).getTime() - this.startTime
	if (elapsed > dropMenu.aniLen) this.endSlide()
	else {
		var d = Math.round(Math.pow(dropMenu.aniLen-elapsed, 2) * this.accelConst)
		if (this.open && this.dirType == "-") d = -d
		else if (this.open && this.dirType == "+") d = -d
		else if (!this.open && this.dirType == "-") d = -this.dim + d
		else d = this.dim + d
		this.moveTo(d)
	}
}
dropMenu.prototype.endSlide = function() {
	this.aniTimer = window.clearTimeout(this.aniTimer)
	this.moveTo(this.open ? this.outPos : this.homePos)
	if (!this.open) this.setVisibility(false)
	if ((this.open && !this.over) || (!this.open && this.over)) {
		this.startSlide(this.over)
	}
}
dropMenu.prototype.setVisibility = function(bShow) { 
	var s = this.ns4 ? this.container : this.container.style
	s.visibility = bShow ? "visible" : "hidden"
}
dropMenu.prototype.moveTo = function(p) { 
	this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}
dropMenu.prototype.getPos = function(c) {
	return parseInt(this.style[c])
}
dropMenu.prototype.onactivate = function() {}
dropMenu.prototype.ondeactivate = function() { }


//grt twitter image rollover

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}