<!--
function correctPNG()
{
    for(var i=0; i<document.images.length; i++)
    {
        var img = document.images[i];
        var imgName = img.src.toUpperCase();

        if (imgName.substring(imgName.length - 3, imgName.length) == "PNG")
        {
            var imgID = (img.id) ? "id='" + img.id + "' " : "";
            var imgClass = (img.className) ? "class='" + img.className + "' " : "";
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
            var imgStyle = "display:inline-block;" + img.style.cssText;

            if (img.align == "left") imgStyle = "float:left;" + imgStyle;

            if (img.align == "right") imgStyle = "float:right;" + imgStyle;

            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;

            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
            
            img.outerHTML = strNewHTML;
            i--;
        }
    }
}

if ( window.attachEvent ) window.attachEvent("onload", correctPNG);

aMonth = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

function datetime()
{
    oToday = new Date();
    
    nTimezoneOffset = Math.floor(oToday.getTimezoneOffset() / 60); // number of hours difference between UTC and user's machine
    nHourDiff = ( nTimezoneOffset - 4 ) * 1;
    
    oToday.setTime(oToday.getTime()); // + ( nHourDiff * 3600000 ));

    sMonth = aMonth[oToday.getMonth()];
    nDate = oToday.getDate();
    nYear = oToday.getFullYear();
    
    nHour = oToday.getHours();
    nMinute = oToday.getMinutes();
    
    
        
    sDatetime = sMonth + " " + nDate + ", " + nYear + " " + twelveHour(nHour) + ":" + zeroPad(nMinute) + " " + amPm(nHour); // + ( fDaylightSavings ? " edt" : " est" );
    document.getElementById("datetime").innerHTML = sDatetime;
}

function twelveHour(n)
{
    return n > 12 ? n - 12 : n;
}

function zeroPad(n)
{
    return n < 10 ? "0" + n : n;
}

function amPm(n)
{
    return n > 11 ? "PM" : "AM";
}

function initDatetime(fDst)
{
    fDaylightSavings = fDst;
    datetime(); // kick it off right away!
    hDatetime = setInterval("datetime()", 5000); // update clock every 5 seconds
}



/*** news ticker functions ***/
function ticker(content, divId, delay)
{
	this.content = content;
	this.tickerid = divId;
	this.delay = delay;
	this.mouseoverBol = 0;
	this.hiddendivpointer = 1;
	document.write('<div id="' + divId + '" style="position: relative; overflow: hidden">HEADLINES: <div class="innerDiv" style="position: absolute; width: 100%;" id="' + divId + '1">' + content[0] + '</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="' + divId + '2">' + content[1] + '</div></div>');
	var scrollerinstance=this;

	if ( window.addEventListener )
	{
		window.addEventListener("load", function(){scrollerinstance.initialize()}, false);
	}
	else if ( window.attachEvent )
	{
		window.attachEvent("onload", function(){scrollerinstance.initialize()});
	}
	else if ( document.getElementById )
	{
		setTimeout(function(){scrollerinstance.initialize()}, 500);
	}
}

ticker.prototype.initialize = function()
{
	this.tickerdiv = document.getElementById(this.tickerid);
	this.visiblediv = document.getElementById(this.tickerid + "1");
	this.hiddendiv = document.getElementById(this.tickerid + "2");
	this.visibledivtop = parseInt(ticker.getCSSpadding(this.tickerdiv));
	this.visiblediv.style.width = this.hiddendiv.style.width = this.tickerdiv.offsetWidth - ( this.visibledivtop * 2 ) + "px";
	this.getinline(this.visiblediv, this.hiddendiv);
	this.hiddendiv.style.visibility = "visible";
	var scrollerinstance = this;
	document.getElementById(this.tickerid).onmouseover = function(){scrollerinstance.mouseoverBol=1};
	document.getElementById(this.tickerid).onmouseout = function(){scrollerinstance.mouseoverBol=0};

	if ( window.attachEvent )
	{
		window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null});
	}
	
	setTimeout(function(){scrollerinstance.animateup()}, this.delay);
}


