var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}

function buildCal(m, y, cM, cH, cDW, cD, brdr){
var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];
var dim=[31,0,31,30,31,30,31,31,30,31,30,31];

var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31st
oD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31st

var todaydate=new Date() //DD added
var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added

dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;
var t='<div class="'+cM+'"><table class="'+cM+'" cols="7" cellpadding="0" border="'+brdr+'" cellspacing="0"><tr align="center">';
t+='<td colspan="7" align="center" class="'+cH+'">'+mn[m-1]+' - '+y+'</td></tr><tr align="center">';
for(s=0;s<7;s++)t+='<td class="'+cDW+'">'+"SMTWTFS".substr(s,1)+'</td>';
t+='</tr><tr align="center">';
for(i=1;i<=42;i++){
var x=((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : '&nbsp;';
if (x==scanfortoday) //DD added
x='<span id="today">'+x+'</span>' //DD added
t+='<td class="'+cD+'">'+x+'</td>';
if(((i)%7==0)&&(i<36))t+='</tr><tr align="center">';
}
return t+='</tr></table></div>';
}

function show(elem,displayMode){
document.getElementById(elem).style.display = displayMode;
}

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Justin Barlow | http://www.netlobo.com */

function toggleLayer(whichLayer) {
  var elem, vis;
  if(document.getElementById) // this is the way the standards work
    elem = document.getElementById(whichLayer);
  else if(document.all) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if(document.layers) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function UP() {
  show('OE','none');
  show('UP','block');
  show('UP_1','none');
  show('UP_2','none');
  show('GN','none');
  show('GN1','none');
  show('GN2','none');
  show('PQ','none');
  show('PQ1','none');
  show('PQ2','none');
  show('SP','none');
  show('RC','none');
  show('WV','none');
  show('LK','none');
}

function UP_1() {
  show('OE','none');
  show('UP','none');
  show('UP_1','block');
  show('UP_2','none');
  show('GN','none');
  show('GN1','none');
  show('GN2','none');
  show('PQ','none');
  show('PQ1','none');
  show('PQ2','none');
  show('SP','none');
  show('RC','none');
  show('WV','none');
  show('LK','none');
}

function UP_2() {
  show('OE','none');
  show('UP','none');
  show('UP_1','none');
  show('UP_2','block');
  show('GN','none');
  show('GN1','none');
  show('GN2','none');
  show('PQ','none');
  show('PQ1','none');
  show('PQ2','none');
  show('SP','none');
  show('RC','none');
  show('WV','none');
  show('LK','none');
}

function OE() {
  show('OE','block');
  show('UP','none');
  show('GN','none');
  show('GN1','none');
  show('GN2','none');
  show('PQ','none');
  show('PQ1','none');
  show('PQ2','none');
  show('SP','none');
  show('RC','none');
  show('WV','none');
  show('LK','none');
}

function GN() {
  show('OE','none');
  show('UP','none');
  show('GN','block');
  show('GN1','none');
  show('GN2','none');
  show('PQ','none');
  show('PQ1','none');
  show('PQ2','none');
  show('SP','none');
  show('RC','none');
  show('WV','none');
  show('LK','none');
}

function GN1()
{

show('OE','none');
show('UP_1','none');
show('GN','none');
show('GN1','block');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','none');
}

function GN2()
{

show('OE','none');
show('UP_2','none');
show('GN','none');
show('GN1','none');
show('GN2','block');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','none');
}

function PQ()
{

show('OE','none');
show('UP','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','block');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','none');
}

function PQ1()
{

show('OE','none');
show('UP_1','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','block');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','none');
}

function PQ2()
{

show('OE','none');
show('UP_2','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','block');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','none');
}

function SP()
{

show('OE','none');
show('UP','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','block');
show('RC','none');
show('WV','none');
show('LK','none');
}

function RC()
{

show('OE','none');
show('UP','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','block');
show('WV','none');
show('LK','none');
}

function WV()
{

show('OE','none');
show('UP','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','block');
show('LK','none');
}

function LK()
{

show('OE','none');
show('UP','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','block');
}

function hertco()
{

show('hertco','block');
show('total','none');
show('kodiak','none');
show('OE','none');
show('UP','none');
show('UP_1','none');
show('UP_2','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','none');
}


function total()
{

show('hertco','none');
show('total','block');
show('kodiak','none');
show('OE','none');
show('UP','none');
show('UP_1','block');
show('UP_2','none');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','none');
}


function kodiak()
{

show('hertco','none');
show('total','none');
show('kodiak','block');
show('OE','none');
show('UP','none');
show('UP_1','none');
show('UP_2','block');
show('GN','none');
show('GN1','none');
show('GN2','none');
show('PQ','none');
show('PQ1','none');
show('PQ2','none');
show('SP','none');
show('RC','none');
show('WV','none');
show('LK','none');
}