// Cole Group, Inc. - CPGTours
<!--

function checkBrowser() {
	var browser = navigator.appName;
	var version = parseFloat(navigator.appVersion);
	if((browser == "Netscape" || browser == "Microsoft Internet Explorer") && (version >= 4)) {
		return true;
	} else {
		alert("\nWe're sorry, but your browser is not sufficient for this site.\nNow would be a great time to update it.\n\nError: This browser's Javascript support is unpredictable.");
		return false;
	}
}

function sortNumber(a, b) {
	return a - b;
}

function setCookie(name,value,expiration) {
	var expDate = new Date();
	expDate.setDate(expDate.getDate()+expiration);
	document.cookie = name + "=" + escape(value) + ((expiration == null) ? "" : ";expires=" + expDate.toGMTString());
}

function getCookie(name) {
	if(document.cookie.length > 0) {
		var c_start = document.cookie.indexOf(name + "=");
		if(c_start != -1) {
			c_start = c_start + name.length + 1;
			c_end = document.cookie.indexOf(";",c_start);
			if(c_end == -1) { c_end = document.cookie.length; }
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}

function checkCookie() {
	var userId = getCookie('userId');
	if(userId != null && userId != "") {
		alert('Welcome back '+userId+'!');
	} else {
		userId = prompt('Please enter your name:',"");
		if(userId != null && userId != "") {
			setCookie('userId',userId,365);
		}
	}
}

function GetXmlHttpObject() {
	var xmlHttp = null;
	try {
		// Firefox, Safari, Opera 8.0+
		xmlHttp = new XMLHttpRequest();
	} catch(e) {
		// Internet Explorer
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				alert("\nWe're sorry, but your browser is not sufficient for this site.\nNow would be a great time to update it.\n\nError: XmlHttp not supported.");
			}
		}
	}
	return xmlHttp;
}

function newImage(arg) {
	if (document.images) {
		var rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImage(where,what) {
	if (document.images && (preloadFlag == true)) {
		document[where].src = what;
	}
}

var preloadFlag = false;
var preloadNumber = 0;
function preloadImage(imageLoc) {
	if (document.images) {
		document['preload'+preloadNumber] = newImage(imageLoc);
		preloadNumber ++;
	}
}

function submitForm(which) {
	document[which].submit();
}

function submitenter(field,e) {
	var keycode;
	if (window.event) {
		keycode = window.event.keyCode;
	} else if(e) {
		keycode = e.which;
	} else {
		return true;
	}

	if (keycode == 13) {
		field.form.submit();
		return false;
	} else {
		return true;
	}
}

// DISABLE RIGHT-CLICK
function disableClick(e) {
	return false;
}

//document.onmousedown=disableClick;
//document.oncontextmenu=disableClick;
//

function toggleAccount(action) {
	var confirmation = confirm("Are you sure you want to turn your account " + action + "?");
	if(confirmation) {
		window.location = "index.php?tg=" + action;
	}
}

function toggleDiv(which) {
	if(document.getElementById(which).style.display == "none") {
		document.getElementById(which).style.display = "block";
	} else {
		document.getElementById(which).style.display = "none";
	}
}

function popTerms() {
	window.open('coeTerms.php','coeTerms','width=500,height=600,toolbar=no,status=no,scrollbars=yes');
}

function checkTerms() {
	if (document.coeForm.terms.checked != true) {
		alert("\nYou must agree to the COE Account Terms");
		return false;
	} else {
		return true;
	}
}




// -->