
function xtractFile(data){
var m = data.match(/(.*)\/([^\/\\]+)(\.\w+)$/);
if(m == null) { m = "null"; }
return {path: m[1], file: m[2], extension: m[3]}
}

jQuery(document).ready(function() {
	
	// Assign Zebra Cols to Product List
	var i = 0;
	jQuery(".catalogueList li, .form_table tr, .cartproductgrid tr, .addresseditor tr, .prod_table tr, .reviewTable tr, .pagecontent tr, #categorydescription tr").each( function(i){
		i % 2 == 0 ? jQuery(this).addClass("zebra_row_0") : jQuery(this).addClass("zebra_row_1");
		i++;
	});
	
	// Apply 0px to first product panel + apply 10px margin to other 3 product panels
	i = 0;
	jQuery(".productItem").each( function(i){
		i % 3 == 0 ? jQuery(this).addClass("margin0px") : jQuery(this).addClass("margin3px");
	});
	i = 0;
	jQuery(".category").each( function(i){
		i % 3 == 0 ? jQuery(this).addClass("margin0px") : jQuery(this).addClass("margin3px");
	});
		
	// give all products equal heights
	$(".productItem").equalHeights();
	
	// lightbox
	$('a.imgMain').lightBox();
	$('a.imgThumb').lightBox();
	// product details tabs
	$("#tabs").tabs();

	jQuery(".header_logo").hover(
		function() { jQuery(this).fadeTo("fast", 0.7); },
		function() { jQuery(this).fadeTo("fast", 1.0); }
	);

	// highlight the current primaryNav link.
	if (document.getElementById("primaryNav")) {
		var sublinks = document.getElementById("primaryNav").getElementsByTagName("a");
		for (var i = 0; i < sublinks.length; i++)
		{ if (sublinks[i].href == document.location.href) { sublinks[i].parentNode.className += "current"; } }
	}
	
	$.PreloadImg = function() {
		for(var i=0; i<arguments.length; i++)
		{
			jQuery("<img>").attr("src", arguments[i]);
		}
	}
});

