
$(document).ready(function(){
	var dir = '';
	for(var i =0; i < file_path; i++){
		dir += '../';
	}

	var image = dir + 'common/img/blank.gif';
	$('img.protect').each(function(){
		var width = $(this).width();
		var height = $(this).height();

		if (width == 0) {
			var src =  $(this).attr('src');
			var strings = src.split('?');

			if (strings.length > 1) {
				var query_string = strings[1];
				var params = query_string.split('&');
				for (var p in params) {
					var l = params[p].split('=');
					if (l[0] == 'w') {
						width = l[1];
					} else if (l[0] == 'h') {
						height = l[1];
					}
				}
			} else {
				var srcs = strings[0].split('/');
				if (srcs.length > 1) {
					if (srcs[1] == 'htp_noimg.gif') {
						width = 98;
						height = 98;
					} else if (srcs[1] == 'sc_noimg.gif') {
						width = 60;
						height = 59;
					}
				}
			}
		}

		var protectImage = $('<img />').attr("src", image)
			.css("position", "absolute")
			.css("width",  width  + "px")
			.css("height", height + "px")
			.css("margin-left", "-" + width + "px")
			.css("z-index", 9999)
			.insertAfter($(this));
		$(this).mouseover(function(){
			var pos = $(this).offset();
			
			$(protectImage).css("top",  pos.top  + "px");
			$(protectImage).css("left", parseInt(pos.left) + parseInt(width) + "px");
		});

		
	});

});

