function CheckForm(theform, del)
{
			 if (!theform.section_name.value && del!=1) 
			 {
			  	alert('Please be sure to include a name for your section.');
				return false;
			 }
			 else return true;
}
function newWindow(file,window,options) {
    msgWindow=open(file,window,options);
    if (msgWindow.opener == null) msgWindow.opener = self;
}
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 MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

var now = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
function fourdigits(number)	{
	return (number < 1000) ? number + 1900 : number;
}
today =  days[now.getDay()] + ", " +
         months[now.getMonth()] + " " +
         date + ", " +
         (fourdigits(now.getYear())) ;
function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}
function OpenWindow(sURL, nw,nh, sOptions) {
   if (nw<1) {nw=500;}
   if (nh<1) {nh=300;}
   if (sOptions == '') { sOptions='screenX=125,left=125,screenY=125,top=125,channelmode=0,dependent=0,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no,left=0,top=0,screenX=0,screenY=0';}

   myRemote2 = launch(sURL, "myRemote2", "height=" + nh + ",width=" + nw + "," + sOptions, "HAMweather_Popup");

   return false;
}
hex=153 // Initial color value.
function fadetext(elemID) {
	if(hex>55) { //If color is not black yet
		hex-=11; // increase color darkness
		document.getElementById(elemID).style.color="rgb("+hex+","+hex+","+hex+")";
		setTimeout("fadetext('"+elemID+"')",20);
	}
	else
	hex=153 //reset hex value
}

function swapblocks(newBlock,oldBlock)
{
        if (newBlock  && oldBlock)
        {
        	if (newBlock.style.display=='none')
        	{
		    	oldBlock.style.display='none';
		    	newBlock.style.display='block';
		    }
    	}
}

function delconf (f_name,f_action) {
	if (del_conf = confirm('Are you sure you want to remove this post from the system?\n')) {
		document.forms[f_name].action = f_action;
		return true;
	}
	else {
		return false;
	}
}

