//::pop-up window (complete settings)
//ex -> onClick="CiPopWin('./pageurl.asp','WindowName','500','300','no','no','no','no','no','no');return false"
var win = null;
function CiPopWin(mypage,myname,w,h,scroll,resize,toolbar,loc,statusbar,menubar){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+',toolbar='+toolbar+',location='+loc+',statusbar='+statusbar+',menubar='+menubar;
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}

//::highlight table cells
var isIE4 = false;
function CheckBrowser(){ 
	if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.charAt(0) >= 4) {isIE4 = true;}
}
function mOvr(src,clrOver){
	if (!src.contains(event.fromElement)) {src.style.cursor = 'hand'; src.bgColor = clrOver;}
}
function mOut(src,clrIn){
	if (!src.contains(event.toElement)) {src.style.cursor = 'default'; src.bgColor = clrIn;}
}
function mClick(url,tgt){
	switch (tgt) {
		case "self": case "":
			self.location.href=url;
			break;
		case "blank":
			window.open(url);
			break;
		case "top":
			top.location.href=url;
			break;
		case "parent":
			parent.location.href=url;
			break;
	}
}

//::Hide Payment Form Function
function HidePaymentForm(total){
	if (total > 0) {
		PaymentTable.style.display = "block";
		document.forms[0].paymenttable.value = "1";
	}
	else{
		PaymentTable.style.display = "none";
		document.forms[0].paymenttable.value = "0";
	}

}

//::Limit TextArea Length
//ex.	onKeyDown="LimitTextarea(this,255);" onKeyUp="LimitTextarea(this,255);"
function LimitTextarea(fld,lmt) {
	if (fld.value.length > lmt) {
		fld.value = fld.value.substring(0, lmt);
	}
}

//::Trim String Function
function Trim(str){
	str = str.replace(/\s+/,'');
	str = str.replace(/\s+$/,'');
	return str;
}

//::IsNumeric Function
function IsNumeric(val){
	for (i=0; i<val.length; i++){
		if (isNaN(val.charAt(i))){
			return false;
		}
	}
	return true;
}

//::Valid E-Mail
function ValidEmail(str){
	AccPos = str.indexOf('@');
	AccStr = str.substr(0,AccPos);
	AccLen = AccStr.length;
	DomPos = str.lastIndexOf('.');
	DomStr = str.substr(AccPos+1,(DomPos-AccPos)-1);
	DomLen = DomStr.length;
	ExtPos = DomPos + 1;
	ExtLen = str.length - ExtPos;
	ExtStr = str.substr(ExtPos,ExtLen);
	if(	   (AccPos != -1)
		&& (DomPos != -1)
		&& (AccLen >= 2)
		&& (DomLen >= 2)
		&& (ExtLen >= 2)
		&& (ExtLen <= 4)){
		return true;
	}
	else{return false}
}

//::Valid Phone
function ValidPhone(PhoneArea,PhonePre,PhoneSuf){
	if ((Trim(PhoneArea) == "") || 
		(Trim(PhonePre) == "") ||
		(Trim(PhoneSuf) == "") ||
		(PhoneArea.length != 3) || 
		(PhonePre.length != 3) ||
		(PhoneSuf.length != 4)){
		return false;
	}else{
		if (IsNumeric(PhoneArea) &&
			IsNumeric(PhonePre) &&
			IsNumeric(PhoneSuf) &&
			(PhoneArea.length == 3) && 
			(PhonePre.length == 3) &&
			(PhoneSuf.length == 4)){
			return true;
		}
	}
}

//::Valid Telephone
function ValidTelephone(str){
	str = Trim(str);
	str = str.replace("(","");
	str = str.replace(")","");
	str = str.replace(".","");
	str = str.replace(".","");
	str = str.replace("-","");
	str = str.replace("-","");
	str = str.replace(" ","");
	strLen = str.length;
	if((strLen == 10 || strLen == 7) && IsNumeric(str)){
		return true;
	}
	else{
		return false;
	}
}

//::Valid Date Function
function ValidDate(dt) {
	var dt1 = /(\d+)\/(\d+)\/(\d+)$/;
	var dt2 = /(\d+)\-(\d+)\-(\d+)$/;
	var dt3 = /(\d+)\.(\d+)\.(\d+)$/;
	if (dt1.exec(dt) ||
		dt2.exec(dt) ||
		dt3.exec(dt)) {
		return true;
	}
	else{return false;}
}

