<!--

// ===================================
// EZregister.com - Javascript Library
// ===================================

	// TODO: set server variables variables
	var server_type = "live"; // live, local, testing_net, testing_org
	var server_ssl = true; // true or false
	
	// server names
	var server_live = "ezregister.com"; // live .com
	var server_local = "localhost:8888"; // local
	var server_testing_net = "ezregister.net"; // .net
	var server_testing_org = "ezregister.org"; // .org
	
	// fix for jqueury ui datepicker
	
	// remember the old function
	var _gotoToday = jQuery.datepicker._gotoToday;
	
	// datepicker is directly inside the jQuery object, so override that
	jQuery.datepicker._gotoToday = function(a){
		var target = jQuery(a);
		var inst = this._getInst(target[0]);
		
		// call the old function, so default behaviour is kept
		_gotoToday.call(this, a);
		
		// now do an additional call to _selectDate which will set the date and close
		// close the datepicker (if it is not inline)
		jQuery.datepicker._selectDate(a, 
		jQuery.datepicker._formatDate(inst,inst.selectedDay, inst.selectedMonth, inst.selectedYear));
	}
	
// jquery-ui dialog (modal box)
// ============================
	function modal_open(src,w,h,title){
		$("#dialog").dialog('destroy').remove()
		$('<div id="dialog"><iframe src="' + src + '" height="' + h + '" width="' + w + '" style="border:0;background:#E0DFE4"></div>').dialog({
		
			modal: true,
			closeOnEscape: true,
			height: 'auto',
			width: 'auto',
			title: title,
			//show: 'fade',
            //hide: 'fade',
			
			open: function(event, ui)
			{
			$(".ui-dialog .ui-dialog-titlebar").css("font-size","8pt");
			$("#dialog").css("background-color","#E0DFE4");
			$("#dialog").css("font-size","8pt");
			},
			
			close: function(event, ui) 
			{ 
			$("#dialog").dialog('destroy').remove()
			} 
		
		});
		
		//Bind to the ui-widget-overlay and watch for when it is clicked
		$('.ui-widget-overlay').live("click", function() {
			//Close the dialog
			$("#dialog").dialog('destroy').remove()
		});
	     		
	}
	
	function modal_close(){
		
		$("#dialog").dialog('destroy').remove()
	}
	// end function

// jquery functions
// ================
$(document).ready(function() {
	
	// IE bug fix for disabling select list options
		$('option[disabled]').css({'color': '#CC0000'});
		$('select').change(function() {
		if(this.options[this.selectedIndex].disabled) {
			if(this.options.length == 0) {
			this.selectedIndex = -1;
		} else {
			this.selectedIndex--;
		}
		$(this).trigger('change');
		}
		});
		$('select').each(function(it) {
		if(this.options[this.selectedIndex].disabled)
			this.onchange();
		});
	
	// calendar datepicker
	$('.datepicker').live('focus', function() {
		$( ".datepicker" ).datepicker({
		showOtherMonths: true,
		selectOtherMonths: true,
		changeMonth: true,
		changeYear: true,
		showButtonPanel: true
		});
	});
	
	// buttons
	//$( ".jq_button" ).button();
	
	// menu tabs
	$( "#jq_tabs" ).tabs();
	
	// highlight form fields
	$("input[type=text]").focus(function(){
		$(this).addClass("highlight");
	});
	
	$("input[type=text]").blur(function(){
		$(this).removeClass("highlight");
	});
	
	$("input[type=password]").focus(function(){
		$(this).addClass("highlight");
	});
	
	$("input[type=password]").blur(function(){
		$(this).removeClass("highlight");
	});
	
	$("input[type=file]").focus(function(){
		$(this).addClass("highlight");
	});
	
	$("input[type=file]").blur(function(){
		$(this).removeClass("highlight");
	});
	
	$("textarea").focus(function(){
		$(this).addClass("highlight");
	});
	
	$("textarea").blur(function(){
		$(this).removeClass("highlight");
	});
	
	$("select").focus(function(){
		$(this).addClass("highlight");
	});
	
	$("select").blur(function(){
		$(this).removeClass("highlight");
	});
	
	$('.security').keypress(function(e) { 
		var s = String.fromCharCode( e.which );
		if ( s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey ) {
			alert('Caps lock is on');
		}
	});
	
// remove highlighting
// ===================
	$(".no_highlight").focus(function(){
		$(this).removeClass("highlight");
		$(this).unbind('focus');
	});
	
// password field on event info page
// =================================
	$("#password_protect").click(function(){
		
		if($('#password_protect').attr('checked')){
			
			$("#event_password").removeAttr("disabled");
			$('#event_password').removeClass("blank");
			$('#event_password').addClass("basic security");
		
		} else {
			
			$("#event_password").attr("disabled", "disabled");
			$('#event_password').val('');
			$('#event_password').removeClass("basic security");
			$('#event_password').addClass("blank");
		}
	});
	// end function
	
// toggle map coordinates on/off on event info page
// ================================================
	$("#show_map").click(function(){
		
		if($('#show_map').attr('checked')){
			
			$("#gps_lat").removeAttr("disabled");
			$('#gps_lat').removeClass("blank");
			$('#gps_lat').addClass("basic");
			
			$("#gps_long").removeAttr("disabled");
			$('#gps_long').removeClass("blank");
			$('#gps_long').addClass("basic");
			
		} else {
			
			$("#gps_lat").attr("disabled", "disabled");
			$('#gps_lat').val('');
			$('#gps_lat').removeClass("basic");
			$('#gps_lat').addClass("blank");
			
			$("#gps_long").attr("disabled", "disabled");
			$('#gps_long').val('');
			$('#gps_long').removeClass("basic");
			$('#gps_long').addClass("blank");
		}
	});
	// end function
	
});
// end jquery functions functions

// separate datepicker function for bug in modal windows
function date_picker(){

	// // date picker
	// $( ".datepicker" ).datepicker({
	// showOtherMonths: true,
	// selectOtherMonths: true,
	// changeMonth: true,
	// changeYear: true
	// });
	
}
// end function

// spam protection for form submissions
// ====================================
function spam_unblock(){

	document.getElementById('human').value = 'asdfasdafSEsd4fa87sdf4';
}
// end function

function spam_check(){
	
	if(window.event && window.event.keyCode == 13){
		return true;
	} else if(document.getElementById('human').value = 'asdfasdafSEsd4fa87sdf4'){
		return true;
	} else {
		return false;
	}
}
// end function

// autofill confirmation
// =====================
function autofill_confirmation(order_id,security_token){
	
	$(document).ready(function(){
		
		var registrant_id = $('#select_confirmation_fields').val();
		
		// send to confirmation fields processing page
		var url = https_host() + "/register/confirmation_fields/" + registrant_id + "/" + order_id + "/" + security_token;
		
		// ajax function loads the page into the target div
		$('#confirmation_fields').load(url);
		
	});
}
// end function

// order login and autofill standard questions
// ===========================================
function OrderAutocomplete(event_id){
	
	$(document).ready(function(){
		
		if ($('#order_autocomplete_checkbox').attr('checked')) {
			
			var checked = 'checked';
		
		} else {
			
			var checked = 'unchecked';
		}
		
		// send to processing page
		var url = https_host() + "/register/order_autocomplete/" + event_id + "/" + checked; 
		
		// ajax function loads the page into the target div
		$('#standard_questions').load(url);
		return false;
	});
}
// end function

// check discount code has been submitted
// ======================================
function CheckDiscountCode(){
	
	if (($('#order_discount_code').val() != '') && ($('#order_discount_code').val() != undefined) && ($('#order_discount_code').val() != 'enter your discount code here')) {
		
		alert('Please click the \"Apply Discount\" button or remove the discount code');
		reset_submit();
		return false;
		
	} else {
		
		return true;	
	}
}
// end function

// registration form
// =================
  function load_standard_questions(){
  
  $(document).ready(function() {
	  
	  // do on page load
	  if ($('#state').val() != undefined) {
		  
		  if ($('#state').val() == 'other') {
			  
			  $('#state_other_display').show();
  
		  } else {
			  
			  $('#state_other').val('');
			  $('#state_other_display').hide();
		  };
	  };
  
	  // do on change
	  $('#state').change(function() {
		  if ($(this).val() == 'other') {
			  
			  $('#state_other_display').show().effect('highlight', {}, 3000);
			  
		  } else {
			  
			  $('#state_other').val('');
			  $('#state_other_display').hide();
		  };
	  });
	  
	  // do on page load
	  if ($('#country').val() != undefined) {
		  
		  if($('#country').val() == 'other') {
			  
			  $('#country_other_display').show();
  
		  } else {
			  
			  $('#country_other_display').hide();
			  $('#country_other').val('');
		  };
	  };
  
	  // do on change
	  $('#country').change(function() {
		  
		  if($(this).val() == 'other'){
			  
			  $('#country_other_display').show().effect('highlight', {}, 3000);
			  
		  } else {
			  
			  $('#country_other').val('');
			  $('#country_other_display').hide();
		  };
	  });
  });
}
// end function

// load the questions based on payment items selected
// ==================================================
function load_questions(event_id){
	
	var ids  = new Array();
	var str_id = '';
	
	// get all selections in the transactions_box and place in an array
	
	// payments
	$('#transactions_box :checkbox').each(function(){
		
		if($(this).attr('checked')) {		
		ids.push(this.id);
		}
	});
	
	// multiple choice registrations
	$('#transactions_box :radio').each(function(){
		if($(this).attr('checked')) {
		ids.push(this.id);
		}
	});
	
	// donations
	$('#transactions_box :text').each(function(){
	
		if(($(this).val()) > 0){
		ids.push(this.id);
		}
	});
	
	// tickets
	$('#transactions_box select').each(function(){
	
		if($(this).val() > 0){
		ids.push(this.id);
		}
	});
	
	// create id string
	for (var i = 0; i < ids.length; i++) {
	str_id = str_id + ids[i] + '.';
	}
	
	// send to confirmation fields processing page
	var url = https_host() + "/register/load_questions/" + event_id + "/" + str_id;
	
	// ajax function loads the page into the target div
	$('#process_conditions').load(url);
}
// end function

// function to clear question selections
function ClearQuestions(){
	
	$('#question_container :radio').each(function(){
		$(this).attr('checked', false);
	});
	
	$('#question_container :checkbox').each(function(){
		$(this).attr('checked', false);
	});
	
	$('#question_container select').val(0);
}	
// end function



// toggle page loading message
function page_loading(action){
	
	if(action == 'on'){
		
		// show page loading message
		document.getElementById('page_body').style.display = 'none';
		document.getElementById('page_loading').style.display = 'block';
		scroll(0,0);
		
	} else if(action == 'off'){
		
		// hide page loading message
		document.getElementById('page_loading').style.display = 'none';
		document.getElementById('page_body').style.display = 'block';
	}
}
// end if


function cornersRound(id,rad_top,rad_bottom){

	settings = 
	{
	tl: { radius: rad_top },
	tr: { radius: rad_top },
	bl: { radius: rad_bottom },
	br: { radius: rad_bottom },
	antiAlias: true,
	autoPad: false
    }

    var cornersRoundObj = new curvyCorners(settings, document.getElementById(id));
    cornersRoundObj.applyCornersToAll();
	
	var cornersRoundObj = null; 

} 


// page loading with round corners
function page_loading_round(){

	// round corners
	cornersRound('curvyDiv','14','14');
	
	// hide page loading message
	document.getElementById('page_loading').style.display = 'none';
	document.getElementById('page_body').style.display = 'block';

}


// page loading with square corners
function page_loading_square(){

	// hide page loading message
	document.getElementById('page_loading').style.display = 'none';
	document.getElementById('page_body').style.display = 'block';

}


// function to reset the hit counter
function ResetHitCounter(){
	cmsg = "Are you sure you want to reset the page views?  This will set the number back to zero.";
	if (confirm(cmsg)) {
	document.getElementById('form1').submit();
	}
}
// end function



