/*
	++ ImageProtector jQuery Plugin ++
	
	RebuildAuthor	: Takaaki Mizota
	Version			: 1.0
	Date			: 2008/08/20
	URL				: http://www.mizoochi.com/jquery/protecter
	LICENCE			: http://creativecommons.org/licenses/by/2.1/jp/
	
	arguments
		image		: set Image Path
		zIndex		: Image z-index
	
	setting sample
		$(function(){
			$(".protect").dwProtector({
				image: "images/blank.gif",
				zIndex: 5
			});
		});
	
*/


jQuery.fn.ImageProtector = function(setting){
	
	//setting
	config = jQuery.extend({
		image	: "/images/common/no_copy.gif",
		zIndex	: 10,
		elements: this
	},setting);
		
	//protect
	function protect(config){
		var makers = config.elements;
		var img = '<img src="'+config.image+'" />';
		//
		jQuery.each(makers,function(){
			var my = jQuery(this);
			var w = my.width();
			var h = my.height();
			my.after(img).next().css({
				"position"	: "absolute",
				"width"		: w+"px",
				"height"	: h+"px",
				"margin-left"	: "-"+w+"px",
				"z-index"	: config.zIndex
			});
		});
		
	}
	protect(config);
};

$(function(){
  $(".protect").ImageProtector({
    image :"/images/common/no_copy.gif",
    zIndex : 10
  });
});

