jQuery.noConflict();

var plauditSite = (function($){
	
	var uiElements = {
		
		init: function() {
			uiElements.defaultMethods();
			uiElements.customElements.init();
		},
		
		defaultMethods: function() {
			$("body").addClass("jsEnabled"); // We use this to style non-js
			$("tr:odd").addClass("odd"); // Setup tables for zebra striping
		},
		
		customElements: {
			
			init: function() {
				this.repFinder();
				this.productPhotoCaptions();
			},
			
			repFinder: function(){
				$("#findRep select").children("option").eq(0).attr("selected","selected");
				$('#findRep select').change(function(){
					var selectedRep = $(this).children("option:selected").attr("value");
					$(".visible").css("display", "none");
					$("#repResult div").each(function(){
						if( $(this).hasClass(selectedRep) ) {
							$(this).addClass("visible").slideDown();
						}
					});
				});
			},
			
			productPhotoCaptions: function(){
				var photoSubtitle = $("#innerColumnSub img.product").attr("alt");
				$("#innerColumnSub img.product").after("<span class='caption'></span>");
				$(".caption").append(photoSubtitle);
			}
			
		} // Custom Elements
		
	}; // uiElements
	
	return {
		setup: uiElements.init()
	}
})(jQuery);

jQuery(function(){ plauditSite.setup });

