<!---
/*
	THIS DOCUMENT COMPILED AND (EDITED OR CREATED) BY MICHAEL TAYLOR  -  michaeljohntaylor@msn.com 
	You're welcome to use this file freely, but please, please , please keep these headers intact for support reasons
*/

ie4up = false;
ns4up = false;
ns6up = false;

switch( navigator.appName.toLowerCase() ) {
	case "microsoft internet explorer" :
		if( parseInt(navigator.appVersion) == 4 ) ie4up = true;
		break;
	case "netscape" :
		if( parseInt(navigator.appVersion) == 4 ) ns4up = true;
		else if( parseInt(navigator.appVersion) == 5 ) ns6up = true;
		break;
}

wh = 0;
ww = 0;

function globalInit() {
	if( ie4up ) {
		doc = 'document.all';
		sty = '.style';
		idHolderLeft = '["';
		idHolderRight = '"]';
		wh = document.body.clientHeight;
		ww = document.body.clientWidth;
		vVis = "visible"; // value for setting visibility to visible 
		hVis = "hidden"; // value for setting visibility to hidden 
	}
	else if( ns4up ) {
		doc = 'document';
		sty = '';
		idHolderLeft = '.';
		idHolderRight = '';
		wh = innerHeight;
		ww = innerWidth;
		vVis = "show"; // value for setting visibility to visible 
		hVis = "hide"; // value for setting visibility to hidden 
	}
	else if( ns6up ) {
		doc = 'document.getElementById';
		sty = '.style';
		idHolderLeft = '("';
		idHolderRight = '")';
		wh = innerHeight;
		ww = innerWidth;
		vVis = "show"; // value for setting visibility to visible 
		hVis = "hide"; // value for setting visibility to hidden 
	}
}

function setMousePosNS(e) {
	xPos = e.pageX;
	yPos = e.pageY;
}
function setMousePosIE() {
	xPos = window.event.x + document.body.scrollLeft;
	yPos = window.event.y + document.body.scrollTop;
}
function setZIndex( theID , indexVal ) {
	var theDiv = eval(doc + idHolderLeft + theID + idHolderRight + sty);
	theDiv.zIndex = indexVal;
}
function showDiv() {

	/*
	Created by Michael Taylor 
	This function receives a variable number of DIV id's 
	and sets their visibility to visible 
	*/

	for( x=0 ; x<showDiv.arguments.length ; x++ ) {
		if( showDiv.arguments[x] == "jumpUp" ) {
			var theDiv = eval(doc + idHolderLeft + showDiv.arguments[x-1] + idHolderRight);
			theDiv.scrollIntoView();
		}
		else if( showDiv.arguments[x] != "" ) {
			var theDiv = eval(doc + idHolderLeft + showDiv.arguments[x] + idHolderRight + sty);
			theDiv.visibility = vVis;
		}
	}
}
function hideDiv() {

	/*
	Created by Michael Taylor 
	This function receives a variable number of DIV id's 
	and sets their visibility to hidden 
	*/

	for( x=0 ; x<hideDiv.arguments.length ; x++ ) {
		if( hideDiv.arguments[x] != "" ) {
			var theDiv = eval(doc + idHolderLeft + hideDiv.arguments[x] + idHolderRight + sty);
			theDiv.visibility = hVis;
		}
	}
}

function followMouse( theID , axis , xDiff , yDiff , delay , screenRelativePos ) {

	/*
	Created by Michael Taylor 
	This function moves the given DIV 
	according to the properties supplied
	*/

	if( ie4up ) {
		setMousePosIE();
	}
	if( ns4up ) {
		setMousePosNS();
	}
	if( isNaN(xDiff) && isNaN(yDiff) ) {
		xDiff = 0;
		yDiff = 0;
	}
	if( delay < 10 && delay > 0 ) {
		delay *= 100;
	}
	else delay = 0;
	eval('following' + theID + 'Div = eval(doc + \'["\' + theID + \'"]\' + sty);');
	switch( axis ) {
		case "x": // move along the x axis only 
			setTimeout("following" + theID + "Div.left = " + (xPos + xDiff) + ";", delay);
			if( screenRelativePos != null && !isNaN(screenRelativePos) )
				setTimeout("following" + theID + "Div.top = " + (screenRelativePos + document.body.scrollTop) + ";", delay);
			break;
		case "y": // move along the y axis only 
			setTimeout("following" + theID + "Div.top = " + (yPos + yDiff) + ";", delay);
			break;
		case "xy": // move along the x and y axes 
			setTimeout("following" + theID + "Div.left = " + (xPos + xDiff) + ";", delay);
			setTimeout("following" + theID + "Div.top = " + (yPos + yDiff) + ";", delay);
			break;
	}
}


