/**********************************************************************************   
NewsMenu 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/
//////////////////////////
// Credits for the browsercheck are listed above
// Rest of the page was Written by Dylan Oster 11/6/01
//////////////////////////

/////////////////////////
// Date variables and leap year function
/////////////////////////
var currDate = new Date();
var currMonth = currDate.getMonth() + 1;
var currDay = currDate.getDate();
var currYear = currDate.getFullYear();
var currHour = currDate.getHours();
var calImageDir = "../images/calendar/";
var daysInMonth = new Array (31,28,31,30,31,30,31,31,30,31,30,31);
var monthName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

function daysInFeb(year) {
return (((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29:28);
}

/////////////////////////
// Browsercheck (needed)
/////////////////////////
function lib_bwcheck(){ 
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?true:false;
	this.op=(this.agent.indexOf("opera")>-1 && window.opera)?true:false;
	this.op5=(this.agent.indexOf("opera 5")>-1 && window.opera)?true:false;
	this.op6=(this.agent.indexOf("opera 6")>-1 && window.opera)?true:false;
	this.op7=(this.agent.indexOf("opera 7")>-1 && window.opera)?true:false;
  	this.ie5=(this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6 && !this.op7)?true:false;
  	this.ie55=(this.ie5 && this.agent.indexOf("msie 5.5")>-1)?true:false;
  	this.ie6=(this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6 && !this.op7)?true:false;
	this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 && !this.op7 &&!this.ie5&&!this.ie6)?true:false;
  	this.ie=(this.ie4 || this.ie5 || this.ie6)?true:false;
	this.mac=(this.agent.indexOf("mac")>-1)?true:false;
	this.sa=(this.agent.indexOf("safari")>-1)?true:false;
	this.ns6=(this.agent.indexOf("gecko")>-1 &&!this.sa  || window.sidebar)?true:false;
	this.ns4=(!this.dom && document.layers)?true:false;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6)

	return this
}
var bw=new lib_bwcheck()

var px   
if (bw.dom) {px = "px"} else {px = ""}

var hand
if (bw.ie) {hand = 'hand';} else if (bw.dom) {hand = 'pointer';} else {hand = '';}

//////////////////////////////////
// returns the inner width of the browser window, outer width can't be used
// because of AOL and the Netscape 6 toolbar. Add around 15 to 20 pixels to compensate
// for outer width
//////////////////////////////////
function getWindowWidth() {
	if (bw.ie) {
		return document.body.clientWidth;
	} else {                                                
		return window.innerWidth;
	}
}

// Various popup options
function openPopup (strURL)
{
	var feature = window.open(strURL,"Print", "top=10,left=10,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=660,height=460");
}

function showZoom(sUrl)
{
	window.open(sUrl, "Part", "top=10,left=10,height=420,width=420,resizable=no");
}

function showZoomLg(sUrl)
{
	window.open(sUrl, "Part", "top=10,left=10,height=510,width=670,resizable=no");
}

function showDoc(sUrl)
{
	window.open(sUrl, "Documentation", "top=10,left=10,height=460,width=660,resizable=yes");
}

function requestInfo(sUrl)
{
	window.open(sUrl, "Request", "top=10,left=10,height=440,width=400,resizable=no,scrollbars=yes");
}

//////////////////////////////////
// Move object to x (north/south) and y (east/west) position on the screen
// ***** obj must be in quotes
//////////////////////////////////
function shiftTo(obj,x,y){
	var theObj = getObjectStyle(obj);
	if (bw.ie) {
		theObj.posLeft = x;
		theObj.posTop = y;
	} else if (bw.dom) {
		theObj.left = x+px;
		theObj.top = y+px;	
	} else if (bw.ns4) {
	    theObj.moveTo(x,y);
	}
}

//////////////////////////////////
// Use the following to clip
// *****Opera does not support this
// *****t = top of the object
// *****r = right of the object
// *****b = bottom of the object
// *****l = left of the object
//////////////////////////////////
function clipTo(obj,t,r,b,l){
	var theObj = getObject(obj);
	if(bw.ns4) {
		theObj.clip.top=t; 
		theObj.clip.right=r; 
		theObj.clip.bottom=b; 
		theObj.clip.left=l;
	} else { 
		theObj.style.clip="rect("+t+px+" "+r+px+" "+b+px+" "+l+px+")";
		theObj.style.visibility="visible";
	}
}

//////////////////////////////////
// Move up/down
//*****1 second = 1000 speed (per pixel)
//////////////////////////////////
function slideUp(obj,ystop,moveby,speed){
	var x = getObjectLeft(obj);
	var y = getObjectTop(obj);
	if(y>ystop){
		shiftTo(obj,x,y-moveby);
		setTimeout("slideUp('"+obj+"',"+ystop+","+moveby+","+speed+")",speed);
	} else {
		shiftTo(obj,x,ystop);
	}
}
function slideDown(obj,ystop,moveby,speed){
	var x = getObjectLeft(obj);
	var y = getObjectTop(obj);
	if(y<ystop){
		shiftTo(obj,x,y+moveby);
		setTimeout("slideDown('"+obj+"',"+ystop+","+moveby+","+speed+")",speed);
	} else {
		shiftTo(obj,x,ystop);
	}
}

//////////////////////////////////
// Move left/right
//*****1 Second = 1000 speed
//////////////////////////////////
function slideLeft(obj,xstop,moveby,speed){
	var x = getObjectLeft(obj);
	var y = getObjectTop(obj);
	if(x>xstop){
		shiftTo(obj,x-moveby,y);
		setTimeout("slideLeft('"+obj+"',"+xstop+","+moveby+","+speed+")",speed);
	} else {
		shiftTo(obj,xstop,y);
	}
}

function slideRight(obj,xstop,moveby,speed){
	var x = getObjectLeft(obj);
	var y = getObjectTop(obj);
	if(x<xstop){
		shiftTo(obj,x+moveby,y);
		setTimeout("slideRight('"+obj+"',"+xstop+","+moveby+","+speed+")",speed)
	}else{
		shiftTo(obj,xstop,y);
	}
}

//////////////////////////////////
// Object width
//////////////////////////////////
function getObjectWidth(obj){	
	var theObj = getObject(obj);	
	if (bw.op) {
		return theObj.style.pixelWidth;	
	} else if (bw.ie || bw.dom) {
		return parseInt(theObj.offsetWidth);
	} else if (bw.ns4) {
		return theObj.document.width;
	}
}

//////////////////////////////////
// Object height
//////////////////////////////////
function getObjectHeight(obj){	
	var theObj = getObject(obj);	
	if (bw.op) {
		return theObj.style.pixelHeight;	
	} else if (bw.ie || bw.dom) {
		return theObj.offsetHeight;
	} else if (bw.ns4) {
		return theObj.document.height;
	}
}

//////////////////////////////////
// Object left
//////////////////////////////////
function getObjectLeft(obj){	
	var theObj = getObject(obj);	
	if (bw.dom || bw.ie) {
		return theObj.offsetLeft;	
	} else if (bw.ns4) {
		return theObj.x;
	}
}

//////////////////////////////////
// Object top
//////////////////////////////////
function getObjectTop(obj){	
	var theObj = getObject(obj);	
	if (bw.dom || bw.ie) {
		return theObj.offsetTop;	
	} else if (bw.ns4) {
		return theObj.y;
	}
}

////////////////////////////////
// Changes background for ie4 and up and dom browsers
// nothing for netscape 4
////////////////////////////////
function changeColor(obj,bg,border,text) {
	var theObj = getObjectStyle(obj);
	if (bw.dom || bw.ie) {
		theObj.border = border+' solid 1px';
		theObj.backgroundColor = bg;
		theObj.color = text;
		theObj.cursor = hand;
	}
}

/////////////////////////////
// builds the document struction for each type of browser
/////////////////////////////
function getObject(obj) {
	if ((bw.dom) && (!bw.ie)) {
		return eval("document.getElementById('" + obj + "')");
	} else if (bw.ie) {
		return eval("document.all." + obj);
	} else if (bw.ns4) {
		return eval("document." + obj);
	}	
}
/////////////////////////////
// tests for countries besides canada and the us to select
// Outside US/Canada automatically
/////////////////////////////
function noState(thisvalue) {
	if (bw.dom || bw.ie) {
		var theObj = getObject('state');
		if (thisvalue != "CA" && thisvalue != "US") {
			theObj.value = "--";
		}
	}
}

/////////////////////////////
// builds the document struction for each type of browser
// adds the style tag for convience 
////////////////////////////
function getObjectStyle(obj) {
	if ((bw.dom) && (!bw.ie)) {
		return eval("document.getElementById('" + obj + "').style");
	} else if (bw.ns4) {
		return eval("document." + obj);
	} else if (bw.ie) {
		return eval("document.all." + obj + ".style");
	}
}

function showObj(obj, hgt) {
	var theObj = getObjectStyle(obj);
	if (bw.ns4) {
		theObj.visibility = 'show';
	} else {
		theObj.visibility = 'visible';
		theObj.display = 'block';
	}
	if (hgt >= 0) {
		theObj.height = hgt;
	}
}

function hideObj(obj, hgt) {
	var theObj = getObjectStyle(obj);
	if (bw.ns4) {
		theObj.visibility = 'hide';
	} else {
		theObj.visibility = 'hidden';
		theObj.display = 'none';
	}
	if (hgt >= 0) {
		theObj.height = hgt;
	}
}

////////////////////////////////
// Show hand
// nothing for netscape 4
////////////////////////////////
function showHand(obj) {
	var theObj = getObjectStyle(obj);
	if (bw.ie) {
		theObj.cursor = hand;
	}
}

////////////////////////////
// reloads the window if Nav4 resized
////////////////////////////
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {
  	if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; 
	}
  } else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) {
  		location.reload();
  }
}

MM_reloadPage(true);