// function to clear purchase selections
function ClearPurchases(){
	
	$('#transaction_container :radio').each(function(){
		$(this).attr('checked', false);
	});
	
	$('#transaction_container :checkbox').each(function(){
		$(this).attr('checked', false);
	});
	
	$('#transaction_container :text').each(function(){
		$(this).val('');
	});

	$('#transaction_container select').val(0);
}	
// end function


// purchase countdown
function countdown(element,minutes,seconds) {
	var interval = setInterval(function() {
		var el = document.getElementById(element);
		if(seconds == 0) {
			if(minutes == 0) {
				el.innerHTML = "no more time";                    
				clearInterval(interval);
				alert('Time is up');
				
				// show time messages
				if(document.getElementById('payment')){
				document.getElementById('payment').style.display = 'none';
				}
				
				if(document.getElementById('time_remaining')){
				document.getElementById('time_remaining').style.display = 'none';
				}
				
				if(document.getElementById('time_expired')){
				document.getElementById('time_expired').style.display = 'block';
				}
				
				if(document.getElementById('try_again')){
				document.getElementById('try_again').style.display = 'block';
				}
				
				// disable form
				disable_form('form1');
				
				if(document.getElementById('try_again_button')){
				document.getElementById('try_again_button').disabled = false;
				}
				
				return;
				
			} else {
				minutes--;
				seconds = 60;
			}
		}
		if(minutes > 0) {
			var minute_text = minutes + (minutes > 1 ? ' minutes' : ' minute');
		} else {
			var minute_text = '';
		}
		var second_text = seconds > 1 ? 'seconds' : 'second';
		el.innerHTML = minute_text + ' ' + seconds + ' ' + second_text;
		seconds--;
	}, 1000);
}
// end function


// preview warning
function PreviewWarning(){
	
	var warning_message = "Your event preview will appear in a seperate window.\n\n If you have a pop up blocker you will need to turn it off to preview your event";
	alert(warning_message);
}
// end function


// invoice warning
function InvoiceWarning(){
	
	var warning_message = "Your invoice will appear in a seperate window.\n\n If you have a pop up blocker you will need to turn it off to view your invoice";
	alert(warning_message);
}
// end function


// preview
function Preview(url){
	
	var warning_message = "Your event preview will appear in a seperate window.\n\n If you have a pop up blocker you will need to turn it off to preview your event";
	alert(warning_message);
	
	window.open(url);		
	
}
// end function


// clear payment method
function ClearPaymentMethod(){
	
	if(document.getElementById('payment_method1')){
	document.getElementById('payment_method1').checked = false;
	}
	
	if(document.getElementById('payment_method2')){
	document.getElementById('payment_method2').checked = false;
	}
	
	if(document.getElementById('payment_method3')){
	document.getElementById('payment_method3').checked = false;
	}
	
	return false;
}
// end function


// cancel warning
function CancelWarning(saved,url){
	
	if(saved != "yes"){
	
		var warning_message = "You have not saved changes on this page.\n\nAre you sure you want to continue?\n\nSelect OK to proceed without saving changes.\n\nSelect Cancel to stay on this page and save changes.";
		
			cmsg = warning_message;
			if(!(confirm(cmsg))) {
			return false;		
			} else {
			window.location.href = url;
			}
		
	} else {
	window.location.href = url;
	}
}
// end function


// nav warning pop up message
function NavWarning(event_id,submission_type,url){
	
	var nav_warning = document.getElementById('nav_warning').value;
		
	if((event_id == '') || (submission_type == 'copy')){
	alert ("\nERROR\n\nAn event ID has not been created.\n\nYou must save the event information page before proceeding.");
	return false;
	}
	
	if(nav_warning == 1){
	
		var warning_message = "WARNING: You have not saved the form.";
		
			cmsg = warning_message;
			if(!(confirm(cmsg))) {
			return false;		
			} else {
			
				if(submission_type == "invoice"){
				// open in new window for invoices
				window.open(url);		
				} else {
				// open in same window for all others
				window.location.href = url;
				}
			
			}
		
	} else {
	
		if(submission_type == "invoice"){
		// open in new window for invoices
		window.open(url);		
		} else {
		// open in same window for all others
		window.location.href = url;
		}
	}
}
// end function

// generic nav warning
function NavWarningHost(promoter_id, url){
	
	var nav_warning = document.getElementById('nav_warning').value;
	
	if((promoter_id == '') || (promoter_id == 0)){
	alert ("\nERROR\n\nA host ID has not been created.\n\nYou must save the host information page before proceeding.");
	return false;
	}
	
	if(nav_warning == 1){
	
		if(!(confirm('WARNING: You have not saved the form.'))) {
		return false;		
		} else {
		window.location.href = url;
		}
	} else {
	window.location.href = url;
	}
}
// end function

// set nav warning
function SetNavWarning(){
	
	document.getElementById('nav_warning').value = 1;
}
// end function

// unpublish
function publish_event(action){
	
	if(action == "unpublish"){
		var warning_message = "Are you sure you want to unpublish this event?\n\nWARNING\n\nThis option will close the event page and associated registration pages\nto all registrants until the event is published again.";
		
		cmsg = warning_message;
		if(!(confirm(cmsg))) {
		return false;		
		} else {
		document.getElementById('published').value = 'no';
		document.getElementById('form1').submit();
		}
	} else {
	document.getElementById('published').value = 'yes';
	document.getElementById('form1').submit();
	}
}
// end function


// switch cover image
function SwitchCoverImage(show_image){
	
	document.getElementById('cover_image_0').style.display = 'none';
	document.getElementById('cover_image_1').style.display = 'none';
	document.getElementById('cover_image_2').style.display = 'none';
	document.getElementById('cover_image_3').style.display = 'none';
	document.getElementById('cover_image_4').style.display = 'none';
	document.getElementById('cover_image_5').style.display = 'none';
	
	document.getElementById(show_image).style.display = 'block';
	
}
// end function


// url form handler
function goto_URL(object) {
window.location.href = object.options[object.selectedIndex].value;
}
// end function

// go to url
function gotoURL (url){
	window.location.href = url;	
}

// include event header input
function IncludeCustomHeader(){

	if (document.getElementById('include_custom_header').checked==true) {
	document.getElementById('include_custom_header_table').style.display = 'block';
	} else {
	document.getElementById('include_custom_header_table').style.display = 'none';
	}
}
// end function


// include event header input
function IncludeCustomFooter(){

	if (document.getElementById('include_custom_footer').checked==true) {
	document.getElementById('include_custom_footer_table').style.display = 'block';
	} else {
	document.getElementById('include_custom_footer_table').style.display = 'none';
	}
}
// end function


// calulator currency selection
function CalculatorCurrency(){
	
	var object = document.getElementById('event_currency');
	var event_currency = object.options[object.selectedIndex].value;
	var currency_symbol = '';
		
		if(event_currency == "AUD"){
		document.getElementById('display_fees').innerHTML = '(3.9 percent of the registrant payment amount plus $0.30 AUD per transaction)';
		currency_symbol = '$';
		
		} else if(event_currency == "CAD"){
		document.getElementById('display_fees').innerHTML = '(3.9 percent of the registrant payment amount plus $0.30 CAD per transaction)';
		currency_symbol = '$';
		
		} else if(event_currency == "EUR"){
		document.getElementById('display_fees').innerHTML = '(3.9 percent of the registrant payment amount plus €0.35 EUR per transaction)';
		currency_symbol = '€';
		
		} else if(event_currency == "GBP"){
		document.getElementById('display_fees').innerHTML = '(3.9 percent of the registrant payment amount plus £0.20 GBP per transaction)';
		currency_symbol = '£';
		
		} else if(event_currency == "NZD"){
		document.getElementById('display_fees').innerHTML = '(3.9 percent of the registrant payment amount plus $0.45 NZD per transaction)';
		currency_symbol = '$';
		
		} else if(event_currency == "USD"){
		document.getElementById('display_fees').innerHTML = '(2.9 percent of the registrant payment amount plus $0.30 USD per transaction)';
		currency_symbol = '$';
		}

	document.getElementById('currency_selected1').innerHTML = currency_symbol;
	document.getElementById('currency_selected2').innerHTML = currency_symbol;
	document.getElementById('currency_selected3').innerHTML = currency_symbol;
	document.getElementById('currency_selected4').innerHTML = currency_symbol;
	document.getElementById('currency_selected5').innerHTML = currency_symbol;
	document.getElementById('currency_selected6').innerHTML = currency_symbol;
	document.getElementById('currency_selected7').innerHTML = currency_symbol;
}
// end function

// change password protect enter box on event edit page
function event_password(){
	
	$('#event_password').unbind();
	
	if(document.getElementById('event_password').value == 'Enter Password'){
		
		document.getElementById('event_password').value = '';
		
	} else if(document.getElementById('event_password').value == ''){
	
		document.getElementById('event_password').value = 'Enter Password';
	}
}
// end function


// promoter information
function PromoterForm(){
	
	document.getElementById('promoter_name').style.background='#FFFFFF';
	document.getElementById('promoter_name').disabled = false;
	document.getElementById('promoter_name').value = '';
	
	document.getElementById('promoter_description').style.background='#FFFFFF';
	document.getElementById('promoter_description').disabled = false;
	document.getElementById('promoter_description').value = '';
	
}
// end function


// promoter information reset
function PromoterFormReset(){
	
	document.getElementById('promoter_name').style.background='#A8C5E6';
	document.getElementById('promoter_name').disabled = true;
	
	document.getElementById('promoter_description').style.background='#A8C5E6';
	document.getElementById('promoter_description').disabled = true;
	
}
// end function


function showFeePercent() {
	var	selection = document.getElementById('ezregister_fee_payer').selectedIndex;
	if (selection == "3"){
	document.getElementById('fee_payer_percent').style.display = 'block';
	document.getElementById('promoter_percent_ez').value = '';
	} else {
	document.getElementById('fee_payer_percent').style.display = 'none';
	document.getElementById('promoter_percent_ez').value = '';
	}
}
// end function


function selectCurrency() {
	
	var	selection = document.getElementById('currency').selectedIndex;
	
	if (selection == "1"){
	document.getElementById('currency_symbol_1').innerHTML = '$';
	document.getElementById('currency_symbol_2').innerHTML = '$';
	document.getElementById('currency_symbol_3').innerHTML = '$';
	document.getElementById('currency_symbol_4').innerHTML = '$';
	document.getElementById('currency_symbol_5').innerHTML = '$';
	document.getElementById('currency_symbol_6').innerHTML = '$';
	} else if(selection == "2"){
	document.getElementById('currency_symbol_1').innerHTML = '$';
	document.getElementById('currency_symbol_2').innerHTML = '$';
	document.getElementById('currency_symbol_3').innerHTML = '$';
	document.getElementById('currency_symbol_4').innerHTML = '$';
	document.getElementById('currency_symbol_5').innerHTML = '$';
	document.getElementById('currency_symbol_6').innerHTML = '$';
	} else if(selection == "3"){
	document.getElementById('currency_symbol_1').innerHTML = '&euro;';
	document.getElementById('currency_symbol_2').innerHTML = '&euro;';
	document.getElementById('currency_symbol_3').innerHTML = '&euro;';
	document.getElementById('currency_symbol_4').innerHTML = '&euro;';
	document.getElementById('currency_symbol_5').innerHTML = '&euro;';
	document.getElementById('currency_symbol_6').innerHTML = '&euro;';
	} else if(selection == "4"){
	document.getElementById('currency_symbol_1').innerHTML = '&pound;';
	document.getElementById('currency_symbol_2').innerHTML = '&pound;';
	document.getElementById('currency_symbol_3').innerHTML = '&pound;';
	document.getElementById('currency_symbol_4').innerHTML = '&pound;';
	document.getElementById('currency_symbol_5').innerHTML = '&pound;';
	document.getElementById('currency_symbol_6').innerHTML = '&pound;';
	} else if(selection == "5"){
	document.getElementById('currency_symbol_1').innerHTML = '$';
	document.getElementById('currency_symbol_2').innerHTML = '$';
	document.getElementById('currency_symbol_3').innerHTML = '$';
	document.getElementById('currency_symbol_4').innerHTML = '$';
	document.getElementById('currency_symbol_5').innerHTML = '$';
	document.getElementById('currency_symbol_6').innerHTML = '$';
	}
}
// end function


