// JavaScript Document


function InitImage() {
	$("#divBG").click(function() {
		HideImage();
	});
	$("#divImage").click(function() {
		HideImage();
	});
}
function ShowImage(strFilename) {
	//set background
	$("#divBG").css('width',screen.width);
	$("#divBG").css('height',screen.height);
	$("#divBG").show(0);
	
	document.getElementById('divImage').style.top = '50%';
	document.getElementById('divImage').style.left = '50%';
	$("#imgLoading").show();
	
	//set image
	var img = new Image();
	$(img).load(function () {
		//hide preloader
		$("#imgLoading").hide();
		//add image
		$('#divImage').append(this);
		$("#divImage").show();
		$(this).attr("id",'imgImage')
		//img link
		$("#aImageLink").attr('href',strRoot+'uploads/images/'+strFilename);
		
		//position
		$("#divImage").css('height',$(this).height());
		$("#divImage").css('width',$(this).width());
		$("#divImage").css('marginTop', -($(this).height()/2));
		$("#divImage").css('marginLeft',-($(this).width()/2));
	}).error(function () {
		
	}).attr('src', strRoot+'thumb.php?img=../uploads/images/'+strFilename+'&max_width=600&max_height=600');
}
function HideImage() {
	//hide background
	$("#divBG").hide();
	//remove image
	$("#imgImage").remove();
	//reset image
	$("#divImage").hide();
}

