Drupal.behaviors.grassBehaviors = function(context){
  $('fieldset.collapsible .fieldset-title', context).click(hideFieldset);


  function hideFieldset() {
    var $content = $(this).parent().children('.fieldset-body');
    if($content.is(':hidden')){
      $(this).parent().removeClass('collapsed');
      $content.show();
    }else{
      $content.hide();
      $(this).parent().addClass('collapsed');
    }
  }

  sidebarSize();

  function sidebarSize(){
		if($('#left').height() < $('#main').height()){
			var height = $('#main').height();
			$('#left').css('height', height);
		}
	}
	
	var originalimg = $('#image-holder').children('img').attr('src');

	function imgOver(){
	  var image = $(this).attr('href');
		$(this).parents('.product-ntype').children('#image-holder').children('img').attr('src', image);
	}
	function imgOut(){
		if($('#image-holder').children('img').attr('src') != $(this).attr('href')) {
			
		}else {
			$('#image-holder').children('img').attr('src', originalimg);
		}
	}
	var config = {    
	     sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
	     interval: 0, // number = milliseconds for onMouseOver polling interval    
	     over: imgOver, // function = onMouseOver callback (REQUIRED)    
	     timeout: 500, // number = milliseconds delay before onMouseOut    
	     out: imgOut // function = onMouseOut callback (REQUIRED)    
	};

	$('a.thumbs').hoverIntent( config );

 /**
   * Superfish Menus
   * http://users.tpg.com.au/j_birch/plugins/superfish/
   * To use this feature please add the superfish.js to the js directory
   */
  jQuery('#nav ul').superfish({
    animation: { opacity: 'show'},
    easing: 'swing',
    speed: 50,
    autoArrows:  false,
    dropShadows: false /* Needed for IE */
  });
};