function validateFees(){
	
	var	fee_payer_selected = document.getElementById('ezregister_fee_payer').selectedIndex;
	var	currency_selected = document.getElementById('event_currency').selectedIndex;
	
	if (currency_selected == "0"){
	alert("ERROR: Select a currency");
	return false;
	}
	
	if (document.getElementById('payment_amount').value == ''){
	alert("ERROR: Enter a transaction amount");
	return false;
	}
	
	if (isNaN(document.getElementById('payment_amount').value)){
	alert("ERROR: Numbers only in transaction amount");
	return false;
	}
	
	if (document.getElementById('payment_amount').value < 0){
	alert("ERROR: Enter transaction amount must be a positive number");
	return false;
	}
	
	if (fee_payer_selected == "0"){
	alert("ERROR: Select a fee payer");
	return false;
	}
		
	if (fee_payer_selected == "3"){
		if(document.getElementById('promoter_percent_ez').value == ''){
		alert ("ERROR: Enter a percent value");
		return false;
		}
		
		if (isNaN(document.getElementById('promoter_percent_ez').value)){
		alert("ERROR: Numbers only in percent value");
		return false;
		}
		
		if (document.getElementById('promoter_percent_ez').value > 100 || document.getElementById('promoter_fee_percent').value < 0){
		alert ("ERROR: percent value must be between 0 and 100");
		return false;
		}
	}
}
// end function


function AutoFill(login_member_id,first_name,last_name,company,job_title,address,city,state,state_other,zip_code,country,country_other,email_address,phone,gender,age) {

	// checked
	if(document.getElementById('autofill').checked == true){
	
		if(document.getElementById('first')){
		document.getElementById('first').value = first_name;
		}
		
		if(document.getElementById('last')){
		document.getElementById('last').value = last_name;
		}
		
		if(document.getElementById('company')){
		document.getElementById('company').value = company;
		}
		
		if(document.getElementById('title')){
		document.getElementById('title').value = job_title;
		}
		
		if(document.getElementById('address')){
		document.getElementById('address').value = address;
		}
		
		if(document.getElementById('city')){
		document.getElementById('city').value = city;
		}
		
		if(document.getElementById('state')){
			var indexVal = document.getElementById('state').length;
			for(x=0; x<indexVal;x++) {
				if (document.getElementById('state').options[x].value == state) {
				document.getElementById('state').selectedIndex = x;
				}
			}
			
			if(state == 'other'){
			document.getElementById('state_other_display').style.display = 'block';
			document.getElementById('state_other').value = state_other;
			}
		}
		
		if(document.getElementById('zip')){
		document.getElementById('zip').value =  zip_code;
		}
		
		if(document.getElementById('country')){
			var indexVal = document.getElementById('country').length;
			for(x=0; x<indexVal;x++) {
				if (document.getElementById('country').options[x].value == country) {
				document.getElementById('country').selectedIndex = x;
				}
			}
			
			if(country == 'other'){
			document.getElementById('country_other_display').style.display = 'block';
			document.getElementById('country_other').value = country_other;
			}
		}
		
		if(document.getElementById('email1')){
		document.getElementById('email1').value = email_address;
		document.getElementById('email2').value = email_address;
		}
		
		if(document.getElementById('phone')){
		document.getElementById('phone').value = phone;
		}
		
		if(document.getElementById('male')){
			if(gender == "male"){
			document.getElementById('male').checked = true;
			}
		}
		
		if(document.getElementById('female')){
			if(gender == "female"){
			document.getElementById('female').checked = true;
			}
		}
		
		if(document.getElementById('age')){
		document.getElementById('age').value = age;
		}
	
	// unchecked
	} else {
		
		if(document.getElementById('first')){
		document.getElementById('first').value = "";
		}
		
		if(document.getElementById('last')){
		document.getElementById('last').value = "";
		}
		
		if(document.getElementById('email1')){
		document.getElementById('email1').value = "";
		document.getElementById('email2').value = "";
		}
		
		if(document.getElementById('company')){
		document.getElementById('company').value = "";
		}
		
		if(document.getElementById('title')){
		document.getElementById('title').value = "";
		}
		
		if(document.getElementById('country')){
		document.getElementById('country').selectedIndex = 0;
		}
		
		if (document.getElementById('country_other')) {
			document.getElementById('country_other').value = '';
			// document.getElementById('country_other_display').style.display = 'none';
		};
		
		if(document.getElementById('address')){
		document.getElementById('address').value = "";
		}
		
		if(document.getElementById('city')){
		document.getElementById('city').value = "";
		}
		
		if(document.getElementById('state')){
		document.getElementById('state').selectedIndex = 0;
		}
		
		if (document.getElementById('state_other')) {
			document.getElementById('country_other').value = '';
			// document.getElementById('state_other_display').style.display = 'none';
		};
		
		if(document.getElementById('zip')){
		document.getElementById('zip').value =  "";
		}
		
		if(document.getElementById('phone')){
		document.getElementById('phone').value = "";
		}
		
		if(document.getElementById('male')){
		document.getElementById('male').checked = false;
		}
		
		if(document.getElementById('female')){
		document.getElementById('female').checked = false;
		}
		
		if(document.getElementById('age')){
		document.getElementById('age').value = "";
		}
	}

}
// end function


function AutoFillPaymentOptions(first_name,last_name,company,address,city,state,zip_code,country,email_address){
	//document.form1.reset();
	
	// checked state
	
	//if (document.getElementById('same_box').value == '') {
	if (document.getElementById('same_box').checked==true) {
		
		if(document.getElementById('receiver_first_name')){
		document.getElementById('receiver_first_name').value = first_name;
		}
		if(document.getElementById('receiver_last_name')){
		document.getElementById('receiver_last_name').value = last_name;
		}
		if(document.getElementById('receiver_company')){
		document.getElementById('receiver_company').value = company;
		}
		if(document.getElementById('receiver_payable')){
		
			// use company name if available otherwise just use name
			if(company != ''){
			document.getElementById('receiver_payable').value = company;
			} else {
			document.getElementById('receiver_payable').value = first_name + ' ' + last_name;
			}
		
		}
		if(document.getElementById('receiver_address')){
		document.getElementById('receiver_address').value = address;
		}
		if(document.getElementById('receiver_city')){
		document.getElementById('receiver_city').value = city;
		}
		
		//document.getElementById('state').value = "";
		
		if(document.getElementById('receiver_zip_code')){
		document.getElementById('receiver_zip_code').value =  zip_code;
		}
		
		//document.getElementById('country').value = "";
		
		if(document.getElementById('receiver_email')){
		document.getElementById('receiver_email').value = email_address;
		}
		
		// reset box value to no for unchecked state
		document.getElementById('same_box').value = 'yes';
	
	//} else if(document.getElementById('same_box').value == 'yes'){
	} else if(document.getElementById('same_box').checked==false){
		
		if(document.getElementById('receiver_first_name')){
		document.getElementById('receiver_first_name').value = '';
		}
		if(document.getElementById('receiver_last_name')){
		document.getElementById('receiver_last_name').value = '';
		}
		if(document.getElementById('receiver_company')){
		document.getElementById('receiver_company').value = '';
		}
		if(document.getElementById('receiver_payable')){
		document.getElementById('receiver_payable').value = '';
		}
		if(document.getElementById('receiver_address')){
		document.getElementById('receiver_address').value = '';
		}
		if(document.getElementById('receiver_city')){
		document.getElementById('receiver_city').value = '';
		}
		
		//document.getElementById('state').value = "";
		
		if(document.getElementById('receiver_zip_code')){
		document.getElementById('receiver_zip_code').value = '';
		}
		
		//document.getElementById('country').value = "";
		
		if(document.getElementById('receiver_email')){
		document.getElementById('receiver_email').value = '';
		}
		
		// reset box value to no for unchecked state
		document.getElementById('same_box').value = 'no';

	}
	
}
// end function


function AutoFillPromoter(first_name,last_name,company,address,city,state,state_other,zip_code,country,country_other,email_address,phone){
	
	// checked
	if (document.getElementById('same_box_promoter').checked==true) {
		
		document.getElementById('promoter_first_name').value = first_name;
		document.getElementById('promoter_last_name').value = last_name;
		document.getElementById('promoter_company').value = company;
		
			// use company name if available otherwise just use name
			if(company != ''){
			document.getElementById('promoter_payable').value = company;
			} else {
			document.getElementById('promoter_payable').value = first_name + " " + " " + last_name;
			}
		
		document.getElementById('promoter_address').value = address;
		document.getElementById('promoter_city').value = city;
		
		var indexVal = document.getElementById('promoter_state').length;
		for(x=0; x<indexVal;x++) {
			if (document.getElementById('promoter_state').options[x].value == state) {
			document.getElementById('promoter_state').selectedIndex = x;
			}
		}
		
		if(state == 'other'){
		document.getElementById('promoter_state_other_display').style.display = 'block';
		document.getElementById('promoter_state_other').value = state_other;
		}
		
		document.getElementById('promoter_zip_code').value =  zip_code;
		
		var indexVal = document.getElementById('promoter_country').length;
		for(x=0; x<indexVal;x++) {
			if (document.getElementById('promoter_country').options[x].value == country) {
			document.getElementById('promoter_country').selectedIndex = x;
			}
		}
		
		if(country == 'other'){
		document.getElementById('promoter_country_other_display').style.display = 'block';
		document.getElementById('promoter_country_other').value = country_other;
		}
		
		document.getElementById('promoter_email').value = email_address;
		document.getElementById('promoter_phone').value = phone;
	
	// unchecked
	} else {
		
		document.getElementById('promoter_first_name').value = '';
		document.getElementById('promoter_last_name').value = '';
		document.getElementById('promoter_company').value = '';
		document.getElementById('promoter_payable').value = '';
		document.getElementById('promoter_address').value = '';
		document.getElementById('promoter_city').value = '';
		document.getElementById('promoter_state').selectedIndex = 0;
		document.getElementById('promoter_state_other').value = '';
		document.getElementById('promoter_state_other_display').style.display = 'none';
		
		document.getElementById('promoter_zip_code').value = '';
		document.getElementById('promoter_country').selectedIndex = 0;
		document.getElementById('promoter_country_other').value = '';
		document.getElementById('promoter_country_other_display').style.display = 'none';
		
		document.getElementById('promoter_email').value = '';
		document.getElementById('promoter_phone').value = '';
	}
	
}
// end function


