/* createProductSlider -- This utility function extends jQuery and 
   creates the product slider tabs and loads the panels with images, 
   all done via Ajax */
(function($){ 
	$.createProductSlider = function(ajax_div, file, slider, showLog) {
			
		if ($(ajax_div).children().length === 0)
		{
			// append the loading gif image to show we're loading the elements...
			$(ajax_div).append('<img src="images/loading.gif" alt="Currently Loading" id="loading" />');
			
			<!-- Ajax 'get' call -->
			/* Load the commercial-products.html chunk... */
			$.get(file, function(data)
				{
					$(ajax_div).append(data);  // append the returned data to the #ajaxProducts placeholder <div>
					
					
					$(slider).codaSlider({  // initiate the coda-slider...
						dynamicArrows: false,
						dynamicTabs: false
						//slideEaseDuration: 1500,
						// slideEaseFunction: "easeInOutElastic",
						//autoHeightEaseDuration: 1500,
						//autoHeighEaseFunction: "easeInOutElastic"	
					});
					
										// Remove the loading gif by fading it out...
					$(ajax_div + ' #loading').fadeOut(700, function() { 
						$(this).remove();
					});
					
			    });
		}
		else
		{
			if (showLog == 1 || showLog == true)
				console.log("Page elements are already loaded");
			return;
		}
		
  }
})(jQuery);
// JavaScript Document
