
// Note: Wouldn't need the Case statement if the image names matched the body id names
//  but can't have too id's the same - could capitalise or some such...

var bodyRef;
var targetImg;

function initMenu (){

	bodyRef = document.getElementsByTagName('body')[0].id;

	switch (bodyRef) {
	case 'home': targetImg='Home'; break;
	case 'about': targetImg='AboutUs'; break;
	case 'clients': targetImg='Clients'; break;
	case 'contact': targetImg='Contact'; break;
	case 'portfolio': targetImg='Portfolio'; break;
	case 'services': targetImg='OurServices'; break;
	default:targetImg='Home';
	}

	document[targetImg].src = "/images/common/"+targetImg+"_on.gif";

}

function swapImage(imagename, dir){

var imagein = document[imagename].src;
var pos = imagein.indexOf("_");
var onoff = imagein.substr((pos+1),2);

if (imagename != targetImg) {
	if (onoff == "on"){
	imagesource = "/images/" + dir + imagename + "_off.gif";
	}
	else{
	imagesource = "/images/" + dir + imagename + "_on.gif";
	}
	document[imagename].src = imagesource;
}

}