// JavaScript Document

is = new browserCheck();

function browserCheck() {
	this.ns4 = (document.layers)? true:false;
	this.ie = (document.all&&(!window.opera))? true:false;
	this.dom = (document.getElementById)? true:false;
	this.ns6 = (window.sidebar)? true:false;
	this.moz = (window.sidebar||navigator.userAgent.indexOf('Gecko')!=-1)? true:false;
	this.opera = (window.opera)? true:false;
	this.mac = (navigator.userAgent.indexOf('Mac')!=-1)? true:false;
}

// hover styles by suckerfish
/*function sfHover() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	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"), "");
		}
	}
	
	var sfEls = document.getElementById("homeContent").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" navhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" navhover\\b"), "");
		}
	}
}

if (document.all) { //MS IE
	if (window.attachEvent) {
		window.attachEvent("onload", sfHover);
	}else{ //IE 5.2 Mac does not support attachEvent
		var old = window.onload;
		window.onload = function() { 
			sfHover(); 
		}
	}
}*/

function getObjectName(nameOfObject){

	Obj = null;

	if (is.ie) Obj = document.all[nameOfObject];
	else if (is.dom) Obj = document.getElementById(nameOfObject);
	else if (is.ns4) findLayer(window,nameOfObject);

	if (!Obj || ( is.ns4 && Obj == window ) ) Obj = "Object not found"
	
	return Obj;
}

function getObjectStyle(nameOfObject){
	Obj = null;
	
	if (is.ie) Obj = document.all[nameOfObject].style;
	else if (is.dom) Obj = document.getElementById(nameOfObject).style;
	else if (is.ns4) findLayer(window,nameOfObject);
	
	return Obj;
}

function validateContact(){
	f = document.forms.contactform;
	curObj = getObjectName('formError');
	if(f.firstname.value=="" || f.lastname.value=="" || f.emailaddress.value==""){
		curObj.innerHTML='<strong>ERROR</strong><br/>To help us contact you we need at least your firstname, last name and email address.';
	}else{
		curObj.innerHTML='&nbsp;';
		f.submit();
	}
	
}