
//Copyright Design Solutions, All rights reserved.
//Any use without express permission from Jeff Margenau at Design Solutions is expressly prohibited.For inquiries, contact Jeff Margenau at j@xmlo.com, 920-568-3468 or by writing Jeff Margenau c/o Design Solutions, 1016 Heth, Fort Atkinson, WI 53538-1216

var de = navigator.userAgent.toLowerCase()
var mo=(de.indexOf("mozilla/")!=-1)?1:0
mt=0;if(mo){x=de.indexOf(" ")+1;mt=Number(de.substring(8,x))}
var opera=(de.indexOf("opera")!=-1)?1:0
var ns=(navigator.appName == 'Netscape' && !opera)
var mv=0;ie=de.indexOf('msie ');if(ie!=-1)mv=Number(de.substring(ie+5,ie+8))
var DOM1=document.layers?1:0
var DOM2=0
var DOM3=document.getElementById?1:0
var s0x=DOM1?'hide':'hidden'
var s1x=DOM1?'show':'visible'
var n4=(ns && DOM1 && !opera)? 1:0
var sn=n4?'4':'';if(opera)sn='4'
var sns=(DOM2)?'':'4'
var ns5=(ns && DOM3 && !opera)?1:0
var wh=0
var eu=''
var howQuick = 70;
var iWhere = 1000000;
var pval=0
var hval=0
var now = new Date();
var dd = now.getDate();var ddd=dd
var mm = now.getMonth();var mmm=mm
var yy = now.getFullYear();var yyy=yy
var dw = now.getDay()
var da
da=document.getElementById
var pOs=100
var wx=0
var names = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var d0w = new Array('S','M','T','W','T','F','S');
var dow2 = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var days = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var c=""
var who
var birth
var rst=false
var Forestry=null
var wbkg
var wfade
var dc=document.personal
var imgnum
var X=0
var Y=0
var cpy='Copyright 2002-'+yy+' Design Solutions All Rights Reserved.'
var hourz= new Array([],[],[],[],[],[],[],[]);
var minutz= new Array([],[],[],[],[],[],[],[]);
var hourzx= new Array([],[],[],[],[],[],[],[]);
var minutzx= new Array([],[],[],[],[],[],[],[]);
var LD = new Date()
var MD = new Date()
var mdd;var ldd
var libraryhours
var todayshours
todayshours=''
var openhour
var closedhour
var nextopenhour
var nextclosedhour
var mopen
var daytype
var logD=now.getDay();
var ngD=now.getDay();
var ngDNO=ngD+1>6?0:ngD+1;
var LD = new Date()
var MD = new Date()
var TD = new Date()
var TE = new Date()
var CD = new Date()
var CE = new Date()
var NY = new Date()
var NE = new Date()
var EA = new Date()
var xmxx
var xnow
var specialmessage=''
var fontsize
var pe
var pe=new Array('a','b','00/00/0000',0,0,3,0,0,1,0,1,0,0,0,0,0)
var DFPL_Cookie
var tgs = new Array( 'p','li','td');
var szs = new Array( 11,12,13,14,15,16,18 );
var startSz
var cdated
var homepage=false
var firstdate
var closedtoday=false;
fontsize=11;
var nextdayopen='';
var nextopendate='';
var beforeopen=true;
var nextdaynumopen;
var nextstarttime;
var nextendtime;
var dayprefix
var daytype
var starttime
var endtime
var openagenda

Date.prototype.Add = function(strInterval, intIncrement){
if(strInterval != "M" && strInterval != "D" && strInterval != "Y" && strInterval != "h" && strInterval != "m" && strInterval != "uM" && strInterval != "uD" && strInterval != "uY" && strInterval != "uh" && strInterval != "um" && strInterval != "us"){throw("DateAdd: Second parameter must be M, D, Y, h, m, uM, uD, uY, uh, um or us");}
if(typeof(intIncrement) != "number"){throw("DateAdd: Third parameter must be a number");}
 
switch(strInterval)
{
case "M":
this.setMonth(parseInt(this.getMonth()) + parseInt(intIncrement));break;
case "D":
this.setDate(parseInt(this.getDate()) + parseInt(intIncrement));break;
case "Y":
this.setYear(parseInt(this.getYear()) + parseInt(intIncrement));break;
case "h":
this.setHours(parseInt(this.getHours()) + parseInt(intIncrement));break;
case "m":
this.setMinutes(parseInt(this.getMinutes()) + parseInt(intIncrement));break;
case "s":
this.setSeconds(parseInt(this.getSeconds()) + parseInt(intIncrement));break;
case "uM":
this.setUTCMonth(parseInt(this.getUTCMonth()) + parseInt(intIncrement));break;
case "uD":
this.setUTCDate(parseInt(this.getUTCDate()) + parseInt(intIncrement));break;
case "uY":
this.setUTCFullYear(parseInt(this.getUTCFullYear()) + parseInt(intIncrement));break;
case "uh":
this.setUTCHours(parseInt(this.getUTCHours()) + parseInt(intIncrement));break;
case "um":
this.setUTCMinutes(parseInt(this.getUTCMinutes()) + parseInt(intIncrement));break;
case "us":
this.setUTCSeconds(parseInt(this.getUTCSeconds()) + parseInt(intIncrement));break;
}
return this;
}

