//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 + "_on.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;
   }
}
//course select nav bar, book online
function courseSelect(obj) {
   var courseurl = obj.options[obj.selectedIndex].value;
   if (courseurl != 0 && courseurl != "") {
      window.open(courseurl);
   } else {
      obj.selectedIndex = 0;
   }
}

//nav
preload("butt_home","/images/nav/butt_home")
preload("butt_our_courses","/images/nav/butt_our_courses")
preload("butt_special_offers","/images/nav/butt_special_offers")
preload("butt_reservations","/images/nav/butt_reservations")
preload("butt_restaurants","/images/nav/butt_restaurants")
preload("butt_trilogy_life","/images/nav/butt_trilogy_life")
preload("butt_contact_us","/images/nav/butt_contact_us")


