//simple browser detect
DOM = (document.getElementById) ? true : false;
NS4 = (document.layers) ? true : false;
IE = (document.all) ? true : false;
IE4 = IE && !DOM;
NS = (navigator.appName=="Netscape") ? true : false;
NS6 = NS && DOM;
MAC = (navigator.appVersion.indexOf("Mac") != -1);
//preload images for rollovers 
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj + 'On = new Image()')
		eval(imgObj + 'On.src = imgSrc + "_over.gif"')
		eval(imgObj + 'Off = new Image()')
		eval(imgObj + 'Off.src = imgSrc + "_off.gif"')
	}
}
//img rollover
function img_act(imgName) {
	if (document.images) {
		document[imgName].src = eval(imgName + "On.src");
	}
}
//img rollout
function img_inact(imgName) {
	if (document.images) {
		document[imgName].src = eval(imgName + "Off.src");
	}
}
//form button rollover
function butt_act(imgName, obj) {
	obj.src = eval(imgName + "On.src");
}
//form button rollout
function butt_inact(imgName, obj) {
	obj.src = eval(imgName + "Off.src");
}
//multi img rollover
function changeImages() {
	if (document.images) {
    	for (var i=0; i<changeImages.arguments.length; i+=2) {
      		document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    		}
		}
}
//popup window
function openWindow(windowURL,windowName,windowWidth,windowHeight,scroll,center) {
	newWindow = window.open(windowURL,windowName,'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollbars='+scroll+',resizable=0');
	newWindow.focus(); 
   if (center) {
      newWindow.moveTo((screen.width-windowWidth)/2,(screen.height-windowHeight)/2)
   }
}
//change css style
function changeStyle(id,styleSelector,value){
	eval("document.getElementById(id).style."+styleSelector+"='"+value+"';");
}
//show element
function showElement(id) {
	document.getElementById(id).style.display = "block";
}
//hide element
function hideElement(id) {
   document.getElementById(id).style.display = "none";
}
//change element class
function changeCss(id,theClass) {
	document.getElementById(id).className = theClass;
}
//select box navigation jump
function navChange(obj) {
   if (obj.value != "") {
      location.href = obj.value;
   }
}
//checks form field for default value and remove it
function checkText(obj,txt) {
   if (obj.value == txt) {
      obj.value = "";
   }
}
//text area max length
function textCounter(field, countfield, maxlimit) {
   if (field.value.length > maxlimit) {
      // if too long...trim it!
      field.value = field.value.substring(0, maxlimit);
   } else {
      // otherwise, update 'characters left' counter
      countfield.value = maxlimit - field.value.length;
   }
}
//email spam script
function nospam(user,domain) {
   locationstring = "mailto:" + user + "@" + domain;
   window.location = locationstring;
}
//grab browser width
function getBrowserWidth(){
    if (window.innerWidth){
        return window.innerWidth;}  
    else if (document.documentElement && document.documentElement.clientWidth != 0){
        return document.documentElement.clientWidth;    }
    else if (document.body){return document.body.clientWidth;}      
        return 0;
}
//grab browser height
function getBrowserHeight(){
    if (window.innerHeight){
        return window.innerHeight;}  
    else if (document.documentElement && document.documentElement.clientHeight != 0){
        return document.documentElement.clientHeight;    }
    else if (document.body){return document.body.clientHeight;}      
        return 0;
}
// JavaScript Document
function getParam(paramName) 
{
	var sURL = window.document.URL.toString();
	var strReturn = null;
	if (sURL.indexOf("?") > 0)
	{
		var arrParams = sURL.split("?");
			
		var arrURLParams = arrParams[1].split("&");
		
		var arrParamNames = new Array(arrURLParams.length);
		var arrParamValues = new Array(arrURLParams.length);
		
		var i = 0;
		for (i=0;i<arrURLParams.length;i++)
		{
			var sParam =  arrURLParams[i].split("=");
			arrParamNames[i] = sParam[0];
			if (sParam[1] != "")
				arrParamValues[i] = unescape(sParam[1]);
			else
				arrParamValues[i] = "No Value";
		}
		
		for (i=0;i<arrURLParams.length;i++)
		{
			if(arrParamNames[i] == paramName){
				strReturn = arrParamValues[i];
				break;
			}
		}
	}
	return strReturn;
}
function goBack() {
   var thankyou = getParam("thankyou");
   if (thankyou == "true") {
      history.go(-1);
   }
}
var thankyou = getParam("thankyou");

