//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 = "";
   }
}
//checks form field for "" else add back default value
function checkDefault(obj,txt) {
   if (obj.value == "") {
      obj.value = txt;
   }
}
//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;
   }
}
//string trim functions
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
//email spam script
function nospam(user,domain) {
   locationstring = "mailto:" + user + "@" + domain;
   window.location = locationstring;
}
//flash external interface
function thisMovie(movieName) {
   if (navigator.appName.indexOf("Microsoft") != -1) {
      return window[movieName]
   } else {
      return document[movieName]
   }
}

/*
//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;
}
sWidth = "100%";
sHeight = "100%";
if (getBrowserWidth() < 1024) {
   sWidth = "950";
}
if (getBrowserHeight() < 768) {
   sHeight = "570";
}
*/
function resetForm(myform){
      document[myform].reset();
   }
   function submitForm(myform){
      document[myform].submit();
   }