function findThanksgiving(year) {
var delta = year - 1900;
var doomsday = delta % 12;
doomsday = (doomsday + Math.floor(doomsday/4) + Math.floor(delta/12)) % 7;
return (doomsday == 0)? 28 : (29 - doomsday);
}

function holidays() {
ea = yy % 19;
eb = Math.floor(yy/100);
ec = yy % 100;
ed = Math.floor(eb/4);
ee = eb % 4;
ef = Math.floor((eb+8) / 25);
eg = Math.floor((eb-ef+1) / 3);
eh = (19*ea + eb - ed - eg + 15) % 30;
ei = Math.floor(ec/4);
ej = ec % 4;
ek = (32 + 2*ee + 2*ei - eh - ej) % 7;
em = Math.floor((ea + 11*eh + 22*ek) / 451);
emonth = Math.floor((eh + ek - 7*em + 114) / 31);
eday = ((eh + ek - 7*em +114) % 31) + 1;
EA.setYear(yy)
EA.setMonth(emonth-1)
EA.setDate(eday)
EA.setHours(0)
EA.setMinutes(0)
EA.setSeconds(0)
TD.setYear(yy)
TD.setMonth(10)
TD.setDate(findThanksgiving(yy))
TD.setHours(0)
TD.setMinutes(0)
TD.setSeconds(0)

var ldd=0
LD.setYear(yy)
LD.setMonth(8)
LD.setDate(1)
LD.setHours(0)
LD.setMinutes(0)
LD.setSeconds(0)
for (j=1; j <= 7; j++) {LD.setDate(j);if(LD.getDay()==1){ldd=LD.getDate();break}}
var mdd=0
MD.setYear(yy)
MD.setMonth(4)
MD.setDate(31)
MD.setHours(0)
MD.setMinutes(0)
MD.setSeconds(0)
for (j=31; j >= 25; j--) {MD.setDate(j);if(MD.getDay()==1){mdd=MD.getDate();break}}
}
holidays()

if(now >=MD && now < LD){
// Summer Hours
libraryhours='<b>Mon - Thurs</b> 9am to 8pm - <b>Fri</b> 9am to 5pm - <b>Sat</b> 9am to 1pm'
hourz[0][0]=0;hourz[0][1]=0; // Sunday
hourz[1][0]=9;hourz[1][1]=20;
hourz[2][0]=9;hourz[2][1]=20;
hourz[3][0]=9;hourz[3][1]=20; //Wednesday
hourz[4][0]=9;hourz[4][1]=20;
hourz[5][0]=9;hourz[5][1]=17;
hourz[6][0]=9;hourz[6][1]=13; // Saturday
minutz[0][0]=0;minutz[0][1]=0; // Sunday
minutz[1][0]=0;minutz[1][1]=0;
minutz[2][0]=0;minutz[2][1]=0;
minutz[3][0]=0;minutz[3][1]=0; //Wednesday
minutz[4][0]=0;minutz[4][1]=0;
minutz[5][0]=0;minutz[5][1]=0;
minutz[6][0]=0;minutz[6][1]=0; // Saturday

}

else{
// Winter Hours
libraryhours='<b>Mon - Thurs</b> 9am to 9pm - <b>Fri</b> 9am to 5pm - <b>Sat</b> 9am to 5pm'
hourz[0][0]=0;hourz[0][1]=0; // Sunday
hourz[1][0]=9;hourz[1][1]=21;
hourz[2][0]=9;hourz[2][1]=21;
hourz[3][0]=9;hourz[3][1]=21; //Wednesday
hourz[4][0]=9;hourz[4][1]=21;
hourz[5][0]=9;hourz[5][1]=17;
hourz[6][0]=9;hourz[6][1]=17; // Saturday
minutz[0][0]=0;minutz[0][1]=0; // Sunday
minutz[1][0]=0;minutz[1][1]=0;
minutz[2][0]=0;minutz[2][1]=0;
minutz[3][0]=0;minutz[3][1]=0; //Wednesday
minutz[4][0]=0;minutz[4][1]=0;
minutz[5][0]=0;minutz[5][1]=0;
minutz[6][0]=0;minutz[6][1]=0; // Saturday
}

todaynum=2;
;nextopendatex='Wednesday the 10th of March 2010'
;nextopendate='2010-02-10'
;nextdayopen='Wednesday'
;nextdaynumopen=3

;openagenda=0


