// JavaScript Document
$(function(){
  // Document is ready
function getLeaf(url) {
 var splited=url.split('?');
 url=splited[0];
 return url.substring(url.lastIndexOf("/")+1);
} 

jQuery.fn.extend({
 enter: function() {
     return this.each(function() {
       var pth = $(this).find("img")[0];
	   //alert($(this).children().attr("href"));
	    if($(this).children().attr("href")==getLeaf(document.location.href)){
           $(pth).attr("src",pth.src.replace(/.gif/g, '-active.gif'));
		 } else{
               $(this).hover(function(){
                  $(pth).attr("src",pth.src.replace(/.gif/g, '-active.gif'));
                  },function(){
                      $(pth).attr("src",pth.src.replace(/-active.gif/g, '.gif'));
                      });
               }
               });
     }
});
 $("#nav li, #navigation li, .purchase, .purchase-home").enter();
});
