// when the DOM is ready:
$(document).ready(function () {
  // find the div.fade elements and hook the hover event
  $('#products li').hover(function() {
 		$('#products li').stop(true);
	    $('#products li').fadeTo(50, 0.5);
        $(this).stop().fadeTo(50, 1);

  }, function () {
    // on hovering out, fade the element out
	    $('#products li').fadeTo(250, 1);

  });

  // in subcategory
  var subcategory = jQuery.url.segment(2);
  if (subcategory  > "" ) {

	  subcategory = decodeURIComponent(subcategory);
 	  subcategory = subcategory.replace("-{47}-"," / ");
	  subcategory  = subcategory.replace(/-/g," ");	  
//	  alert(subcategory);
	  $("#menu ul li a:contains('" + subcategory + "')").css({'fontWeight' : 'bold'});
  } else {
	// on parent category
	// hide preview images
	$('#products li').hide();
	$('#CategoryPaging').hide();	
	
  }
  // send category to detail page
  var current = jQuery.url.segment(1);
    if (current > "" ) {
	current = decodeURIComponent(current);
	current = current.replace(/-/g," ");
	}
	
	strlink = "#" + current;   
	 
 $("#products li a").each(function () {
    var strlink = $(this).attr('href');
	strlink = strlink + "#" + current;
   $(this).attr({'href' : strlink});
}); 
 
});