if (minutz[nextdaynumopen][0] < 10){xmin = ":0" + minutz[nextdaynumopen][0];} else {xmin=":" + minutz[nextdaynumopen][0]}
if (minutz[nextdaynumopen][1] < 10){xminc = ":0" + minutz[nextdaynumopen][1];} else {xminc=":" + minutz[nextdaynumopen][1]}
if (hourz[nextdaynumopen][0] > 12){xhr = hourz[nextdaynumopen][0]-12;ttx='pm'} else {xhr=hourz[nextdaynumopen][0];ttx='am'}
if (hourz[nextdaynumopen][1] > 12){xhrc = hourz[nextdaynumopen][1]-12;ttxc='pm'} else {xhrc=hourz[nextdaynumopen][1];ttxc='am'}
if (hourz[nextdaynumopen][0] == 12)ttx='pm'
if (hourz[nextdaynumopen][1] == 12)ttxc='pm'
nextstarttime=xhr+xmin+' '+ttx
nextendtime=xhrc+xminc+' '+ttxc

if (minutz[todaynum][0] < 10){xmin = ":0" + minutz[todaynum][0];} else {xmin=":" + minutz[todaynum][0]}
if (minutz[todaynum][1] < 10){xminc = ":0" + minutz[todaynum][1];} else {xminc=":" + minutz[todaynum][1]}
if (hourz[todaynum][0] > 12){xhr = hourz[todaynum][0]-12;ttx='pm'} else {xhr=hourz[todaynum][0];ttx='am'}
if (hourz[todaynum][1] > 12){xhrc = hourz[todaynum][1]-12;ttxc='pm'} else {xhrc=hourz[todaynum][1];ttxc='am'}
if (hourz[todaynum][0] == 12)ttx='pm'
if (hourz[todaynum][1] == 12)ttxc='pm'
todaystarttime=xhr+xmin+' '+ttx
todayendtime=xhrc+xminc+' '+ttxc


function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
  sz=parseInt(sz);
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
pe[13]=parseInt(startSz)
pe[14]=parseInt(startSz)
fontsize=szs[pe[13]]
Save()
}
//********************************************************************


function Initialize(){
dc=document.personal
DFPL_Cookie=rC("DFPL_Cookie")
if(DFPL_Cookie==null)DFPL_Cookie='a,b,00/00/0000,0,0,3,0,0,1,0,1,0,0,0,0,0'
pe=DFPL_Cookie.split(",")
fontsize=szs[pe[13]]
startSz = parseInt(pe[13]);
ts('body',0)
goforit()
}

function Save() {
dc=document.personal
cC('DFPL_Cookie',pe,100000)
//DFPL_Cookie=rC("DFPL_Cookie")
//if(DFPL_Cookie==null)DFPL_Cookie='a,b,00/00/0000,0,0,3,0,0,1,0,1,0,0,0,0,0'
//pe=DFPL_Cookie.split(",")
}

function cC(name,value,days){
if (days){
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString()}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function rC(name){
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)	{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)}
return null
}

function eC(name)
{cC(name,"",-1)}


function stat(){window.status=(cpy)}
stat()

function scheme(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}


function Jump(selItem) {
 dindex = selItem.selectedIndex
 ditem = selItem.options[dindex].value
 if (ditem != '') {
	 window.location = ditem
 }
}

N = 0;
var ob;
function MD(e) {
if (N) {
ob = document.layers[e.target.name];
X=e.x;
Y=e.y;
return false;
}
else {
ob = event.srcElement.parentElement.style;
X=event.offsetX;
Y=event.offsetY;
 }
}
function MM(e) {
if (ob) {
if (N) {
ob.moveTo((e.pageX-X), (e.pageY-Y));
}
else {
ob.pixelLeft = event.clientX-X + document.body.scrollLeft;
ob.pixelTop = event.clientY-Y + document.body.scrollTop;
return false;
}
 }
}
function MU() {
ob = null;
}

