
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(".cartproductgrid tr, .addresseditor tr, .prod_table tr, .reviewTable tr, #tabs-2 table tr").each( function(i){
		i % 2 == 0 ? jQuery(this).addClass("zebra_row_0") : jQuery(this).addClass("zebra_row_1");
		i++;
	});
	
	jQuery(".maincontent .form_table tr:nth-child(even)").addClass("alt");
	jQuery(".maincontent .giftwrap tr:nth-child(even)").addClass("alt");
	jQuery(".pagecontent table tr:nth-child(even)").addClass("alt");
	jQuery("#categorydescription table tr:nth-child(even)").addClass("alt");

	//Apply 11px to first imgThumb & 0 pixels to next 1
	i = 0;
	jQuery(".imgThumb").each( function(i){
		i % 3 == 0 ? jQuery(this).addClass("margin0px") : jQuery(this).addClass("margin11px");
	});

	// give all products equal heights
	//$(".productItem").equalHeights();
	
	// lightbox
	$('.main_image a').lightBox();
	$('a.imgThumb').lightBox();
	
	// image slideshow
	//$("#productItemSlider").easySlider();
	
	// product details tabs
	//$("#tabs").tabs();
	
	// logo fade on mouse over
	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("nav")) {
		var sublinks = document.getElementById("nav").getElementsByTagName("a");
		for (var i = 0; i < sublinks.length; i++)
		{ if (sublinks[i].href == document.location.href) { sublinks[i].parentNode.className += "current"; } }
	};
	
	// highlight the current sidenav link
	if (document.getElementById("sidenav")) {
		var sublinks = document.getElementById("sidenav").getElementsByTagName("a");
		for (var i = 0; i < sublinks.length; i++)
		{ if (sublinks[i].href == document.location.href) { sublinks[i].parentNode.className += "current"; } }
	};
							
	// Dropdown Nav - 
	//$("#nav li").hover(
		//function(){ 
			//$(this).toggleClass("hover");
			//$(this).find(".dropdownWrapper").show(); 
		//},
		//function(){ 
			//$(this).toggleClass("hover");
			//$(this).find(".dropdownWrapper").hide(); 
		//}			
	//);
	
	_typeface_js.initialize();
	
	$.PreloadImg = function() {
		for(var i=0; i<arguments.length; i++)
		{
			jQuery("<img>").attr("src", arguments[i]);
		}
	};
	
});

