window.onload=initAll;

function initAll(){
CurrentNavLink();
}

function MakeArrayday(size) {
this.length = size;
for(var i = 1; i <= size; i++) {
this[i] = "";
}
return this;
}


function MakeArraymonth(size) {
this.length = size;
for(var i = 1; i <= size; i++) {
this[i] = "";
}
return this;
}

function dateStamp() {

var d = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var m = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var today = new Date();
var day = today.getDate();
var year = today.getYear();
if (year < 2000) year += 1900; 

var runTime = new Date();
var hours = runTime.getHours();
var minutes = runTime.getMinutes();
var seconds = runTime.getSeconds();
var dn = "am";
if (hours >= 12) {
dn = "pm";
hours = hours - 12;
}

if (hours == 0) {
hours = 12;
}

if (minutes <= 9) {
minutes = "0" + minutes;
}

if (seconds <= 9) {
seconds = "0" + seconds;
}

movingtime = d[today.getDay()]+", "+m[today.getMonth()]+" "+day+", " + year+" "+ hours + ":" + minutes + ":" + seconds + " " + dn;

document.getElementById("datestamp").innerHTML = movingtime;

setTimeout("dateStamp()", 1000)
}


function CurrentNavLink() {

if (!document.getElementsByTagName) return; 
var anchors = document.getElementsByTagName("a"); 
var thisPage = location.href;
if ((thisPage == 'http://www.cyclesportpendle.org.uk') || (thisPage == 'http://www.cyclesportpendle.org.uk/')){
       thisPage = "http://www.cyclesportpendle.org.uk/index.html";
}

for (var i=0; i<anchors.length; i++) { 
var anchor = anchors[i]; 
thisHREF = anchor.getAttribute("href");
//    if ((thisHREF == thisPage) && (anchor.className == 'nav')){ 
    if (thisHREF == thisPage){ 
     anchor.id = "current"; 
//     return; 
  } 
}
} 