var opacity = 100;
var globalOffset_x = 2;
// properties imgheight, imgwidth and class are only for using images ("[-image-]"). class determines the image file using css class of that name and its hover class. imgheight, imgwidth set the size of the image.  These properties are not to be used otherwise
// use [-divider-] to add a dividing line
// current limitation: DO NOT MAKE a top level item with no sub menus.
// XML Data
var xmlData='';
xmlData+='<menu popdirection="down">';



//Products Menu Begins
xmlData+='<top title="[-image-]" imgwidth="97" imgheight="60" class="roll2" hoverclass="roll2hov">';
    //Products Submenus
	xmlData+='<first title="POWERSPORTS" url="/nxt/index.php"></first>';  	
	xmlData+='<first title="RV" url="/rv/index.php"></first>';
    xmlData+='<first title="MARINE" url="/marine/index.php"></first>';
xmlData+='</top>';
//Products Menu Ends

//Services Menu
xmlData+='<top title="[-image-]" imgwidth="98" imgheight="60" class="roll3" hoverclass="roll3hov">';
	//1st Services Submenu - Powersports
	xmlData+='<first title="POWERSPORTS" url="/nxt/index.php">'; 
		//xmlData+='<second title="DOX" url="/nxt/nxt_xpress.php"></second>';
        //xmlData+='<second title="OEM Data" url="/nxt/nxt_oemdata.php"></second>';
		xmlData+='<second title="Credit Check" url="/nxt/nxt_creditcheck.php"></second>';
		xmlData+='<second title="Vehicle Registration" url="/nxt/nxt_registration.php"></second>';
		xmlData+='<second title="Credit Card Integration" url="/nxt/nxt_charge.php"></second>';
		//xmlData+='<second title="PSN" url="/nxt/nxt_psn.php"></second>';
		//xmlData+='<second title="[-divider-]></second>';
		xmlData+='<second title="DataBack" url="/nxt/nxt_databack.php"></second>'
    	//xmlData+='<second title="Hardware Maintenance" url="/nxt/nxt_hardware.php"></second>';
    	//xmlData+='<second title="Payroll/HR Services" url="/nxt/nxt_payroll.php"></second>';
		xmlData+='<second title="Dealership Consulting" url="/nxt/nxt_consulting.php"></second>';	
                xmlData+='<second title="PartsManager Pro™" url="/nxt/nxt_pmpro.php"></second>';
		xmlData+='<second title="Parts and MU Locator" url="/nxt/nxt_locator.php"></second>';
		xmlData+='<second title="CRM" url="/nxt/nxt_crm.php"></second>';
		xmlData+='<second title="Payroll Plus" url="/nxt/nxt_payrollplus.php"></second>';
		xmlData+='<second title="Website Integration" url="/nxt/web_int.php"></second>';
	xmlData+='</first>';
	//2nd Services Submenu - RV
	xmlData+='<first title="RV" url="/rv/index.php">';
		xmlData+='<second title="Manufacturer Data" url="/rv/rv_oemdata.php"></second>';
		//xmlData+='<second title="Databackl" url="/rv/rv_databack.php"></second>';
		//xmlData+='<second title="Hardware Maintenance" url="/rv/rv_hardware.php"></second>';
		xmlData+='<second title="Payroll/HR Services" url="/rv/rv_payroll.php"></second>';
		xmlData+='<second title="Dealership Consulting" url="/rv/rv_consulting.php"></second>';
		xmlData+='<second title="CRM" url="/rv/rv_crm.php"></second>';
		xmlData+='<second title="Payroll Plus" url="/rv/rv_payrollplus.php"></second>';
		xmlData+='<second title="Rental and Storage" url="/rv/rv_rental.php"></second>';
		xmlData+='<second title="Website Integration" url="/rv/rv_webint.php"></second>';
    xmlData+='</first>';
	//3rd Services Submenu - Marine
    xmlData+='<first title="MARINE" url="/marine/index.php">';
		xmlData+='<second title="Manufacturers Data" url="/marine/m_oemdata.php"></second>';
		//xmlData+='<second title="Rental" url="/marine/m_rental.php"></second>';
		//xmlData+='<second title="Hardware Maintenance" url="/marine/m_hardware.php"></second>';
		xmlData+='<second title="Payroll/HR Services" url="/marine/m_payroll.php"></second>';
		xmlData+='<second title="Dealership Consulting" url="/marine/m_consulting.php"></second>';
                xmlData+='<second title="PartsManager Pro™" url="/marine/m_pmpro.php"></second>';
				xmlData+='<second title="CRM" url="/marine/marine_crm.php"></second>';
		xmlData+='<second title="Payroll Plus" url="/marine/marine_payrollplus.php"></second>';
		xmlData+='<second title="Rental and Storage" url="/marine/marine_rental.php"></second>';
		xmlData+='<second title="Website Integration" url="/marine/marine_webint.php"></second>';
    xmlData+='</first>';
xmlData+='</top>';
//Services Menu Ends

//Support Menu Begins
xmlData+='<top title="[-image-]" imgwidth="98" imgheight="60" class="roll4" hoverclass="roll4hov">';
	xmlData+='<first title="TECHNICAL SUPPORT" url="/technical.php"></first>';
	xmlData+='<first title="TRAINING" url="/training.php"></first>';
xmlData+='</top>';
//Support Menu Ends

//Contact Menu Begins
xmlData+='<top title="[-image-]" imgwidth="98" imgheight="60" class="roll5" hoverclass="roll5hov">';
xmlData+='<first title="CORPORATE CONTACT" url="/contact.php"></first>';
xmlData+='<first title="DRIVING DIRECTIONS" url="/driving.php"></first>';
xmlData+='<first title="FIND A SALES REP" url="/salesrep.php"></first>';
xmlData+='<first title="REQUEST INFORMATION" url="/request.php"></first>';
xmlData+='<first title="CUSTOMER LOGIN" url="http://www.psdealer.com/"></first>';
xmlData+='</top>';
//Contact Menu Ends

