/*
	Team Walking Javascript Functions
	Created by Matt R 3rd July 2007
	for Kariba Creative Media
*/

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

// This script will emulate the css :hover effect on the menu elements in IE

// The variables
var cssid = "primary-nav"; // CSS ID for the menuwrapper
var menuadd = "h";  // Character to be added to the specific classes upon hovering. So for example, if this is set to "h", class "menuparent" will become "menuparenth" when hovered over.
var menuh = "menuh"; // Classname for hovering over all other menu items

if (window.attachEvent) window.attachEvent("onload", cssHover);

function cssHover() {
	var sfEls = document.getElementById(cssid).getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {

		sfEls[i].onmouseover=function() {
			if (this.className != "") {
				this.className = this.className + menuadd;
			}
			else {	
				this.className = menuh;
			}
		}

		sfEls[i].onmouseout=function() {
			if (this.className == menuh) {
				this.className = "";
			}
			else {
				this.className = this.className.replace(new RegExp(menuadd + "$"), "");
			}
		}
	}
}
			
function display_date()
{
	if ($('date'))
	{
		var months = new Array(13);
		months[0]  = "January";
		months[1]  = "February";
		months[2]  = "March";
		months[3]  = "April";
		months[4]  = "May";
		months[5]  = "June";
		months[6]  = "July";
		months[7]  = "August";
		months[8]  = "September";
		months[9]  = "October";
		months[10] = "November";
		months[11] = "December";	
		
		var days = new Array(7);
		days[0] = "Sunday";
		days[1] = "Monday";
		days[2] = "Tuesday";
		days[3] = "Wednesday";
		days[4] = "Thursday";
		days[5] = "Friday";
		days[6] = "Saturday";
		
		var currentTime = new Date();
		var month_number = currentTime.getMonth();
		var dayname = days[currentTime.getDay()];
		var day = currentTime.getDate();
		var year = currentTime.getFullYear();
		//document.write(month + "/" + day + "/" + year)
		$('date').innerHTML =  dayname + " " + months[month_number] + " " + day + " " + year;
	}
}

addLoadEvent(function() {
	display_date();
});


addLoadEvent(function() {
	var currentTime = new Date();
	var year = currentTime.getFullYear();
	if ($('year'))
	{
		$('year').innerHTML = year;
	}
});