//::Validate Time Function	(HH:MM:SS AM/PM)
function ValidTime(tm) {
	var errCount = 0;
	var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;
	var matchArray = tm.match(timePat);
	if (matchArray == null) { errCount += 1; }
	hour = matchArray[1];
	minute = matchArray[2];
	second = matchArray[4];
	ampm = matchArray[6];
	if (second == "") { second = null; }
	if (ampm == "") { ampm = null }
	if (hour < 0  || hour > 23) { errCount += 1; }
	if (hour <= 12 && ampm == null) { errCount += 1; }
	if (hour > 12 && ampm != null) { errCount += 1; }
	if (minute < 0 || minute > 59) { errCount += 1; }
	if (second != null && (second < 0 || second > 59)) { errCount += 1; }
	if (errCount > 0) {	return false; }
	else{ return true; }
}

//::check if radio or checkbox items are selected
function CheckSelected(arr){
	if(arr.length > 0){
		for(var index = 0; index < arr.length; index++){
			if(arr[index].checked){
				return true;
				break;
			}
		}
	}
	else{
		if(arr.checked){
			return true;
		}
		else{
			return false;
		}
	}
}

//::Validate Contact
function ValidateContact() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (objForm.name.value == "") {
	missinginfo += "\n     »  Name";
	}
	if (!ValidEmail(objForm.email.value)) {
	missinginfo += "\n     »  E-Mail";
	}
	if (objForm.questions.value == "") {
	missinginfo += "\n     »  Questions / Comments";
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::Validate Newsletter
function ValidateNewsletter() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (objForm.firstname.value == "") {
	missinginfo += "\n     »  First Name";
	}
	if (objForm.lastname.value == "") {
	missinginfo += "\n     »  Last Name";
	}
	if (!ValidEmail(objForm.emailaddress.value)) {
	missinginfo += "\n     »  E-Mail Address";
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::check menus for at least one selection
function CheckSelectedMenus() {
	chk = 0;
	var objForm = document.forms[0];
	if(objForm.thursdayam1.value != ""){chk ++;}
	if(objForm.thursdayam2.value != ""){chk ++;}
	if(objForm.thursdaypm1.value != ""){chk ++;}
	if(objForm.thursdaypm2.value != ""){chk ++;}
	if(objForm.fridayam1.value != ""){chk ++;}
	if(objForm.fridayam2.value != ""){chk ++;}
	if(objForm.fridaypm1.value != ""){chk ++;}
	if(objForm.fridaypm2.value != ""){chk ++;}
	if(objForm.teambuilding.value != ""){chk ++;}

	if(chk > 0){return true;}
	else{return false;}
}

//::Validate Membership
function ValidateMembership() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (objForm.firstname.value == "") {
	missinginfo += "\n     »  First Name";
	}
	if (objForm.lastname.value == "") {
	missinginfo += "\n     »  Last Name";
	}
	if (objForm.address.value == "") {
	missinginfo += "\n     »  Address";
	}
	if (objForm.city.value == "") {
	missinginfo += "\n     »  City";
	}
	if (objForm.state.value == "") {
	missinginfo += "\n     »  State";
	}
	if (objForm.zip.value == "") {
	missinginfo += "\n     »  Zip";
	}
	if (!ValidTelephone(objForm.telephone.value)) {
	missinginfo += "\n     »  Telephone";
	}
	if (!ValidEmail(objForm.email.value)) {
	missinginfo += "\n     »  E-Mail";
	}
	if (objForm.pw.value == "") {
	missinginfo += "\n     »  Password";
	}

	if (objForm.conferencetotal.value > 0) {
		if (objForm.b_firstname.value == "") {
		missinginfo += "\n     »  First Name (Billing)";
		}
		if (objForm.b_lastname.value == "") {
		missinginfo += "\n     »  Last Name (Billing)";
		}
		if (objForm.b_address.value == "") {
		missinginfo += "\n     »  Address (Billing)";
		}
		if (objForm.b_city.value == "") {
		missinginfo += "\n     »  City (Billing)";
		}
		if (objForm.b_state.value == "") {
		missinginfo += "\n     »  State (Billing)";
		}
		if (objForm.b_zip.value == "") {
		missinginfo += "\n     »  Zip (Billing)";
		}
		if (objForm.paymentmethod.value == "") {
		missinginfo += "\n     »  Payment Method";
		}
		if (objForm.paymentmethod.value == "Credit Card"){
			if (objForm.creditcard.value == "") {
			missinginfo += "\n     »  Credit Card";
			}
			if (objForm.cardholdername.value == "") {
			missinginfo += "\n     »  Cardholder Name";
			}
			if (objForm.creditcardnumber.value == "") {
			missinginfo += "\n     »  Credit Card Number";
			}
			if (objForm.expmonth.value == "") {
			missinginfo += "\n     »  Expiration Month";
			}
			if (objForm.expyear.value == "") {
			missinginfo += "\n     »  Expiration Year";
			}
		}
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::Validate MembershipProfile
function ValidateMembershipProfile() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (objForm.firstname.value == "") {
	missinginfo += "\n     »  First Name";
	}
	if (objForm.lastname.value == "") {
	missinginfo += "\n     »  Last Name";
	}
	if (objForm.address.value == "") {
	missinginfo += "\n     »  Address";
	}
	if (objForm.city.value == "") {
	missinginfo += "\n     »  City";
	}
	if (objForm.state.value == "") {
	missinginfo += "\n     »  State";
	}
	if (objForm.zip.value == "") {
	missinginfo += "\n     »  Zip";
	}
	if (!ValidTelephone(objForm.telephone.value)) {
	missinginfo += "\n     »  Telephone";
	}
	if (!ValidEmail(objForm.email.value)) {
	missinginfo += "\n     »  E-Mail";
	}
	if (objForm.pw.value == "") {
	missinginfo += "\n     »  Password";
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::Validate Event Registration
function ValidateEventRegistration(billBypass) {
	missinginfo = "";
	var objForm = document.forms[0];

	if (objForm.firstname.value == "") {
	missinginfo += "\n     »  First Name";
	}
	if (objForm.lastname.value == "") {
	missinginfo += "\n     »  Last Name";
	}
	if (objForm.address.value == "") {
	missinginfo += "\n     »  Address";
	}
	if (objForm.city.value == "") {
	missinginfo += "\n     »  City";
	}
	if (objForm.state.value == "") {
	missinginfo += "\n     »  State";
	}
	if (objForm.zip.value == "") {
	missinginfo += "\n     »  Zip";
	}
	if (!ValidTelephone(objForm.telephone.value)) {
	missinginfo += "\n     »  Telephone";
	}
	if (!ValidEmail(objForm.email.value)) {
	missinginfo += "\n     »  E-Mail";
	}

	if (objForm.conferencetotal.value > 0 && billBypass != 0) {
		if (objForm.b_firstname.value == "") {
		missinginfo += "\n     »  First Name (Billing)";
		}
		if (objForm.b_lastname.value == "") {
		missinginfo += "\n     »  Last Name (Billing)";
		}
		if (objForm.b_address.value == "") {
		missinginfo += "\n     »  Address (Billing)";
		}
		if (objForm.b_city.value == "") {
		missinginfo += "\n     »  City (Billing)";
		}
		if (objForm.b_state.value == "") {
		missinginfo += "\n     »  State (Billing)";
		}
		if (objForm.b_zip.value == "") {
		missinginfo += "\n     »  Zip (Billing)";
		}
		if (objForm.paymentmethod.value == "") {
		missinginfo += "\n     »  Payment Method";
		}
		if (objForm.paymentmethod.value == "Credit Card"){
			if (objForm.creditcard.value == "") {
			missinginfo += "\n     »  Credit Card";
			}
			if (objForm.cardholdername.value == "") {
			missinginfo += "\n     »  Cardholder Name";
			}
			if (objForm.creditcardnumber.value == "") {
			missinginfo += "\n     »  Credit Card Number";
			}
			if (objForm.expmonth.value == "") {
			missinginfo += "\n     »  Expiration Month";
			}
			if (objForm.expyear.value == "") {
			missinginfo += "\n     »  Expiration Year";
			}
		}
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::Validate Registration
function ValidateRegistration() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (objForm.firstname.value == "") {
	missinginfo += "\n     »  First Name";
	}
	if (objForm.lastname.value == "") {
	missinginfo += "\n     »  Last Name";
	}
	if (objForm.address.value == "") {
	missinginfo += "\n     »  Address";
	}
	if (objForm.city.value == "") {
	missinginfo += "\n     »  City";
	}
	if (objForm.state.value == "") {
	missinginfo += "\n     »  State";
	}
	if (objForm.zip.value == "") {
	missinginfo += "\n     »  Zip";
	}
	if (!ValidTelephone(objForm.telephone.value)) {
	missinginfo += "\n     »  Telephone";
	}
	if (!ValidEmail(objForm.email.value)) {
	missinginfo += "\n     »  E-Mail";
	}
	if (!CheckSelected(objForm.conferenceoptions)) {
	missinginfo += "\n     »  Please select a conference option.";
	}
//	if (objForm.conferenceregistration.value == "") {
//	missinginfo += "\n     »  Conference Registration";
//	}
//	if (!CheckSelectedMenus()) {
//	missinginfo += "\n     »  Breakout Session Choices";
//	}

	if (objForm.paymenttable.value == "1") {
		if (objForm.b_firstname.value == "") {
		missinginfo += "\n     »  First Name (Billing)";
		}
		if (objForm.b_lastname.value == "") {
		missinginfo += "\n     »  Last Name (Billing)";
		}
		if (objForm.b_address.value == "") {
		missinginfo += "\n     »  Address (Billing)";
		}
		if (objForm.b_city.value == "") {
		missinginfo += "\n     »  City (Billing)";
		}
		if (objForm.b_state.value == "") {
		missinginfo += "\n     »  State (Billing)";
		}
		if (objForm.b_zip.value == "") {
		missinginfo += "\n     »  Zip (Billing)";
		}
		if (objForm.paymentmethod.value == "") {
		missinginfo += "\n     »  Payment Method";
		}
		if (objForm.paymentmethod.value == "Credit Card"){
			if (objForm.creditcard.value == "") {
			missinginfo += "\n     »  Credit Card";
			}
			if (objForm.cardholdername.value == "") {
			missinginfo += "\n     »  Cardholder Name";
			}
			if (objForm.creditcardnumber.value == "") {
			missinginfo += "\n     »  Credit Card Number";
			}
			if (objForm.expmonth.value == "") {
			missinginfo += "\n     »  Expiration Month";
			}
			if (objForm.expyear.value == "") {
			missinginfo += "\n     »  Expiration Year";
			}
		}
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::Validate Sponsorship
function ValidateSponsorship() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (!CheckSelected(objForm.sponsorshiplevel)) {
	missinginfo += "\n     »  Sponsorship Level";
	}
	if (objForm.b_firstname.value == "") {
	missinginfo += "\n     »  First Name (Billing)";
	}
	if (objForm.b_lastname.value == "") {
	missinginfo += "\n     »  Last Name (Billing)";
	}
	if (objForm.b_address.value == "") {
	missinginfo += "\n     »  Address (Billing)";
	}
	if (objForm.b_city.value == "") {
	missinginfo += "\n     »  City (Billing)";
	}
	if (objForm.b_state.value == "") {
	missinginfo += "\n     »  State (Billing)";
	}
	if (objForm.b_zip.value == "") {
	missinginfo += "\n     »  Zip (Billing)";
	}
	if (!ValidTelephone(objForm.b_telephone.value)) {
	missinginfo += "\n     »  Telephone";
	}
	if (!ValidEmail(objForm.b_email.value)) {
	missinginfo += "\n     »  E-Mail";
	}
	if (objForm.paymentmethod.value == "") {
	missinginfo += "\n     »  Payment Method";
	}
	if (objForm.paymentmethod.value == "Credit Card"){
		if (objForm.creditcard.value == "") {
		missinginfo += "\n     »  Credit Card";
		}
		if (objForm.cardholdername.value == "") {
		missinginfo += "\n     »  Cardholder Name";
		}
		if (objForm.creditcardnumber.value == "") {
		missinginfo += "\n     »  Credit Card Number";
		}
		if (objForm.expmonth.value == "") {
		missinginfo += "\n     »  Expiration Month";
		}
		if (objForm.expyear.value == "") {
		missinginfo += "\n     »  Expiration Year";
		}
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::Validate Tabletop Exhibits
function ValidateTabletopExhibits() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (objForm.total.value == "0" && objForm.special.value != "free") {
	missinginfo += "\n     »  Tabletop Exhibit Options (Select at least one)";
	}
	if (objForm.b_firstname.value == "") {
	missinginfo += "\n     »  First Name";
	}
	if (objForm.b_lastname.value == "") {
	missinginfo += "\n     »  Last Name";
	}
	if (objForm.b_address.value == "") {
	missinginfo += "\n     »  Address";
	}
	if (objForm.b_city.value == "") {
	missinginfo += "\n     »  City";
	}
	if (objForm.b_state.value == "") {
	missinginfo += "\n     »  State";
	}
	if (objForm.b_zip.value == "") {
	missinginfo += "\n     »  Zip";
	}
	if (!ValidTelephone(objForm.b_telephone.value)) {
	missinginfo += "\n     »  Telephone";
	}
	if (!ValidEmail(objForm.b_email.value)) {
	missinginfo += "\n     »  E-Mail";
	}

	if (objForm.special.value != "free") {
		if (objForm.paymentmethod.value == "") {
		missinginfo += "\n     »  Payment Method";
		}
		if (objForm.paymentmethod.value == "Credit Card"){
			if (objForm.creditcard.value == "") {
			missinginfo += "\n     »  Credit Card";
			}
			if (objForm.cardholdername.value == "") {
			missinginfo += "\n     »  Cardholder Name";
			}
			if (objForm.creditcardnumber.value == "") {
			missinginfo += "\n     »  Credit Card Number";
			}
			if (objForm.expmonth.value == "") {
			missinginfo += "\n     »  Expiration Month";
			}
			if (objForm.expyear.value == "") {
			missinginfo += "\n     »  Expiration Year";
			}
		}
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::Validate News Updates
function ValidateNewsUpdates() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (!ValidDate(objForm.date.value)) {
	missinginfo += "\n     »  Date";
	}
	if (!ValidTime(objForm.time.value)) {
	missinginfo += "\n     »  Time";
	}
	if (objForm.description.value == "") {
	missinginfo += "\n     »  Message";
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::Validate Membership Password Recovery
function ValidateMembershipPasswordRecovery() {
	missinginfo = "";
	var objForm = document.forms[0];

	if (!ValidEmail(objForm.email.value)) {
	missinginfo += "\n     »  Member E-Mail";
	}

	if (missinginfo != "") {
	missinginfo = "The following information was entered incorrectly:\n" +
	missinginfo + "\n\nPlease re-enter the information and try again...";
	alert(missinginfo);
	return false;
	}
	else return true;
}

//::FormatNumber Function
function FormatNumber(amt,dec){
	var val = parseFloat(amt);
	var zeros = "0.";
	if(isNaN(dec)){ dec = 0; }
	for(z=0;z<dec;z++){ zeros = zeros + "0"; }
	if(dec <= 0){ zeros = "0"; }
	if(isNaN(val)){ return zeros; }
	if(val <= 0){ return zeros; }
	val = (1 * parseFloat(val));
	rndcnt = (!dec ? 2 : dec);
	val = Math.round(val*Math.pow(10,rndcnt))/Math.pow(10,rndcnt);
	val = val + "";
	if(val.indexOf('.') == -1){
		newZeros = zeros.substring(1,zeros.length);
		return FormatComma(val) + newZeros; 
	}
	else{ 
		declen = (val.length - (val.indexOf(".")+1));
		decdif = (dec - declen)
		for(d=0;d<decdif;d++){ val = val + "0"; }
	}
	return FormatComma(val) + val.substring(val.indexOf('.'),val.length);
	function FormatComma(val){
		cutval = Math.floor(val);
		var arr=new Array('0'), i=0; 
		while(cutval>0){arr[i]=''+cutval%1000; cutval=Math.floor(cutval/1000); i++;}
		arr=arr.reverse();
		for(var i in arr) if (i>0)
		while(arr[i].length<3) arr[i]='0'+arr[i];
		return arr.join();
	}
}

//::Calculate Registration Fees
function CalculateFees(){
	var objForm = document.forms[0];
	var intTotal = 0;
	
//	if(CheckSelected(objForm.conferenceregistration)){
//		if(objForm.conferenceregistration[0].checked){
//			intTotal += parseFloat(objForm.conferenceregistration[0].value);
//		}
//		else{
//			intTotal += parseFloat(objForm.conferenceregistration[1].value);
//		}
//	}

	if(objForm.conferenceregistration.value != ""){
		var valConf = objForm.conferenceregistration.value;
		valConf = valConf.substr(2);
		intTotal += parseFloat(valConf);
	}

//	if(CheckSelected(objForm.golf)){
//		intTotal += parseFloat(objForm.golf.value);
//	}

//	if(CheckSelected(objForm.tennis)){
//		intTotal += parseFloat(objForm.tennis.value);
//	}

	if(CheckSelected(objForm.spa)){
		intTotal += parseFloat(objForm.spa.value);
	}

	objForm.conferencetotal.value = FormatNumber(intTotal,2);

	if(intTotal == 0){
		PaymentTable.style.display = 'none';
	}
	else{
		PaymentTable.style.display = '';
	}

	//enable / disable breakout session options
	BreakoutSessionOptions();
}

//::Calculate Tabletop Fees
function CalculateTabletopFees(){
	var objForm = document.forms[0];
	var intTotal = 0;

	if(CheckSelected(objForm.tableandchairs)){
		intTotal += parseFloat(objForm.tableandchairs.value);
	}

	if(CheckSelected(objForm.electricaloutlet)){
		intTotal += parseFloat(objForm.electricaloutlet.value);
	}

	if(CheckSelected(objForm.boothattendee)){
		//intTotal += parseFloat(objForm.boothattendee.value);
		intTotal += parseFloat((objForm.boothattendeeqty.value*objForm.boothattendee.value));
	}

	objForm.total.value = intTotal;
}

//::Copy Fields Function
function CopyFields(){
	var objForm = document.forms[0];
	if(objForm.copy.checked){
		objForm.b_firstname.value = objForm.firstname.value;
		objForm.b_lastname.value = objForm.lastname.value;
		objForm.b_address.value = objForm.address.value;
		objForm.b_city.value = objForm.city.value;
		objForm.b_state.value = objForm.state.value;
		objForm.b_zip.value = objForm.zip.value;
	}
	else{
		objForm.b_firstname.value = "";
		objForm.b_lastname.value = "";
		objForm.b_address.value = "";
		objForm.b_city.value = "";
		objForm.b_state.value = "";
		objForm.b_zip.value = "";
	}
}

//::Limit TextArea Length
//ex.	onKeyDown="LimitTextarea(this,255);" onKeyUp="LimitTextarea(this,255);"
function LimitTextarea(fld,lmt) {
	if (fld.value.length > lmt) {
		fld.value = fld.value.substring(0, lmt);
	}
}

//::Set Date and Time Fields Function
function DateTimeFields(origDate, origTime){
	var objForm = document.forms[0];
	if(objForm.timenow.checked){
		objForm.date.value = DateTime('Date');
		objForm.time.value = DateTime('Time');
	}
	else{
		objForm.date.value = origDate;
		objForm.time.value = origTime;
	}
}

//::Date/Time Function
function DateTime(dt){
	var now = new Date();
	var day = now.getDay();
	var month = now.getMonth()+1;
	var date = now.getDate();
	var year = now.getYear();
	var dates = month + "/" + date + "/" + year;
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds();
	var time = "" + ((hours >12) ? hours -12 :hours)
	if (time == "0") time = 12;
	time += ((minutes < 10) ? ":0" : ":") + minutes
	time += ((seconds < 10) ? ":0" : ":") + seconds
	time += (hours >= 12) ? " PM" : " AM"
	switch (dt) {
		case "Date":
			return dates;
			break;
		case "Time":
			return time;
			break;
		case "Now":
			return dates + " " + time;
			break;
		default:
			return now;
	}
}

//::Enable/Disable Payment Method Fields
function PaymentMethodFields(){
	var objForm = document.forms[0];
	if(objForm.paymentmethod.value == "Credit Card"){
		objForm.creditcard.disabled = false;
		objForm.cardholdername.disabled = false;
		objForm.creditcardnumber.disabled = false;
		objForm.expmonth.disabled = false;
		objForm.expyear.disabled = false;
	}
	else{
		objForm.creditcard.disabled = true;
		objForm.cardholdername.disabled = true;
		objForm.creditcardnumber.disabled = true;
		objForm.expmonth.disabled = true;
		objForm.expyear.disabled = true;
	}
}

//::Select/Unselect List Function
//	ex. SelectList(document.forms[0].LIST,true);
function SelectList(lst,bool) {
	for (i = 0; i < lst.length; i++) {
		lst.options[i].selected = bool;
	}
}

//::Enable/Disable Select All of Breakout Sessions
function SelectAllBS(){
	var objForm = document.forms[0];
	if(objForm.breakoutsessionsall.checked){
		SelectList(objForm.breakoutsessions,true);
	}
	else{
		SelectList(objForm.breakoutsessions,false);
	}
}

//::Enable/Disable Select All of Activities
function SelectAllAct(){
	var objForm = document.forms[0];
	if(objForm.activitiesall.checked){
		SelectList(objForm.activities,true);
	}
	else{
		SelectList(objForm.activities,false);
	}
}

//::Enable/Disable Select All of Sponsorship Levels
function SelectAllSL(){
	var objForm = document.forms[0];
	if(objForm.sponsorshiplevelsall.checked){
		SelectList(objForm.sponsorshiplevels,true);
	}
	else{
		SelectList(objForm.sponsorshiplevels,false);
	}
}

//::Enable/Disable Select All Options
function SelectAllOPT(){
	var objForm = document.forms[0];
	if(objForm.optionsall.checked){
		SelectList(objForm.options,true);
	}
	else{
		SelectList(objForm.options,false);
	}
}

//::Select/Deselect Breakout Session Options
function BreakoutSessionSelect(sessiontype){
	var objForm = document.forms[0];

	if(sessiontype == 0){
		if(objForm.thursdaypm1.value != "" || objForm.thursdaypm2.value != ""){
			objForm.workshop.options[0].selected = true;
		}
	}
	else if(sessiontype == 1){
		if(objForm.workshop.value != ""){
			objForm.thursdaypm1.options[0].selected = true;
			objForm.thursdaypm2.options[0].selected = true;
		}
	}
}

//::Auto-Select Spa Option
function AutoSelectSpa(menuid){
	var objForm = document.forms[0];
	var opt1 = objForm.fridaypm1.value;
	var opt2 = objForm.fridaypm2.value;

	if(opt1 == "24" || opt2 == "24"){
		objForm.spa.checked = true;
	}
	else{
		objForm.spa.checked = false;
	}

	//calculate fees
	CalculateFees();

	//check for duplicate spa option
	if(opt1 == "24" && opt2 == "24"){
		if(menuid == "fridaypm1"){
			objForm.fridaypm2.options[0].selected = true;
		}
		else{
			objForm.fridaypm1.options[0].selected = true;
		}
	}

}

//::Enable/Disable Breakout Session Options
function BreakoutSessionOptions(){
	var objForm = document.forms[0];
	var objConf = objForm.conferenceregistration.value;
	objConf = objConf.substring(0,1);

	switch (objConf) {
		case "T":
			objForm.thursdayam1.disabled = false;
			objForm.thursdayam2.disabled = false;
			objForm.thursdaypm1.disabled = false;
			objForm.thursdaypm2.disabled = false;
			objForm.fridayam1.disabled = true;
			objForm.fridayam2.disabled = true;
			objForm.fridaypm1.disabled = true;
			objForm.fridaypm2.disabled = true;
			objForm.teambuilding.disabled = true;
			break;

		case "F":
			objForm.thursdayam1.disabled = true;
			objForm.thursdayam2.disabled = true;
			objForm.thursdaypm1.disabled = true;
			objForm.thursdaypm2.disabled = true;
			objForm.fridayam1.disabled = false;
			objForm.fridayam2.disabled = false;
			objForm.fridaypm1.disabled = false;
			objForm.fridaypm2.disabled = false;
			objForm.teambuilding.disabled = false;
			break;

		case "B":
			objForm.thursdayam1.disabled = false;
			objForm.thursdayam2.disabled = false;
			objForm.thursdaypm1.disabled = false;
			objForm.thursdaypm2.disabled = false;
			objForm.fridayam1.disabled = false;
			objForm.fridayam2.disabled = false;
			objForm.fridaypm1.disabled = false;
			objForm.fridaypm2.disabled = false;
			objForm.teambuilding.disabled = false;
			break;

		default:
			objForm.thursdayam1.disabled = true;
			objForm.thursdayam2.disabled = true;
			objForm.thursdaypm1.disabled = true;
			objForm.thursdaypm2.disabled = true;
			objForm.fridayam1.disabled = true;
			objForm.fridayam2.disabled = true;
			objForm.fridaypm1.disabled = true;
			objForm.fridaypm2.disabled = true;
			objForm.teambuilding.disabled = true;
	}
}
