jQuery.noConflict();

var plauditSite = (function($){
	
	var defaultMethods = function(){
		$("body").addClass("jsEnabled");
		$("tr:odd").addClass("odd");
		$(".searchForm input#query").focus(function(){ 
			$(this).data("inputValue",$(this).val()); // Store for use later if needed
			$(this).val("");
		});
		$('input').keyup(function(event){
			var input = $(this);
		    if (event.keyCode == 13) {
		    	var submitButtons = input.closest("form").find(":submit:first, input.submit:first");
		    	if ( submitButtons.length > 0 ) {
		    		// handle the submit
		    		submitButtons.first().click();
		        	return false;
		    	}
		    	return true;
		    }
		});
	}();
	
	var mediaGallery = function(){
		
		var lightBoxOptions = {
			animationSpeed: 'normal',
			allowresize: false,
			showTitle: false,
			theme: 'light_rounded'	
		};
		
		var sliderOptions = {
			size: 1,
			clickable: false,
			next: "#next",
			prev: "#prev"
		};
		
		$("a[rel^='lightbox']").prettyPhoto(lightBoxOptions);
		$("#imageGallery").scrollable(sliderOptions);
	}();
	
	// Setup Date picker
	$(".datePicker").datepicker();
	
	var traveling = {
		init: function() {
			this.travelOptionsForm = $('#travelOptionsForm');
			var $this = this;
			if ( this.travelOptionsForm.length > 0 ) {
				$('select', this.travelOptionsForm).change(function(event){
					$this.update();
				});
				this.update();
			}
		},
		update: function() {
			$(".select-option").hide();
			
			var disable = false;
			var show = new Array();
			var prev = "";
			$('select', this.travelOptionsForm).each(function(index, el){
				var $el = $(el);
				if ( disable ) {
					$el.attr('disabled','disabled');
				} else {
					$el.removeAttr('disabled');
					
					var id = $el.attr('id');
					var value = $el.val();
					
					if ( value == 'select' ) {
						disable = true;
					}
					
					var temp = id + "-" + value;
					if ( prev != "" ) {
						show[show.length] = "."+prev+"-"+temp+", ."+temp;
						prev = prev+"-"+temp;
					} else {
						show[show.length] = "."+temp;
						prev = temp;
					}
				}
			});

			$(".select-option").hide();
			if ( !disable ) {
				$(".select-option").fadeTo('slow',1);
				for (var i=0; i < show.length; i++ ) {
					var selector = show[i];
					var showing = $(selector).first();
					showing.fadeTo('slow',1);
				}
			}
		}
	}
	traveling.init();
	
	return {
		// Return Public Methods Here
	}
})(jQuery);


