/**********************************************************************
	Javascript File
	
	File: default.js
	
	Description: change this
	
	Usage: Contains 4 functions:
			newImage(string arg) - used to load image (from imageready)
			changeImage() - used to switch images, can be used for multiple images (from imageready)
			preloadMenu() - used to preload menu images, placed in body tag i.e: <body onLoad="preloadMenu();">
			go1() - used to activate quicklinks
			expirenew(date) - will display a flashing new gif untill the date supplied.
			quicklinks() - loads the quick links drop down box.
			
			
	Version 2.0
	Created: Stephen Treadgold, April 5, 2006.
	Copyright 2004 - 2006 Stephen Treadgold.
***********************************************************************	
	Version: 1 - inital design
	Version: 1.1 - added function gol, added code in MainMenu to add quicklinks the same page as the menu.
	Version: 1.2 - Added expirenew function into this js from main page. Now usable on all pages.
	Version 2.0 - Renamed to default.js and removed menu componets
	Version 2.1 - Updated preloadMenu(), removed the preload for square menu button, using CSS now.
	
	Version History:
		1   / 03.04.04 / Created / SMT
		1.1 / 05.15.04 / Updated / SMT
		1.2 / 03.26.06 / Updated / SMT
		2.0 / 04.05.06 / Updated / SMT
		2.1 / 08.20.06 / Updates / SMT
***********************************************************************/
// ------------------------ Preload Script ------------------------ 
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 preloadMenu() {
	if (document.images) {
		Hiking_over = newImage("images/Hiking-over.gif");
		Gallery_over = newImage("images/Gallery-over.gif");
		Ice_Magic_over = newImage("images/IceMagic-over.gif");
		Panorama_over = newImage("images/Panorama-over.gif");
		Map_Tour_over = newImage("images/MapTour-over.gif");
		Contact_over = newImage("images/Contact-over.gif");
		Times_over = newImage("images/Times-over.gif");
		Legal_Stuff_over = newImage("images/Legal-over.gif");
		preloadFlag = true;
	}
}

//--------------------- expirenew ---------------------------
// used to display new flashing Gif
function expirenew(when) {
	var image = "http://www.mtn-hiker.ca/images/newf.gif";
	when = new Date(when);
	today = new Date();
	if (when.getTime() > today.getTime()) {
	document.write("<img src="+image+" width='35' height='20' alt='New'>");
	}
}
// ------------------------ Quicklinks go ------------------------
// original code by Bill Trefzger 12/12/96
function go1(){
if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") {
location = document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value
		}
	}
// ---------------------------- Quicklinks ---------------------------
function quicklinks(){
var relLink = "http://www.mtn-hiker.ca/"
document.write("<div style='position: absolute; top: 30px; Left: 650px;'>");
document.write("<form name='selecter1'><select name='select1' size=1 onchange='go1()'>");
document.write("<option value=none>Quick Links");
document.write("<option value='"+relLink+"index.html'>Home");
document.write("<option value='"+relLink+"Sitemap.html'>Site Map");
document.write("<option value='"+relLink+"hiking/hiking.html'>Hiking");
document.write("<option value='"+relLink+"hiking/past-hiking.html'>--Past Hiking");
document.write("<option value='"+relLink+"hiking/weekend.html'>--This Weekend");
document.write("<option value='"+relLink+"hiking/future-hiking.html'>--Future Hiking");
document.write("<option value='"+relLink+"hiking/links.html'>--Hiking Links");
document.write("<option value='"+relLink+"gallery/gallery.html'>Gallery");
document.write("<option value='"+relLink+"IceMagic/index.html'>Ice Magic");
document.write("<option value='"+relLink+"panorama/panoramas.html'>Panoramas");
document.write("<option value='"+relLink+"MapTour/index.html'>Map Tour");
document.write("<option value='"+relLink+"legal/contact.html'>Contact Me");
document.write("<option value='"+relLink+"times/times.html'>Treader Times");
document.write("<option value='"+relLink+"legal/legal.html'>Legal Stuff");
document.write("</select>");
document.write("</form>");	
}
