var NS4, IE4, NS3, IE3mac, IE3pc, b4, browserType;
b4 = false;
hover=(((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)>=3))||
((navigator.appName=="Microsoft Internet Explorer")&&(parseInt(navigator.appVersion)>=4)));
if (document.all != null) {IE4 = true; browserType = "IE4"; b4=true;}
if (document.layers != null) {NS4 = true; browserType = "NS4"; b4=true;}

var rootPage = 0;

window.onload=initial;
window.onresize=browserResized;

function browserResized() {
  if (NS4) {
    pageWidth = window.innerWidth;
    pageHeight = window.innerHeight;
  }
  if (IE4) {
    pageWidth = document.body.clientWidth;
    pageHeight = document.body.clientHeight;
  }
}

function initial() {
  browserResized();

  if (rootPage == 1) {
    if (document.all||document.layers) { 
//      regenerate2(); 
 //     update();
     }
  }
  loaded = 1;
}

function mOvr(src,clrOver){ 
	if (!src.contains(event.fromElement)){ 
		src.style.cursor = 'hand'; src.bgColor = clrOver; 
	} 
} 
function mOut(src,clrIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
	src.bgColor = clrIn; 
	} 
} 
function mClk(src){ 
	if(event.srcElement.tagName=='TD'){ 
 		src.children.tags('A')[0].click(); 
	} 
} 

function Get_Cookie(name) {
  var start = document.cookie.indexOf(name+"=");
  var len = start+name.length+1;
  if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
  if (start == -1) return null;
  var end = document.cookie.indexOf(";",len);
  if (end == -1) end = document.cookie.length;
  return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure) {
  document.cookie = name + "=" +escape(value) +
  ";expires=Thu, 07-Jan-2010 00:00:01 GMT" +
  ( (path) ? ";path=" + path : "") + 
  ( (domain) ? ";domain=" + domain : "") +
  ( (secure) ? ";secure" : "");
}

