$(document).ready(function(){

 $('.featurebox:first').css('margin-left','0px');
 $('img[align=right]').addClass('right');
 $('img[align=left]').addClass('left');
 $('.testimonialItem:last').css('border','0px');

 Cufon.replace('.productheading, #instructions, .price, .stylebutton', {hover: true, fontFamily: 'Cronos Pro'});
 Cufon.replace('#nav2 li a, .featurebox h2, h1, h2, h3, h4', {hover: true, fontFamily: 'Cantarell'});

// --------------------------------------- //
// Spacing Between Categories
// --------------------------------------- // 
$('.productcategory').filter(function(index) {
  return index % 3 == 1;
}).css('margin', '0 23px 0 23px');

$('.productdetail').filter(function(index) {
  return index % 3 == 1;
}).css('margin', '0 23px 0 23px');

/*-------------------------------------- */
/* Navigation
/*-------------------------------------- */

	//$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
	$("ul#nav2 li a").hover(function() { //When trigger is clicked...
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});
	});
	
	$("ul#nav2 li ul.subnav li a").hover(function() { //When trigger is clicked...
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show();
		$(this).parent().find("ul.secondnav").slideDown('fast').show(); //Drop down the subnav on click
      
		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.secondnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
	  });
  });


/* ------------------------------- */
// Equal Heights
/* ------------------------------- */
function equalHeight(group) {
    tallest = 0;
    group.each(function() {
       thisHeight = $(this).height();
       if(thisHeight > tallest) {
        tallest = thisHeight;
      }
    });
    group.height(tallest);
}

equalHeight($(".featurebox p"));
equalHeight($(".productdetail .productheading"));

});
