/* auto zoom pictrue */
$(document).ready(function(){
	$("img[name='picautozoom']").each(function(){
		
		var smallWidth = $(this).width();
		var smallHeight = $(this).height();

		$(this).width(smallWidth).css("height","auto");
		if($(this).height() > smallHeight){
			$(this).height(smallHeight).css("width","auto");
			$(this).css("padding","0px "+Math.floor(Math.abs((smallWidth-$(this).width())/2))+"px");
		}else{
			$(this).css("padding",Math.floor(Math.abs((smallHeight-$(this).height())/2))+"px 0px");
		}
		
		$(this).load(function(){
			var smallWidth = $(this).width();
			var smallHeight = $(this).height();
	
			$(this).width(smallWidth).css("height","auto");
			if($(this).height() > smallHeight){
				$(this).height(smallHeight).css("width","auto");
				$(this).css("padding","0px "+Math.floor(Math.abs((smallWidth-$(this).width())/2))+"px");
			}else{
				$(this).css("padding",Math.floor(Math.abs((smallHeight-$(this).height())/2))+"px 0px");
			}
		});
		
	});
});

