﻿function lastMod() {
	var x = new Date (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 changed ';
	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 MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function bringBackBlinky() 
{
	if (swi == 1) 
	{
		sho="visible";
		swi=0;
	}
	else 
	{
		sho="hidden";
		swi=1;
	}

	for(i=0;i<na.length;i++) 
	{
		na[i].style.visibility=sho;
	}
}

String.prototype.trim = function() {
  return this.replace(/^\s+/g, "").replace(/\s+$/g, "");
};


function classmod(element, elemclass)
{
	if(elemclass == "")
	{
		return "<"+element+">";
	}
	else
	{
		return "<"+element+" class=\""+elemclass+"\">";
	}
}

 
function wrapdata(element,elemclass,data)
{
	if (data == "")
	{
		temp = "&nbsp;";
	}
	else
	{
		temp = data;
	}
	start = classmod(element,elemclass)
	return start + temp +"</"+element+">";
}  



function flipflop(odd)
{
	if(odd)
	{
		return false;
	}
	else
	{
		return true;
	}
}

function counties()
{
	return "Austin, Brazoria, Chambers, Fort Bend, Galveston, Grimes, Hardin, Harris, Jefferson, Liberty, Matagorda, Montgomery, Orange, Polk, San Jacinto, Walker, Waller, Washington, and Wharton";
}


