function img_path (filen) {

from_root = 'design/buttons/'
root = '/Billies Ski Hire/web/'               //server root is empty string
// -- dont edit below this line --


rel_to_root = ''
	path = window.location.pathname
	to_root = path.substring (root.length)
	dirs = to_root.split('/')
	for (i = 0; i < dirs.length -1; i++) {
		rel_to_root += '../'	
	}
return rel_to_root + from_root + filen
}

function preload_images (page) {
	if (document.images) //test if images enabled
	{
		//Home
		button01 = new Image(); button01.src = img_path ('button01.gif');
		button01_m = new Image(); button01_m.src = img_path ('button01_m.gif');
		if (page == 'f') { home = new Image(); button01.src = img_path ('button01.gif') }	
		
		//Ski Hire
		button02 = new Image(); button02.src = img_path ('button02.gif');
		button02_m = new Image(); button02_m.src = img_path ('button02_m.gif');
		if (page == 's') { home = new Image(); button02.src = img_path ('button02.gif') }
	
		//Chain Hire
		button03 = new Image(); button03.src = img_path ('button03.gif');
		button03_m = new Image(); button03_m.src = img_path ('button03_m.gif');
		if (page == 'm') { home = new Image(); button03.src = img_path ('button03.gif') }
	
		//Resort Entry
		button04 = new Image(); button04.src = img_path ('button04.gif');
		button04_m = new Image(); button04_m.src = img_path ('button04_m.gif');
		if (page == 'a') { home = new Image(); button04.src = img_path ('button04.gif') }
		
		//Boutique
		button05 = new Image(); button05.src = img_path ('button05.gif');
		button05_m = new Image(); button05_m.src = img_path ('button05_m.gif');
		if (page == 'l') { home = new Image(); button05.src = img_path ('button05.gif') }	

		//Contact
		button06 = new Image(); button06.src = img_path ('button06.gif');
		button06_m = new Image(); button06_m.src = img_path ('button06_m.gif');
		if (page == 'c') { home = new Image(); button06.src = img_path ('button06.gif') }
		
		//Links
		button07 = new Image(); button07.src = img_path ('button07.gif');
		button07_m = new Image(); button07_m.src = img_path ('button07_m.gif');
		if (page == 'c') { home = new Image(); button07.src = img_path ('button07.gif') }

	}	
}

function do_over(imagename)
{
	 if (document.images) 
	 {
	 	document.images[imagename].src = eval(imagename+"_m.src") 
	 }
}

function do_out(imagename, f)
{
	 if (document.images) 
	 {
	 	if (f) {
	 		document.images[imagename].src = eval(imagename+".src")
	 	} else {
	 	document.images[imagename].src = eval(imagename+".src") 
	 	}
	 }
}