ticker.prototype.animateup = function()
{
	var scrollerinstance = this

	if ( parseInt(this.hiddendiv.style.top) > (this.visibledivtop+5) )
	{
		this.visiblediv.style.top = ( parseInt(this.visiblediv.style.top) - 5 ) + "px";
		this.hiddendiv.style.top = ( parseInt(this.hiddendiv.style.top) - 5 ) + "px";
		setTimeout(function(){scrollerinstance.animateup()}, 50);
	}
	else
	{
		this.getinline(this.hiddendiv, this.visiblediv);
		this.swapdivs();
		setTimeout(function(){scrollerinstance.setmessage()}, this.delay);
	}
}

ticker.prototype.swapdivs = function()
{
	var tempcontainer = this.visiblediv;
	this.visiblediv = this.hiddendiv;
	this.hiddendiv = tempcontainer;
}

ticker.prototype.getinline = function(div1, div2)
{
	div1.style.top = this.visibledivtop + "px"
	div2.style.top = Math.max(div1.parentNode.offsetHeight, div1.offsetHeight) + "px"
}

ticker.prototype.setmessage = function()
{
	var scrollerinstance = this;

	if ( this.mouseoverBol == 1 )
	{
		setTimeout(function(){scrollerinstance.setmessage()}, 100);
	}
	else
	{
		var i = this.hiddendivpointer;
		var ceiling = this.content.length;
		this.hiddendivpointer = ( ( i + 1 ) > ( ceiling - 1 ) ) ? 0 : ( i + 1 );
		this.hiddendiv.innerHTML = this.content[this.hiddendivpointer];
		this.animateup();
	}
}

ticker.getCSSpadding = function(tickerobj)
{ 
	if ( tickerobj.currentStyle )
	{
		return tickerobj.currentStyle["paddingTop"];
	}
	else if ( window.getComputedStyle )
	{
		return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top");
	}
	else
	{
		return 0;
	}
}

// function from http://www.quirksmode.org/js/lastmod.html
function lastMod()
{
	var x = new Date(2007, 10, 15, 0, 0, 0); // (document.lastModified);
	Modif = new Date(x.toGMTString());
	Year = takeYear(Modif);
	Month = Modif.getMonth();
	Day = Modif.getDate();
	Mod = (Date.UTC(Year,Month,Day,0,0,0)) / 86400000;
	x = new Date();
	today = new Date(x.toGMTString());
	Year2 = takeYear(today);
	Month2 = today.getMonth();
	Day2 = today.getDate();
	now = (Date.UTC(Year2,Month2,Day2,0,0,0)) / 86400000;
	daysago = now - Mod;
	
	if ( daysago < 0 ) return '';
	
	unit = 'days';
	
	if ( daysago > 730 )
	{
		daysago = Math.floor(daysago / 365);
		unit = 'years';
	}
	else if ( daysago > 60 )
	{
		daysago = Math.floor(daysago / 30);
		unit = 'months';
	}
	else if ( daysago > 14 )
	{
		daysago = Math.floor(daysago / 7);
		unit = 'weeks'
	}
	
	var towrite = 'Page last updated: ';
	
	if ( daysago == 0 ) towrite += 'today';
	else if ( daysago == 1 ) towrite += 'yesterday';
	else towrite += daysago + ' ' + unit + ' ago';
	
	return towrite;
}


function takeYear(theDate)
{
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	
	return y;
}

function showFlag(sId)
{
	document.getElementById(sId).style.display = 'block';
}

function hideFlag(sId)
{
	document.getElementById(sId).style.display = 'none';
}

hHide = 0;

function showLinks(sId)
{
	if ( hHide > 0 )
	{
		clearTimeout(hHide);
	}
	
	aId = new Array("links_bar", "links_plate", "links_buildingsys");
	
	for ( n = 0; n < aId.length; n++ )
	{
		if ( sId != aId[n] ) document.getElementById(aId[n]).style.display = "none";
	}

	document.getElementById("coverup").style.display = "block";
	document.getElementById("coverup").style.zIndex = 2;
	document.getElementById(sId).style.display = "block";
	document.getElementById("links").style.zIndex = 3;
}

function hideLinks(sId)
{
	hHide = setTimeout(function(){document.getElementById(sId).style.display="none";document.getElementById("coverup").style.display="none";}, 1000);
}
//-->