function loadedBigPic() {
	$("#bigpicpic").css({ "display":"block", opacity:0.01});
	$("#bigpicload").fadeOut(300, function() {
		$("#bigpiccontentback").show().animate({
			"height": $("#bigpicpic").height(),
			opacity: 0.8,
			"top":  ($(window).height()/2-($("#bigpicpic").height()+30)/2)+"px"
		},200, function() {
			$("#bigpic").css({
				"padding-left":7,
				"top":  ($(window).height()/2-($("#bigpicpic").height()+30)/2)+"px"
			});
		
			$("#bigpicpic").animate({opacity:1},200);
		});
	});
}
			
function hidebigpic() {
	$("#bigpicpic").fadeOut(200, function() {
		$("#bigpiccontentback").animate({ 
			"height":10,
			"top": ($(window).height()/2-5)+"px"
		},200).animate({
			opacity:0
		}, 200, function() {
			$(this).hide();
			$("#picbox").fadeOut(200);
			$("#bigpicpic").css({"display":"none"});
			$("bigpic").hide();
		});
	});
}
			
function showbigpic(id) {
	$("#picbox").fadeIn(300, function() {
		$("#bigpiccontentback").show().css({
			"height": 40,
			opacity: 0.8,
			"top":  ($(window).height()/2-20)+"px"
		});
	
		$("#bigpiccontentback").fadeIn(200, function() {
			$("#bigpicpic").attr("src", "image.php?db="+id+"&maxw="+($(window).width()-100)+"&maxh="+($(window).height()-50));
			$("#bigpicload").show();
		
			$("#bigpic").show().css({
				"padding-left":7,
				"top":  ($(window).height()/2-20)+"px"
			});
			
			$("#bigpicpic").imagesLoaded(loadedBigPic);
		});
	});
	
	$("#picbox").click(function() {
		hidebigpic();
	});
	$("#bigpiccontentback").click(function() {
		hidebigpic();
	});
	$("#bigpic").click(function() {
		hidebigpic();
	});
}

function emit_bigpic() {
	document.write('\
		<!-- PICZOOM -->\
		<div id="picbox" class="askbox divlink"></div>\
		<div id="bigpic" class="bigpiccontent divlink">\
			<center><div id="bigpicload" style="background:white;width:50px; height:42px;border-radius: 10px;display:none" class="opaque">\
					<img style="width:40px;padding-top:1px" src="loading.gif" alt="loading" />\
				</div></center>\
			<center>\
			<div>\
				<center><img style="display:none" id="bigpicpic" src="" /></center>\
			</div>\
		</div>\
		\
		<div id="bigpiccontentback" class="bigpiccontentback">\
			&nbsp;\
		</div>\
		<!-- /PICZOOM -->\
	');
}

function picCheckState(id) {
	var obj = "#pic"+id;
	var obj2 = "#img"+id;
	
	if($(obj).data("mover")==true) {
		$(obj).animate({ height: 150 }, 200);
		$(obj2).animate({ height: 120 }, 200);
	} else {
		$(obj).animate({ height: 30}, 200);
		$(obj2).animate({ height: 30 }, 200);
	}
	
	$(obj).data("timeout", "");
}