// navigation links

	function GoTo(page,saved,event_id,submission_type) {
		
		var warning_message = "You have not saved changes on this page.\n\nAre you sure you want to continue?\n\nSelect OK to proceed without saving changes.\n\nSelect Cancel to stay on this page and save changes.";
		
		if((event_id == '') || (submission_type == 'copy')){
		alert ("\nERROR\n\nAn event ID has not been created.\n\nYou must save the form from the information page before proceeding.");
		} else {
			if (page == "event") {
				if (saved != "yes") {
					cmsg = warning_message;
					if (confirm(cmsg)) {
						window.location = http_host() + "/event_edit/event/?event_id=" + event_id + "&submission_type=edit";
					}
				} else {
					window.location = http_host() + "/event_edit/event/?event_id=" + event_id + "&submission_type=edit";
				}
				
			} else if (page == "promoter") {
				if (saved != "yes") {
					cmsg = warning_message;
					if (confirm(cmsg)) {
						window.location = http_host() + "/event_edit/promoter/?event_id=" + event_id + "&submission_type=edit";
					}
				} else {
					window.location = http_host() + "/event_edit/promoter/?event_id=" + event_id + "&submission_type=edit";
				}
				
			} else if (page == "registration") {
				if (saved != "yes") {
					cmsg = warning_message;
					if (confirm(cmsg)) {
						window.location = http_host() + "/event_edit/registration/?event_id=" + event_id + "&submission_type=edit";
					}
				} else {
					window.location = http_host() + "/event_edit/registration/?event_id=" + event_id + "&submission_type=edit";
				}
				
			} else if (page == "payment") {
				if (saved != "yes") {
					cmsg = warning_message;
					if (confirm(cmsg)) {
						window.location = http_host() + "/event_edit/payment/?event_id=" + event_id + "&submission_type=edit";
					}
				} else {
					window.location = http_host() + "/event_edit/payment/?event_id=" + event_id + "&submission_type=edit";
				}
			
			} else if (page == "transactions") {
				if (saved != "yes") {
					cmsg = warning_message;
					if (confirm(cmsg)) {
						window.location = http_host() + "/event_edit/transactions/?event_id=" + event_id + "&submission_type=edit";
					}
				} else {
					window.location = http_host() + "/event_edit/transactions/?event_id=" + event_id + "&submission_type=edit";
				}
			
			} else if (page == "questions") {
				if (saved != "yes") {
					cmsg = warning_message;
					if (confirm(cmsg)) {
						window.location = http_host() + "/event_edit/questions/?event_id=" + event_id + "&submission_type=edit";
					}
				} else {
					window.location = http_host() + "/event_edit/questions/?event_id=" + event_id + "&submission_type=edit";
				}
				
			} else if (page == "styles") {
				if (saved != "yes") {
					cmsg = warning_message;
					if (confirm(cmsg)) {
						window.location = http_host() + "/event_edit/styles/?event_id=" + event_id + "&submission_type=edit";
					}
				} else {
					window.location = http_host() + "/event_edit/styles/?event_id=" + event_id + "&submission_type=edit";
				}
				
			} else if (page == "publish") {
				if (saved != "yes") {
					cmsg = warning_message;
					if (confirm(cmsg)) {
						window.location = http_host() + "/event_edit/publish/?event_id=" + event_id + "&submission_type=edit";
					}
				} else {
					window.location = http_host() + "/event_edit/publish/?event_id=" + event_id + "&submission_type=edit";
				}
			}
		}
	}
	// end function

// end navigation links



function AddEvent() {
	// go to page
	window.location = http_host() + "/event_edit/event/?submission_type=new";
}
// end function

function NoSubmit() {
alert ("The form was not submitted because this event is unpublished and this is only a preview version.");
}
// end function


// highlight link
function Highlight(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")
}
// end function


// option handler (for questions)
function do_questions(question_type,object_id) {
	
	var question_type_id = "question_type" + object_id;
	var selection = document.getElementById(question_type_id).selectedIndex;
	var submit_button = "submit_button" + object_id;
		
	if (question_type != "") {
		
		// give warning if question is changed to a single field type
		if ((selection == "0") ||  (selection == "1") || (selection == "2")) {
			
			cmsg = "Are you sure you want to change the question to a single field type?\n\nWARNING: Any previously associated answer choices for this question will be deleted.";
			if (confirm(cmsg)) {
				
				// assign values to the submit button depending on choice selected
				if ((selection == "0") || (selection == "1") || (selection == "2")) {
				document.getElementById(submit_button).value = 'Save';
				} else if ((selection == "3") || (selection == "4") || (selection == "5")) {
				document.getElementById(submit_button).value = 'Next >>';
				}
				
			} else {
				
				// otherwise just keep list selected state from the original value
				if (question_type == 'textfield') {
				document.getElementById(question_type_id).selectedIndex = 1;
				} else if (question_type == 'textarea') {
				document.getElementById(question_type_id).selectedIndex = 2;
				} else if (question_type == 'radio') {
				document.getElementById(question_type_id).selectedIndex = 3;
				} else if (question_type == 'list') {
				document.getElementById(question_type_id).selectedIndex = 4;
				} else if (question_type == 'checkbox') {
				document.getElementById(question_type_id).selectedIndex = 5;
				}				
			}
			
		} else {
			
			if ((selection == "0") || (selection == "1") || (selection == "2")) {
			document.getElementById(submit_button).value = 'Save';
			} else if ((selection == "3") || (selection == "4") || (selection == "5")) {
			alert ("Define multiple choice answers for this question on next page.");
			document.getElementById(submit_button).value = 'Next >>';
			}
		}
		
	} else {
			
		// assign values to the submit button depending on choice selected
		if ((selection == "0") || (selection == "1") || (selection == "2")) {
		document.getElementById(submit_button).value = 'Add';
		} else if ((selection == "3") || (selection == "4") || (selection == "5")) {
		alert ("Define multiple choice answers for this question on next page.");
		document.getElementById(submit_button).value = 'Next >>';
		}
	}
}
// end function