function scrollDiv( theID , chunkSize , increment , direction ) {

	/*
	Written by Michael Taylor - 2000-05 
	This function displays a layer gradually, 
	allowing the developer to set the direction 
	and speed the layer will be displayed in. 
	*/

	var chunk = chunkSize;
	switch( direction ) {
		case "n-s": // direction is north to south 
			EndNum = 100;
			var dir = "rect(0 100% " + chunk + "% 0)";
			break;
		case "nw-se": // direction is north-west to south-east 
			EndNum = 100;
			var dir = "rect(0 " + chunk + "% " + chunk + "% 0)";
			break;
		case "w-e": // direction is west to east 
			EndNum = 100;
			var dir = "rect(0 " + chunk + "% 100% 0)";
			break;
		case "sw-ne": // direction is south-west to north-east 
			EndNum = 100;
			var dir = "rect(" + (100 - chunk) + "% " + chunk + "% 100% 0)";
			break;
		case "s-n": // direction is south  to north 
			EndNum = 100;
			var dir = "rect(" + (100 - chunk) + " 100% 100% 0)";
			break;
		case "se-nw": // direction is south-east to north-west 
			EndNum = 100;
			var dir = "rect(" + (100 - chunk) + "% 100% 100% " + (100 - chunk) + "%)";
			break;
		case "e-w": // direction is east to west 
			EndNum = 100;
			var dir = "rect(0 100% 100% " + (100 - chunk) + "%)";
			break;
		case "ne-sw": // direction is north-east to south-west 
			EndNum = 100;
			var dir = "rect(0 100% " + chunk + "% " + (100 - chunk) + "%)";
			break;
		case "centerOutV": // direction is from the center outwards vertically 
			EndNum = 50;
			var dir = "rect(" + (50 - chunk) + "% 100% " + (50 + chunk) + "% 0)";
			break;
		case "centerOutH": // direction is from the center outwards horizontally 
			EndNum = 50;
			var dir = "rect(0 " + (50 + chunk) + "% 100% " + (50 - chunk) + "%)";
			break;
	}
	var theDiv = eval(doc + idHolderLeft + theID + idHolderRight + sty);
	theDiv.visibility = vVis;
	theDiv.clip = dir;
	chunk += increment;
	if( chunk <= EndNum ) {
		eval('gradual' + theID + ' = setTimeout("scrollDiv( \'" + theID + "\' , " + chunk + " , " + increment + " , \'" + direction + "\' )", 1)');
	}
	else {
		clearTimeout(eval('gradual' + theID));
	}
}


function nudgeDiv( theID , nudgeX , nudgeY ) {
	/*
	Created by Michael Taylor - 2001-12-12 
	This function receives the name of a DIV,
	the horizontal pixel value and the vertical 
	pixel value to nudge the div by when the 
	cursor keys are used.
	*/
	code = window.event.keyCode;
	switch( code ) {
		case 37:
			// key = "left";
			var change = "left";
			var nudge = nudgeX;
			var dir = "-";
			break;
		case 38:
			// key = "up";
			var change = "top";
			var nudge = nudgeY;
			var dir = "-";
			break;
		case 39:
			// key = "right";
			var change = "left";
			var nudge = nudgeX;
			var dir = "+";
			break;
		case 40:
			// key = "down";
			var change = "top";
			var nudge = nudgeY;
			var dir = "+";
			break;
	}
	if( code == 37 || code == 38 || code == 39 || code == 40 ) {
		var MovingDIV = eval(doc + idHolderLeft + theID + idHolderRight + sty);
		eval('MovingDIV.' + change + ' = parseInt(MovingDIV.' + change + ') ' + dir + ' ' + nudge);
	}
}


function fadeDiv( theID , speed , from , to ) {

	/*
	This function created by Michael Taylor  -  2001-12-04 
	receives a DIV id, fading speed (from 0 to 100), 
	from number and to number (from 0 to 100) 
	
	To call the function, use the following examples in a mouseover or click event: 
	fadeDiv( 'div1' , 5 , 0 , 100 ) --- This will fade div1 in increments of 0.05 starting at 0.00 and ending at 1.00 
	
	This function requires Internet Explorer 5 and up 
	*/

	var thisDiv = eval( doc + idHolderLeft + theID + idHolderRight + sty );
	if( from != to ) {
		if( from < to ) {
			from += speed;
		}
		else {
			from -= speed;
		}
		thisDiv.filter = "progid:DXImageTransform.Microsoft.BasicImage( Opacity=" + (from/100) + " )";
		eval('Faded' + theID + ' = setTimeout("fadeDiv( \'" + theID + "\' , " + speed + " , " + from + ", " + to + " )", 10)');
	}
	else {
		clearTimeout(eval('Faded' + theID));
	}
}


