/****************************************************
*			    	General Routines
*             ==================
*            (c) Adrian Jones, woodsgood.ca
*****************************************************/

MM_preloadImages("images/bg0","images/bg1","images/bg2","images/bg3","images/bg4","images/bg5","images/bg6");
MM_preloadImages("images/nav0","images/nav1","images/nav2","images/nav3","images/nav4","images/nav5","images/nav6");

function bgChange(ref, bg) {	name="c"+ref+"";	rCell = getObject(name);	rCell.style.background="url(images/" + bg + ")";}

// returns the "name" Object
function getObject(name) {return (document.getElementById?document.getElementById(name):document.all?document.all[name]:document.layers?eval("document.layers[\"" + name + "\"]"):null); }

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/* ***************************************************/

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// ==============================================================
// Script:     Auto-Sizing Image Popup Window
// 
// Functions:  Use this script to launch a popup window that
//             automatically loads an image and resizes itself
//             to fit neatly around that image. The script also
//             places a title you set in the titlebar of the 
//             popup window. Any number of images can be launched
//             from a single instance of the script.
//             
// Browsers:   NS6-7 & IE4 and later
//             [Degrades functionally in NS4]
// 
// Author:     etLux
// ==============================================================

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set autoclose true to have the window close automatically, false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isOP=(navigator.appName=="Opera")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
}

function popImage(imageURL,imageTitle,w,h){
	var opt='scrollbars=no,menubar=no,toolbar=no,resizable=no,width='+(w+60)+',height='+(h+60)+',left='+PositionX+',top='+PositionY+'';
	if (isIE) opt='scrollbars=no,menubar=no,toolbar=no,resizable=no,width='+(w+66)+',height='+(h+70)+',left='+PositionX+',top='+PositionY+'';
	imgWin=window.open('about:blank','n',opt);
	with (imgWin.document){
		var msg = '<html><head><title>'+imageTitle+'</title><meta http-equiv="Content-Style-Type" content="text/css">';
		msg +=('<style type="text/css">#thephoto {visibility:hidden} #photoholder {background:transparent url(\'images/loading.gif\') 50% 50% no-repeat;}.tit {font-weight:bold;font-family:"Trebuchet MS",sans-serif;font-size:10pt;text-align:center;}</style>');

msg += ('<script type="text/Javascript">function initImage() {imageId="thephoto";image=getObject(imageId);image.style.visibility="visible";setOpacity(image,0);fadeIn(imageId,0);} function fadeIn(objId,opacity) {obj = getObject(objId);if (opacity <= 100) {setOpacity(obj, opacity);opacity += 10;window.setTimeout("fadeIn(\'"+objId+"\',"+opacity+")", 50);}} function setOpacity(obj, opacity) { opacity = (opacity == 100)?99.999:opacity; obj.style.filter = "alpha(opacity:"+opacity+")"; obj.style.KHTMLOpacity = opacity/100; obj.style.MozOpacity = opacity/100; obj.style.opacity = opacity/100;}function getObject(obj) {var theObj;if(document.all) {if(typeof obj=="string") { return document.all(obj);} else {return obj.style;}} if(document.getElementById) {if(typeof obj=="string") {return document.getElementById(obj); } else {return obj.style;}} return null; }</script>');
		msg +=('</head><body style="background-image:url(\'images/bg.jpg\');" bgcolor="#ffffff" scroll="no" onload="self.focus();initImage();')
		msg += (!AutoClose)?'">':'" onblur="self.close()">';
	   msg +=('<table align="center" cellpadding="4" cellspacing="1" border="0" bgcolor="#888888" style="margin-top:5px;"><tr><td valign="middle" bgcolor="#555555" align="center"><table cellpadding="2" cellspacing="2" border="3" width="100%"><tr><td valign="top" align="center" bgcolor="#ffffff">');
	   msg +=('<div id="photoholder"><img alt="photo" name="thephoto" src="'+imageURL+'" style="display:block" id="thephoto"></div>');
      msg +=('</td></tr></table></td></tr></table><div class="tit">'+imageTitle+'</div>');
      msg +=('</body></html>');
      writeln (msg);
	   close();
	   }
}

function initImage() {
	imageId='thephoto';
	image = getObject(imageId);
	image.style.visibility="visible";
	setOpacity(image,0);
	fadeIn(imageId,0);
}

function fadeIn(objId,opacity) {
	obj = getObject(objId);
	if (opacity <= 100) {
		setOpacity(obj, opacity);
		opacity += 10;
		window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 50);
	}
}

function setOpacity(obj, opacity) {
	if(isIE) opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	if(isIE) obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	if(isNN) obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	if(isNN) obj.style.opacity = opacity/100;
}

// fades colour (rgb) of object (o) to (enl) at speed (s)
function KW_fade(r,g,b,e,n,l,s,o){ for(i=0;i<s+1;i++) setTimeout("KW_s("+KW_c(r,e,s,i)+","+KW_c(g,n,s,i)+","+KW_c(b,l,s,i)+",'"+o+"');",i*s);}
function KW_s(r, g, b, el)	{ getObject(el).style.color="rgb("+r+","+g+","+b+")";}
function KW_c(a,b,s,i) 		{ return Math.floor(a+(b-a)*(i/s));}


//***************************