// option handler (for transactions)
function do_transactions(transaction_type,object_id) {
	
	var transaction_type_id = "transaction_type" + object_id;
	var show_payment_options_id = "show_payment_options_" + object_id;
	var show_category_links_id = "show_category_links_" + object_id;
	var show_donation_option_id = "show_donation_option_" + object_id;
	var show_transaction_limit_id = "show_transaction_limit_" + object_id;
	var show_transaction_limit_none_id = "show_transaction_limit_none_" + object_id;
	var show_max_tickets_id = "show_max_tickets_" + object_id;
	

	var selection = document.getElementById(transaction_type_id).selectedIndex;
	var submit_button = "submit_button" + object_id;
		
	if (transaction_type != "") {
		
		// for edit fields
		// give warning if transaction is changed to a single field type
		if (((transaction_type == "registration")) && ((selection == "2") || (selection == "3") || (selection == "4"))) {
			
			cmsg = "NOTICE: Are you sure you want to change the transaction to a single field type?\n\nWARNING: Any previously associated categories for this transaction will be deleted.";
			if (confirm(cmsg)) {
				
				// assign values to the submit button depending on choice selected
				if (selection == "0") {
				document.getElementById(submit_button).value = 'Save';
				document.getElementById(show_payment_options_id).style.display = 'block';
				document.getElementById(show_category_links_id).style.display = 'none';
				document.getElementById(show_donation_option_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'none';
				document.getElementById(show_transaction_limit_none_id).style.display = 'none';
				document.getElementById(show_max_tickets_id).style.display = 'none';
				
				} else if (selection == "1") {
				alert ("NOTICE: A multiple choice transaction type allows registrants to choose from a list of possible registration categories.  Define categories and limits with each category on next page.");
				document.getElementById(submit_button).value = 'Next >>';
				document.getElementById(show_category_links_id).style.display = 'block';
				document.getElementById(show_payment_options_id).style.display = 'none';
				document.getElementById(show_donation_option_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'none';
				document.getElementById(show_transaction_limit_none_id).style.display = 'block';
				document.getElementById(show_max_tickets_id).style.display = 'none';
				
				} else if (selection == "2") {
				alert ("NOTICE: A ticket transaction type allows registrants to select multiple tickets from 1 to the maximum ticket order.");
				document.getElementById(submit_button).value = 'Save';
				document.getElementById(show_payment_options_id).style.display = 'block';
				document.getElementById(show_category_links_id).style.display = 'none';
				document.getElementById(show_donation_option_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'block';
				document.getElementById(show_transaction_limit_none_id).style.display = 'none';
				document.getElementById(show_max_tickets_id).style.display = 'block';
				
				} else if (selection == "3") {
				alert ("NOTICE: Donations are set as an undefined blank amount to be determined by the registrant.\n\nIf you wish to collect a set amount choose the ticket or payment type instead.");
				document.getElementById(submit_button).value = 'Save';
				document.getElementById(show_donation_option_id).style.display = 'block';
				document.getElementById(show_payment_options_id).style.display = 'none';
				document.getElementById(show_category_links_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'none';
				document.getElementById(show_transaction_limit_none_id).style.display = 'block';
				document.getElementById(show_max_tickets_id).style.display = 'none';
				
				} else if (selection == "4") {
				alert ("NOTICE: A payment transaction type allows registrants to pay a set amount for a single purchase only such as selling an item, membership, or subscription.  If you want to collect a user defined amount or for multiple items then choose the donation or ticket type instead.");
				document.getElementById(submit_button).value = 'Save';
				document.getElementById(show_payment_options_id).style.display = 'block';
				document.getElementById(show_category_links_id).style.display = 'none';
				document.getElementById(show_donation_option_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'block';
				document.getElementById(show_transaction_limit_none_id).style.display = 'none';
				document.getElementById(show_max_tickets_id).style.display = 'none';
				}
				
			} else {
				
				// otherwise just keep list selected state from the original value
				if (transaction_type == 'registration') {
				document.getElementById(transaction_type_id).selectedIndex = 1;
				document.getElementById(show_category_links_id).style.display = 'block';
				document.getElementById(show_payment_options_id).style.display = 'none';
				document.getElementById(show_donation_option_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'none';
				document.getElementById(show_transaction_limit_none_id).style.display = 'block';
				document.getElementById(show_max_tickets_id).style.display = 'none';
				
				} else if (transaction_type == 'ticket') {
				document.getElementById(transaction_type_id).selectedIndex = 2;
				document.getElementById(show_payment_options_id).style.display = 'block';
				document.getElementById(show_category_links_id).style.display = 'none';
				document.getElementById(show_donation_option_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'block';
				document.getElementById(show_transaction_limit_none_id).style.display = 'none';
				document.getElementById(show_max_tickets_id).style.display = 'block';
				
				} else if (transaction_type == 'donation') {
				document.getElementById(transaction_type_id).selectedIndex = 3;
				document.getElementById(show_donation_option_id).style.display = 'block';
				document.getElementById(show_payment_options_id).style.display = 'none';
				document.getElementById(show_category_links_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'none';
				document.getElementById(show_transaction_limit_none_id).style.display = 'block';
				document.getElementById(show_max_tickets_id).style.display = 'none';
				
				} else if (transaction_type == 'payment') {
				document.getElementById(transaction_type_id).selectedIndex = 4;
				document.getElementById(show_payment_options_id).style.display = 'block';
				document.getElementById(show_category_links_id).style.display = 'none';
				document.getElementById(show_donation_option_id).style.display = 'none';
				document.getElementById(show_transaction_limit_id).style.display = 'block';
				document.getElementById(show_transaction_limit_none_id).style.display = 'none';
				document.getElementById(show_max_tickets_id).style.display = 'none';
				}
			}
			
		} else {
			
			if (selection == "0") {
			document.getElementById(submit_button).value = 'Save';
			document.getElementById(show_payment_options_id).style.display = 'block';
			document.getElementById(show_category_links_id).style.display = 'none';
			document.getElementById(show_donation_option_id).style.display = 'none';
			document.getElementById(show_transaction_limit_id).style.display = 'none';
			document.getElementById(show_transaction_limit_none_id).style.display = 'none';
			document.getElementById(show_max_tickets_id).style.display = 'none';
			
			} else if ((selection == "1")) {
			alert ("NOTICE: A multiple choice transaction type allows registrants to choose from a list of possible registration categories.  Define categories and limits with each category on next page.");
			document.getElementById(submit_button).value = 'Next >>';
			document.getElementById(show_category_links_id).style.display = 'block';
			document.getElementById(show_payment_options_id).style.display = 'none';
			document.getElementById(show_donation_option_id).style.display = 'none';
			document.getElementById(show_transaction_limit_id).style.display = 'none';
			document.getElementById(show_transaction_limit_none_id).style.display = 'block';
			document.getElementById(show_max_tickets_id).style.display = 'none';
			
			} else if (selection == "2") {
			alert ("NOTICE: A ticket transaction type allows registrants to select multiple tickets from 1 to the maximum ticket order.");
			document.getElementById(submit_button).value = 'Save';
			document.getElementById(show_payment_options_id).style.display = 'block';
			document.getElementById(show_category_links_id).style.display = 'none';
			document.getElementById(show_donation_option_id).style.display = 'none';
			document.getElementById(show_transaction_limit_id).style.display = 'block';
			document.getElementById(show_transaction_limit_none_id).style.display = 'none';
			document.getElementById(show_max_tickets_id).style.display = 'block';
			
			} else if (selection == "3") {
			alert ("NOTICE: Donations are set as an undefined blank amount to be determined by the registrant.\n\nIf you wish to collect a set amount choose the ticket or payment type instead.");
			document.getElementById(submit_button).value = 'Save';
			document.getElementById(show_donation_option_id).style.display = 'block';
			document.getElementById(show_payment_options_id).style.display = 'none';
			document.getElementById(show_category_links_id).style.display = 'none';
			document.getElementById(show_transaction_limit_id).style.display = 'none';
			document.getElementById(show_transaction_limit_none_id).style.display = 'block';
			document.getElementById(show_max_tickets_id).style.display = 'none';
			
			} else if (selection == "4") {
			alert ("NOTICE: A payment transaction type allows registrants to pay a set amount for a single purchase only such as selling an item, membership, or subscription.  If you want to collect a user defined amount or for multiple items then choose the donation or ticket type instead.");
			document.getElementById(submit_button).value = 'Save';
			document.getElementById(show_payment_options_id).style.display = 'block';
			document.getElementById(show_category_links_id).style.display = 'none';
			document.getElementById(show_donation_option_id).style.display = 'none';
			document.getElementById(show_transaction_limit_id).style.display = 'block';
			document.getElementById(show_transaction_limit_none_id).style.display = 'none';
			document.getElementById(show_max_tickets_id).style.display = 'none';
			}
		}
		
	} else {
			
		// for add field
		// assign values to the submit button depending on choice selected
		if (selection == "0") {
		document.getElementById(submit_button).value = 'Add';
		document.getElementById('show_payment_options').style.display = 'block';
		document.getElementById('show_category_links').style.display = 'none';
		document.getElementById('show_donation_option').style.display = 'none';
		document.getElementById('show_transaction_limit_none').style.display = 'none';
		document.getElementById('show_transaction_limit').style.display = 'block';
		document.getElementById('show_max_tickets').style.display = 'none';
		
		} else if (selection == "1") {
		alert ("NOTICE: A multiple choice transaction type allows registrants to choose from a list of possible registration categories.  Define categories and limits with each category on next page.");
		document.getElementById(submit_button).value = 'Next >>';
		document.getElementById('show_category_links').style.display = 'block';
		document.getElementById('show_payment_options').style.display = 'none';
		document.getElementById('show_donation_option').style.display = 'none';
		document.getElementById('show_transaction_limit_none').style.display = 'block';
		document.getElementById('show_transaction_limit').style.display = 'none';
		document.getElementById('show_max_tickets').style.display = 'none';
		
		} else if (selection == "2") {
		alert ("NOTICE: A ticket transaction type allows registrants to select multiple tickets from 1 to the maximum ticket order.");
		document.getElementById(submit_button).value = 'Add';
		document.getElementById('show_payment_options').style.display = 'block';
		document.getElementById('show_category_links').style.display = 'none';
		document.getElementById('show_donation_option').style.display = 'none';
		document.getElementById('show_transaction_limit_none').style.display = 'none';
		document.getElementById('show_transaction_limit').style.display = 'block';
		document.getElementById('show_max_tickets').style.display = 'block';
		
		} else if (selection == "3") {
		alert ("NOTICE: Donations are set as an undefined blank amount to be determined by the registrant.  If you wish to collect a set amount choose the ticket or payment type instead.");
		document.getElementById(submit_button).value = 'Add';
		document.getElementById('show_donation_option').style.display = 'block';
		document.getElementById('show_payment_options').style.display = 'none';
		document.getElementById('show_category_links').style.display = 'none';
		document.getElementById('show_transaction_limit_none').style.display = 'block';
		document.getElementById('show_transaction_limit').style.display = 'none';
		document.getElementById('show_max_tickets').style.display = 'none';
		
		} else if (selection == "4") {
		alert ("NOTICE: A payment transaction type allows registrants to pay a set amount for a single purchase only such as selling an item, membership, or subscription.  If you want to collect a user defined amount or for multiple items then choose the donation or ticket type instead.");
		document.getElementById(submit_button).value = 'Add';
		document.getElementById('show_payment_options').style.display = 'block';
		document.getElementById('show_category_links').style.display = 'none';
		document.getElementById('show_donation_option').style.display = 'none';
		document.getElementById('show_transaction_limit_none').style.display = 'none';
		document.getElementById('show_transaction_limit').style.display = 'block';
		document.getElementById('show_max_tickets').style.display = 'none';
		}
	}
}
// end function


// event delete warning
function DeleteEvent(url){
	
	var warning_message = "Are you sure you want to delete this event?\n\nWARNING\n\nThis event can only be deleted if no paid transactions have been recorded.  Once it has been published and any payments have been collected the event can no longer be deleted.  To hide this event from public viewing, select unpublish instead.\n\nClick OK and continue to attempt deleting this event or click cancel to cancel this deletion attempt.";
	
	cmsg = warning_message;
	if(!(confirm(cmsg))){
	return false;		
	} else {
	window.location.href = url;
	}
}
// end function
	

// option handler (for my events admin droplist)
function do_option(object,i) {
	if (object.options[object.selectedIndex].value != '') {
		
	var location = object.options[object.selectedIndex].value;	
		
		// give warning message if option is delete
		if (object.options[object.selectedIndex].text == 'Delete') {
		
			answer = window.confirm('Are you sure you want to delete this event?\n\nWARNING\n\nThis event can only be deleted if no paid transactions have been recorded.  Once it has been published and any payments have been collected the event can no longer be deleted.  To hide this event from public viewing, select unpublish in the event management options droplist.\n\nClick OK and continue to attempt deleting this event or click cancel to cancel this deletion attempt.');			
		
			if (answer !=0){ 
			location = object.options[object.selectedIndex].value;
			window.location.href = object.options[object.selectedIndex].value;
			} else {
			// reset droplist
			document.getElementById('select_option'+i).selectedIndex = 0;
			}
		}
		
		// give warning message if option is unpublish
		else if (object.options[object.selectedIndex].text == 'Unpublish') {
		
			cmsg = "NOTICE: Are you sure you want to unpublish this event?\n\nWARNING\n\nThis option will remove the event from the publicly viewed list of events on the EZregister website.";
			if (confirm(cmsg)) {
			window.location.href = object.options[object.selectedIndex].value;
			} else {
			// reset droplist
			document.getElementById('select_option'+i).selectedIndex = 0;
			}
		}

		// open a new window if option is preview
		else if (object.options[object.selectedIndex].text == 'Preview'){
		window.open(object.options[object.selectedIndex].value);
		// reset droplist
		document.getElementById('select_option'+i).selectedIndex = 0;
		}
		
		else if (object.options[object.selectedIndex].text == 'Summary') {
		// reset droplist
		document.getElementById('select_option'+i).selectedIndex = 0;
		// open in greybox window
		return GB_showCenter('', location,500, 760);
		}
		
		else if (object.options[object.selectedIndex].text == 'Invoice') {
		// reset droplist
		document.getElementById('select_option'+i).selectedIndex = 0;
		// open in greybox window
		return GB_showCenter('', location,500, 760);
		}

		else {
		window.location.href = object.options[object.selectedIndex].value;
		// reset droplist
		document.getElementById('select_option'+i).selectedIndex = 0;
		}
	}
}
// end function



// popup richtext html editor
var currentTextArea = null
function openEditor(textarea) {

	// location of edit.php file:
	var editFile = 'edit.php';
	
	currentTextArea = textarea;
	
	width = 720;
	height = 450;

	winLeft = (screen.width-width)/2; 
	winTop = (screen.height-(height+110))/2; 

	var edit = window.open(editFile, 'editorWindow', 'width=720, height=450, left = "' + winLeft + '",top = "' + winTop + '"');
	edit.focus();
}
// end function



function SaveForm() {
	// submit the form
	document.getElementById('form1').submit();
	// disable buttons
	document.getElementById('save_form').disabled = true;
}
// end function



function ReportSubmit(report_format) {
	
	if(report_format == "excel"){
	document.getElementById('form1').target = "_self";	
	} else {
	document.getElementById('form1').target = "_blank";	
	}
	
	// assign value to report_format hidden field
	document.getElementById('report_format').value = report_format;
	document.getElementById('form1').submit();

}
// end function


// open report in new window
function OpenReport() {
	
	var count = $(":checkbox:checked").length; 
	
	if(count == 0){
	alert('No field boxes were selected');
	return false;		
		
	} else {
	return true;
	}
}
// end function


function SortReport(order_selection) {
	// assign value to report_format hidden field
	document.getElementById('order_selection').value = order_selection;
	document.getElementById('report_format').value = 'html';
	document.getElementById('form1').submit();
}
// end function



function PublishSubmit() {
	// disable buttons
	document.getElementById('publish_submit').disabled = true;
	// submit the form
	document.getElementById('form1').submit();
}
// end function



function MoveSubmit(move_type,move_id,form_id) {
	// assign move_type
	document.getElementById(move_id).value = move_type;
	// submit the form
	document.getElementById(form_id).submit();
}
// end function


function checkAllFormQuestions() {
	
	if (document.getElementById('checkall').value == 'Check All') {
	
		$('#container :checkbox.group1').each(function(){
			$(this).attr('checked', true);
		});
		
		document.getElementById('checkall').value = 'Uncheck All';	
	
	} else if (document.getElementById('checkall').value == 'Uncheck All') {
		
		$('#container :checkbox.group1').each(function(){
			$(this).attr('checked', false);
		});
		
		document.getElementById('checkall').value = 'Check All';
	}
}
// end function


function ToggleSelect() {
	var inputs = document.getElementsByTagName('input');
	// check all
	if (document.getElementById('toggle_select').value == 'Check All'){

		for(var i=0; i<inputs.length; i++){
			if(inputs[i].getAttribute('type')=='checkbox'){
			// check all
				if(inputs[i].value != 'save_report'){
					inputs[i].checked = true;
				}
			}
		}
	document.getElementById('toggle_select').value = 'Uncheck All';
	}
	
	// uncheck all
	else if (document.getElementById('toggle_select').value == 'Uncheck All'){

		for(var i=0; i<inputs.length; i++){
			if(inputs[i].getAttribute('type')=='checkbox'){
			// check all
				if(inputs[i].value != 'save_report'){
					inputs[i].checked = false;
				}
			}
		}
	document.getElementById('toggle_select').value = 'Check All';
	}
	
}
// end function


function ReportCheckAll() {
	var inputs = document.getElementsByTagName('input');
	// check all
	if(document.getElementById('check_all').value == 'Check All'){

		for(var i=0; i<inputs.length; i++){
			if(inputs[i].getAttribute('type')=='checkbox'){
			// check all
				if(inputs[i].value != 'save_report'){
					inputs[i].checked = true;
				}
			}
		}
	document.getElementById('check_all').value = 'Uncheck All';
	document.getElementById('check_all2').value = 'Uncheck All';
	}
	
	// uncheck all
	else if(document.getElementById('check_all').value == 'Uncheck All'){

		for(var i=0; i<inputs.length; i++){
			if(inputs[i].getAttribute('type')=='checkbox'){
			// check all
				if(inputs[i].value != 'save_report'){
					inputs[i].checked = false;
				}
			}
		}
	document.getElementById('check_all').value = 'Check All';
	document.getElementById('check_all2').value = 'Check All';
	}
	
}
// end function



function CheckAllReport() {
	var inputs = document.getElementsByTagName('input');
	// check all
	if ((document.getElementById('check_all_1').value == 'Check All') || (document.getElementById('check_all_2').value == 'Check All')){

		for(var i=0; i<inputs.length; i++){
			if(inputs[i].getAttribute('type')=='checkbox'){
			// check all
				if(inputs[i].value != 'save_report'){
					inputs[i].checked = true;
				}
			}
		}
	document.getElementById('check_all_1').value = 'Uncheck All';
	document.getElementById('check_all_2').value = 'Uncheck All';
	}
	
	// uncheck all
	else if ((document.getElementById('check_all_1').value == 'Uncheck All') || (document.getElementById('check_all_2').value == 'Uncheck All')){

		for(var i=0; i<inputs.length; i++){
			if(inputs[i].getAttribute('type')=='checkbox'){
			// check all
				if(inputs[i].value != 'save_report'){
					inputs[i].checked = false;
				}
			}
		}
	document.getElementById('check_all_1').value = 'Check All';
	document.getElementById('check_all_2').value = 'Check All';
	}
	
}
// end function



function PopulateFees(processor_fee_percent,per_transaction_fee) {
	document.getElementById('processor_fee_percent').value = processor_fee_percent;
	document.getElementById('per_transaction_fee').value = per_transaction_fee;
}
// end function


function DeletePromoter(event_id,promoter_id) {
	cmsg = "Are you sure you want to delete this host event account?";
	if (confirm(cmsg)) {
	// go to delete page
	window.location = http_host() + "/event_edit/promoter/delete.php?promoter_id=" + promoter_id + "&event_id=" + event_id;
}
}
// end function


function DeleteThisPromoter(promoter_id) {
	
	cmsg = "Are you sure you want to delete this host account?";
	if (confirm(cmsg)) {
	// go to delete page
	window.location = http_host() + "/accounts/delete_promoter/" + promoter_id;
}
}
// end function


function DeleteRegistration(registration_id,url) {
	
	cmsg = "Are you sure you want to delete your order?\n\nRegistration ID# " + registration_id + "\n\nIf you are having trouble with the registration process please contact EZregister at 1-800-476-4895 for assistance.\n\nSelect OK to delete this order or Cancel to continue with this order.";
	if (confirm(cmsg)) {
	// go to delete page
	window.location.href = url;
	}
}
// end function

/*
function DeleteAdmin(member_id) {
	cmsg = "Are you sure you want to delete this administrator?\n";
	if(!(confirm(cmsg))){
	return false;		
	} else {
	document.getElementById('submission_type').value = 'delete';
	document.getElementById('delete_member_id').value = member_id;
	document.getElementById('form1').submit();
	}
}
// end function
*/

function DeleteAdmin(event_id,member_id) {
	cmsg = "Are you sure you want to delete this administrator?\n";
	if (confirm(cmsg)) {
	// go to delete page
	window.location = http_host() + "/event_edit/administrators/delete.php?event_id=" + event_id + "&member_id=" + member_id;
}
}
// end function

function NoDeleteAdmin(message){
	if(message == "self"){	
		alert('You cannot delete yourself from the administrators group, this action requires another administrator\n');
		return false;
	}
	else if(message == "last"){	
		alert('You cannot delete the last administrator, at least one administrator must remain on the account\n');
		return false;
	}
}
// end function


function DeleteQuestion(event_id,question_temp_id) {
	cmsg = "Are you sure you want to delete this question?\n\nWARNING: Any collected registration data for this question will also be deleted.\n\nInstead of deleting the question and losing any registrations you might consider hiding the answer from future registrants by unchecking the display box on the edit page.\n\nSelect OK if you still want to delete this question."
	if (confirm(cmsg)) {
	// go to delete page
	window.location="delete_question.php?event_id=" + event_id + "&question_temp_id=" + question_temp_id;
}
}
// end function



function DeleteChoice(event_id,question_temp_id,choice_temp_id) {
	cmsg = "Are you sure you want to delete this record?\nWARNING"
	if (confirm(cmsg)) {
	// go to delete page
	window.location="delete_choice.php?event_id=" + event_id + "&question_temp_id=" + question_temp_id + "&choice_temp_id=" + choice_temp_id;
}
}
// end function



function DeleteTransaction(event_id,transaction_temp_id) {
	cmsg = "Are you sure you want to delete this record?\nWARNING: All associated transaction categories will also be deleted"
	if (confirm(cmsg)) {
	// go to delete page
	window.location="delete_transaction.php?event_id=" + event_id + "&transaction_temp_id=" + transaction_temp_id;
}
}
// end function



function DeleteCategory(event_id,transaction_temp_id,category_temp_id) {
	cmsg = "Are you sure you want to delete this record?\nWARNING"
	if (confirm(cmsg)) {
	// go to delete page
	window.location="delete_category.php?event_id=" + event_id + "&transaction_temp_id=" + transaction_temp_id + "&category_temp_id=" + category_temp_id;
}
}
// end function



function QuestionSelection(event_id,answer_type,selection) {
	
	if (answer_type != "") {
		
		// respond to changing the answer to a single textfield with a warning
		if (((answer_type == "radio") || (answer_type == "list") || (answer_type == "checkbox")) && ((selection == "textfield") || (selection == "textarea"))) {
		cmsg = "Are you sure you want to change the answer type to a single field?\n\nWARNING: Any associated anwer choices to this question will also be deleted.";
			
			if (confirm(cmsg)) {
				
				// assign values to the submit button depending on choice selected
				if ((selection == "radio") || (selection == "list") || (selection == "checkbox")) {
				document.getElementById('submit_form').value = 'Next >>>';
				} else if ((selection == "textfield") || (selection == "textarea")) {
				document.getElementById('submit_form').value = 'Submit';
				}
				
			} else {
				
				// otherwise just keep button selected state from the original value
				if (answer_type == 'textfield') {
				document.form1.answer_type[0].checked = true;
				} else if (answer_type == 'textarea') {
				document.form1.answer_type[1].checked = true;
				} else if (answer_type == 'radio') {
				document.form1.answer_type[2].checked = true;
				} else if (answer_type == 'list') {
				document.form1.answer_type[3].checked = true;				
				} else if (answer_type == 'checkbox') {
				document.form1.answer_type[4].checked = true;
				}
			}
			
		} else {

			// assign values to the submit button depending on choice selected
			if ((selection == "radio") || (selection == "list") || (selection == "checkbox")) {
			document.getElementById('submit_form').value = 'Next >>>';
			} else if ((selection == "textfield") || (selection == "textarea")) {
			document.getElementById('submit_form').value = 'Submit';
			}
		}
		
	} else {

		// assign values to the submit button depending on choice selected
		if ((selection == "radio") || (selection == "list") || (selection == "checkbox")) {
		document.getElementById('submit_form').value = 'Next >>>';
		} else if ((selection == "textfield") || (selection == "textarea")) {
		document.getElementById('submit_form').value = 'Submit';
		}
	}
}
// end function




function toggle(obj1,obj2,button_value) {
	
	var last_edit = document.getElementById('last_edit').value;
		if (last_edit != "") {
		var last_el = document.getElementById(last_edit);
		last_el.style.display = 'none';
		}
	
	var last_output = document.getElementById('last_output').value;
		if (last_output != "") {
		var last_e2 = document.getElementById(last_output);
		last_e2.style.display = '';
		}
		

	var el = document.getElementById(obj1);
	var e2 = document.getElementById(obj2);

	if ( button_value == 'edit' ) {
		el.style.display = '';
		e2.style.display = 'none';
	}
	
	else if ( button_value == 'cancel' ) {
		el.style.display = 'none';
		e2.style.display = '';
	}
	
	document.getElementById('last_edit').value = obj1;
	document.getElementById('last_output').value = obj2;

}
// end function


function toggleTransactions(obj1,obj2,button_value) {
	
	var last_edit = document.getElementById('last_edit').value;
		if (last_edit != "") {
		var last_el = document.getElementById(last_edit);
		last_el.style.display = 'none';
		}
	
	var last_output = document.getElementById('last_output').value;
		if (last_output != "") {
		var last_e2 = document.getElementById(last_output);
		last_e2.style.display = '';
		}
		

	var el = document.getElementById(obj1);
	var e2 = document.getElementById(obj2);

	if ( button_value == 'edit' ) {
		el.style.display = '';
		e2.style.display = 'none';
	}
	
	else if ( button_value == 'cancel' ) {
		el.style.display = 'none';
		e2.style.display = '';
	}
	
	document.getElementById('last_edit').value = obj1;
	document.getElementById('last_output').value = obj2;

}
// end function




function CheckInclude(box) {
	
	id1 = box.id;
	id2 = id1.replace('_include', '_required');
	
	var box1 = document.getElementById(id1)
	var box2 = document.getElementById(id2)
	
	if (!box1.checked) {
	box2.checked = false;
	}
}
// end function



function CheckRequired(box) {
	
	id1 = box.id;
	id2 = id1.replace('_required', '_include');
	
	var box1 = document.getElementById(id2)
	var box2 = document.getElementById(id1)
	
	if (box2.checked) {
	box1.checked = true;
	}
}
// end function



function popUp(URL) {
day = new Date();
id = day.getTime();

width = 600;
height = 600;

winLeft = (screen.width-width)/2; 
winTop = (screen.height-(height+110))/2; 


eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=550,left = " + winLeft + ",top = " + winTop + "');");
}
// end function


function popUpFees(URL) {
day = new Date();
id = day.getTime();

width = 750;
height = 750;

winLeft = (screen.width-width)/2; 
winTop = (screen.height-(height+110))/2; 


eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=750,height=750,left = " + winLeft + ",top = " + winTop + "');");
}
// end function


function DisableUpload() {
	
	if (document.getElementById('delete_image').checked == true) {
		document.getElementById('file_1').disabled = true;
		document.getElementById('file_1').value = "";
	} else if (document.getElementById('delete_image').checked == false) {
		document.getElementById('file_1').disabled = false;
	}
}
// end function


// ============
// style picker
// ============
function selectStyle(style,val) {
	
	// make sure a radio button was selected
	for (var i=0; i < document.form1.select_style.length; i++) {
		if (document.form1.select_style[i].checked) {
		var id = i;
		var checked = "yes";
		} 
	}
   
   	// give error alert if no elements were selected
	if (checked != "yes") {
	alert ("ERROR\n\nPlease select an element from the radio button group.");
	}
	
	// get values from standard colors drop list if selected
	if (val == "standard_colors") {
	
		if (checked == "yes") {
			val = document.getElementById('standard_colors').value;
			
			document.getElementById("color_" + id).value = val;
			document.getElementById("sample_" + id).style.background=val;
		}
	}
	
	// page background		
	if (id == 0) { // row 0
		// color
		if(style == "color") {
			// assign the new value to the styles page selections
			document.getElementById("sample_" + id).style.background=val; // sample box background
			document.getElementById("color_" + id).value = val;  // display form color input value
			document.getElementById("image_" + id).value = '';  // clear form image input value
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("eventPage").style.background=val; // page background
		}
		// image
		else if(style == "image") {
			image_url = "url(../../../images/backgrounds/" + val + ")";
			// assign the new value to the styles page selections
			document.getElementById("sample_" + id).style.background=image_url; // sample box background
			document.getElementById("image_" + id).value = val;  // display form image input value
			document.getElementById("color_" + id).value = '';  // clear form color input value
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("eventPage").style.background=image_url; // page background
		}
	}
	
	// page text
	if (id == 1) {
		// text color
		if(style == "color") {
			document.getElementById("color_" + id).value = val;
			document.getElementById("sample_" + id).style.background=val;
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.color=val;
		}
		// text font
			if(style == "font_family") {
			val = document.getElementById("font_1").value;
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.fontFamily=val;
		}
		// text size
		if(style == "font_size") {
			val = document.getElementById("font_1_size").value;
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.fontSize=val;
		}
	}
	
	// links text
	if (id == 2) {
		var links = window.frames['preview_frame'].document.getElementById("eventPage").getElementsByTagName("a");
		// color
		if(style=="color") {
			for (var x = 0; x < links.length; x++) {
				links[x].style.color = val;
			}
			document.getElementById("sample_" + id).style.background=val; // sample box background
			document.getElementById("color_" + id).value=val;  // form color input value
		}
		// font family
		if(style=="font_family") {
			val = document.getElementById("font_2").value;
			for (var x = 0; x < links.length; x++) {
				links[x].style.fontFamily = val;
			}
		}
		// font size
		if(style=="font_size") {
			val = document.getElementById("font_2_size").value;
			for (var x = 0; x < links.length; x++) {
				links[x].style.fontSize = val;
			}
		}
	}
	
	// table background		
	if (id == 3) { // row 0
		// color
		if(style == "color") {
			// assign the new value to the styles page selections
			document.getElementById("sample_" + id).style.background=val; // sample box background
			document.getElementById("color_" + id).value = val;  // display form color input value
			document.getElementById("image_" + id).value = '';  // clear form image input value
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.background=val; // table background
		}
		// image
		else if(style == "image") {
			image_url = "url(../../../images/backgrounds/" + val + ")";
			// assign the new value to the styles page selections
			document.getElementById("sample_" + id).style.background=image_url; // sample box background
			document.getElementById("image_" + id).value = val;  // display form image input value
			document.getElementById("color_" + id).value = '';  // clear form color input value
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.background=image_url; // table background
		}
	}
	
	// table border
	if (id == 4) {
		// color
		if(style == "color") {
			// assign the new value to the styles page selections
			document.getElementById("color_" + id).value = val;
			document.getElementById("sample_" + id).style.background=val;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.borderColor=val;
		}
		// style
		if(style == "border_style") {
			val = document.getElementById("border_4").value;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.borderStyle=val;
		}
		// size
		if(style == "border_size") {
			val = document.getElementById("border_4_size").value;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.borderWidth=val;
		}

	}
	
	// titlebar background		
	if (id == 5) { // row 0
		// color
		if(style == "color") {
			// assign the new value to the styles page selections
			document.getElementById("sample_" + id).style.background=val; // sample box background
			document.getElementById("color_" + id).value = val;  // display form color input value
			document.getElementById("image_" + id).value = '';  // clear form image input value
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.background=val; // page background
		}
		// image
		else if(style == "image") {
			image_url = "url(../../../images/backgrounds/" + val + ")";
			// assign the new value to the styles page selections
			document.getElementById("sample_" + id).style.background=image_url; // sample box background
			document.getElementById("image_" + id).value = val;  // display form image input value
			document.getElementById("color_" + id).value = '';  // clear form color input value
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.background=image_url; // page background
		}
	}
	
	// titlebar border
	if (id == 6) {
		// color
		if(style == "color") {
			// assign the new value to the styles page selections
			document.getElementById("color_" + id).value = val;
			document.getElementById("sample_" + id).style.background=val;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.borderColor=val;
		}
		// style
		if(style == "border_style") {
			val = document.getElementById("border_6").value;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.borderStyle=val;
		}
		// size
		if(style == "border_size") {
			val = document.getElementById("border_6_size").value;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.borderWidth=val;
		}

	}
	
	// titlebar text
	if (id == 7) {
		// text color
		if(style == "color") {
			// assign the new value to the styles page selections
			document.getElementById("color_" + id).value = val;
			document.getElementById("sample_" + id).style.background=val;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.color=val;
		}
		// text font
			if(style == "font_family") {
			val = document.getElementById("font_7").value;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.fontFamily=val;
		}
		// text size
		if(style == "font_size") {
			val = document.getElementById("font_7_size").value;
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.fontSize=val;
		}
	}
	
	// divider border
	if (id == 8) {
		// color
		if(style == "color") {
			// assign the new value to the styles page selections
			document.getElementById("color_" + id).value = val;
			document.getElementById("sample_" + id).style.background=val;
			
			// assign the new value to the event preview iframe
			
			// find and change all tags with class = dividerVertical
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerVertical') allTags[i].style.borderRightColor=val;
			}
			 
			// find and change all tags with class = dividerHorizontal
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerHorizontal') allTags[i].style.borderBottomColor=val;
			}
		}
		// style
		if(style == "border_style") {
			val = document.getElementById("border_8").value;
			
			// assign the new value to the event preview iframe
			
			// find and change all tags with class = dividerVertical
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerVertical') allTags[i].style.borderRightStyle=val;
			}
			 
			// find and change all tags with class = dividerHorizontal
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerHorizontal') allTags[i].style.borderBottomStyle=val;
			}
		}
		// size
		if(style == "border_size") {
		val = document.getElementById("border_8_size").value;
		
			// assign the new value to the event preview iframe
			
			// assign the new value to the event preview iframe
			
			// find and change all tags with class = dividerVertical
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerVertical') allTags[i].style.borderRightWidth=val;
			}
			 
			// find and change all tags with class = dividerHorizontal
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerHorizontal') allTags[i].style.borderBottomWidth=val;
			}
		}
	}

	// reset drop list
	document.getElementById('standard_colors').selectedIndex = 0;
}
// ================
// end style picker
// ================


function DefaultStyles() {
	
	// display all elements on the page to default settings
	if(document.getElementById("default_styles").checked == true){
		
		// event page background
		document.getElementById("color_0").value="#32689A";
		document.getElementById("sample_0").style.background="#32689A";
		document.getElementById("image_0").value='';
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("eventPage").style.background="#32689A";
		
		// page text color
		document.getElementById("color_1").value='#000000';
		document.getElementById("sample_1").style.background='#000000';
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.color="#000000";
		
		// page text font
		document.getElementById("font_1").selectedIndex = 8;
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.fontFamily="Verdana, Arial, Helvetica, sans-serif";
		
		// page text size
		document.getElementById("font_1_size").selectedIndex = 4;
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.fontSize="10pt";
		
		// links text color, font, size
			document.getElementById("color_2").value='#0000CC';
			document.getElementById("sample_2").style.background='#0000CC';
			document.getElementById("font_2").selectedIndex = 8;
			document.getElementById("font_2_size").selectedIndex = 4;
			
				// assign the new value to the event preview iframe
				var links = window.frames['preview_frame'].document.getElementById("boxTemplate").getElementsByTagName("a");
					for (var x = 0; x < links.length; x++) {
					// color
					links[x].style.color = "blue";
					// font
					links[x].style.fontFamily="Verdana, Arial, Helvetica, sans-serif";
					// size
					links[x].style.fontSize="10pt";
					// background
					links[x].style.background="#FFFFFF";
					}
		
		// table background				
		document.getElementById("color_3").value='#FFFFFF';
		document.getElementById("sample_3").style.background='#FFFFFF';
		document.getElementById("image_3").value='';
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.background="#FFFFFF";
		
		// table border color
		document.getElementById("color_4").value='#C0C0C0';
		document.getElementById("sample_4").style.background='#C0C0C0';
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.borderColor="#C0C0C0";
		
		// table border style
		document.getElementById("border_4").selectedIndex = 3;
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.borderStyle="solid";
		
		// table border size
		document.getElementById("border_4_size").selectedIndex = 4;
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("boxTemplate").style.borderWidth="1px";
		
		// titlebar background
		document.getElementById("color_5").value='#32689A';
		document.getElementById("sample_5").style.background='#32689A';
		document.getElementById("image_5").value='';
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.background="#32689A";
		
		// titlebar border color
		document.getElementById("color_6").value='#FFFFFF';
		document.getElementById("sample_6").style.background='#FFFFFF';
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.borderColor="#FFFFFF";
		
		// titlbar border style
		document.getElementById("border_6").selectedIndex = 3;
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.borderStyle="solid";
		
		// titlebar border size
		document.getElementById("border_6_size").selectedIndex = 3;
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.borderWidth="0px";
		
		// titlebar text color
		document.getElementById("color_7").value='#FFFFFF';
		document.getElementById("sample_7").style.background='#FFFFFF';
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.color="#FFFFFF";
		
		// titlebar text font
		document.getElementById("font_7").selectedIndex = 3;
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.fontFamily="Arial";
		
		// titlebar text size
		document.getElementById("font_7_size").selectedIndex = 6;
		
			// assign the new value to the event preview iframe
			window.frames['preview_frame'].document.getElementById("titlebar").style.fontSize="14pt";
		
		// divider border color
		document.getElementById("color_8").value='#C0C0C0';
		document.getElementById("sample_8").style.background='#C0C0C0';
		
			// assign the new values to the event preview iframe
			// find and change all tags with class = dividerVertical
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerVertical') allTags[i].style.borderRightColor='#C0C0C0';
			}
			 
			// find and change all tags with class = dividerHorizontal
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerHorizontal') allTags[i].style.borderBottomColor='#C0C0C0';
			}
		
		// divider border style
		document.getElementById("border_8").selectedIndex = 3;
			
			// assign the new values to the event preview iframe
			// find and change all tags with class = dividerVertical
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerVertical') allTags[i].style.borderRightStyle='solid';
			}
			 
			// find and change all tags with class = dividerHorizontal
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerHorizontal') allTags[i].style.borderBottomStyle='solid';
			}
			
		// divider border size
		document.getElementById("border_8_size").selectedIndex = 4;
			
			// assign the new values to the event preview iframe
			// find and change all tags with class = dividerVertical
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerVertical') allTags[i].style.borderRightWidth='1px';
			}
			 
			// find and change all tags with class = dividerHorizontal
			var allTags = window.frames['preview_frame'].document.getElementsByTagName('*');
			for(i=0; i<allTags.length; i++){
			if(allTags[i].className == 'dividerHorizontal') allTags[i].style.borderBottomWidth='1px';
			}
		
		// table corners
		document.getElementById("corner_radius").disabled=false;
		document.getElementById("corner_radius").style.background='#FFFFFF';
		document.getElementById("corner_radius").value='15';
		document.getElementById("corner_style").selectedIndex = 1;
		
		// info column
		document.getElementById("column_style").selectedIndex = 1;
	
	}
}
// end function