//Company Menu Begins
xmlData+='<top title="[-image-]" imgwidth="97" imgheight="60" class="roll1" hoverclass="roll1hov">';
    //Company Submenus
	xmlData+='<first title="ABOUT US" url="/company.php"></first>';  	
	xmlData+='<first title="PRESS RELEASES" url="/press.php"></first>';
	//xmlData+='<first title="CALENDAR OF EVENTS" url="/calendar.php"></first>';
	xmlData+='<first title="KNOWLEDGE CENTER" url="/knowledge.php"></first>';
	xmlData+='<first title="CAREERS" url="/career.php"></first>';
xmlData+='</top>';
//Company Menu Ends

xmlData+='</menu>';

var clear_zone_click='';
clear_zone_click+='<a href="javascript: menubar_clearSubs(0)" onmouseover="menubar_rollItOut()"><img src="/img/spacer.gif" width="780" height="500" border="0"></a>';
var timerID;

var menuTitlesXML=new Array(); 
var mainNames=new Array();
var mainProps=new Array();

var subNames=new Array();
var subProps=new Array();

var flatArrXML = new Array();
var flatArrXMLsubs = new Array();
var trackArr = new Array();
var trackIdarr = new Array();
var trackArrDepth = new Array();
var flatMerge = new Array();
var flatArr=0;
var arrReady=0;

//var req = new XMLHttpRequest();
//var req = new ActiveXObject("Microsoft.XMLHTTP");
//req.open('menus.xml');

var req;
var xmlDoc;

//var items = req.responseXML.getElementsByTagName("item");
//-----Re-useable functions-----
var ml = new Array();
var vz = new Array();
var lszix = new Array();
var lsziy = new Array();

var sho=new Array();
var indx;
var delayit;
var zindx;

var donechk = 0;
var adth=".parent";

if (document.layers){

sho[0]="hide";
sho[1]="show";
}
else {
sho[0]="hidden";
sho[1]="visible";
}

function handleIt(layid) {
	
	if (document.layers){
  	rtn = eval('document.' + layid);
  	return(rtn);
    }
  else if (document.all) {
  	rtn = eval('document.all.' + layid + '.style');
  	return(rtn);
  }
  else if (document.getElementById){

 return (document.getElementById(layid).style);
	}
  else return(null);
}

function makeIt(layid, lposx, lposy, lsizx, lsizy, layon, incode, opacity) {
  indx = ml.length;
  zindx=100000+indx;
  ml[indx] = layid;  
  vz[indx]=layon;
  lszix[indx]=lsizx;
  lsziy[indx]=lsizy;

if (document.layers) {
     document.writeln('<layer name="' + layid + '" left=' + lposx + ' top=' + lposy + ' width=' + lsizx + ' height=' + lsizy +  ' visibility=' + (layon ? '"show"' : '"hide"') + ' z-index=' + zindx + '>');
     document.writeln(incode);
     document.writeln('</layer>');
    
  }
	else {
     document.writeln('<div id="' + layid + '" style="filter:alpha(opacity=' + opacity + '); -moz-opacity:' + opacity/100 + '; opacity:' + opacity/100 + '; position:absolute; overflow:none; left: ' + lposx + 'px; top: ' + lposy + 'px; width: ' + lsizx + 'px; height: ' + lsizy + 'px;' + ' visibility:' + (layon ? 'visible;' : 'hidden;') + ' z-index:' + zindx + '; cursor: hand;">');
     document.writeln(incode);
     document.writeln('</div>');
  }  
}

function moveIt(layid,mx,my) {
  layr = handleIt(layid);
if ((document.getElementById)||(document.all)) {
  layr.left = mx + 'px';
  layr.top = my + 'px';
  } else {
  layr.left = mx;
  layr.top = my;
  
  }
}

function clipIt(layid,tp,rt,bt,lf) {
	layr = handleIt(layid);
	if (document.layers) {
     layr.clip.top = tp;
     layr.clip.right = rt;
     layr.clip.bottom = bt;
     layr.clip.left = lf;
  } 
  else {
	layr.clip = 'rect(' + tp + ' ' +  rt + ' ' + bt + ' ' + lf +')';
	}
}

function showIt(layid, shm) {
	layr = handleIt(layid);
	layr.visibility = sho[shm];
}

function remakeIt(name, content) {

  if (document.layers) {
    var layer = eval('document.' + name);
    layer.document.open();
    layer.document.writeln(content);
    layer.document.close();
  }
  else if (document.all) {
    document.all(name).innerHTML=content;
  }
  else if (document.getElementById){ 
  	document.getElementById(name).innerHTML = content;
  }
}

function stackIt(layid, zlv) {
	layr = handleIt(layid);
	layr.zIndex = zlv;
}

function sizeIt(layid,mx,my) {
  layr = handleIt(layid);
  layr.width = mx;
  layr.height = my;
}

function findPosition( oLink ) {
    
    if (document.layers) {
        theobj = document.eval(oLink);
    }
    
    if ((!document.all) && (document.getElementById)) {
        theobj = document.getElementById(oLink);
    }
    
    if (document.all) {
        theobj = document.all[oLink];
    }
    
      if( theobj.offsetParent ) {
        for( var posX = 0, posY = 0; theobj.offsetParent; theobj = theobj.offsetParent ) {
          posX += theobj.offsetLeft;
          posY += theobj.offsetTop;
        }
        return [ posX, posY ];
      } else {
        return [ theobj.x, theobj.y ];
      }
    }
    
