/*
	title........... 
	version......... 
	created......... 
	modified........ 
	author.......... 
	description..... 
*/

// DO NOT MODIFY THIS DOCUMENT

var QPop = {
	createMenu:QPOP_createMenu,
	addItem:QPOP_addMnuItm,
	divOver:QPOP_divOver,
	divOut:QPOP_divOut,
	lyrOver:QPOP_menuOver,
	lyrOut:QPOP_menuOut,
	hideDDNav:QPOP_hideDDNav,
	showDDNav:QPOP_showDDNav,
	hideDiv:QPOP_hideDiv,
	makeLayer:QPOP_MakeLayer,
	makeDiv:QPOP_makeDiv,
	createSpaces:QPOP_createSpacing,
	marginThickness:2,
	menudata:{},
	childid:0,
	borderColor:"#00FF00",
	useseparator:1,
	StyleClassName:"",
	bgcolor:"#000000",
	bgover:"#666666",
	ieseparator:"<HR>",
	nsseparator:"<HR>",
	fontface:"Arial, Helvetica",
	fontfacecolor:"#FFFFCE",
	paddingleft:5,
	childfontsize:"10px"
	}
QPop.NS4 = (document.layers)?1:0;
QPop.IE4 = (document.all)?1:0;
	
function QPOP_addMnuItm(id, txt, surl, prespacing) {
	// Add new menu data object if not already done
	// by a previous menu item call
	if (!this.menudata[ id ])
		this.menudata[ id ] = new Array();
	
	// Store Data
	var ary = this.menudata[ id ]
	ary[ ary.length ] = { text:txt, url:surl, prespace:prespacing }
}

//*---------------------------------------------------
// highlight menuitem
// expected arg is active menuitem
//--------------------------------------------------*/
function QPOP_divOver(id){
	document.all[id].style.backgroundColor = this.bgover;
}

//*---------------------------------------------------
// highlight off menuitem
// expected arg is active menuitem
//--------------------------------------------------*/
function QPOP_divOut(id){
	document.all[id].style.backgroundColor = this.bgcolor;
}

//*---------------------------------------------------
// highlight on menuitem in netscape
// expected arg is active menuitem
//--------------------------------------------------*/
function QPOP_menuOver(obj){
	obj.bgColor = this.bgover;
}

//*---------------------------------------------------
// highlight off menuitem in netscape
// expected arg is active menuitem
//--------------------------------------------------*/
function QPOP_menuOut(obj){
	obj.bgColor = this.bgcolor;
}

//*---------------------------------------------------
// shows the drop down menu 
// expected arg is active div
//--------------------------------------------------*/
function QPOP_showDDNav(id){
	if(this.NS4) {
		var objLyr = eval( "document.layers." + id );
  		if (objLyr) objLyr.visibility = 'show';
	}
	else if (this.IE4) {
		var objLyr = eval( "document.all." + id );
		if (objLyr) objLyr.style.visibility = 'visible';
	}
}

//*---------------------------------------------------
// hides the drop down menu 
// expected arg is active div 
//--------------------------------------------------*/
function QPOP_hideDDNav(id){
	if(this.NS4) {
		var objLyr = eval( "document.layers." + id );
  		if (objLyr) objLyr.visibility = 'hide';
	}
	else if (this.IE4) {
		var objLyr = eval( "document.all." + id );
		if (objLyr) objLyr.style.visibility = 'hidden';
	}
}

//*---------------------------------------------------
// hides drop down menu if the menu is visiable and you move off of it
// expected arg is active menu
//--------------------------------------------------*/
function QPOP_hideDiv(id){
	if(!this.NS4) {
		var theObj = document.all[id];
		var winev = window.event
		
		// menu coords +-2; used for identifying where the 
		// mouse is when then Mouseout param executes.
		leftDiv   = theObj.offsetLeft + 2
		rightDiv  = theObj.offsetLeft + theObj.clientWidth - 2
		topDiv    = theObj.offsetTop + 2
		bottomDiv = theObj.offsetTop + theObj.clientHeight - 2
		
		if(winev.clientY > bottomDiv || winev.clientY < topDiv || winev.clientX < leftDiv || winev.clientX > rightDiv) { 
			theObj.style.visibility = 'hidden'
		}
	}
}


function QPOP_createMenu(id, divLeft, divTop, divWidth, lyrLeft, lyrTop, lyrWidth) {
	if (this.NS4) {
		this.makeLayer(id, lyrLeft, lyrTop, lyrWidth)
	}
	else if (this.IE4) {
		this.makeDiv(id, divLeft, divTop, divWidth)
	}
}

function QPOP_createSpacing(x) {
	var sp = ""
	for (var i=0; i < x; i++) sp += "&nbsp;";
	return sp;
}