if (N) {
//document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}
//document.onmousedown = MD;
//document.onmousemove = MM;
//document.onmouseup = MU;

function pp(){
if(pval==0){if(hval==1){pOs=100;fadeout('help');hval=0};s(1,'person');ini();pval=1} else {pOs=100;fadeout('person');pval=0}
val=pval==0?0:60
grayOut(pval,{'opacity':val})
}

//if(pval==1){pOs=100;fadeout('person');pval=0};
function hh(){
if(hval==0){s(1,'help');hval=1} else {s(0,'help');hval=0}
val=hval==0?0:60
grayOut(hval,{'opacity':val})
}

var wval=0
function hw(){
if(wval==0){s(1,'weekly');wval=1} else {s(0,'weekly');wval=0}
val=wval==0?0:60
grayOut(wval,{'opacity':val})
}

function parse(inp){
if(inp.indexOf(",")!=-1){
esearch=inp.split(",")
document.ese.LastName.value=esearch[0]
document.ese.FirstName.value=esearch[1]
}
else if(inp.indexOf(" ")!=-1){
esearch=inp.split(" ")
document.ese.LastName.value=esearch[1]
document.ese.FirstName.value=esearch[0]
}
else{
document.ese.LastName.value=inp
document.ese.FirstName.value=""
}
}

function dis(d){
dc=document.personal
if(d==1){dc.rand.checked=false;pe[9]=0;dc.rand.disabled=true;dc.ss.disabled=true;dc.bkg.disabled=true}
else if(d==0)
{dc.rand.checked=false;pe[9]=0;dc.rand.disabled=true;dc.ss.disabled=false;dc.bkg.disabled=false}
else if(d==2){dc.rand.disabled=false;dc.ss.disabled=true;dc.bkg.disabled=false}
}

function ini(){
if(rst==true) pe=new Array("","","00/00/0000",0,0,3,0,0,1,0,1,0,0,0,0,0)
dc=document.personal
dc.sname.value=pe[0]
dc.email.value=pe[1]
dc.bdate.value=pe[2]
dc.bkg.selectedIndex=pe[3]
dc.abkg[pe[7]].checked=true
if(pe[7]==0 || pe[7]==1){clearTimeout(wbkg);clearTimeout(wfade)}
howQuick=pe[5]*10+50
dc.ss.selectedIndex=pe[5]
if(pe[6]==1){dc.usename.checked=true}
dc.sname.focus();dc.sname.select()
dc.smen.checked=(pe[8]==1)?true:false
dc.rand.checked=(pe[9]==1)?true:false
dc.icon.checked=(pe[10]==1)?true:false
if(pe[7]==0){document.getElementById('head').style.background='#fff';dis(1);clearTimeout(wbkg);clearTimeout(wfade);}
else if (pe[7]==1){dis(2)}
else if (pe[7]==2){dis(0)}
//if(pe[7]==3){clearTimeout(wbkg);document.getElementById("headshow").innerHTML='<img name="SlideShow" src="images/header-1.jpg" height="95" border="0">';Nx(1)}
}

function change(w){
if(w==7 || w==3 || w==99){
img = new Image();img.src = "images/header-"+pe[3]+".jpg";
//if(pe[10]==1){s(1,'icons')} else {s(0,'icons')}
//if(pe[7]==1){clearTimeout(wbkg);clearTimeout(wfade)}
//if(pe[7]==0 || w==99){clearTimeout(wbkg);clearTimeout(wfade);document.getElementById('head').style.background='#fff'}
//if(pe[7]==2){howQuick=pe[5]*10+50;clearTimeout(wbkg);clearTimeout(wfade);sb()}
//if (document.getElementById && pe[7]==1 || pe[7]==2){document.getElementById('head').style.background='url(images/header-'+pe[3]+'.jpg)'}
//if(pe[7]==3){clearTimeout(wbkg);document.getElementById("headshow").innerHTML='<img name="SlideShow" src="images/header-1.jpg" height="95" border="0">';s(1,'headshow');Nx(1)}
if(w==99){pe[6]=0;s(0,'Personality')}
}
else if(w==0 || w==6){
document.getElementById('HEA').innerHTML = ""+pe[0]
if(pe[6]==1){s(1,'Personality')} else {s(0,'Personality')}}
else if (w==8){if(pe[8]==1){s(1,'MBAR')} else {s(0,'MBAR')}}
//else if (w==10){if(pe[10]==1){s(1,'icons')} else {s(0,'icons')}}
}


//function Nx(X){
//if(X==11)X=1
//img = new Image();
//img.src = "images/header-"+(X)+".jpg";
//ix='<img name="SlideShow" src="images/header-'+X+'.jpg" border="0">'
//ix2='images/header-'+(X)+'.jpg'
//runSlideShow(ix2)
//X++
//wfade=setTimeout("Nx("+X+")",5000);
//}

function runSlideShow(ix2) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
document.images.SlideShow.src = ix2;
document.images.SlideShow.filters.blendTrans.Play();
}

engineurl = new Array("http://google.com/search?q=","","http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=","http://www.m-w.com/cgi-bin/thesaurus?book=Thesaurus&va=","http://wunderground.com/cgi-bin/findweather/getForecast?query=","http://www.altavista.com/web/results?itag=wrx&q=","http://search.yahoo.com/search?p=","http://www.sharelibraries.info/uhtbin/cgisirsi/x/0/0/57/5?user_id=FTATKINSONWEB&sort_by=-PBYR&password=guest&srchfield1=GENERAL^SUBJECT^GENERAL^^words or phrase&searchdata1=","search.php?searchtypex=exact&titlesearch=title&keywordssearch=keywords&descriptionsearch=description&maxnum=5&minnum=0&rownum=0&q=")

stxt = new Array("Google","Internet","Dictionary","Thesaurus","Weather","Alta Vista","Yahoo","Library Catalog"," This Site");

stx=new Array("g","b","d","t","w","a","y","c","s")

function dS(q) {ty=q==1?'Browse ':'Search ';wh=q;document.getElementById("sq").sqz.value='';document.getElementById("sq").sqz.focus();eu=engineurl[q];document.getElementById("sq").sqs.value=ty+stxt[wh];}


function Ds(inp){
if(inp!=null){wn=Math.round(Math.random()*100)
x=(screen.width*0.9);var y=(screen.height*0.7);
if (wh == 1) {var cx=inp.substring(0,4);if(cx != 'http'){inp='http://'+inp}}
if(DOM1)inp=inp.replace(/ /g,'+')
url=eu+inp;document.getElementById("sq").sqz.focus()
if(wh!=8){window.open(url,wh+wn,'width='+x+',height='+y+',toolbar=1,directories=1,menubar=1,status=1,resizable=1,location=1,scrollbars=1,copyhistory=1,left=0,top=0,border=0')}else{location=url}
}}


