jQuery.noConflict();
jQuery(document).ready(function($) {

  // Tabbed Content (Homepage)
  var lastBut = '#feat-prod';
  var lastTab = '#featured-products';
  
  $('#feat-prod').bind('click', function() {
  	if(lastTab == '#featured') {
  		return false;
  	} else {
  		$(this).addClass('active');
  		$(lastBut).removeClass('active');
  		$(lastTab).hide(100);
  		$('#featured-products').show(100);
  		lastTab = '#featured-products';
  		lastBut = '#feat-prod';
  	}
  });
  
  $('#cust-mad').bind('click', function() {
  	if(lastTab == '#cust-mad') {
  		return false;
  	} else {
  		$(this).addClass('active');
  		$(lastBut).removeClass('active');
  		$(lastTab).hide(100);
  		$('#cm-products').show(100);
  		lastTab = '#cm-products';
  		lastBut = '#cust-mad';
  	}
  });
  
  // product reviews
  $("#customer-reviews .box-review:odd").addClass("even");

    $('#findadealer ul a').click(function(e) {
        e.preventDefault();
        $('#findadealer a.current').removeClass('current');
        var div = $(this).addClass('current').attr('href').substring(1);
        $('#findadealer > div').hide();
        $('#dealer' + div).show();
    });
    $('#findadealer ul a:first').click();
});

jQuery(window).load(function() {
    if (jQuery('.product-image.product-image-zoom img').width() <= jQuery('.product-image.product-image-zoom').width()) {
        jQuery('.product-image.product-image-zoom').height(jQuery('.product-image.product-image-zoom img').height());
    }
    jQuery('.product_row').each(function() {
        var height = 0;
        jQuery(this).children('.product').each(function() {
            height = jQuery(this).innerHeight() > height ? jQuery(this).innerHeight() : height;
        }).css({height: height});
    });

    var height = Math.max(jQuery('#prdct-left').innerHeight(), jQuery('#prdct-right').innerHeight());
    jQuery('#prdct-left').height(height - 40);
    jQuery('#prdct-right').height(height - 25);
});