function alignSize()
    {
       location.reload(true);
    }

//-----Re-useable functions-----


//-----global menu activity variables-----
var menu_mc=0;
var activd = new Array();
var lighted = new Array();
var lighteditm = new Array();
var activct=0;
var mytime;
var aclick=0;
//-----global menu construction variables-----
var mnu_pg_x=new Array();
var mnu_pg_y=new Array();
var menubar_names=new Array();
var menu_titles_arrs=new Array();
var menubar_topofset=new Array();

var topflagofs=new Array();

var menudivs=[];
var topids=[];
var subparentitems=[];
var perams = new Array();

var fb_title=[];
var fb_id=[];
var fb_parent=[];
var fb_url=[];
var fb_check=[];
var fb_disable=[];
var fb_child=[];
var fb_classname=[];
var fb_classover=[];


//-----end globals----
function menubar_setEnabled(item,state) {
imgref=document.images["checkstatus_" + document.getElementById(item).id];
if (state) {
	document.getElementById(item).setAttribute('enabledState','on');
	document.getElementById(item).className='menubar_item';

	if (imgref.getAttribute('checkedState')=='on') {
		imgref.src='/img/menubar_check.gif';
		}
	
	
} else {
	document.getElementById(item).setAttribute('enabledState','off');
	document.getElementById(item).className='menubar_item_disabled';
	if (imgref.getAttribute('checkedState')=='on') {
		imgref.src='/img/menubar_check_disabled.gif';	
	} 
	
	
	}
}

function callIt(urlref) {
	if (urlref) location.href=urlref;
}

function menubar_toggleEnabled(item) {

}

function menubar_linkCall(ref,link) {

if(document.getElementById(ref).getAttribute('enabledState')=='off') return false;
	else {
	if(document.getElementById(ref).getAttribute('menubarLink')) {         
	callink=document.getElementById(ref).getAttribute('menubarLink');
	if(callink.indexOf('javascript:')!=-1) {
	z=callink.indexOf('javascript:');
	jslnk=callink.substr(z + 11,callink.length);
	eval(jslnk);
	
	} else {
	
	document.location.href=callink;
    
           }
	   }
	}
}

function menubar_setChecked(item,state) {
enab=document.getElementById(item).getAttribute('enabledState');
imgref=document.images["checkstatus_" + document.getElementById(item).id];
if (state) {
	imgref.setAttribute('checkedState','on');
    if(enab!='off') {
    imgref.src='/img/menubar_check.gif';
    } else {
    imgref.src='/img/menubar_check_disabled.gif';
    }
    
} else {
	imgref.src='/img/spacer.gif';
	imgref.setAttribute('checkedState','off');
	}
}

function menubar_toggleChecked(item){
enab=document.getElementById(item).getAttribute('enabledState');
imgref=document.images["checkstatus_" + document.getElementById(item).id];

if (imgref.getAttribute('checkedState')=='on') {
	imgref.src='/img/spacer.gif';
	imgref.setAttribute('checkedState','off');
	
} else {
	
	if(enab!='off') {
    imgref.src='/img/menubar_check.gif';
    } else {
    imgref.src='/img/menubar_check_disabled.gif';
    }
    
	imgref.setAttribute('checkedState','on');

	}
}

