
function xtractFile(data){
var m = data.match(/(.*)\/([^\/\\]+)(\.\w+)$/);
if(m == null) { m = "null"; }
return {path: m[1], file: m[2], extension: m[3]}
}						  
						  
$(document).ready(function() {

	// Jquery Lightbox
	$(function() { $('.imgMain, .product-additionalthumb a').lightBox(); });

	// Utilities Tooltips
	jQuery(".utilities li:last").hover(
		function() 
		{ jQuery(".currency p").fadeIn("fast"); },
		function() 
		{ jQuery(".currency p").fadeOut("slow"); }
	);
	
	jQuery(".helpIcon img").hover(
		function() 
		{ jQuery(".helpIcon p").fadeIn("slow"); },
		function() 
		{ jQuery(".helpIcon p").fadeOut("slow"); }
	);
	
	//$(".helpIcon img").easyTooltip();

	
	jQuery(function() {
		jQuery(".carousel").jCarouselLite({
			btnNext: ".next",
			btnPrev: ".prev",
			vertical: true,
			visible: 4,
			auto: 3000,
			speed: 400
		});
	});
	
	//apply background colour to alternating table rows
	var i = 0;
	jQuery(".prod_details tr, .form_table tr, .search_table tr, .cartproductgrid tr").each( function(i){
		i % 2 == 0 ? jQuery(this).addClass("zebra_row_0") : jQuery(this).addClass("zebra_row_1");
		i++;
	});
	//apply 10px margin to first of 2 products in list
	jQuery(".productItem").each( function(i){
		i % 2 == 0 ? jQuery(this).addClass("margin10px") : jQuery(this).addClass("margin0px");
	});
	//apply 5px margin to first of 2 product thumbnails
	jQuery(".imgThumb").each( function(i){
		i % 2 == 0 ? jQuery(this).addClass("margin5px") : jQuery(this).addClass("margin0px");
	});
	
	    $.PreloadImg = function() {
	    for(var i=0; i<arguments.length; i++)
	    {
	        jQuery("<img>").attr("src", arguments[i]);
        }
	}

	
	
});

$(window).load(function() {
	
	// Align product images vertically and horizontally
	var i = 0;
	var panelHeight = jQuery(".product-thumb").height();
	var difference = 0;
	
	jQuery(".product-thumb img").each( function(i) {
		if(panelHeight > jQuery(this).height() && jQuery(this).height() != 0) {
			difference = panelHeight - jQuery(this).height();
			jQuery(this).css("marginTop", (difference / 2));
		}
	});
	

});						  