function delrec(member_id, host) {
cmsg = "Are you sure you want to delete this record?\n" + "id# " + member_id
if (confirm(cmsg)) {
window.location= host + "/admin/members_delete.php?member_id=" + member_id;
}
}

// =================================================
// functions to submit forms and display progress bar
// =================================================

function SubmitForm(form_id) {
	// submit the form
	document.getElementById(form_id).submit();
	// show progress bar
	document.getElementById("progress").style.visibility = 'visible';
	// disable submit button
	document.getElementById("submit_form").disabled = true;
	// change text value of button
	document.getElementById("submit_form").value = 'Processing';
}
// end function


function please_wait(action,url) {
	
	$('.submit').hide();
	$('.wait').show();
	
	// hide submit button
	if(document.getElementById('submit')){
	document.getElementById('submit').style.display = 'none';
	}
	
	// show please wait
	if(document.getElementById('wait')){
	document.getElementById('wait').style.display = 'block';
	}
	
	// hide submit button
	if(document.getElementById('submit1')){
	document.getElementById('submit1').style.display = 'none';
	}
	
	// show please wait
	if(document.getElementById('wait1')){
	document.getElementById('wait1').style.display = 'block';
	}

	// hide submit button
	if(document.getElementById('submit2')){
	document.getElementById('submit2').style.display = 'none';
	}
	
	// show please wait
	if(document.getElementById('wait2')){
	document.getElementById('wait2').style.display = 'block';
	}

	if(action == 'redirect'){
	window.location.href = url;
	return false;
	}
	
	if(action == 'submit'){
	return false;
	}

}
// end function

