
// JavaScript Document
function xtractFile(data){
var m = data.match(/(.*)\/([^\/\\]+)(\.\w+)$/);
if(m == null) { m = "null"; }
return {path: m[1], file: m[2], extension: m[3]}
}

/**
 * Equal Heights Plugin
 * Equalize the heights of elements. Great for columns or any elements
 * that need to be the same size (floats, etc).
 * 
 * Version 1.0
 * Updated 12/109/2008
 *
 * Copyright (c) 2008 Rob Glazebrook (cssnewbie.com) 
 *
 * Usage: $(object).equalHeights([minHeight], [maxHeight]);
 * 
 * Example 1: $(".cols").equalHeights(); Sets all columns to the same height.
 * Example 2: $(".cols").equalHeights(400); Sets all cols to at least 400px tall.
 * Example 3: $(".cols").equalHeights(100,300); Cols are at least 100 but no more
 * than 300 pixels tall. Elements with too much content will gain a scrollbar.
 * 
 */

(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest).css("overflow","auto");
		});
	}
})(jQuery);

$(window).load(function() {
								
	// Align product images vertically and horizontally
	var i = 0;
	var panelHeight = jQuery("#header").height();
	var difference = 0;
	
	jQuery("#header img").each( function(i) {
		if(panelHeight > jQuery(this).height() && jQuery(this).height() != 0) {
			difference = panelHeight - jQuery(this).height();
			jQuery(this).css("marginTop", (difference / 2));
		}
	});
	

	$(".block").equalHeights();

	// Fix background images on all #cart elements
			$("div#leftsidebar #cart").pngfix();
			$("div#rightsidebar #cart").pngfix();

	// Fix background images on all A elements
			$("a").pngfix();
			
			// Fix all inline PNG images and the element #container with the custom sizingMethod of "scale"
			$("img[@src$=png], #container").pngfix({
				sizingMethod: "scale"
			});
	jQuery(".lightbox, .lightbox a, .side-img a").lightBox();
	jQuery(".lightbox1").lightBox();
	jQuery(".lightbox2").lightBox();
	jQuery(".lightbox3").lightBox();
	jQuery(".lightbox4").lightBox();
	jQuery(".lightbox5").lightBox();
	jQuery(".lightbox6").lightBox();
	jQuery(".lightbox7").lightBox();
	jQuery(".lightbox8").lightBox();
}); // END jQuery(document).ready

