function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		image_name = newImage("images/image_name.gif");
		preloadFlag = true;
	}
}

function doHighlightNav(){
	var lastSlash // the position of the last slash in the path
	var fileName  // the name of the file
	var hashPos // the position of the hash symbol in the case of anchors
	var fullPath
	fullPath = document.URL;
//	fullPath = fullPath.replace(/\\/g,"/");     for local testing
	lastSlash = fullPath.lastIndexOf("/");
	fileName = fullPath.substring(lastSlash+1,fullPath.length);
	hashPos = fileName.lastIndexOf("#");
	if (hashPos!=-1) {
		noAnchor = fileName.substring(0,hashPos);
	}
	else {
		noAnchor = fileName;
	}
	
	switch (noAnchor){
		
		// Main Menu sets class to mover
		case "":
			navhome.className='mover';
			break;
		case "index.html":
			navhome.className='mover';
			break;
		case "products.html":
			products.className='mover';
			break;
		case "accessories.html":
			accessories.className='mover';
			break;
		case "tips-and-advice.html":
			tips.className='mover';
			break;
		case "about-us.html":
			about.className='mover';
			break;
		case "catalogue.html":
			catalogue.className='mover';
			break;
		case "contact-us.php":
			contact.className='mover';
			break;
			
		// Products Submenu sets class to sover
		case "wood-flooring.html":
			products.className='mover';
			pwood.className='sover';
			break;
		case "stone-flooring.html":
			products.className='mover';
			pstone.className='sover';
			break;
		case "natural-carpets.html":
			products.className='mover';
			pcarpets.className='sover';
			break;
			
		// Accessories Submenu sets class to sover
		case "sealants.html":
			accessories.className='mover';
			asealants.className='sover';
			break;
		case "adhesives.html":
			accessories.className='mover';
			aadhesives.className='sover';
			break;
		case "oils.html":
			accessories.className='mover';
			aoils.className='sover';
			break;
			
		// Catalogue Submenu sets class to sover
		case "wood-flooring-cat.html":
			catalogue.className='mover';
			cwood.className='sover';
			break;
		case "wood-flooring-cat-oak.html":
			catalogue.className='mover';
			cwood.className='sover';
			break;
		case "wood-flooring-cat-maple.html":
			catalogue.className='mover';
			cwood.className='sover';
			break;
		case "wood-flooring-cat-walnut.html":
			catalogue.className='mover';
			cwood.className='sover';
			break;
		case "wood-flooring-cat-cherry.html":
			catalogue.className='mover';
			cwood.className='sover';
			break;
		case "wood-flooring-cat-arcacia.html":
			catalogue.className='mover';
			cwood.className='sover';
			break;
			
			
		case "stone-flooring-cat.html":
			catalogue.className='mover';
			cstone.className='sover';
			break;
		case "stone-flooring-cat-travertine.html":
			catalogue.className='mover';
			cstone.className='sover';
			break;
		case "stone-flooring-cat-limestone.html":
			catalogue.className='mover';
			cstone.className='sover';
			break;
		case "stone-flooring-cat-jerusalem.html":
			catalogue.className='mover';
			cstone.className='sover';
			break;
		case "stone-flooring-cat-marble.html":
			catalogue.className='mover';
			cstone.className='sover';
			break;
		case "stone-flooring-cat-slate.html":
			catalogue.className='mover';
			cstone.className='sover';
			break;
		case "stone-flooring-cat-sandstone.html":
			catalogue.className='mover';
			cstone.className='sover';
			break;
		case "stone-flooring-cat-terracotta.html":
			catalogue.className='mover';
			cstone.className='sover';
			break;
			
			
		case "natural-carpets-cat.html":
			catalogue.className='mover';
			ccarpets.className='sover';
			break;
		case "natural-carpets-cat-sea-grass.html":
			catalogue.className='mover';
			ccarpets.className='sover';
			break;
		case "natural-carpets-cat-jute.html":
			catalogue.className='mover';
			ccarpets.className='sover';
			break;
		case "natural-carpets-cat-sisal.html":
			catalogue.className='mover';
			ccarpets.className='sover';
			break;
		case "natural-carpets-cat-coir.html":
			catalogue.className='mover';
			ccarpets.className='sover';
			break;
			
			
		case "stone-bathware-cat.html":
			catalogue.className='mover';
			cbathware.className='sover';
			break;
			
			
		case "doors-cat.html":
			catalogue.className='mover';
			cdoors.className='sover';
			break;
			
			
		case "accessories-cat.html":
			catalogue.className='mover';
			caccessories.className='sover';
			break;
		
	}
}