
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").each( function(i){
		i % 2 == 0 ? jQuery(this).addClass("zebra_row_0") : jQuery(this).addClass("zebra_row_1");
		i++;
	});
	
	//jQuery(".prod_imgs a").each( function(i){
		//i % 2 == 0 ? jQuery(this).addClass("margin5px") : jQuery(this).addClass("margin0px");
	//});
	
	// lightbox
	$('.prod_imgs a').lightBox();
	

	jQuery(".header_logo").hover(
		function() { jQuery(this).fadeTo("fast", 0.5); },
		function() { jQuery(this).fadeTo("fast", 1.0); }
	);
	jQuery(".utilities li a").hover(
		function() { jQuery(this).next().fadeIn("fast"); },
		function() { jQuery(this).next().fadeOut("fast"); }
	);

	/*
	if(document.getElementById("homepageFlash"))
	{
		var so = new SWFObject("flash/homepage_000.swf", "flash_area", "540", "180", "8", "#ffffff");
		so.addParam("wmode", "transparent");
		so.write("homepageFlash"); 
	}
	*/
	
	// Cycle through defined areas & assign icon classes based on href.
	jQuery(".prod_extras li a").each( function(i){
		var parsedObject = xtractFile(jQuery(this).attr("href"));
		if(parsedObject.extension) { jQuery(this).addClass(jQuery(this).attr("class") + " dlicon " + parsedObject.extension.substring(1, parsedObject.extension.length).toLowerCase()); }
	});
	
	if(jQuery(".prod_extras").height())
	{
		if(jQuery(".prod_extras").height() > jQuery(".prod_details").height())
		{
			jQuery(".prod_details").height(jQuery(".prod_extras").height());
		}
	}

	jQuery(".searchInput").focus( function() { jQuery(this).attr("value", ""); });
	
	$.PreloadImg = function() {
	    for(var i=0; i<arguments.length; i++)
	    {
	        jQuery("<img>").attr("src", arguments[i]);
	        alert(arguments[i]);
            }
	}
	

});
function DefaultButtonKeyPress(evt, thisElementName) {
    if(evt.which || evt.keyCode)
        {
            if ((evt.which == 13) || (evt.keyCode == 13))
                {                    
                    location =document.getElementById(thisElementName).href;
                    return false;
                }
        }
    else
        {
            return true;
        }
}

