
//script for loading & rotating images
//ShowImg()    Shows a random image each time the page is loaded.
//RotateImg()  Rotates the image shown on the page.
//Using ShowImg()
//Add the following line to your page where you want the image to appear.
//< script language="javascript">ShowImg('myImage');</script> 
//
//Alternatively, call the ShowImage() function from any event in any HTML tag.
//
//Using RotateImg()
//Simply call the function from the onload event in your document's < body > tag 
//after adding the following line where you want the images to display:
//< img name="myImage" src="" border="0" >
//example <body onload="RotateImg('myImage')" >

var images = new Array();

images[0] = "images/image1.gif"; 
images[1] = "images/image2.gif";
images[2] = "images/image3.gif";
images[3] = "images/image3.gif"; 
images[4] = "images/image4.gif";
images[5] = "images/image5.gif";
images[6] = "images/image6.gif"; 
images[7] = "images/image7.gif";
images[8] = "images/image8.gif";


function ShowImg() {
var number = images.length;
var increment = Math.floor(Math.random() * number);
var strTemp ='<img src="' + images[increment] + '">';
document.write(strTemp);
}

var rotate = 5000; 
var count = 0;

function RotateImg(myImage){
 myImage.src=images[count];
 count++;
 if(count==images.length){count = 0;}
 setTimeout("RotateImg(myImage)",rotate);
} 

//script for time & date - this is the tag to use in the html //
//<form name="clock" onSubmit="0">
//<input type="text" name="face" size=20 value="">
//</form>
//Also add <body onload="startclock()" >


var timerID = null;
var timerRunning = false;
function stopclock (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}

function startclock () {
        stopclock();
        showtime();
}

function showtime () {
        
var today = new Date()
var month = today.getMonth() + 1
var day = today.getDate()
var year = today.getFullYear()
var s = "/"
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.clock.face.value = timeValue + "-" +day + s + month + s + year;
timerID = setTimeout("showtime()",1000);
 timerRunning = true;
}






String.prototype.trim = function () {
	return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function validateEmail(theAddress) {
	theAddress = theAddress.trim();
	result = "OK";
    emailFilter = /^.+@.+\.[^\.]{2,}$/;
    illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/;
	if (theAddress.length == 0) {
		result = "EMPTY";
	} else if (!emailFilter.test(theAddress) || theAddress.match(illegalChars)) {
		result = "BAD";
	}
	return result;
}

function validateCreditCard(theNumber) {
	theNumber = theNumber.trim();
	theNumber = theNumber.replace(/[^0-9]*/g, "");
	result = "OK";
	if (theNumber.length == 0) {
		result = "EMPTY";
	} else if (theNumber.length < 13) {
		// See: http://www.eway.com.au/support/ccprefixlength.asp
		result = "BAD";
	}
	return result;
}

function validateString(theString) {
	theString = theString.trim();
	result = "OK";
	if (theString.length == 0) {
		result = "EMPTY";
	}
	return result;
}

function printContactusEmail() {
	// See: http://www.u.arizona.edu/~trw/spam/spam.htm
}

function setBodyHeight() {
	navHeight = xHeight('leftnav');
	bodyHeight = xHeight('bodytext');
	if (navHeight > bodyHeight) xHeight('bodytext', navHeight + 25);
}

function suckerfish(type, tag, parentId) {
	// See: http://www.htmldog.com/articles/suckerfish/shoal/
	if (window.attachEvent) {
		window.attachEvent("onload", function() {
			var sfEls = (parentId==null) ? document.getElementsByTagName(tag) : document.getElementById(parentId).getElementsByTagName(tag);
			type(sfEls);
		}
		);
	}
}

sfHover = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

sfFocus = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}

sfActive = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmousedown=function() {
			this.className+=" sfactive";
		}
		sfEls[i].onmouseup=function() {
			this.className=this.className.replace(new RegExp(" sfactive\\b"), "");
		}
	}
}

sfTarget = function(sfEls) {
	var aEls = document.getElementsByTagName("A");
	document.lastTarget = null;
	for (var i=0; i<sfEls.length; i++) {
		if (sfEls[i].id) {
			if (location.hash==("#" + sfEls[i].id)) {
				sfEls[i].className+=" sftarget";
				document.lastTarget=sfEls[i];
			}
			for (var j=0; j<aEls.length; j++) {
				if (aEls[j].hash==("#" + sfEls[i].id)) aEls[j].targetEl = sfEls[i];
				aEls[j].onclick = function() {
					if (document.lastTarget) document.lastTarget.className = document.lastTarget.className.replace(new RegExp(" sftarget\\b"), "");
					if (this.targetEl) this.targetEl.className+=" sftarget";
					document.lastTarget=this.targetEl; return true;
				}
			}
		}
	}
}

//xAddEventListener(window, "error", handle_error, false);
//function handle_error() {
//	return true;
//}

xAddEventListener(window, "load", handle_load, false);
function handle_load() {
	setBodyHeight();
	return true;
}

suckerfish(sfFocus, "INPUT"); suckerfish(sfFocus, "TEXTAREA");

