﻿/*********************************************
Copyright 2009 Solid Cactus/Web.com inc.
Last Updated: 8/7/2009
Customized: N
packer: http://dean.edwards.name/packer/
*********************************************/
// Start Features List JS/Plugins
//simple text popups
(function($){
	$.fn.scSimpleText = function(options){
		var defaults = {
			popCloseTxt : ''
		};
		var settings = $.extend({},defaults,options);
		return this.each(function(){  
			var nextElm = $(this).next();
			var closeElement = $(document.createElement("a")).attr("href","").text(settings.popCloseTxt).addClass("scSimpleTextClose").click(function(e){nextElm.fadeOut("slow"); e.preventDefault();});
			$(this).click(function(e){	
				nextElm.fadeIn("slow");
				nextElm.append(closeElement);
				e.preventDefault();
			});
		});
	}
})(jQuery);
/**********************************************************************************************************/
/****************************** Place all add on JS above here, please minify *****************************/
/**********************************************************************************************************/

/************************************* Document on Load jQuery Functions **********************************/

jQuery(document).ready(function() {
		// add a class to the last li in the header and footerlinks.
		$("ul#secondary-links li:last").addClass("last");$("ul#primary-links li:last").addClass("last");$("ul#primary-links").removeAttr("id");$("ul#secondary-links").removeAttr("id");
		// Hide Empty containers and headers (previous element)
		$(".checkempty").each(function(i){var $thisele = $(this);if($.trim($thisele.text()).length < 1){$thisele.prev().hide();}});
		// Hide empty product info table rows
		$("#product-info-table td").each(function(i){var $thisele = $(this);if($.trim($thisele.text()).length < 1){$thisele.parent().hide();}});
		// write seperators for contents.
		var numconts = 3; // change this with number of columns
		$(".products .results-grid").find('.result').each(function(c){var thisresult = $(this);if((c + 1)%numconts!=0){thisresult.addClass("vertsep");} else {thisresult.after("<div class='horzsep'></div>");}});
		// remove styles from image on item page.
		$("#product_image").removeAttr("style");
		//simple text popups
		$("#simpleTextLink").scSimpleText({popClose:".simpleTextRight"});
});