function hidem(which){
//iw=0
//pOs=100;fadeout('help');hval=0
//s(1,'box'+which)
//while (iw < 2){
//if (iw != which)s(0,'box'+iw)
//iw++
//}
}

function s(y,z) {
x=y?s1x:s0x
hv(x,z)
}
function hv(x,y) {la=document.getElementById(y);la.style.visibility = x}

function moveIt(id,x) 
{
var supported = (document.getElementById); 
if (!supported) return; 
var divPath = document.getElementById(id); 
var currPos = parseInt(divPath.style.top); 
if (currPos >= x) 
{currPos -= 1; 
divPath.style.top = currPos; 
setTimeout("moveIt('" + id + "'," + x+ ")",10); 
} 
} 


function sb(){
if (DOM2){
 iWhere = iWhere - 1;
 if (iWhere < 0) iWhere = 1000000;
document.getElementById("head").style.backgroundPosition = iWhere + " 0";
 wbkg=setTimeout("sb()",howQuick);
}
}

function fadeout(which){
pOs=pOs-34
wx++;whicher=which
wone=which+wx
if(pOs >= 0){da(which).filters.alpha.opacity=pOs
wone=setTimeout("fadeout(whicher)",2)}
if(pOs <= 0){pOs=0;clearTimeout(wone);s(0,which);document.getElementById(which).filters.alpha.opacity=100}
}


function go(wh) {
if(wh=='list'){wh='this.list'}
if(wh=='list2'){wh='this.list2'}
sel = wh.selectedIndex
u=wh[sel].value
if(sel==0){return}
mw(u);wh.selectedIndex=0
}

function plural(num){ys='';if(Math.abs(num)!=1)ys='s';return ys}

var FH
var FM
var FS
var TTF
function FixT(h,m,s){
TTF=h>=12?"pm":"am"
FH=h>12?h-12:h
FH=FH==0?12:FH
FM=m<10?"0"+m:m
FS=s<10?"0"+s:s
TIME=FH+":"+FM+":"+FS+" "+TTF
return FH,FM,FS,TTF,TIME
}

var lDvalue=""
var OnTimeValue = " ";
var OffTimeValue = " ";
var PageTimeValue = " ";
var spanend="</span>"
var PTV
var lh
var lm
var ls
var onDate
var startday
var clockStart
var timeDiff
var diffSecs
var d1="0"
var st=true

function colortime(ptv,ptvn){
PageTimeValue = spanmaker(0,'arial','10px','#f5f5f5','','')+ptv+spanend+PageTimeValue.substring(ptvn,PageTimeValue.length)
}
//if (PageTimeValue.substring(0,7) == "00:00:0") colortime("00:00:0",7)
//else if (PageTimeValue.substring(0,6) == "00:00:") colortime("00:00:",6)
//else if (PageTimeValue.substring(0,4) == "00:0") colortime("00:0",4)
//else if (PageTimeValue.substring(0,3) == "00:") colortime("00:",3)
//else if (PageTimeValue.substring(0,1) == "0") colortime("0",1)

// CLOCK GENERATION ROUTINE_________________________________________________
var LOGndw=now.getDay()
var firsthours=0;

nowe=new Date()
var tmzoffset=nowe.getTimezoneOffset()/60
function getthedate(){
now=new Date()
//now.setHours(tmzoffset-7)
ngD=now.getDay();
nyy=now.getFullYear()
ndw=now.getDay()
nmm=now.getMonth()
ndd=now.getDate()
Hr=now.getHours()
Mn=now.getMinutes()
Sec=now.getSeconds()
FixT(Hr,Mn,Sec)

if (st==true){st=false;firstdate=ndd;OnTimeValue =FH+":"+FM+":"+FS+" "+TTF;cdate=dow2[ndw]+" "+names[nmm]+" "+ndd+", "+nyy+" "+OnTimeValue+"&nbsp;&nbsp;|&nbsp;&nbsp;Age:";startday = new Date();clockStart = startday.getTime();onDate=dow2[now.getDay()]+" "+names[now.getMonth()]+" "+now.getDate()+", "+now.getFullYear();document.getElementById("docdate").innerHTML=cdate}

if(ndd!=firstdate)location=location
timeNow = now.getTime();  
//timeNow=timeNow+(timeNow.getTimezoneOffset() * 60000)
timeDiff = timeNow - clockStart; 
diffsecs = Math.floor(timeDiff.valueOf()/1000);

d1 = ((Math.floor(diffsecs/86400))%100000).toString()
h1 = ((Math.floor(diffsecs/3600))%24).toString();lh=h1;if (h1.length < 2) h1 = "0" + h1;
m1 = ((Math.floor(diffsecs/60))%60).toString();lm=m1;if (m1.length < 2) m1 = "0" + m1;
s1 = ((Math.floor(diffsecs/1))%60).toString();ls=s1;if (s1.length < 2) s1 = "0" + s1;

if (d1>0){lDvalue=d1+" day"+plural(d1)+" "}
PageTimeValue =h1+":"+ m1+":"+ s1

if(homepage==true){
oldhours=todayshours
if(closedtoday==false && Hr*60+Mn>=hourz[ngD][0]*60+minutz[ngD][0] && Hr*60+Mn<hourz[ngD][1]*60+minutz[ngD][1])
{mopen="Open"}
else{
//nextopend =new Date(nextopendate.getFullYear(), nextopendate.getMonth(), nextopendate.getDate())
//nextopenint=Math.ceil((now.getTime()-nextopend.getTime())/(1000*60*60*24))

mopen="Closed";dayprefix="be open again "
if((nextdaynumopen-LOGndw) > 2 || (nextdaynumopen-LOGndw < -2)){daytype=nextopendatex}
else{daytype=dow2[nextdaynumopen];dayprefix="be open ";}
if (closedtoday==false && Hr*60+Mn<hourz[ngD][0]*60+minutz[ngD][0]){dayprefix="be open ";daytype="today";beforeopen=true}else{beforeopen=false;}
}

ho()
if(firsthours==0 || oldhours!=todayshours && document.getElementById("Thours2")){
firsthours++;
document.getElementById("Thours2").innerHTML=todayshours;

if (document.getElementById("bigday")){document.getElementById("bigday").innerHTML=dow2[ndw];}
if (document.getElementById("bigdate")){document.getElementById("bigdate").innerHTML=ndd;}
if (document.getElementById("bigmonth")){document.getElementById("bigmonth").innerHTML=names[nmm];}
}}
if (document.getElementById("pageTime"))document.getElementById("pageTime").innerHTML=lDvalue+PageTimeValue+"&nbsp;"
}

