function applyCoupon(btn){	btn.style.cursor = 'wait';	form = btn.form;   	url = '/store/apply-coupon.cgi?o=' + encodeURIComponent(form.oId.value) + '&c=' + encodeURIComponent(form.code.value);	xmlGet(url, function(){ checkCoupon(btn);});}function checkCoupon(btn){	if (req.readyState == 4){		if (req.status == 200){			btn.style.cursor = 'auto';			form = btn.form;			if (req.responseText == "FAIL"){				document.getElementById('coupon-header').innerHTML = '<strong>The code you entered (' + form.code.value + ') is not valid</strong>';			}else{				window.location = 'http://' + window.location.hostname + '/store/summary.cgi';			}		}	}}function checkOrg(btn){	form = btn.form;		if ((form.oId.value == "") || (isNaN(form.oId.value))){		return checkFields(form, 'N');	}		btn.style.cursor = 'wait';          	url = '/store/validate-organization-code.cgi?o=' + encodeURIComponent(form.oId.value);	xmlGet(url, function(){ checkSignUp(btn);});}function checkSignUp(btn){	if (req.readyState == 4){		if (req.status == 200){						btn.style.cursor = 'auto';			checkFields(form, req.responseText); // this function is included in a separate file.		}	}}function login(btn){	form = btn.form;		if (form.sId.value.length != 6){		alert("Please enter your six digit participant code.");		form.sId.focus();		return false;	}		btn.style.cursor = 'wait';	obj = document.getElementById('login-popup');	obj.style.cursor = 'wait';		url = '/participant-login/login.cgi?u=' + encodeURIComponent(form.sId.value) + '&p=' + encodeURIComponent(form.password.value);	xmlGet(url, function(){ checkLogin(btn);});}function checkLogin(btn){	if (req.readyState == 4){		if (req.status == 200){						btn.style.cursor = 'auto';						obj = document.getElementById('login-popup');			obj.style.cursor = 'auto';						if (req.responseText == 'FAIL'){				txt_fld = document.getElementById('login-txt');				txt_fld.innerHTML = '<strong>The code and password you provided is not valid.  Please try again.</strong>';			}else{				// success				document.cookie="participant=" +escape(req.responseText);				window.location = 'http://' + window.location.hostname + '/participant-login/index.cgi';			}        }    }}function emailPassword(btn){	form = btn.form;    btn.style.cursor = 'wait';    	obj = document.getElementById('login-popup');	obj.style.cursor = 'wait';		url = '/participant-login/forgot-password.cgi?e=' + encodeURIComponent(form.email.value);	xmlGet(url, function(){ emailSent(btn);});}function emailSent(btn){	if (req.readyState == 4){		if (req.status == 200){						btn.style.cursor = 'auto';						obj = document.getElementById('login-popup');			obj.style.cursor = 'auto';						txt_fld = document.getElementById('password-txt');			if (req.responseText == 'SENT'){				switchWindow('password-sent-popup');				txt_fld.innerHTML = '<strong>Forgot Password?</strong> Please enter your email address to have it sent to you.';			}else{				txt_fld.innerHTML = '<strong>Your e-mail address was not found.</strong>';			}		}    }}