//----menu constructor----
function menubarMaker(mbmkid,bldx,bldy,thisarr) {
//thisarr=new Array();
//thisarr=anarr;

menubar_names[menu_mc]=mbmkid;
mnu_pg_x[menu_mc]=bldx;
mnu_pg_y[menu_mc]=bldy;

menu_titles_arrs[menu_mc]=thisarr;
menubar_topofset[menu_mc]='topofset_' + mbmkid;

menudivs[menu_mc]=[];
topids[menu_mc]=[];
subparentitems[menu_mc]=[];

fb_title[menu_mc]=[];
fb_id[menu_mc]=[];
fb_parent[menu_mc]=[];
fb_url[menu_mc]=[];
fb_check[menu_mc]=[];
fb_disable[menu_mc]=[];
fb_child[menu_mc]=[];
fb_classname[menu_mc]=[];
fb_classover[menu_mc]=[];

var subcont=new Array();
var spict=0;
var topidsct=0;
var menudivct=0;
var topflag=0;

subcont[menudivct]='<table cellspacing="0" cellpadding="0" border="0">';
subcont[menudivct]+='<tr><td><table cellspacing="0" cellpadding="0" border="0">';

var lastsub='';

var mnubar='';

mnubar+='<table cellspacing="0" cellpadding="0" border="0" width="100%">';
mnubar+='<tr><td><table cellspacing="0" cellpadding="0" border="0"><tr>';


for (i=0; i<thisarr.length; i++) {

myvars=thisarr[i];
	
if (myvars.indexOf('&')!=-1) {
	perams=new Array();   
	lastx = 0;
   	x = 0;
   	p=myvars.length;
   	for (y = 0; lastx <= p; y++)
   	{
   	x = myvars.indexOf('&', lastx);
   	if(x==-1) x=p;
   	perams[y] = myvars.substring(lastx, x);
   	lastx = x + 1;
    }
}


fb_title[menu_mc][i]=perams[0];
fb_id[menu_mc][i]=perams[1];
fb_parent[menu_mc][i]=perams[2];
fb_url[menu_mc][i]=perams[3];
fb_check[menu_mc][i]=perams[4];
fb_disable[menu_mc][i]=perams[5];
fb_classname[menu_mc][i]=perams[6];
fb_classover[menu_mc][i]=perams[7];


if (i==0) lastsub=perams[2];

if (thisarr[i].indexOf('[$020113]')!=-1) {
	topflag=1;
	topflagofs[menu_mc]=i;
	
	} 
	
if (!topflag) {
  
 	topids[menu_mc][topidsct]=perams[1];
    topidsct++;
	
	if (thisarr[i].indexOf("<img")!=-1) {
	//alert(perams[7]);
	//image in topmenu
	mnubar+='<td id="' + perams[1] + '" onclick="menubar_linkCall(\''+ perams[1] +'\')" onmouseover="if(aclick<1) menubar_goMenu(this.id,3,' + menu_mc + '); if(aclick>0) menubar_rollMenu(this.id,2,' + menu_mc + ')" onmouseout="if(aclick<1) menubar_rollOut(this.id,' + menu_mc + ',' + i + '); menubar_rollMenu(this.id,0,' + menu_mc + ')" class="' + perams[6] + '"><nobr>' + perams[0] + '</nobr></td>';
	
	} else {
	
	if (perams[5]=="1")  {
	//disabled top menu item
	mnubar+='<td><table cellspacing="0" cellpadding="5" border="0" class="menubar_top_item"><tr class="menubar_top_item_disabled" id="' + perams[1] + '" onmouseover="menubar_rollMenu(this.id,2,' + menu_mc + ')" onmouseout="if(aclick<1) menubar_rollOut(this.id,' + menu_mc + ',' + i + ');" disabledState="' + perams[5] + '"><td>';
} else {
	
	//normal top menu item
	mnubar+='<td><table cellspacing="0" cellpadding="5" border="0" class="menubar_top_item"><tr class="menubar_top_item" id="' + perams[1] + '" onmouseover="menubar_rollMenu(this.id,2,' + menu_mc + ')" onmouseout="if(aclick<1) menubar_rollOut(this.id,' + menu_mc + ',' + i + ');" onclick="menubar_goMenu(this.id,3,' + menu_mc + ')" disabledState="0"><td>';	
	}

if(perams[4]=='1') {
	if(perams[5]=="1") {
	mnubar+='<img src="/img/menubar_check_disabled.gif" width="12" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="1">';
	} else {
	mnubar+='<img src="/img/menubar_check.gif" width="12" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="1">';
	}
	} else {
	mnubar+='<img src="/img/spacer.gif" width="1" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="0">';
	}
	
	
	mnubar+='</td><td><nobr>' + perams[0] + '</nobr></td><td><img src="/img/spacer.gif" width="12" height="15" border="0"></td></tr></table></td>';
		
	}
} else if (thisarr[i].indexOf('[$020113]')!=-1) {
	
	mnubar+='</tr></table></tr>';
	mnubar+='<tr><td id="' + menubar_topofset[menu_mc] + '"></td></tr></table>';
	makeIt(menubar_names[menu_mc],bldx,bldy,window.width,0,true,mnubar,opacity);
	
} else {
	
	if((perams[2]==lastsub)&&(i<thisarr.length-1)) {
	
	if(perams[0]=="[-divider-]") subcont[menudivct]+='<tr id="'+ perams[1] + '" class="menubar_item"><td colspan="11"><img src="/img/menubar_divider.gif" width="100%" height="1" border="0"></td></tr>';
	else if(perams[0].indexOf("<img")!=-1) subcont[menudivct]+='<tr id="'+ perams[1] + '" onmouseover="menubar_goMenu(this.id,1,' + menu_mc + ')" onmouseout="menubar_rollOut(this.id,' + menu_mc + ',' + i + '); menubar_goMenu(this.id,0,' + menu_mc + ')" onclick="menubar_linkCall(\''+ perams[1] +'\')" menubarLink="' + perams[3] + '"><td colspan="11" id="'+ perams[1] + 'so">' + perams[0] + '</td></tr>';
	
	else {

	if (perams[5]=="1") {
	subcont[menudivct]+='<tr id="'+ perams[1] + '" class="menubar_item_disabled" onmouseover="menubar_goMenu(this.id,1,' + menu_mc + ')" onmouseout="menubar_rollOut(this.id,' + menu_mc + ',' + i + '); menubar_goMenu(this.id,0,' + menu_mc + ')" menubarLink="' + perams[3] + '" disabledState="1"><td id="'+ perams[1] + 'so"><img src="/img/spacer.gif" width="3" height="15" border="0"></td><td>';
	} else {
	subcont[menudivct]+='<tr id="'+ perams[1] + '" class="menubar_item" onmouseover="menubar_goMenu(this.id,1,' + menu_mc + ')" onmouseout="menubar_rollOut(this.id,' + menu_mc + ',' + i + '); menubar_goMenu(this.id,0,' + menu_mc + ')" onclick="menubar_linkCall(\''+ perams[1] +'\')" menubarLink="' + perams[3] + '" disabledState="0"><td><img src="/img/spacer.gif" width="3" height="15" border="0"></td><td id="'+ perams[1] + 'so">';
	}

if(perams[4]=='1') {
	if(perams[5]=="1") {
	subcont[menudivct]+='<img src="/img/menubar_check_disabled.gif" width="12" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="1">';
	} else {
	subcont[menudivct]+='<img src="/img/menubar_check.gif" width="12" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="1">';
	}
	} else {
	subcont[menudivct]+='<img src="/img/spacer.gif" width="1" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="0">';
	}
	subcont[menudivct]+='</td><td></td><td><nobr>' + perams[0] + '</nobr></td><td><img src="/img/spacer.gif" width="15" height="15" border="0"></td><td><!--text hint--></td><td><img src="/img/spacer.gif" width="3" height="15" border="0"></td><td><img src="/img/spacer.gif" width="12" height="15" border="0" name="arrowed_' + perams[1] + '"></td><td><img src="/img/spacer.gif" width="3" height="15" border="0"></td></tr>';
	}
	lastsub=perams[2];
		
	}
	
if ((perams[2]!=lastsub)&&(i<thisarr.length-1)) {
	menudivs[menu_mc][menudivct]=menubar_names[menu_mc] + 'sub' + menudivct;
	subparentitems[menu_mc][spict]=perams[2];
	spict++;
	subcont[menudivct]+='</table></td><td id="' + menubar_names[menu_mc] + 'sub' + menudivct + 'w" class="menubar_none"><img src="/img/spacer.gif" width="1" height="1" border="0"></td></tr>';
	subcont[menudivct]+='<tr><td id="' + menubar_names[menu_mc] + 'sub' + menudivct + 'h"></td></tr></table>';
	makeIt(menubar_names[menu_mc] + 'sub' + menudivct,bldx,bldy,100,100,false,subcont[menudivct], opacity);
//SUBMENUS
if (i<thisarr.length-1) {	
	menudivct++;
	subcont[menudivct]='<table cellspacing="0" cellpadding="0" border="0">';
	subcont[menudivct]+='<tr><td><table cellspacing="0" cellpadding="1" border="0" class="submenu_style">';
	
	if(perams[0]=="[-divider-]") subcont[menudivct]+='<tr id="'+ perams[1] + '"><td colspan="11"><img src="/img/menubar_divider.gif" width="100%" height="11" border="0"></td></tr>';
	else if(perams[0].indexOf("<img")!=-1) subcont[menudivct]+='<tr id="'+ perams[1] + '" onmouseover="menubar_goMenu(this.id,1,' + menu_mc + ')" onmouseout="menubar_rollOut(this.id,' + menu_mc + ',' + i + '); menubar_goMenu(this.id,0,' + menu_mc + ')" onclick="menubar_linkCall(\''+ perams[1] +'\')" menubarLink="' + perams[3] + '"><td colspan="11" id="'+ perams[1] + 'so">' + perams[0] + '</td></tr>';
	else {
	if (perams[5]=="1") {
	subcont[menudivct]+='<tr id="'+ perams[1] + '" class="menubar_item_disabled" onmouseover="menubar_goMenu(this.id,1,' + menu_mc + ')" onmouseout="menubar_rollOut(this.id,' + menu_mc + ',' + i + '); menubar_goMenu(this.id,0,' + menu_mc + ')" menubarLink="' + perams[3] + '" disabledState="1"><td id="'+ perams[1] + 'so"><img src="/img/spacer.gif" width="1" height="15" border="0"></td><td>';
	} else {
	subcont[menudivct]+='<tr id="'+ perams[1] + '" class="menubar_item" onmouseover="menubar_goMenu(this.id,1,' + menu_mc + ')" onmouseout="menubar_rollOut(this.id,' + menu_mc + ',' + i + '); menubar_goMenu(this.id,0,' + menu_mc + ')" onclick="menubar_linkCall(\''+ perams[1] +'\')" menubarLink="' + perams[3] + '" disabledState="0"><td><img src="/img/spacer.gif" width="1" height="15" border="0"></td><td  id="'+ perams[1] + 'so">';
	}

if(perams[4]=='1') {
	if(perams[5]=="1") {
	subcont[menudivct]+='<img src="/img/menubar_check_disabled.gif" width="12" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="1">';
	} else {
	subcont[menudivct]+='<img src="/img/menubar_check.gif" width="12" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="1">';
	}
	} else {
	subcont[menudivct]+='<img src="/img/spacer.gif" width="1" height="15" border="0" name="checkstatus_' + perams[1] + '" checkedState="0">';
	}
	subcont[menudivct]+='</td><td></td><td><nobr>' + perams[0] + '</nobr></td><td ><img src="/img/spacer.gif" width="15" height="15" border="0"></td><td><!-- text hint--></td><td></td><td><img src="/img/spacer.gif" width="12" height="15" border="0" name="arrowed_' + perams[1] + '"></td><td><img src="/img/spacer.gif" width="3" height="15" border="0"></td></tr>';
	}
	lastsub=perams[2];
	}
	}
if (i==thisarr.length-1) {
if (perams[2]==lastsub) menudivs[menu_mc][menudivct]=menubar_names[menu_mc] + 'sub' + (menudivct);
if (perams[2]!=lastsub) {
menudivs[menu_mc][menudivct]=menubar_names[menu_mc] + 'sub' + menudivct;
subparentitems[menu_mc][spict]=perams[2];
}
subcont[menudivct]+='</table></td><td id="' + menubar_names[menu_mc] + 'sub' + menudivct + 'w" class="menubar_none"></td></tr>';
subcont[menudivct]+='<tr><td id="' + menubar_names[menu_mc] + 'sub' + menudivct + 'h"></td></tr></table>';
	makeIt(menubar_names[menu_mc] + 'sub' + menudivct,bldx,bldy,400,400,false,subcont[menudivct],opacity);
}
	
}
}


for (k=0; k<fb_id[menu_mc].length; k++) {
    temptheid=fb_id[menu_mc][k];
    for(j=0; j<fb_id[menu_mc].length; j++) {
        if(fb_parent[menu_mc][j]==temptheid) {
        fb_child[menu_mc][k]=fb_id[menu_mc][j];
        }
    }
}

menu_mc++;

makeIt('coverLayer',0,0,743,449,false,clear_zone_click, opacity);
menuzmade=1;
}
//-----END menu constructor---------------------------------

