$(document).ready(function(){  
  var srchTxtDefaultValue = "ex. 8769-987"; /*  Search the default value of search box here */  
  if( $('#siteSearch #srchTxt').val() != srchTxtDefaultValue ) {
    $('#siteSearch #srchTxt').val(srchTxtDefaultValue);
  }  
  $('#menu li.dropdown').hover(    
    function() {
      $('ul',this).addClass('show');
      $(this).addClass('active');
    },    
    function() { 
      $('ul',this).removeClass('show');
      $(this).removeClass('active');
    }    
  );  
  $('#siteSearch #srchTxt').click(function() {    
    $(this).val('');    
  });  
  $('#siteSearch #srchTxt').blur(function() {          
    if( $(this).val() == '' ) {
      $('#siteSearch #srchTxt').val(srchTxtDefaultValue);
    }    
  });  
  $('#siteSearch #srchTxt').hover(
    function() {
      $('#srchToolTip').slideDown();
    },
    function() {
      $('#srchToolTip').slideUp();
    }
  );  
  $('.frontBlock').hover(  
    function() {
      $(this).addClass('frontBlockActive');
    },    
    function() {
      $(this).removeClass('frontBlockActive');
    }  
  ); 
$('#prodListing .prodNav:first').insertBefore('#prodListing');
$('#prodListing .prodNav:last').insertAfter('#prodListing');
  $('#tickerWrap ul').innerfade({
    animationtype: 'slide',
    timeout: '3333',
    containerheight: '23px'
  });  
  $('#owners .ownerBar').hover(
    function() {
     $(this).addClass('active'); 
    },
    function() {
      $(this).removeClass('active'); 
    }
  );  
  $('.mainContact .submit').hover(
    function() {
      $(this).css({'background-position' : '0 -44px'});
    },
    function() {
      $(this).css({'background-position' : '0 0'});
    }
  );  
  $('#address').hover(
    function() {
     $(this).css({'border-color':'#f47920'}); 
    },
    function() {
      $(this).css({'border-color':'#4e5e68'}); 
    }
  );      
  $('#catBoxes li:nth-child(4n)').css({ 'marginRight' : '0' });    
  
	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click
	$("h2.trigger").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});

	//Slide up and down on click
	$("h2.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow");
	});
 
  
  $('#prodListing li').hover(
    function() {
      $(this).addClass('hover');
    },
    function() {
      $(this).removeClass('hover');
    }
  );
  
});

$(window).load(function() {  
  var imgSpace = 138;  
  $('#catBoxes img').each(function(i) {    
    var imgHeight = $(this).height();    
    var imgMargin = (imgSpace-imgHeight)/2;    
    $(this).css({ 'marginTop' : imgMargin });    
  });
  var prodImgSpace = 175;    
  $('#prodListing li .prodImg img').each(function(i) {    
    var prodImgHeight = $(this).height();    
    var prodImgMargin = (prodImgSpace-prodImgHeight)/2;    
    $(this).css({ 'marginTop' : prodImgMargin });    
  });      
  
  function sameHeight(group) {
    highest = 0;  
    group.each(function() {
      high = $(this).height();
      if(high>highest) {
        highest = high;
      }
    });    
    group.height(highest);
  }

  $('#prodListing li .prodInfo:has(p)').parent().addClass('hazIt');
  
  sameHeight($('#prodListing li.hazIt'));  


});