/* All scripts here are by me (except were stated) and you are free
	to use them as you wish, providing you give credit to me or
	the person wrote the script. After all, it's only fair.
	
	Scripts by Martin Cotterill */

// window.defaultStatus = "Christian Lewis Trust Children's Cancer Charity";

/* Make the Title Bar and Status Bar the same */
function titleStatus() {
	var stuff = top.document.title
		top.document.title = stuff;
		defaultStatus = stuff;
}


/* Changes the text depending on the year and month to show the number of years the Trust has been here */
function yearsGoing() {
    nowYear = new Date

	startYear = 1989;
    thisYear = nowYear.getFullYear();

    manyYears = (thisYear - startYear);
    nearlyYears = (manyYears +1);

	if (nowYear.getMonth() <= 5) {
		document.write("for more than "+manyYears+" years,");
	} else {
		document.write("for nearly "+nearlyYears+" years,");
	}
}

/* Gift Aid */
function GiftAid() {
	document.write("28p");
}

function pageReturn() {
	document.write('<a href="javascript:history.back(-1)" class="more">[ Return to the previous page ]</a>')
}

/* Date Script  from www.htmlgoodies.com */
DaysofWeek = new Array()
	DaysofWeek[0]="Sunday"
	DaysofWeek[1]="Monday"
	DaysofWeek[2]="Tuesday"
	DaysofWeek[3]="Wednesday"
	DaysofWeek[4]="Thursday"
	DaysofWeek[5]="Friday"
	DaysofWeek[6]="Saturday"

Months = new Array()
	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"

RightNow = new Date()

var day = DaysofWeek[RightNow.getDay()]
var date = RightNow.getDate()
var Month = Months[RightNow.getMonth()]
var Year = RightNow.getFullYear()

if (date == 1 || date == 21 || date == 31)
	{ender = "st"}
else if (date == 2 || date == 22)
	{ender = "nd"}
else if (date == 3 || date == 23)
	{ender = "rd"}
else 
  {ender = "th"}


function TodaysDate() {
	document.write(day + ",  " + date + ender + " " + Month + ",  " + Year)
	//document.write(date + ender + " " + Month + " "+ Year)
}

// This bit by me.
function LastModDate() {
	RightNow = new Date(document.lastModified)
	document.write(day +", "+ date +" " + Month +", " + Year)
}


/* 4LevelWebs ver1.0 [Based on code by Eddie Traversa] */
function unblur() {
	this.blur();
} 


function blurLinks() {
	if (!document.getElementById) return;
	theLinks = document.getElementsByTagName("A");
	theAreas = document.getElementsByTagName("AREA");
	for(i=0; i<theLinks.length; i++) {theLinks[i].onfocus = unblur;}
	for(i=0; i<theAreas.length; i++) {theAreas[i].onfocus = unblur;}
} 


/* BLOCK ERROR */
//function blockError(){return true;}
//window.onerror = blockError;


function equalize()
{
   obj1=document.getElementById('pageContent');
   obj2=document.getElementById('sideBar');
   if (obj1.offsetHeight<obj2.offsetHeight)
   {
      diff=obj2.offsetHeight-obj1.offsetHeight;
      obj1.style.paddingBottom=diff+'px';
   }
   else
   {
      diff=obj1.offsetHeight-obj2.offsetHeight;
      obj2.style.paddingBottom=diff+"px";
   }
}

function windowStart() {
	titleStatus()
	equalize()
}

window.onload = windowStart