function menubar_setOffsets(wmu,psax,psay) {
	menubar_clearSubs(wmu);
	ofsx=0;
	ofsx1=0;
	ofsy=0;
	ofsy1=0;
	if (psax) mnu_pg_x[wmu]=psax;
	if (psay) mnu_pg_y[wmu]=psay;
	//dcw=document.width;
	//mcw=document.getElementById(menubar_topofset[wmu]).offsetLeft;
	//if ((mnu_pg_x[wmu]+mcw)>dcw) {
	//mnu_pg_x[wmu]=dcw-mcw;
	//moveIt(menubar_names[wmu],mnu_pg_x[wmu],mnu_pg_y[wmu]);
	//}
	
	
	for (i=0; i<subparentitems[wmu].length; i++) {

if (i>=topflagofs[wmu]){
	//alert(subparentitems[wmu][i]);
	if (document.images["arrowed_" + document.getElementById(subparentitems[wmu][i]).id]) document.images["arrowed_" + document.getElementById(subparentitems[wmu][i]).id].src='/img/menubar_arrow.gif';	
}

	if (i<topflagofs[wmu]){
	ofsx=mnu_pg_x[wmu] + document.getElementById(subparentitems[wmu][i]).offsetLeft-1;
    ofsx1=document.getElementById(subparentitems[wmu][i]).offsetParent.offsetParent.offsetLeft;
    ofsx1+=globalOffset_x;
	             
	} else {
	ofsx=document.getElementById(subparentitems[wmu][i]).offsetParent.offsetParent.nextSibling.offsetLeft-5;
	ofsx1=document.getElementById(subparentitems[wmu][i]).offsetParent.offsetParent.offsetParent.offsetParent.offsetLeft;
	}
	
	if (i<topflagofs[wmu]){
	ofsy=document.getElementById(menubar_topofset[wmu]).offsetTop + mnu_pg_y[wmu];
	//alert(document.getElementById(menubar_topofset[wmu]).offsetTop);	ofsy1=document.getElementById(subparentitems[wmu][i]).offsetParent.offsetParent.offsetParent.offsetTop;
	} else {
	ofsy=document.getElementById(subparentitems[wmu][i]+"so").offsetTop-1;
	
	//alert(document.getElementById(subparentitems[wmu][i]).offsetTop);
	ofsy1=document.getElementById(subparentitems[wmu][i]).offsetParent.offsetParent.offsetParent.offsetParent.offsetTop;
	}

	moveIt(menudivs[wmu][i+1],ofsx+ofsx1,ofsy+ofsy1);
	}
	
	for (j=0; j<menudivs[wmu].length; j++) {
    szht=document.getElementById(menudivs[wmu][j]+'h').offsetTop + 1;
    szwt=document.getElementById(menudivs[wmu][j]+'w').offsetLeft + 1;	
	sizeIt(menudivs[wmu][j],szwt,szht);
	}
}