var dayprefix='';
function ho(){
if(mopen=="Closed" && beforeopen==false){specialmessage='';starttime=nextstarttime;endtime=nextendtime}
if(beforeopen==true){starttime=todaystarttime;endtime=todayendtime}

if(mopen!='Closed'){todayshours='<p style="font-size:'+fontsize+'px">'+specialmessage+'The building is open <a href="contact.php">now until '+xhrc+xminc+' '+ttxc+'</a>.</p>';}
else{
if(ngD==0 || todayshours=='' || mopen=='Closed')todayshours='<p style="font-size:'+fontsize+'px">'+specialmessage+'The building is closed now and will '+dayprefix+'<a href="calendar.php">'+daytype+' from '+starttime+' to '+endtime+'</a>. Until then, on our Web site you can:</p><ul><li style="font-size:'+fontsize+'px"><a href="http://www.sharelibraries.info/uhtbin/cgisirsi/x/0/0/57/49?user_id=FTATKINSONWEB">search for and place holds on books, dvds, videos, cds and more</a></li><li style="font-size:'+fontsize+'px"><a href="http://www.fortlibrary.org/webtemplate.php?linkname=bkltrs">get great book ideas for cooking, relaxing, learning...</a></li><li style="font-size:'+fontsize+'px"><a href="http://www.fortlibrary.org/webtemplate.php?linkname=databases">use our databases for research</a></li><li style="font-size:'+fontsize+'px"><a href="http://www.fortlibrary.org/form_library_card_application.php">start your library card application</a></li><li style="font-size:'+fontsize+'px"><a href="http://www.fortlibrary.org/calendar.php">discover what is coming up at the library</a></li></ul>'
}

if(openagenda==1 && (beforeopen==true || mopen=='Open'))todayshours+='<p>Open agenda today.  <a href="/webtemplate.php?linkname=libserv" title="Go to Library Services page...">Stop by and see what we have to offer</a>!</p>'
}


// CLOCK GENERATION ROUTINE_________________________________________________

//cdate=''
//if(pe[2]=="1")
//cdate+=spanmaker(1,'arial','','#ccccff','#333','')+"&nbsp;"+FH+":"+FM+":"+FS+" "+TTF+"&nbsp;"+spanend
//if(pe[3]=="1")
//cdate+= spanmaker(1,'arial','10px','#fff','transparent','')+dow2[ndw]+spanend+" &nbsp;"
//cdate+=spanmaker(0,'arial','10px','#fff','transparent','')+names[nmm]+" "+ndd+", "+nyy+spanend+"";
//cdated+=spanmaker(1,'arial','10px','#fff','transparent','')+cdate+" "+OnTimeValue+"&nbsp;&nbsp;|&nbsp;&nbsp;Age:"+spanend+spanmaker(0,'arial','','#fff','transparent','displayTimes()')+" &nbsp;&nbsp;"+lDvalue+PageTimeValue+"&nbsp;"+spanend
//cdated=cdated+lDvalue+PageTimeValue+"&nbsp;"
//else if (document.getElementById)document.getElementById("clock2").innerHTML=cdate

function spanmaker(bold1,font,size,color,bgcolor,onclick,extra){
if(bold1)bold1=" font-weight:bold; "
if(size)size=" font-size:"+size+";"
if(color)color=" color:"+color+";"
if(font)font=" font-family:"+font+";"
if(bgcolor)bgcolor=" background: "+bgcolor+";"
if(onclick)onclick=" onclick='"+onclick+"';"
out1="<span style='"+bold1+font+color+size+bgcolor+"' "+onclick+extra+">"
return out1
}