function Delete_Cookie(name,path,domain) {
  if (Get_Cookie(name)) document.cookie = name + "=" +
    ( (path) ? ";path=" + path : "") +
    ( (domain) ? ";domain=" + domain : "") +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";

function printDateTime() {
  var time=new Date();
  var lmonth=months[time.getMonth() + 1];
  var date=time.getDate();
  var year=time.getYear();
  if (year < 2000) year = year + 1900;
  myhours = time.getHours();
  ampmhour  =  (myhours > 12) ? myhours - 12 : myhours;
  ampm =  (myhours >= 12) ? 'pm' : 'am';
  mytime = time.getMinutes();
  myminutes =  ((mytime < 10) ? ':0' : ':') + mytime;
  document.write(ampmhour + myminutes + ampm + ", ");
  document.write(lmonth + " ");
  document.write(date + ", " + year + "&nbsp;&nbsp;");
}

function printLastModified() {
  var last = document.lastModified;
  var time = new Date(last);
  var lmonth=months[time.getMonth() + 1];
  var date=time.getDate();
  var year=time.getYear();
  if (year < 2000) year = year + 1900;
  myhours = time.getHours();
  ampmhour  =  (myhours > 12) ? myhours - 12 : myhours;
  ampm =  (myhours >= 12) ? 'pm' : 'am';
  mytime = time.getMinutes();
  myminutes =  ((mytime < 10) ? ':0' : ':') + mytime;
  document.write(ampmhour + myminutes + ampm + ", ");
  document.write(lmonth + " ");
  document.write(date + ", " + year + "&nbsp;&nbsp;");
}

function preload(img) {
 var a=new Image(); a.src=img; return a;
}

//returns a random number, but not the last one it returned
function rand(numTot) {
  if (nn) {
	var ret=oldRand;
	while(ret==oldRand) {
		ret=(Math.floor(Math.random()*1000) % numTot) +1;
	}
	oldRand=ret;
	return ret;
  }
  else if (ie) {
	cNum+=1;
	if (cNum>38) cNum=0;
	return cNum;
  }
}



var speed=4000;
var news=new Array();
function regenerate() {
         window.location.reload();
}

function regenerate2() {
         if (document.layers)
            setTimeout("window.onresize=regenerate",450);
}

function update() {
     BgFade(0xff,0xff,0xff, 0xff,0x00,0x00,10);
     if (document.layers) {
        document.tickertape.document.subtickertape.document.write('<center><span class="subtickertapefont">'+news[i]+'</span></center>');
        document.tickertape.document.subtickertape.document.close();
		}
     else 
        document.all.subtickertape.innerHTML="<center>" + news[i] + "</center>";

     if (i < news.length-1)
         i++;
     else
         i = 0;
         setTimeout("update()",speed);
  }

function BgFade(red1, grn1, blu1, red2, grn2, blu2, steps) {
     sred = red1; sgrn = grn1; sblu = blu1; 
     ered = red2; egrn = grn2; eblu = blu2; 
     inc = steps; 
     step = 0; 
     RunFader();
}

function RunFader() {
    var epct = step/inc; 
    var spct = 1 - epct; 
    if (document.layers)
       document.tickertape.document.bgColor = Math.floor(sred * spct + ered * epct)*256*256 + Math.floor(sgrn * spct + egrn * epct)*256 + Math.floor(sblu * spct + eblu * epct); 
    else
       tickerobject.backgroundColor = Math.floor(sred * spct + ered * epct)*256*256 + Math.floor(sgrn * spct + egrn * epct)*256 + Math.floor(sblu * spct + eblu * epct); 
    if ( step < inc ) {
       setTimeout('RunFader()',50); 
    }
    step++;
}

function moveOut() {
if (window.cancel) {clearTimeout(cancel);}
if (window.moving2) {clearTimeout(moving2);}
if ((IE4 && ssm2.style.pixelLeft<0)||(NS4 && document.ssm2.left<0)) {
if (IE4) {ssm2.style.pixelLeft += 10;}
if (NS4) {document.ssm2.left += 10;}
moving1 = setTimeout('moveOut()', slideSpeed)}
else {clearTimeout(moving1)}
}

function moveBack() {
cancel = setTimeout('moveBack1()', waitTime)
}

function moveBack1() {
if (window.moving1) {clearTimeout(moving1)}
if ((IE4 && ssm2.style.pixelLeft>(-menuWidth))||(NS4 && document.ssm2.left>(-menuWidth))) {
if (IE4) {ssm2.style.pixelLeft -= 10;}
if (NS4) {document.ssm2.left -= 10;}
moving2 = setTimeout('moveBack1()', slideSpeed)}
else {clearTimeout(moving2)}
}

lastY = 0;
function makeStatic(mode) {
if (IE4) {winY = document.body.scrollTop;var NM=ssm2.style}
if (NS4) {winY = window.pageYOffset;var NM=document.ssm2}
if (mode=="smooth") {
if ((IE4||NS4) && winY!=lastY) {
smooth = .2 * (winY - lastY);
if(smooth > 0) smooth = Math.ceil(smooth);
else smooth = Math.floor(smooth);
if (IE4) NM.pixelTop+=smooth;
if (NS4) NM.top+=smooth;
lastY = lastY+smooth;}
setTimeout('makeStatic("smooth")', 1)}
else if (mode=="advanced") {
if ((IE4||NS4) && winY>YOffset-staticYOffset) {
if (IE4) {NM.pixelTop=winY+staticYOffset}
if (NS4) {NM.top=winY+staticYOffset}}
else {
if (IE4) {NM.pixelTop=YOffset}
if (NS4) {NM.top=YOffset-7}}
setTimeout('makeStatic("advanced")', 1)}}

function initSlide() {
if (IE4) {
ssm2.style.pixelLeft = -menuWidth;
ssm2.style.visibility = "visible"}
else if (NS4) {
document.ssm2.left = -menuWidth;
document.ssm2.visibility = "show"}
else {alert('Choose either the "smooth" or "advanced" static modes!')}
}

function startMenu() {
if (IE4) {document.write('<DIV ID="ssm2" style="visibility:hidden;Position : Absolute ;Left : 0px ;Top : '+YOffset+'px ;Z-Index : 20;width:1px" onmouseover="moveOut()" onmouseout="moveBack()">')}
if (NS4) {document.write('<LAYER visibility="hide" top="'+YOffset+'" name="ssm2" bgcolor="'+menuBGColor+'" left="0" onmouseover="moveOut()" onmouseout="moveBack()">')}
tempBar=""
for (i=0;i<barText.length;i++) {
tempBar+=barText.substring(i, i+1)+"<BR>"}
document.write('<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+barWidth+2)+'" bgcolor="'+menuBGColor+'"><tr><td bgcolor="'+hdrBGColor+'" WIDTH="'+(menuWidth-1)+'" HEIGHT="'+hdrHeight+'" ALIGN="'+hdrAlign+'" VALIGN="'+hdrVAlign+'">&nbsp;<font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+menuHeader+'</b></font></td><td align="center" rowspan="100" width="'+barWidth+'" background="'+barBG+'" bgcolor="'+barBGColor+'" valign="'+barVAlign+'"><p align="center"><font face="'+barFontFamily+'" Size="'+barFontSize+'" COLOR="'+barFontColor+'"><B>'+tempBar+'</B></font></p></TD></tr>')
}

function addItem(text, link, target) {
if (!target) {target=linkTarget}
document.write('<TR><TD BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" ALIGN="'+linkAlign+'" WIDTH="'+(menuWidth-1)+'"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkAlign+'"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'">&nbsp;<A HREF="'+link+'" target="'+target+'" CLASS="ssm2Items">'+text+'</LAYER></ILAYER></TD></TR>')
}

function addHdr(text) {
document.write('<tr><td bgcolor="'+hdrBGColor+'" HEIGHT="'+hdrHeight+'" ALIGN="'+hdrAlign+'" VALIGN="'+hdrVAlign+'">&nbsp;<font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+text+'</b></font></td></tr>')
}

function endMenu() {
document.write('<tr><td bgcolor="'+hdrBGColor+'"><font size="0" face="Arial">&nbsp;</font></td></TR></table>')
if (IE4) {document.write('</DIV>')}
if (NS4) {document.write('</LAYER>')}
if ((IE4||NS4) && (menuIsStatic=="yes"&&staticMode)) {makeStatic(staticMode);}
}

YOffset=90;
staticYOffset=90;
staticMode="smooth";
slideSpeed=10;
waitTime=30;
menuBGColor="#000000";
menuIsStatic="yes";
menuHeader="website navigation";
menuWidth=160;
hdrFontFamily="verdana";
hdrFontSize="1";
hdrFontColor="ffffff";
hdrBGColor="006600";
hdrAlign="left";
hdrVAlign="top";
hdrHeight="0";
linkFontFamily="Verdana";
linkFontSize="1";
linkBGColor="white";
linkOverBGColor="05910B";
linkTarget="_top";
linkAlign="Left";
barBGColor="05910B";
barBG = "images/bg_patch.jpg";
barFontFamily="Verdana";
barFontSize="1";
barFontColor="ffffff";
barText="navigation";
barVAlign="center";
barWidth=10;


function makeMenu() {
startMenu();
addItem('Home', 'http://www.adminlaw.org/', '_top');
addItem('Bandwidth Speed Test', 'http://bandwidthplace.com/speedtest/', '_top');
endMenu();
}

