/********************************************/
/*   Add these styles to your stylesheet:   */
/*      B = Main Menu Button 'Out'          */
/*      S = Sub Menu Button 'Out'           */
/*                                          */
/*                                          */
/*   Menu-building function definitions:    */
/*                                          */
/*   _B('Text', 'Link')                     */
/*    Creates a main menu button            */
/*   _SM('Text', 'ID')                      */
/*    Creates a sub-menu                    */ 
/*   _S('Parent-ID', 'Text', 'Link')        */
/*    Creates a sub-menu button             */
/********************************************/


/* Menu Functions */

//writes surrounding div
function _D (ID, C){
 document.write("<div class="+C+" id="+ID+">");
}
function _C (){
 document.write("</div>");
}
//writes menu button 
function _B (text, Link){
 document.write("<div class=B onMouseOver=\"_BOver(this)\" onMouseOut=\"_BOut(this)\" onMouseDown=\"_go('"+Link+"')\">"+text+"</div>");
}
//writes menu button with link to sub-menu
function _SM (text, subID){
 document.write("<div class=B onMouseOut=\"_hideWait('"+subID+"')\" onMouseOver=\"_show('"+subID+"')\">"+text+"</div>");
}
//writes sub-menu button
function _S (text, Link, parentID){
 document.write("<div class=S onMouseOut=\"_hideWait('"+parentID+"'); _SOut(this)\" onMouseOver=\"_show('"+parentID+"'); _SOver(this)\" onMouseDown=\"_go('"+Link+"')\">"+text+"</div>");
}

//goes to a locaiton
function _go(Link){
	window.location = Link;
}
//shows object
tID=0;
OpenID=0;
function _show(ID){
	if (tID || OpenID) _clearHide();
	_getSty(ID).display="block";
	OpenID=ID;
}
//hides object after T milliseconds
T=500;
function _hideWait(ID){
	tID = setTimeout('_hide("'+ID+'")', T);
}
function _hide(ID){
	_getSty(ID).display="none";
	OpenID=0;
}
function _clearHide(){
	if (tID) clearTimeout (tID);
	if (OpenID) _hide(OpenID);
}

/* Layout Functions */

//compatability code, positioning functions and window width & height functions
var isDOM=document.getElementById?1:0;
var isIE=document.all?1:0;
var isNS4=navigator.appName=='Netscape'&&!isDOM?1:0;
var isIE4=isIE&&!isDOM?1:0;
var isOp=window.opera?1:0;
var isWin=navigator.platform.indexOf('Win')!=-1?1:0;
var isDyn=isDOM||isIE||isNS4;
function _getRef(id, par) {
 par=!par?document:(par.navigator?par.document:par);
 return isIE ? par.all[id] :
  (isDOM ? (par.getElementById?par:par.ownerDocument).getElementById(id) :
  (isNS4 ? par.layers[id] : null));
}
function _getSty(id, par){
 var r=_getRef(id, par);
 return r?(isNS4?r:r.style):(isNS4?id:id.style);
}
function _top(id, value, par){
 var sty=_getSty(id, par);
 var px=isNS4||isOp?0:"px"; 
 sty.top=(value?value:0)+px;
}
function _left(id, value, par){
 var sty=_getSty(id, par);
 var px=isNS4||isOp?0:"px"; 
 sty.left=(value?value:0)+px;
}
function _width(id, value, par){
 var sty=_getSty(id, par);
 var px=isNS4||isOp?0:"px"; 
 sty.width=(value?value:0)+px;
}
function _height(id, value, par){
 var sty=_getSty(id, par);
 var px=isNS4||isOp?0:"px"; 
 sty.height=(value?value:0)+px;
}
var CSSmode=document.compatMode;
CSSmode=(CSSmode&&CSSmode.indexOf('CSS')!=-1)||isDOM&&!isIE||isOp?1:0;
if (!window.page) var page = { win: window, minW: 780, minH: 580, MS: isIE&&!isOp, db: CSSmode?'documentElement':'body' }
page.winW=function() { with (this) return Math.max(minW, MS?win.document[db].clientWidth:win.innerWidth) }
page.winH=function() { with (this) return Math.max(minH, MS?win.document[db].clientHeight:win.innerHeight) }
//onLoad and onResize functions
window.onload = function() { _position(); }
window.onresize = function() { _position(); _ResizeMenu(443);}
//array to hold all div objects
var divs = Array();
//creates divs object
function div (id, x, y, w, h){
 this.id = id;
 this.x = x;
 this.y = y;
 this.w = w;
 this.h = h;
}
//position div objects
function _position() {
 for (var i = 0; i < divs.length; i++) {
  _left(divs[i].id, eval(divs[i].x)); 
  _top(divs[i].id, eval(divs[i].y)); 
  // Don't let the width and height get below 0.    
  _width(divs[i].id, Math.max(0,eval(divs[i].w)));
  _height(divs[i].id, Math.max(0,eval(divs[i].h)));
  _getSty(divs[i].id).visibility="visible";
 }
}