function displayTimes() {
offDate=dow2[ndw]+" "+names[nmm]+" "+ndd+", "+nyy
OffTimeValue = FH+":"+FM+":"+FS+" "+TTF

lH=lh!="0"?lh+" hour"+plural(lh):""
lM=lm!="0"?lm+" minute"+plural(lm):""
lS=ls!="0"?ls+" second"+plural(ls):""

LHC="";LMC="" 
if(lH!="" && lM!="" && lS!=""){LHC=", "; LMC=" and "}
else if(lH!="" && lM!="" && lS=="")LHC=" and "
else if(lH!="" && lM=="" && lS!="")LMC=" and "
else if(lM!="" && lS!="")LMC=" and "

PTV=lDvalue+lH+LHC+lM+LMC+lS
alert("\n   LOG ON TIME:   " +OnTimeValue+" on "+onDate+"\n\n   INQUIRY TIME:   "+OffTimeValue+" on "+offDate+"\n\n   DOCUMENT AGE:   " + PTV);
}

function getthedate2(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if(day2!=day && seconds >=2){day2=day;now = new Date();dd=now.getDate();dw=now.getDay();mm=now.getMonth();yy=now.getFullYear();yyy=yy;ddd=dd;mmm=mm}
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
{
 d = new Date();
 Time24H = new Date();
 Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000);
 InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44);
 if (InternetTime < 10) InternetTime = '00'+InternetTime;
 else if (InternetTime < 100) InternetTime = '0'+InternetTime;
}

if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var cdate
cdate=names[month]+" "+daym+" "+year+"&nbsp;"
// " <b>"+dow2[day]+"</b>, "+    &nbsp; "+hours+":"+minutes+":"+seconds+" "+dn+" 
document.getElementById("clock2").innerHTML=cdate
}




function mw(u){
swi=Math.round((screen.width*0.9))
she=Math.round((screen.height*0.9))
windowX = Math.round(((screen.width/2)-(swi/2))) 
windowY = Math.round(((screen.height/2)-(she/2)))
wn=Math.round(Math.random()*100);nw=open(u, wn,"toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width="+swi+",height="+she+",left="+windowX+",top="+windowY)}


function goforit(){if (document.getElementById)setInterval("getthedate()",1000)}

var wincount=1;

function mwi(u,x,y,sc,opt,name){
wn=name==null?Math.round(Math.random()*100):name
if(sc==null)sc=1
if(opt==null)opt=1
window.open(u,wn,'width='+x+',height='+y+',toolbar='+opt+',directories='+opt+',menubar='+opt+',status='+opt+',resizable=1,location='+opt+',scrollbars='+sc+',copyhistory='+opt)
}

function Browser() {
var ua, s, i;
this.isIE= false;
this.isOP= false;
this.isNS= false;
this.version = null;
ua = navigator.userAgent;
s = "Opera";
if ((i = ua.indexOf(s)) >= 0) {
this.isOP = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}

s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}

// Treat any other "Gecko" browser as Netscape 6.1.
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = 6.1;
return;
}

s = "MSIE";
if ((i = ua.indexOf(s))) {
this.isIE = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
}

var browser = new Browser();
var activeButton = null;

function buttonClick(event, menuId) {
var button;
if (browser.isIE)
button = window.event.srcElement;
else
button = event.currentTarget;
button.blur();
if (button.menu == null) {
button.menu = document.getElementById(menuId);
if (button.menu.isInitialized == null)
menuInit(button.menu);
}
if (button.onmouseout == null)
button.onmouseout = buttonOrMenuMouseout;
if (button == activeButton)
return false;
if (activeButton != null)
resetButton(activeButton);
if (button != activeButton) {
depressButton(button);
activeButton = button;
}
else
activeButton = null;
return false;
}

function buttonMouseover(event, menuId) {
var button;
if (activeButton == null) {
buttonClick(event, menuId);
return;
}

if (browser.isIE)
button = window.event.srcElement;
else
button = event.currentTarget;

if (activeButton != null && activeButton != button)
buttonClick(event, menuId);
}

function depressButton(button) {
var x, y;
button.className += " menuButtonActive";
if (button.onmouseout == null)
button.onmouseout = buttonOrMenuMouseout;
if (button.menu.onmouseout == null)
button.menu.onmouseout = buttonOrMenuMouseout;
x = getPageOffsetLeft(button);
y = getPageOffsetTop(button) + button.offsetHeight;
if (browser.isIE) {
x += button.offsetParent.clientLeft;
y += button.offsetParent.clientTop;
}

button.menu.style.left = x + "px";
button.menu.style.top= y + "px";
button.menu.style.visibility = "visible";
}

function resetButton(button) {
removeClassName(button, "menuButtonActive");
if (button.menu != null) {
closeSubMenu(button.menu);
button.menu.style.visibility = "hidden";
}
}


function menuMouseover(event) {
var menu;
if (browser.isIE)
menu = getContainerWith(window.event.srcElement, "DIV", "menu");
else
menu = event.currentTarget;
if (menu.activeItem != null)
closeSubMenu(menu);
}

