 function startTime()
	 {
	   	var today=new Date();
		var h=today.getHours();
		var m=today.getMinutes();
		var s=today.getSeconds();
		var ampm="AM";
		// add a zero in front of numbers<10
		if (h > 12)
		{
		  h = h - 12;
		  ampm="PM";
		}
		m=checkTime(m);
		s=checkTime(s);
		document.getElementById('txt').innerHTML=h+":"+m+":"+s+" "+ampm;
		t=setTimeout('startTime()',500);
	  }

	  function checkTime(i)
	  {
		if (i<10)
  		{
  			i="0" + i;
  		}
		return i;
	  }
	  
	  function displayDate()
	  {
	  	var d=new Date();
	    var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    	var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
        document.write(weekday[d.getDay()] + " - ");
        document.write(monthname[d.getMonth()] + " ");
	    document.write(d.getDate() + ", ");
	    document.write(d.getFullYear());
	  }
	  
	  
	  var whichImage = true;

function blend()
{
  if ( whichImage )
  {
    image1.filters("blendTrans").apply();
	image1.style.visibility = "hidden";
	image1.filters("blendTrans").play();
  }
  else
  {
    image2.filters("blendTrans").apply();
	image2.style.visibility = "hidden";
	image2.filters("blendTrans").play();
  }
}

function reBlend( fromImage )
{
  if ( fromImage )
  {
    image1.style.zIndex -= 2;
	image1.style.visibility = "visible";
  }
  else
  {
    image1.style.zIndex += 2;
	image2.style.visibility = "visible";
  }
whichImage = !whichImage;
blend();
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookie()
{
	username=getCookie('username');
	if (username!=null && username!="")
	{
		document.writeln("<h2>Hello " + username + ", Welcome to the Dunellen Fire Department</h2>");
	}
	else 
	{
		username=prompt('Please enter your name:',"");
		if (username!=null && username!="")
    {
		setCookie('username',username,365);
		document.writeln("<h2>Hello " + username + ", Welcome to the Dunellen Fire Department</h2>");
    }
	}
}
