function include(arr, obj) {
  for(var i=0; i<arr.length; i++) {
    if (arr[i] == obj) return true;
  }
}
/* Accordion
 
$(document).ready(function() {
	$(".accordion").accordion();
});

  */

 
/* Colorbox (schedules lightbox) */ 
  		$(document).ready(function(){
			
	 	  if(!DetectMobileQuick()) {
			//Examples of how to assign the ColorBox event to elements
			$("a.popup").colorbox({ scrolling: false });	
			$("a.popup-iframe").colorbox({ iframe: true, width: "650px", height: "90%" });
			
			$("a.popup2").colorbox({ scrolling: false, width: "650px", height: "90%" });	
		  }
		});
		
/* Locations Selector */
	function locationSelected(selector) {
		$('li.location-selection label.selected').removeClass('selected');
		selector.addClass('selected');
	};
	
	$(document).ready(function() {
		// Refreshed form, basically
		$('li.location-selection label').click( function() { 
			$('li.location-selection input:radio#'+this.htmlFor).attr("checked", "checked");
			locationSelected($(this));
		});
		
		// Hide Radios
		$('li.location-selection input:radio').hide();
		
		// On page load, select already checked
		$('li.location-selection label[for="'+$('li.location-selection input:radio:checked').attr('id')+'"]').addClass('selected');
	});
	
/* Join Form */
	function updatePaymentState() {
		
		$('.cc').attr('disabled',true);
		$('.ba').attr('disabled',true);
	
		if($('#pay_meth_cc:checked').val()) {
			$('.cc').removeAttr('disabled');
		}
		if($('#pay_meth_ba:checked').val()) {
			$('.ba').removeAttr('disabled');
		}
	}

	$(document).ready(function() {
			updatePaymentState();
		
			$('#pay_meth_cc').click(function() {
				updatePaymentState();
			});
			$('#pay_meth_ba').click(function() {
				updatePaymentState();
			});
	});
	
/* Tabs */
	$(function() {
		$( "#tabs" ).tabs();
	});
	
/* Guest Pass Captcha */
	$(document).ready(function() {		
		$('button#guest-pass-submit').colorbox({ inline:true, href:"#guest-pass-captcha" });
		
		// bind "click" event for continue link to submit form
		  $("button#guest-pass-captcha-submit").click( function(){
			$.colorbox.close();
			//$('#guest-pass-captcha-container').css({ 'display':'block' });
			$('#guest-pass-captcha').appendTo("#guest-pass-form");
			$('form#guest-pass-form').submit();
		  });
	});
	
/* Tooltips */
	$(document).ready(function() {
		$('a[title]').tipsy({ fade: true });
	});
