(function($){
	function Loader(target,p1){
		if(target){
			var jNode=$('<div class="loader">Loading</div>').appendTo('body');
			this.target=$(target).data("Loader",this).load(function(){
				jNode.remove();
				$(this).data("Loader").callBack();
			});
			this.jNode=jNode;
			jNode.animate({ 
				width: "100%"
			},1500);
		}
	}
	Loader.prototype.callBack=function(){
		if(typeof this.callBack=="function") this.callBack();
	}
	Loader.prototype.load=function(href,callBack){
		var cb=this.callBack=callBack,jNode=this.jNode;
		if(this.target[0].nodeName.toLowerCase()=="img")this.target.attr("src",href)
		else this.target.load(href,function(){
			jNode.remove();
			if(typeof cb=="function")cb()
		})
	}
	$.fn.addLoader=function(image,callBack){new Loader(this,image,callBack)}
	$.fn.useLoader=function(href,callBack){this.data("Loader").load(href,callBack)}
})(jQuery);