// JavaScript Document

(function( $ ){
		  
	$.fn.preLoad = function() {
  		 var extAr=$(this).attr('src').split('.');
		var filename=extAr[0];
		var ext=extAr[1];
		var newName=filename+"_h."+ext;
		var image1 = $('<img />').attr('src', newName);
	};

  $.fn.imH = function() {
	 	 var orfile=$(this).attr('src');
  	 	var extAr=$(this).attr('src').split('.');
		var filename=extAr[0];
		var ext=extAr[1];
		if(orfile.indexOf('_h.')>=0){
			var newName=orfile.replace('_h.','.');
		}else{
			var newName=filename+"_h."+ext;
		}
		this.attr('src',newName);
		return this;
  };
  
  $.fn.menuH = function() {
	  var location=window.location.href;
	  if(location.substr(-1,1)=="/"){
		 location="home";
	  }
	  var href=$(this).attr("href");
	  $.img=$(this).children('img:eq(0)');
	  if(location.indexOf(href)>=0){
		  $.img.imH();
		  $.img.addClass('menuon');
	  }else{
		  $.img.hover(
			function(){
				$(this).imH();
			} ,
			function(){
				$(this).imH();
			});
	  }
  }
})( jQuery );