function blurDiv( theID , speed , from , to ) {

	/*
	This function created by Michael Taylor  -  2001-12-04 
	receives a DIV id, bluring speed (from 0 to 100), 
	from number and to number (from 0 to 100) 
	
	To call the function, use the following examples in a mouseover or click event: 
	blurDiv( 'div1' , 5 , 0 , 100 ) --- This will blur div1 in increments of 5 starting at 0 and ending at 100 
	
	This function requires Internet Explorer 5 and up 
	*/

	var thisDiv = eval( doc + idHolderLeft + theID + idHolderRight + sty );
	if( from != to ) {
		if( from < to ) {
			from += speed;
		}
		else {
			from -= speed;
		}
		thisDiv.filter = "progid:DXImageTransform.Microsoft.Blur( PixelRadius=" + from + " )";
		eval('Blurred' + theID + ' = setTimeout("blurDiv( \'" + theID + "\' , " + speed + " , " + from + ", " + to + " )", 10)');
	}
	else {
		clearTimeout(eval('Blurred' + theID));
	}
}

function moveDiv( theID , speed , startX , startY , endX , endY , isFirstTime ) {

	/*
	This function created by Michael Taylor  -  2001-11-26 
	receives a DIV id, movement speed (measured in pixels) 
	and X and Y values for moving the DIV from one position 
	on the screen to another position. 
	
	To call the function, use the following examples in a mouseover or click event: 
	moveDiv( 'div1' , 5 , 600 , 300 , 200 , 300 ) --- This will move div1 from X position 600px to 200px 
	moveDiv( 'div1' , 5 , 0 , 300 , 500 , 300 ) --- This will move div1 from X position 0px to 500px 
	*/

	var thisDiv = eval( doc + idHolderLeft + theID + idHolderRight + sty );
	if( isNaN(startX) ) {
		startX = 5 - parseInt(thisDiv.width);
		endX = 5;
	}
	if( isNaN(startY) ) {
		startY = 5 - parseInt(thisDiv.height);
		endY = 5;
	}
	if( isNaN(isFirstTime) ) {
		thisDiv.left = startX;
		thisDiv.top = startY;
	}
	thisDiv.visibility = vVis;
	if( startX < endX || startY < endY ) {
		if( parseInt(thisDiv.left) < endX || parseInt(thisDiv.top) < endY ) {
			if( startX < endX ) {
				thisDiv.left = parseInt( thisDiv.left ) + speed;
			}
			if( startY < endY ) {
				thisDiv.top = parseInt( thisDiv.top ) + speed;
			}
			if( startX > endX ) {
				thisDiv.left = parseInt( thisDiv.left ) - speed;
			}
			if( startY > endY ) {
				thisDiv.top = parseInt( thisDiv.top ) - speed;
			}
			eval('Moved' + theID + ' = setTimeout("moveDiv( \'" + theID + "\' , " + speed + " , " + startX + ", " + startY + ", " + endX + ", " + endY + ", 0 )", 10)');
		}
		else {
			clearTimeout(eval('Moved' + theID));
		}
	}
	else if( startX == endX && startY == endY ) {
			thisDiv.left = parseInt( startX );
			thisDiv.top = parseInt( startY );
			eval('Moved' + theID + ' = null;');
	}
	else {
		if( parseInt(thisDiv.left) > endX || parseInt(thisDiv.top) > endY ) {
			if( startX < endX ) {
				thisDiv.left = parseInt( thisDiv.left ) + speed;
			}
			if( startY < endY ) {
				thisDiv.top = parseInt( thisDiv.top ) + speed;
			}
			if( startX > endX ) {
				thisDiv.left = parseInt( thisDiv.left ) - speed;
			}
			if( startY > endY ) {
				thisDiv.top = parseInt( thisDiv.top ) - speed;
			}
			eval('Moved' + theID + ' = setTimeout("moveDiv( \'" + theID + "\' , " + speed + " , " + startX + ", " + startY + ", " + endX + ", " + endY + ", 0 )", 10)');
		}
		else {
			clearTimeout(eval('Moved' + theID));
		}
	}
}

nextPic = 0;
function pictureViewer( interval ) { // interval is measured in milliseconds 

	/*
	Created by Michael Taylor 
	This function receives an interval and 
	a variable number of image filenames. 
	It then creates a slideshow of these 
	images in the browser 
	*/

	if( pictureViewer.arguments.length > 1 ) {
		var argumentList = '';
		for( x = 1 ; x<pictureViewer.arguments.length ; x++ ) {
			argumentList += '"' + pictureViewer.arguments[x] + '"';
			if( x < pictureViewer.arguments.length - 1 ) {
				argumentList += ',';
			}
		}
		if( nextPic == 0 ) {
			document.write('<img name="scrollPic" src="' + pictureViewer.arguments[1] + '" border="0">');
			nextPic = 2;
		}
		else {
			document.scrollPic.src = pictureViewer.arguments[nextPic];
			nextPic += 1;
		}
		if( nextPic == ( pictureViewer.arguments.length ) ) {
			nextPic = 1;
		}
		scrollPicTimer = setTimeout('pictureViewer( ' + interval + ',' + argumentList + ' )', interval);
	}
}
function endPictureViewer() {
	clearTimeout(scrollPicTimer);
}
// --->

