// =========================================================================
// =========================== browser object ==============================
// =========================================================================

//Fade-in image slideshow- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var slideshow_width='225px' //SET IMAGE WIDTH
var slideshow_height='178px' //SET IMAGE HEIGHT
var slideshow_eat_height='178px' //SET IMAGE HEIGHT
var pause=3000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)

var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]="photo1medium.jpg"
fadeimages[1]="photo2medium.jpg"
fadeimages[2]="photo3medium.jpg"
fadeimages[3]="photo4medium.jpg"
fadeimages[4]="photo5medium.jpg"
fadeimages[5]="photo6medium.jpg"
fadeimages[6]="photo7medium.jpg"
fadeimages[7]="photo8medium.jpg"
fadeimages[8]="photo9medium.jpg"

////NO need to edit beyond here/////////////

var ie4=document.all
var dom=document.getElementById

var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1

var currentImageIndex = 0;
var currentOpacity = 0;
var fadeTimer = null;
var currentZIndex = 0;


function Browser () {
	this.mac = navigator.platform == "MacPPC";
	
	this.dom = document.getElementById ? 1 : 0;

	this.mo5 = document.getElementById && !document.all ? 1 : 0;
	this.ns4 = document.layers ? 1 : 0;
	
	this.op5=(navigator.userAgent.indexOf("Opera 5")>-1)?1:0;
	this.op6=(navigator.userAgent.indexOf("Opera 6")>-1)?1:0;

	this.ie  = document.all ? 1 : 0;
	
	this.ie4=(document.all && !document.getElementById && !(this.op5 || this.op6))?1:0;
	this.ie5=(navigator.appVersion.indexOf("MSIE 5.0")>-1 && document.getElementById && !(this.op5 || this.op6))?1:0;
	this.ie55=(navigator.appVersion.indexOf("MSIE 5.5")>-1 && document.getElementById && !(this.op5 || this.op6))?1:0;
	this.ie6= (navigator.appVersion.indexOf("MSIE 6")>-1 && document.getElementById && !(this.op5 || this.op6))?1:0;
}

/*-----------------------------------------------------------------
basic layer object
	- basically everything extends this ... 
-----------------------------------------------------------------*/
function o_show () {
	if (bw.ns4)
		this.style.visibility = "show";
	else
		this.style.visibility = "visible";
}

function o_hide () {
	if (bw.ns4) 
		this.style.visibility = "hide";
	else
		this.style.visibility = "hidden";
}

function o_setZIndexTo (newIndex) {
	this.style.zIndex=newIndex;
}

function o_moveTo (x,y) {
	this.style.left = this.x = x;
	this.style.top = this.y = y;
}

function o_setClipRect (cTop, cRight, cBottom, cLeft) {
	this.t = cTop;
	this.r = cRight;
	this.b = cBottom;
	this.l = cLeft;
	
	if (!bw.ns4) {
		// "rect()" - must not have a space between rect and (
		// rect(top right bottom left)
		this.style.clip = "rect("+parseInt(cTop)+"px "+parseInt(cRight)+"px "+parseInt(cBottom)+"px "+parseInt(cLeft)+"px)";
	} else {
		this.style.clip.top = this.y + cTop;
		this.style.clip.bottom = cBottom;
		this.style.left = this.x + cLeft;
		this.style.clip.right =cRight;		
	}
}



function MoveableLayer (layerPath, x, y) {
	this.x = 0;
	this.y = 0;
	this.layerName = getLayerNameFromPath (layerPath);
	this.timerObject = this.layerName + "Object";
	this.timer = 0;
	eval(this.timerObject + "=this");
	
	var layer = getLayerFromPath (layerPath);
	if (!layer)
		alert ("Layer not found: "+layerPath);
	if (bw.ns4) {
		this.element = this.style = layer;
    } else {
		this.element = layer;
		this.style = layer.style;
   	} 
	
	// methods
	this.setClipRect = o_setClipRect;
	this.moveTo = o_moveTo;
	this.hide = o_hide;
	this.show = o_show;
	this.setZIndexTo = o_setZIndexTo;
	
	if (bw.ns4) {
		x=x==undefined?this.element.left:x;
		y=y==undefined?this.element.top:y;
	} else {
		x=x==null?this.element.offsetLeft:x;
		y=y==null?this.element.offsetTop:y;
	}
	
	this.moveTo (x, y);
}

function getLayerFromPath (layerPath) {
	var layerArray = layerPath.split(".");
	var layerName = layerArray[layerArray.length-1];	
	
	if (bw.ns4) {
		var eval_str='';
		for (var i=0; i<layerArray.length; i++)
			eval_str+=(i?'.':'')+'document.layers.'+layerArray[i];
		return eval(eval_str);
    } else if (bw.dom) {
		return document.getElementById (layerName);
   	} else {
		return document.all[layerName];
	}
}




function getLayerNameFromPath (layerPath) {
	var layerArray=layerPath.split(".");
	return layerArray[layerArray.length-1];
}

var bw = new Browser ();

function onLoad () {
	//oRollOver0 = new MoveableLayer ("dRollOver0", null, null);
	//oRollOver1 = new MoveableLayer ("dRollOver1", null, null);
	//oRollOver2 = new MoveableLayer ("dRollOver2", null, null);
	//oRollOver3 = new MoveableLayer ("dRollOver3", null, null);
	//oRollOver4 = new MoveableLayer ("dRollOver4", null, null);
	//oRollOver5 = new MoveableLayer ("dRollOver5", null, null);
	//oRollOver6 = new MoveableLayer ("dRollOver6", null, null);
	//oRollOver7 = new MoveableLayer ("dRollOver7", null, null);
	//oRollOver8 = new MoveableLayer ("dRollOver8", null, null);
	//oRollOver9 = new MoveableLayer ("dRollOver9", null, null);		
	//ointro = new MoveableLayer ("intro", null, null);		
}


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) {
		preloadFlag = true;
	}
	rotateImage ();
}

function fadeImage () {
	if (currentOpacity<100) {
		currentOpacity+=10
		if (tempobj.filters)
			tempobj.filters.alpha.opacity=currentOpacity
		else if (tempobj.style.MozOpacity)
			tempobj.style.MozOpacity=currentOpacity/100
		fadeTimer = setTimeout("fadeImage()",50);
	}
}

function rotateImage () {
	if(currentImageIndex<fadeimages.length-1)
		currentImageIndex++;
	else	
		currentImageIndex=0;
	loadImage (currentImageIndex);
	rotateTimer = setTimeout("rotateImage()",pause);
}

function pauseRotate () {
	clearTimeout (rotateTimer);
}