function applyCoupon(couponcode, course_id, memnum) {
	if (couponcode != "") {
		objHTTP = getHTTPObject();
		objHTTP.open("GET","validateCoupon.cfm?course_id="+course_id + "&couponcode=" +couponcode + "&member_number="+memnum, false);
		objHTTP.send(null);	
		result = objHTTP.responseText;
		var val = parseInt(document.frmReg.amount.value);
		var msg = "Coupon can't be validated"
		if (result.length > 7 && result.indexOf('|') > 0) {
			aryCoupon = result.split('|');
			if ( aryCoupon[2].substring(0,3) == 'dlr') {
				val= val - parseInt(aryCoupon[1]);
				msg = "Coupon value is " + aryCoupon[1] + ' dollar off.'
			}
			if (aryCoupon[2].substring(0,3) == 'pct') {
				val = val- (parseInt(aryCoupon[1]) * val)/100 ;
				msg = "Coupon  value is " + aryCoupon[1] + '% off.'
			}
			document.frmReg.totalFee.value = val;
			document.frmReg.couponcode.value = couponcode;
			document.getElementById("feeDisplay").innerHTML = "<span style='text-decoration:line-through; color:red'>$"+document.frmReg.amount.value+"</span> $" + val
			document.getElementById("couponMsg").innerHTML = msg;
		}
		else {
			if(trim(result) == "Err1") msg = "This coupon can only be used once.";
			document.getElementById("feeDisplay").innerHTML = '$' + parseFloat(document.frmReg.amount.value).toFixed(2);
			document.getElementById("couponMsg").innerHTML = msg;
		}
	}
}

function trim(str)
{
  return str.replace(/^\s+|\s+$/g, '');
}

function checkFrm(frm) { 
  if (frm.loginRequired.value == "true") {
		if (frm.publicid.value == "" || frm.privateid.value == "") {
			alert("Please enter your user id and password.")
			return false;
		}
  }
  return true;
 }
function copy_obj(o){
	  	var c = new Object();
		
		for (var e in o) {
			c[e] = o[e];
		}
		return c;
}
	  

function getHTTPObject() {
	if(navigator.appName=='Netscape'){
		var objHTTP = new XMLHttpRequest();
	}
	else if (navigator.appName.indexOf("Explorer") > 0) {
		var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objHTTP;
}
	
function hideDiv(id)
{
	if (document.getElementById)
	{
		document.getElementById(id).style.display = 'none';	
		
	}
	
}

function showDiv(id)
{
	if (document.getElementById)
	{
		document.getElementById(id).style.display = 'block';		
	}
}

function toggleDiv(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
					
		} else {
			
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
				
			} else {
					
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				
				document.all.id.style.display = 'none';
			}
		}
	}
}



function click1(schoolid)
{
toggleDiv('campus' + schoolid);
toggleDiv('col' + schoolid);
toggleDiv('exp' + schoolid);
}



function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=780,height=565,left = 255,top = 299.5');");
}

function showClass(classid, schoolid,event) {
	objHTTP = getHTTPObject();
	objHTTP.open("GET","divClass.cfm?class_id="+classid + "&school_id=" +schoolid ,false);
	objHTTP.send(null);
	objTarget = document.getElementById("divClass");
	sObj=document.getElementById("clickOn"+classid);

	
	if(!document.all){
		var xpos=event.pageX+"px";
		var ypos=event.pageY+"px";
		
	}else{
		var xpos=event.x;
		var ypos=event.y;
	}

	objTarget.style.left=xpos;
	objTarget.style.top=ypos;
	objTarget.innerHTML = objHTTP.responseText;
	objTarget.style.display = "block";
//	document.all.cursorplus.innerHTML = event.clientX + ' , ' + event.clientY + " : " + event.offsetX + ' , ' + event.offsetY + ' scrollY' + document.body.scrollTop
	return;
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function showZipDiv() {
	objHTTP = getHTTPObject();
	objHTTP.open("GET","divZipCode.cfm",false);
	objHTTP.send(null);
	objTarget = document.getElementById("divZip");
	objTarget.style.posLeft=event.clientX + 50;
	objTarget.style.posTop=event.clientY + document.body.scrollTop -150 ;
	objTarget.innerHTML = objHTTP.responseText;
	objTarget.style.display = "block";
//	document.all.cursorplus.innerHTML = event.clientX + ' , ' + event.clientY + " : " + event.offsetX + ' , ' + event.offsetY + ' scrollY' + document.body.scrollTop
	return;
}

function frmvalidator(aform){
if (aform.Address.value == '' && aform.zip.value == ''){

alert('Please enter an address or a zip code to search');

return false;

}
}