function menubar_goMenu(idcalled,mode,wmu) {
clearTimeout(timerID);
itm=-1;

for (i=0; i<fb_id[wmu].length; i++) {

    if(fb_id[wmu][i]==idcalled) itm=i;
}


if(mode==1) {
document.getElementById(idcalled).className='menubar_item_over';
}

if((mode==3)&&(aclick==1)) {
    aclick=0;
    menubar_clearSubs(wmu);
    return;
}

if((mode==2)&&(aclick==1)) {
    aclick=1;
    menubar_clearSubs(wmu);
    
}

if(mode>=2) aclick=1;

pramz=0;
perams=new Array;

if (fb_child[wmu][itm]) {
               showIt(document.getElementById(fb_child[wmu][itm]).offsetParent.offsetParent.offsetParent.offsetParent.id,1);
    showIt('coverLayer',1);

if(itm>=topflagofs[wmu]) {
 document.getElementById(fb_id[wmu][itm]).className='menubar_item_over';
} else {
         document.getElementById(fb_id[wmu][itm]).className=fb_classover[wmu][itm];

}

pramz++;

if ((document.getElementById(fb_child[wmu][itm]).offsetParent.offsetParent.offsetParent.offsetParent.id!=activd[activct-1])) {
	hhd=0;
	for (j=0; j<activd.length; j++) {
if (document.getElementById(idcalled).offsetParent.offsetParent.offsetParent.offsetParent.id==activd[j])  {
		hhd=j;
		break;
		}
	}
	for (j=hhd+1; j<activd.length; j++) {
	showIt(activd[j],0);
	if(itm>=topflagofs[wmu]) {
	    menubar_rollOut(lighted[j],wmu,lighteditm[j]);
        //document.getElementById(lighted[j]).className='menubar_item';
        }  else {
        menubar_rollOut(lighted[j],wmu,lighteditm[j]);                             //document.getElementById(lighted[j]).className='menubar_top_item';

}
	
	}
	activd=activd.slice(0,hhd+1);
	activct=activd.length;
    lighted=lighted.slice(0,hhd+1);	
	activd[activct]=document.getElementById(fb_child[wmu][itm]).offsetParent.offsetParent.offsetParent.offsetParent.id;
lighted[activct]=fb_id[wmu][itm];
lighteditm[activct]=itm;
	activct++;
	} 

}

if (pramz==0) {
	hhd=0;
	
	
	for (j=0; j<activd.length; j++) {
	
    
     if (document.getElementById(idcalled).offsetParent.offsetParent.offsetParent.offsetParent.id==activd[j]) {
		
		hhd=j;
		break;
		}
	}
    
	for (j=hhd+1; j<activd.length; j++) {

	showIt(activd[j],0);
	if(itm>=topflagofs[wmu]) {
	    menubar_rollOut(lighted[j],wmu,lighteditm[j]);
        //document.getElementById(lighted[j]).className='menubar_item';
        }  else {
        menubar_rollOut(lighted[j],wmu,lighteditm[j]);
     //document.getElementById(lighted[j]).className=fb_classname[wmu][itm];

}
	
	}
	
	activd=activd.slice(0,hhd+1);
	activct=activd.length;
	lighted=lighted.slice(0,hhd+1);
	
	}


}