function open_window(link,w,h) //opens new window
{
        var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
        newWin = window.open(link,'newWin',win);
        newWin.focus();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Banner Rotate Opacity (09-12-2005)
// by Vic Phillips  http://www.vicsjavascripts.org.uk

// Banner Images Opacity Rotation
// As many applications on a page as required

// Application Notes

// The Banner Images are nested in a <DIV>
// The <DIV> must have a unique ID name
// and a style position of relative or absolute
// e.g.
// <div id="Dick" style="position:relative;top:150px;">
// <img class="SSImg" width="500" height="50" src="http://www.vicsjavascripts.org.uk/StdImages/Zero.gif">
// <img class="SSImg" width="500" height="50" src="http://www.vicsjavascripts.org.uk/StdImages/One.gif">
// <img class="SSImg" width="500" height="50" src="http://www.vicsjavascripts.org.uk/StdImages/Two.gif">
// <img class="SSImg" width="500" height="50" src="http://www.vicsjavascripts.org.uk/StdImages/Three.gif">
// <img class="SSImg" width="500" height="50" src="http://www.vicsjavascripts.org.uk/StdImages/Four.gif">
// <img class="SSImg" width="500" height="50" src="http://www.vicsjavascripts.org.uk/StdImages/Five.gif">
// </div>

// The images must have a style of
// position:absolute;visibility:hidden;top:0px;left:0px;
// The script would normally Initialised from a <BODY> or window onload event
// e.g.
// <body onload="zxcBannerRotateOpacity('Dick',5,1)">
// Where:
// parameter 0 = the unique id of the <DIV>                                  (string)
// The follow parameters are optional, if ommitted defaults will be applied
// parameter 1 = the start image                                             (digits interga)
// parameter 2 = the number of slide show cycles (1 to n)                    (digits intega or floating point)
// parameter 3 = the fade increment (minimum = 1 = slow )( max = 30 = fast ) (digits interga)
// parameter 4 = the fade speed  (minimum = 5 = fast )                       (digits interga)
// parameter 5 = the Image delay (minimum = 50 = fast )                      (digits interga)


// All variable, function etc. names are prefixed with 'zxc' to minimise conflicts with other JavaScripts
// These charactors are easily changed to charactors of choise using global find and replace.

// The Functional Code is best as an External JavaScript

// Tested with IE6 and Mozilla FireFox


// Defaults
var zxcIncrement=2;
var zxcFadeSpeed=20;
var zxcImgDelay=2000;

// Functional Code - No Need to Change

var zxcCnt=0;

function zxcBannerRotateOpacity(zxcid,zxcsi,zxccy,zxcinc,zxcspd,zxcdly){
 var zxcp=document.getElementById(zxcid);
 if (!zxcp){ return; }
 if (zxcp.obj){ return; }
 zxcp.obj=new zxcAddBannerFade();
 zxcp.obj.imgary=zxcp.getElementsByTagName('IMG');
 if (!zxccy){ zxcccy=1; }
 zxcp.obj.cy=zxccy*zxcp.obj.imgary.length-1;
 zxcp.obj.cnt=0;
 if (!zxcsi){ zxcsi=1; }
 if (zxcsi>=zxcp.obj.imgary.length||zxcsi<1){ zxcsi=1; }
 zxcp.obj.cntT=zxcsi-1;
 zxcp.obj.cntB=zxcsi;
 if (zxcp.obj.cntB==zxcp.obj.imgary.length){ zxcp.obj.cntB=0; }
 if (!zxcinc){ zxcinc=zxcIncrement; }
 if (zxcinc<1||zxcinc>30){ zxcinc=zxcIncrement; }
 zxcp.obj.inc=zxcinc;
 if (!zxcspd){ zxcspd=zxcFadeSpeed; }
 if (zxcspd<5||zxcspd>70){ zxcspd=zxcFadeSpeed; }
 zxcp.obj.spd=zxcspd;
 if (!zxcdly){ zxcdly=zxcImgDelay; }
 if (zxcdly<50){ zxcdly=zxcImgDelay; }
 zxcp.obj.dly=zxcdly;
 var zxc0;
 for (zxc0=0;zxc0<zxcp.obj.imgary.length;zxc0++){
  zxcOpacity(zxcp.obj.imgary[zxc0],0)
 }
 zxcp.obj.IT=zxcp.obj.imgary[zxcp.obj.cntT];
 zxcOpacity(zxcp.obj.IT.style,100);
 zxcp.obj.IT.style.zIndex=1;
 zxcp.obj.IT.style.visibility='visible';
 if (navigator.appName == 'Microsoft Internet Explorer') {
 	zxcp.obj.IT.style.marginLeft=(200-zxcp.obj.IT.width)/2;
 	zxcp.obj.IT.style.marginTop=(200-zxcp.obj.IT.height)/2;
 }
 zxcp.obj.setTimeOut0();
}

function zxcAddBannerFade(){
 this.ref0 = 'timeout0'+zxcCnt;
 window[this.ref0]=this;
 this.ref1 = 'timeout1'+zxcCnt;
 window[this.ref1]=this;

 this.setTimeOut0= function(zxcf,zxcd){
  setTimeout('window.'+this.ref0+'.rotate()',this.dly);
 }

 this.setTimeOut1= function(zxcf,zxcd){
  setTimeout('window.'+this.ref1+'.'+zxcf,zxcd);
 }

 this.rotate=function(){
 if (this.cnt>=this.cy){ return; }
  this.fcnt=0;
  this.cnt++;
  this.IT=this.imgary[this.cntT]
  this.IB=this.imgary[this.cntB]
  this.IT.style.zIndex=0;
  this.IB.style.zIndex=1;
  this.IB.style.visibility='visible';
  if (navigator.appName == 'Microsoft Internet Explorer') {
  	this.IB.style.marginLeft=(200-this.IB.width)/2;
  	this.IB.style.marginTop=(200-this.IB.height)/2;
  }
  this.fadebanner();
 }

 this.fadebanner=function(){
  this.fcnt+=this.inc;
  zxcOpacity(this.IT.style,100-this.fcnt);
  zxcOpacity(this.IB.style,this.fcnt);
  if (this.fcnt<100){ this.setTimeOut1('fadebanner()',this.spd); }
  else {
   zxcOpacity(this.IB.style,100);
   zxcOpacity(this.IT.style,0);
   this.cntT=(this.cntT+1)%this.imgary.length;
   this.cntB=(this.cntB+1)%this.imgary.length;
   this.setTimeOut1('rotate()',this.dly);
  }
 }
 zxcCnt++;
}

function zxcOpacity(zxcobj,zxcop) {
 if (zxcop>100||zxcop<0){ return }
 if (zxcobj.MozOpacity!=null){ zxcobj.MozOpacity=(zxcop/100)-.001; }
 else if (zxcobj.opacity!=null){ zxcobj.opacity=(zxcop/100)-.001; }
 else if (zxcobj.filter!=null){ zxcobj.filter = 'alpha(opacity='+zxcop+')';     }
 else if (zxcobj.KHTMLOpacity!=null){ zxcobj.KHTMLOpacity=(zxcop/100)-.001; }
}

function setActiveStyleSheet(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 getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

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

function readCookie(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;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);