function menuItemMouseover(event, menuId) {
var item, menu, x, y;
if (browser.isIE)
item = getContainerWith(window.event.srcElement, "A", "menuItem");
else
item = event.currentTarget;
menu = getContainerWith(item, "DIV", "menu");
if (menu.activeItem != null)
closeSubMenu(menu);
menu.activeItem = item;
item.className += " menuItemHighlight";
if (item.subMenu == null) {
item.subMenu = document.getElementById(menuId);
if (item.subMenu.isInitialized == null)
menuInit(item.subMenu);
}


if (item.subMenu.onmouseout == null)
item.subMenu.onmouseout = buttonOrMenuMouseout;
x = getPageOffsetLeft(item) + item.offsetWidth;
y = getPageOffsetTop(item);
var maxX, maxY;
if (browser.isIE) {
maxX = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) +
(document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth);
maxY = Math.max(document.documentElement.scrollTop, document.body.scrollTop) +
(document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
}
if (browser.isOP) {
maxX = document.documentElement.scrollLeft + window.innerWidth;
maxY = document.documentElement.scrollTop+ window.innerHeight;
}
if (browser.isNS) {
maxX = window.scrollX + window.innerWidth;
maxY = window.scrollY + window.innerHeight;
}
maxX -= item.subMenu.offsetWidth;
maxY -= item.subMenu.offsetHeight;
if (x > maxX)
x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
+ (menu.offsetWidth - item.offsetWidth));
y = Math.max(0, Math.min(y, maxY));
item.subMenu.style.left = x + "px";
item.subMenu.style.top= y + "px";
item.subMenu.style.visibility = "visible";
if (browser.isIE)
window.event.cancelBubble = true;
else
event.stopPropagation();
}

function closeSubMenu(menu) {
if (menu == null || menu.activeItem == null)
return;
if (menu.activeItem.subMenu != null) {
closeSubMenu(menu.activeItem.subMenu);
menu.activeItem.subMenu.style.visibility = "hidden";
menu.activeItem.subMenu = null;
}
removeClassName(menu.activeItem, "menuItemHighlight");
menu.activeItem = null;
}

function buttonOrMenuMouseout(event) {
var el;
if (activeButton == null)
return;
if (browser.isIE)
el = window.event.toElement;
else if (event.relatedTarget != null)
el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);
if (getContainerWith(el, "DIV", "menu") == null) {
resetButton(activeButton);
activeButton = null;
}
}

function menuInit(menu) {
var itemList, spanList;
var textEl, arrowEl;
var itemWidth;
var w, dw;
var i, j;
if (browser.isIE) {
menu.style.lineHeight = "2.5ex";
spanList = menu.getElementsByTagName("SPAN");
for (i = 0; i < spanList.length; i++)
if (hasClassName(spanList[i], "menuItemArrow")) {
spanList[i].style.fontFamily = "Webdings";
spanList[i].firstChild.nodeValue = "4";
}
}
itemList = menu.getElementsByTagName("A");
if (itemList.length > 0)
itemWidth = itemList[0].offsetWidth;
else
return;
for (i = 0; i < itemList.length; i++) {
spanList = itemList[i].getElementsByTagName("SPAN");
textEl= null;
arrowEl = null;
for (j = 0; j < spanList.length; j++) {
if (hasClassName(spanList[j], "menuItemText"))
textEl = spanList[j];
if (hasClassName(spanList[j], "menuItemArrow"))
arrowEl = spanList[j];
}
if (textEl != null && arrowEl != null) {
textEl.style.paddingRight = (itemWidth 
- (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
if (browser.isOP)
arrowEl.style.marginRight = "0px";
}
}

if (browser.isIE) {
w = itemList[0].offsetWidth;
itemList[0].style.width = w + "px";
dw = itemList[0].offsetWidth - w;
w -= dw;
itemList[0].style.width = w + "px";
}
menu.isInitialized = true;
}

function getContainerWith(node, tagName, className) {
while (node != null) {
if (node.tagName != null && node.tagName == tagName &&
hasClassName(node, className))
return node;
node = node.parentNode;
}
return node;
}

function hasClassName(el, name) {
var i, list;
list = el.className.split(" ");
for (i = 0; i < list.length; i++)
if (list[i] == name)
return true;
return false;
}

function removeClassName(el, name) {
var i, curList, newList;
if (el.className == null)
return;
newList = new Array();
curList = el.className.split(" ");
for (i = 0; i < curList.length; i++)
if (curList[i] != name)
newList.push(curList[i]);
el.className = newList.join(" ");
}

function getPageOffsetLeft(el) {
var x;
x = el.offsetLeft;
if (el.offsetParent != null)
x += getPageOffsetLeft(el.offsetParent);
return x;
}

function getPageOffsetTop(el) {
var y;
y = el.offsetTop;
if (el.offsetParent != null)
y += getPageOffsetTop(el.offsetParent);
return y;
}

function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 50;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';     
  } else {
     dark.style.display='none';
  }
}