// reset the form submission
// =========================
function reset_submit(){
	
	$('.submit').show();
	$('.wait').hide();
}
// end function

// old PleaseWait function (TODO: omit this one?)
// =============================================
function PleaseWait(form_id) {
	// submit the form
	document.getElementById(form_id).submit();
	// hide submit button
	document.getElementById("submit_button").style.display = 'none';
	// show progress
	document.getElementById("progress").style.display = 'block';
}
// end function

// TODO: omit this one?
function PleaseWaitWYSIWYG() {
	// hide submit button
	document.getElementById("submit_button").style.display = 'none';
	// show progress
	document.getElementById("progress").style.display = 'block';
}
// end function

// =====================================
// function to show display progress bar
// =====================================
// TODO: omit this one?

function ShowProgress() {
	// show progress bar
	document.getElementById("progress").style.visibility = 'visible';
	// change text value of button
	document.getElementById("submit_form").value = 'Processing';
	// disable submit button
	//document.getElementById("submit_form").disabled = true;
}
// end function

// TODO: omit this one?
function DisableButton(button) {
	// disable submit button
	document.getElementById(button).disabled = true;
}
// end function


function clearAll(){
var texts=document.getElementsByTagName('input')

for (var i_tem = 0; i_tem < texts.length; i_tem++){
if (texts[i_tem].type=='text')
texts[i_tem].value=''
}

// clear member_id info
document.getElementById("member_id").value = '';
}
// end function


//function to toggle element display
function toggleCheckboxElement(check_box,display_box){

	if (document.getElementById(check_box).checked==true) {
	document.getElementById(display_box).style.display = 'inline';
	} else {
	document.getElementById(display_box).style.display = 'none';
	}
}
// end function

// begin function
// toggle element display (with slider)
function toggleView(display_object){

	if(document.getElementById(display_object).style.display == 'none'){
		
		$('#' + display_object).show();
		
	} else {
	
		$('#' + display_object).hide();
	}
}
// end function