function menubar_clearSubs(wmu) {

	for (i=0;i<activd.length; i++) {
	    showIt(activd[i],0);
        if (document.getElementById(lighted[i])) {
        menubar_rollOut(lighted[i],wmu,lighteditm[i]);       
        //document.getElementById(lighted[i]).className='menubar_item';
        }
        if (document.getElementById(lighted[i])) {
        menubar_rollOut(lighted[i],wmu,lighteditm[i]);
        //document.getElementById(lighted[i]).className='menubar_top_item';
        }
    }
    
	aclick=0;
	activd=new Array();
	lighted=new Array();
	lighteditm=new Array();
	activct=0;

showIt('coverLayer',0);
	
}

function menubar_rollMenu(idcalled,mode,wmu) {
	//alert(mode);
	clearTimeout(timerID);
	if(mode==2) {
//document.getElementById(idcalled).className='menubar_top_item_over';
//document.getElementById(idcalled).className='roll1hov';
  
}
	if (aclick) menubar_goMenu(idcalled,mode,wmu);
    
}

function menubar_rollOut(item,wmu,itm) {

	if (document.getElementById(item).getAttribute('disabledState')=='1') {
		document.getElementById(item).className='menubar_item_disabled';
		} else {
		
		if(itm>=topflagofs[wmu]) {
            document.getElementById(item).className='menubar_item';
        } else {
            document.getElementById(item).className=fb_classname[wmu][itm];

        }
 
    }
}

function menubar_rollItOut() {

    clearTimeout(timerID);
    timerID = setTimeout('menubar_clearSubs(0)', 300);
  
}

// XML Document Load