function QPOP_makeDiv(id, divLeft, divTop, divWidth){
	
	var ClassName  = (this.StyleClassName.length) ? ' Class="' + this.StyleClassName + '"' : '';

	var objDiv = '<div id="' + id + '" style="position:absolute; left:' + divLeft + 'px; top:' + divTop + 'px; width:' +  (divWidth) + 'px; z-index:99; background-color:' + this.borderColor + '; visibility:hidden;" onMouseover="QPop.showDDNav(\'' + id + '\')"  onMouseout="QPop.hideDiv(\'' + id + '\')">';

	objDiv += '<div id="a' + id + '" style="position:relative; left:0px; top:0px; margin: ' + this.marginThickness + '; margin-top: 0; width:' + divWidth + 'px; z-index:99; background-color:' + this.bgcolor + '; ">';
	
	var ary = this.menudata[id];
	for (var i=0; i < ary.length; i++) {
		// ary[i].text;ary[i].url
		
		objDiv += '<div id="x' + this.childid + '" style="position:relative; background-color:' + this.bgcolor + '; z-index:99; width:' + divWidth + 'px;" onMouseover="QPop.divOver(\'x' + this.childid + '\')" onMouseout="QPop.divOut(\'x' + this.childid + '\')"><FONT FACE="' + this.fontface + '" COLOR="' + this.fontfacecolor + '" size=1>' + this.createSpaces(ary[i].prespace) + '<A HREF="' + ary[i].url + '"><FONT FACE="' + this.fontface + '" COLOR="' + this.fontfacecolor + '" size=1 ' + ClassName + '>' + ary[i].text + '</FONT></a></FONT></div>'
			
		// Add separator bar
		if (this.useseparator) {
			objDiv += '<div id="line' + this.childid + '" style="position:relative; z-index:99; background-color:' + this.bgcolor + '; width:' + divWidth + 'px;">' + this.ieseparator + '</div>';
		}
		
		this.childid++;
	}
	objDiv += "<FONT SIZE=1>&nbsp;</FONT></DIV></div>"	
	document.write(objDiv);
}

//*---------------------------------------------------
// build the layers for netscape
// expected args are 'div name','x in menudata aray',
// 'menu left coord','layer width','top in pixels' 
//--------------------------------------------------*/
function QPOP_MakeLayer(id, layerLeft, layerTop, layerWidth){

	var ClassName  = (this.StyleClassName.length) ? ' Class="' + this.StyleClassName + '"' : '';

	// Mystery Code...
	if ( navigator.platform.indexOf("Win") < 0 ) { layerInc=16; layerStyle="netMenuMac" }
	else { layerInc=19; layerStyle="netMenu"; }	
		
	var objDiv = '<layer id="'+ id + '" Z-INDEX=99 BGCOLOR="' + this.borderColor + '" WIDTH=' + layerWidth + ' LEFT=' + layerLeft + ' TOP=' + layerTop + ' VISIBILITY=HIDE onmouseover="QPop.showDDNav(\'' + id + '\')" onmouseout="QPop.hideDDNav(\'' + id +'\')">';	

	layerWidth -= this.marginThickness * 2;
	
	objDiv += '<layer id="a'+ id + '" Z-INDEX=99 BGCOLOR="' + this.bgcolor + '" WIDTH=' + layerWidth + ' LEFT=' + this.marginThickness + '>\n';	

	var nestLayerID = 0
	var nestTop = 2
		
	var ary = this.menudata[id];
	for (var i=0; i < ary.length; i++) {
		// ary[i].text;ary[i].url
			
			objDiv += '<layer id="x' + nestLayerID + '" CLIP="0,0,' + layerWidth + ',20" Z-INDEX=99 BGCOLOR="' + this.bgcolor + '" HEIGHT=20 WIDTH=' + layerWidth + ' TOP=' + nestTop + ' onmouseover="QPop.lyrOver(this)" onmouseout="QPop.lyrOut(this)"><font face="' + this.fontface + '" color=' + this.fontfacecolor + ' SIZE=1>' + this.createSpaces(ary[i].prespace) + '<a href="' + ary[i].url + '" onMouseOver=\'window.status="' + ary[i].text + '"; return true\'><font face="' + this.fontface + '" color=' + this.fontfacecolor + ' SIZE=1 ' + ClassName + '>' + ary[i].text;

			objDiv += "</font></a></font></layer>\n"		

			nestLayerID++
			nestTop += layerInc
			
			if (this.useseparator) {
				objDiv += '<layer id="line2" BGCOLOR="' + this.bgcolor + "\" WIDTH="+ layerWidth +" HEIGHT=2 Z-INDEX=99 TOP="+ nestTop +"><center>" + this.nsseparator + "</center></layer>\n"
			}

			nestTop=nestTop+2

	}
	
	objDiv +="<layer id=\"lineEnd\" BGCOLOR=\"" + this.borderColor + "\" WIDTH=" + layerWidth + " HEIGHT=" + this.marginThickness + " Z-INDEX=99 TOP=" + nestTop + "></layer></layer></layer>\n\n"

	document.write(objDiv)
}