// begin function
// toggle element display with no slider
function toggleDisplay(display_object,action){

	if(document.getElementById(display_object).style.display == 'none'){
		
		if(action == "slide"){
		$('#' + display_object).slideDown();
		$('#' + display_object).effect('highlight', {}, 2000);
		} else {
		$('#' + display_object).show();
		}
		
	} else {
	
		if(action == "slide"){
		$('#' + display_object).hide();	
		} else {
		$('#' + display_object).slideUp();
		}
	}
}
// end function


// function to fix submit problem with IE on homepage login form
function entsub(){

if(window.event && window.event.keyCode == 13){
		document.form1.submit();
	} else {
		return true;
	}
}

// cancel order and go back to event page
function cancel_order(event_id){
	
	cmsg = "Are you sure you want to cancel this order?\n\nThis action will remove all registrants from your order\n\nand return you to the event homepage.";
	if (confirm(cmsg)) {
	
		// send to discount processing page
		var url = http_host() + "/events/" + event_id;
		
		please_wait();
		
		// redirect
		window.location = url;
		
	}
	return false;
}
// end function

// cancel payment and go back to summary page
function cancel_payment(order_id,security_token){
	
	cmsg = "Are you sure you want to cancel this payment?\n\nThis action will you to the order summary.";
	if (confirm(cmsg)) {
	
		// send to discount processing page
		var url = http_host() + "/register/summary/" + order_id + "/" + security_token;
		
		please_wait();
		
		// redirect
		window.location = url;
		
	}
	return false;
}
// end function


// =================================================
// =================================================
// BEGIN DISCOUNTS

$(document).ready(function(){
	
	// SHOW HIDE FUNCTIONS
	$('.toggle').click(function(){
		$(this).next('.toggle_target').slideToggle();
	})
	
	// DONATION FUNCTION
	$('.type_donation').blur(function(){
		if((this.value == '') || (this.value == 0)) { 
			this.value = '' 
		} else { 
			this.value = CurrencyFormatted(this.value); 
		}
	})
	
});

// ajax function get and display discount codes
function apply_discount(order_id,security_token){
	
	// please wait button
	$('.apply_discount').hide();
	$('.apply_discount_wait').show();
	$('#show_discount').hide();
	$('#discount_loading').show();
	
	// get the discount code value
	var order_discount_code = $('#order_discount_code').val();
	
	// assign random discount code if empty
	if(order_discount_code == ''){
	order_discount_code = 'dfasfxrghpolfgjmrtierhnmirnq';
	}
	
	// format with lowercase and remove spaces
	order_discount_code = order_discount_code.split(' ').join('');
	order_discount_code = order_discount_code.toLowerCase();
	
	order_discount_code = encodeURIComponent(order_discount_code);
	
	// return formatted
	document.getElementById('order_discount_code').value = order_discount_code;
	
	// send to discount processing page
	var url = https_host() + "/register/apply_discount/" + order_discount_code + "/" + order_id + "/" + security_token;
	
	// ajax function loads the page into the target div
	$('#summary_total').load(url);
	
}
// end function


// remove discount from order
function remove_discount(order_id,security_token){
	
	cmsg = "Are you sure you want to remove this discount?";
	if (confirm(cmsg)) {
	
		// send to discount processing page
		var url = https_host() + "/register/remove_discount/" + order_id + "/" + security_token;
		
		// ajax function loads the page into the target div
		$('#summary_total').load(url);
	
	}
	return false;
}
// end function

// delete a discount
function delete_discount(url) {
	
	cmsg = "Are you sure you want to remove this discount?";
	if (confirm(cmsg)) {
	window.location = url;
	}
	return false;
}
// end function
	
// END DISCOUNTS
// =================================================
// =================================================

function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}
// end function


function remove_registrant(url) {
	
	cmsg = "Are you sure you want to remove this registration?";
	if (confirm(cmsg)) {
	please_wait();	
	window.location = url;
	}
	
	return false;
}
// end function


// select payment option and show/hide associated checkout buttons
function show_payment(payment_type,list) {
	
	switch(payment_type)
	{
	case 'paypal':
	
		$('#paypal_payments').show();
		$('#authnet_payments').hide();
		$('#check_payments').hide();
		$('#door_payments').hide();
		$('#free_payments').hide();
		
		if(list == 1){
		$('#multiple_payments').show();
		} else {
		$('#multiple_payments').hide();
		}
	
	break;
	
	case 'authnet':
	
		$('#paypal_payments').hide();
		$('#authnet_payments').show();
		$('#check_payments').hide();
		$('#door_payments').hide();
		$('#free_payments').hide();
		
		if(list == 1){
		$('#multiple_payments').show();
		} else {
		$('#multiple_payments').hide();
		}
	
	break;
	
	case 'check':
	
		$('#paypal_payments').hide();
		$('#authnet_payments').hide();
		$('#check_payments').show();
		$('#door_payments').hide();
		$('#free_payments').hide();
		
		if(list == 1){
		$('#multiple_payments').show();
		} else {
		$('#multiple_payments').hide();
		}
	
	break;
	
	case 'door':
	
		$('#paypal_payments').hide();
		$('#authnet_payments').hide();
		$('#check_payments').hide();
		$('#door_payments').show();
		$('#free_payments').hide();
		
		if(list == 1){
			
		$('#multiple_payments').show();
		} else {
		$('#multiple_payments').hide();
		}
	
	break;                 
	
	case 'free':
	
		$('#paypal_payments').hide();
		$('#authnet_payments').hide();
		$('#check_payments').hide();
		$('#door_payments').hide();
		$('#free_payments').show();
		$('#multiple_payments').hide();
	
	break;
	
	default:
	
		$('#paypal_payments').hide();
		$('#authnet_payments').hide();
		$('#check_payments').hide();
		$('#door_payments').hide();
		$('#free_payments').hide();
		$('#multiple_payments').show();
	}
}
// end function


// select payment option and show/hide associated checkout buttons
function payment_select(payment_type) {
	
	switch(payment_type)
	{
	case 'paypal':
	
		$('#payment_type').val('paypal');
		
	break;
	
	case 'authnet':
	
		$('#payment_type').val('authnet');
		
	break;
	
	case 'check':
	
		$('#payment_type').val('check');
	
	break;
	
	case 'door':
	
		$('#payment_type').val('door');
	
	break;                 
	
	case 'free':
	
		$('#payment_type').val('free');
	
	break;
	
	default:
	
		$('#payment_type').val('');
	}
}
// end function
	
function disable_form(form) {

	// disable all inputs
	var inputs = document.getElementsByTagName('input');

		for(var i=0; i<inputs.length; i++){
		// disable all
		inputs[i].disabled = true;
		}
		
	// disable all selects
	var selects = document.getElementsByTagName('select');

		for(var i=0; i<selects.length; i++){
		// disable all
		selects[i].disabled = true;
		}
		
	document.getElementById(form).disabled = true;
	
	document.getElementById('try_again_button').disabled = false;
		
}
// end function

// show or hide payment items details
// ==================================
function toggle_details(id,action){

	if(action == "expand"){
		
	document.getElementById('expand_' + id).style.display = 'none';
	document.getElementById('collapse_' + id).style.display = 'inline';
	
	// document.getElementById('details_' + id).style.display = 'inline';
	
	$('#details_' + id).slideDown();
	$('#details_' + id).effect('highlight', {}, 2000);
		
	} else if(action == "collapse"){
		
	document.getElementById('expand_' + id).style.display = 'inline';
	document.getElementById('collapse_' + id).style.display = 'none';
	
	// document.getElementById('details_' + id).style.display = 'none';
	
	$('#details_' + id).slideUp();
	
	}
}

// show or hide item
// =================
function toggle_item(id,action,trigger){
	
	if(action == "expand"){
		
	document.getElementById('expand_' + id).style.display = 'none';
	document.getElementById('collapse_' + id).style.display = 'block';
	
	document.getElementById(id).style.display = 'block';
	
	} else if(action == "collapse"){
		
	document.getElementById('expand_' + id).style.display = 'block';
	document.getElementById('collapse_' + id).style.display = 'none';
	
	document.getElementById(id).style.display = 'none';
	
	} else if(action == "checkbox"){
		
		if(document.getElementById(trigger).checked == true){
			
			document.getElementById(id).style.display = 'block';
		
		} else {
			
			document.getElementById(id).style.display = 'none';
			
/*			if(trigger == 'transaction_limit_other_checkbox'){
				
				$('#transaction_limit_other_display :checkbox.group1').each(function(){
					$(this).attr('checked', false);
				});
				
			}
*/			
			if(trigger == 'include_items_checkbox'){
				
				$('#include_items_display :checkbox.group1').each(function(){
					$(this).attr('checked', false);
				});
			}
		}
	}
}


// delete invoice adjusment
function deleteInvoiceAdjust(url){

	cmsg = "Are you sure you want to delete this invoice adjustment.";
	if (confirm(cmsg)) {
	
		window.location.href = url;
	}
	return false;
}

// ===============	
// format currency
// ===============
	function CurrencyFormatted(amount)
	{
		var i = parseFloat(amount);
		if(isNaN(i)) { i = 0.00; }
		var minus = '';
		if(i < 0) { minus = '-'; }
		i = Math.abs(i);
		i = parseInt((i + .005) * 100);
		i = i / 100;
		s = new String(i);
		if(s.indexOf('.') < 0) { s += '.00'; }
		if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
		s = minus + s;
		return s;
	}
	// end function

///////////////////////////////
/// RESERVED SEAT SLECTIONS ///

	function get_count(transaction_id){
	
		var $reserved_seats = $('input.reserved_seats_' + transaction_id + ':checkbox');
		document.getElementById('ticket_' + transaction_id).value = $reserved_seats.filter(':checked').length;
	}
	// end function
	
	function toggle_seats(transaction_id){
	
		var droplist = document.getElementById('reserved_seats_select_' + transaction_id);
	
		if (droplist.style.display == 'none') {
		droplist.style.display = 'block';
		
		} else if(droplist.style.display == 'block') {
		droplist.style.display = 'none'
		}
	}
	// end function
	
	function clear_seats(transaction_id){
		
		$('input.reserved_seats_' + transaction_id + ':checkbox').each(function(){
			$(this).attr('checked', false);
		});
		
		get_count(transaction_id);
	}	
	// end function
	
///// END RESERVED SEAT SELECTIONS ////
///////////////////////////////////////

// set http variables based on server settings
// ===========================================
function http_host(){
	
	var http_host = "";
	
	if(server_type == "live"){
		if(server_ssl == true){
			var http_host = "https://" + server_live;
			} else {
			var http_host = "http://" + server_live;
			}
		}
	
	else if(server_type == "local"){
		if(server_ssl == true){
			var http_host = "https://" + server_local;
			} else {
			var http_host = "http://" + server_local;
			}
		}
	
	else if(server_type == "testing_org"){
		if(server_ssl == true){
			var http_host = "https://" + server_testing_org;
			} else {
			var http_host = "http://" + server_testing_org;
			}
		}
	
	else if(server_type == "testing_net"){
		if(server_ssl == true){
			var http_host = "https://" + server_testing_net;
			} else {
			var http_host = "http://" + server_testing_net;
			}
		}
	
	return http_host
}
// end function

// set https variables based on server settings
// ============================================
function https_host(){
	
	var https_host = "";
	
	if(server_type == "live"){
		if(server_ssl == true){
			var https_host = "https://" + server_live;
			} else {
			var https_host = "http://" + server_live;
			}
		}
	
	else if(server_type == "local"){
		if(server_ssl == true){
			var https_host = "https://" + server_local;
			} else {
			var https_host = "http://" + server_local;
			}
		}
	
	else if(server_type == "testing_org"){
		if(server_ssl == true){
			var https_host = "https://" + server_testing_org;
			} else {
			var https_host = "http://" + server_testing_org;
			}
		}
	
	else if(server_type == "testing_net"){
		if(server_ssl == true){
			var https_host = "https://" + server_testing_net;
			} else {
			var https_host = "http://" + server_testing_net;
			}
		}
	
	return https_host
}
// end function

///////////////////////
//  End all scripts -->