function processReqChange() {
    
   //alert(req.readyState);
   //alert(req.status);

   
        
        cuurentid='';
        buildid="popmenu";
        buildct=0;
        deptharr=new Array();
        deptharrid=new Array();
        
        //alert(req.responseText);
        //xmlData = req.responseText;
        
        currTag='';
 
        a=xmlData.indexOf("<")
        if (a!=-1) {
        
            b=xmlData.indexOf(" ",a);
            currTag=xmlData.substring(a+1,b);
            c=xmlData.indexOf(">",b);
            propzone=xmlData.substring(b,c);
            
            // mainProps and mainNames are storage arrays, must be already declared ex: var mainProps=new Array();
            parseProperties(mainNames,mainProps,propzone);
            
            myindx=c;
            menudepth=0;
            flatarr=0;
            linearct=0;
            absdepth=0;
            flatBuild="";
            
            
            do {
            
            x=xmlData.indexOf("<",myindx);            
            z=xmlData.indexOf(">",x);
            tag=xmlData.substring(x,z);
            if (tag.indexOf(" ")!=-1) {
                y=xmlData.indexOf(" ",x);
            } else {
                y=z;
            }
            currenTag=xmlData.substring(x+1,y);
            //alert(currenTag);
            
            if (currenTag.indexOf("/")!=-1) {
            
                if (currenTag.substring(1,currenTag.length)==currTag) {
                    //alert("end of menu tag");
                    break;
                
                }
            //alert(currenTag + ' ' + menudepth);
            
            trackArr[menudepth]="";
            menudepth--;
            
            
            /*
            for (i=menudepth; i<trackArr.length; i++) {
            
                trackArr[i]="";
            }
            */
            myindx=z;
            
            if (menudepth<-1) {
                //alert('here');
                break;
                }
            } else {
            
            //alert(flatarr + ' ' + menudepth)
            
            trackid = "";
            storeoffset=0;
            //alert(currentid);
            
            absdepth=menudepth;
            deptharr[linearct]=absdepth;

            
            //alert(trackArr + '~' + absdepth);
            
            if(!trackArr[absdepth]) {
                trackid = buildid + buildct;
                trackArrDepth[absdepth]=buildct;
                trackArr[absdepth]=trackid;
                buildct++;
                
            } else {
            
                //trackid=trackArr[absdepth];
               
                //alert(trackArr[absdepth]);
            }
            
            //alert(currentid + ' ' + trackArrDepth[absdepth]);
            storeoffset=trackArrDepth[absdepth];
            
            deptharrid[linearct]=trackid;            
            propzone=xmlData.substring(y,z);
            
            subNames=new Array();
            subProps=new Array();
                
            parseProperties(subNames,subProps,propzone);
            
            //menu item text (cosmetic)&id&parent id&link&initially checked boolean (true means checked)&initially disabled (true means disabled)
            //'Upper Left Menu&redbloc1','Menutest&realm1&&&on&off','File&file1','Edit&edit1','Text&text1','Font&font1',
            flatBuild="";
            flatTitle="";
            flatId="";
            flatUrl="";
            flatChecked="";
            flatDisabled=""
//<item title="[-image-]" url="http://www.testurl.com" imgwidth="" imgheight="" imgref="" imgover="">            
            flatImgwidth=""; 
            flatImgheight=""; 
            flatImgref="";
            flatRollcode="";
            flatClass="";
            flatHoverclass="";
            
            parentid = "";
            currentid = "";
            
            currentid=buildid + linearct;
            trackIdarr[absdepth]=currentid;
            if (absdepth>0) parentid=trackIdarr[absdepth-1];
            //buildct, currentid
            
            
            for (i=0; i<subNames.length; i++) {
            
            if (subNames[i].toLowerCase()=="title") flatTitle=subProps[i];
            if (subNames[i].toLowerCase()=="url") flatUrl=subProps[i];
            if (subNames[i].toLowerCase()=="checked") flatChecked=subProps[i];
            if (subNames[i].toLowerCase()=="disabled") flatDisabled=subProps[i];
            if (subNames[i].toLowerCase()=="imgwidth") flatImgwidth=subProps[i];
            if (subNames[i].toLowerCase()=="imgheight") flatImgheight=subProps[i];
            if (subNames[i].toLowerCase()=="imgref") flatImgref=subProps[i];
            if (subNames[i].toLowerCase()=="rollcode") flatRollcode=subProps[i];
            if (subNames[i].toLowerCase()=="class") flatClass=subProps[i];
            if (subNames[i].toLowerCase()=="hoverclass") flatHoverclass=subProps[i];
            
            }
           
            if ((flatTitle=="[-image-]")||(flatTitle=="[-img-]")) {
            
                //flatTitle='<img src="' +  flatImgref + '" width="' + flatImgwidth + '" height="' + flatImgheight + '" border="0" onmouseover="menu_rollImg(this,' + flatRollcode + ',1)" onmouseout="menu_rollImg(this,' + flatRollcode + ',0)">';
/*
            	if (flatUrl) {
            	
            	if (document.all) {
              		flatTitle='<a href="' + flatUrl + '" class="' + flatClass + '"><img src="/img/spacer.gif" width="' + flatImgwidth + '" height="' + flatImgheight + '" border="0"></a>';
             	} else {
             	flatTitle='<a href="' + flatUrl + '" class="' + flatClass + '"><img src="/img/spacer.gif" width="' + flatImgwidth + '" height="' + flatImgheight + '" border="0" class="' + flatClass + '"></a>';
             	}
             	} else {  //from if (flatUrl)
             	if (document.all) {	
             		flatTitle='<a href="#" class="' + flatClass + '"><img src="/img/spacer.gif" width="' + flatImgwidth + '" height="' + flatImgheight + '" border="0"></a>';
            	} else {
            	
            	flatTitle='<a href="#" class="' + flatClass + '"><img src="/img/spacer.gif" width="' + flatImgwidth + '" height="' + flatImgheight + '" border="0" class="' + flatClass + '"></a>';
            	
            	
            	}
            	
            	
            	}
            	*/
            	
            	
            	flatTitle='<img src="/img/spacer.gif" width="' + flatImgwidth + '" height="' + flatImgheight + '" border="0">';
            	
            } //end else from- if(flatUrl)
          
            
            //alert(parentid);
            flatBuild+="'" + flatTitle + "&" + currentid + "&" + parentid + "&" + flatUrl + "&" + flatChecked + "&" + flatDisabled + "&" + flatClass + "&" + flatHoverclass + "',";
            
            //alert(flatBuild);
            
            if (!flatArrXML[storeoffset]) {
                flatArrXML[storeoffset]="";
            }
            
            if (!flatArrXMLsubs[storeoffset]) {
                flatArrXMLsubs[storeoffset]="";
            }
            
            
            
            if (absdepth<2) {
            
            flatArrXML[storeoffset]+=flatBuild;
            flatArrXMLsubs[storeoffset]+="'[$030214]'";

            } else {
            
            flatArrXMLsubs[storeoffset]+=flatBuild; 
            flatArrXML[storeoffset]+="'[$030214]'";
            
            }
           
            myindx=z;
            menudepth++;
            flatarr++;
            
            linearct++;
            }

            myindx++;
            
            } while (myindx<xmlData.length);
            
            
        } else { 
        
            alert('No XML tags found.');
            
        }
        //alert(deptharr);
        //alert(deptharrid);
        flatArrXML[0]+="'[$020113]&topendid',";
        
        //flatMerge=menu_titles_test;

 
        
        flatMerge="";
        for (i=0; i<flatArrXML.length; i++) {
        
        if (flatArrXML[i].indexOf("[$030214]")==-1) {
            flatMerge+=flatArrXML[i];
        
        } 
        }
        
        if (flatArrXMLsubs) {
        
        for (i=0; i<flatArrXMLsubs.length; i++) {
                if (flatArrXMLsubs[i].indexOf("[$030214]")==-1) {
        
                flatMerge+=flatArrXMLsubs[i];
                }
        
            }
        }
        
        flatMerge+="''";
 
        //alert(flatMerge);
        
         eval("var menuTitlesXML = new Array(" + flatMerge + ");");
         menubarMaker('mnub',380,10,menuTitlesXML);
         
         arrReady=1;   
        

}

function parseProperties (nameArr,propArr,propref) {

//nameArr = new Array();
//propArr = new Array();
//alert(propref);
myindx=0;
count=0;

do {

spac=propref.substr(myindx,1);
if (spac!=" ") {
    
    eq=propref.indexOf("=",myindx);
    nameArr[count]=propref.substring(myindx,eq);
    if (nameArr[count].indexOf(" ")!=-1) {
    nameArr[count]=nameArr[count].substring(0,nameArr[count].indexOf(" "));
    }
    ql=propref.indexOf('"',eq);
    qr=propref.indexOf('"',ql+1);
    propArr[count]=propref.substring(ql+1,qr);
    
    //alert(nameArr[count] + ':' + propArr[count]);
   
    count++;
    myindx=qr;
    }
    myindx++;
    } while (myindx<propref.length);
}

processReqChange();
/*
var rollItems_off= new Array('nav1Off','nav2Off','nav3Off','nav4Off','nav5Off');
var rollItems_on= new Array('nav1On','nav2On','nav3On','nav4On','nav5On');

function menu_rollImg(x,rollcode,rollmode) {

if (rollmode==1) y=rollItems_on[rollcode];
else y=rollItems_off[rollcode];
  
  x.src=eval(y + '.src');

}
*/
function menubar_setPositions() {

for (l=0; l<menubar_names.length; l++) {
	menubar_setOffsets(l,0,-05);
	}
	
	stackIt('coverLayer',9000);
}


//end xml document load