function largeImageLoaded() {
	if(!earlyResetLarge) {
		var top = Math.round(($(window).height() - (largeImg.height + 50)) /2);
		var left = Math.round(($(window).width() - (largeImg.width + 50)) /2);
		if(top < 0)
			top = 0;
		if(left < 0)
			left = 0;
		if((largeImg.height + 40) > $(window).height()) {
			$('#largeImageContainer').css('height', (largeImg.height + 50)+'px');
			$('#largeImageBackground').css('height', (largeImg.height + 50)+'px');
		}
		if((largeImg.width + 40) > $(window).width()) {
			$('#largeImageContainer').css('width', (largeImg.width + 50)+'px');
			$('#largeImageBackground').css('width', (largeImg.width + 50)+'px');
		}
		$('#largeImageSource').html('<img src = "'+largeImg.src+'" /><div id = "largeCloseText">close</div>');
		$('#loadingLargeContainer').animate({
			width: largeImg.width,
			height: largeImg.height,
			top: top,
			left: left
		}, 300);//, 'linear', function() {
		//});
		$('#largeImageSource').click(function() {
			$('#largeImageContainer').fadeOut('fast', function() {
				$('select[name="quantity"]').fadeIn();
				$('#largeImageContainer').remove();
			});
		});
		$('#loadingLargeImage').fadeOut('500', function() {
			$('#largeImageLoader').fadeIn('500');
		});
	}
}
function earlyResetLargeLoad() {
	earlyResetLarge = true;
	$('#largeImageContainer').fadeOut('fast', function() {
		$('select[name="quantity"]').fadeIn();
		$(this).remove();
	});
}
function loadFullSize(image) {
	if(image) {
		var html = "";
		html += "<div id = \"largeImageContainer\" style = \"display:none;\">";
		html += "<div id = \"largeImageBackground\">&nbsp;</div>";
		html += "<div id = \"loadingLargeContainer\" style = \"top:"+Math.round(($(window).height() - 200)/2)+"px;left:"+Math.round(($(window).width() - 300)/2)+"px\">";
		html += "<div id = \"loadingLargeImage\" ><img src = \"/murad/images/ajax-loader.gif\" width = \"16\" height = \"16\" /><br /><a href = \"javascript:earlyResetLargeLoad();\">Cancel</a></div>";
		html += "<div id = \"largeImageLoader\" style = \"display:none;\">";
		html += "<div id = \"largeImageSource\">&nbsp;</div>";
		html += "</div>";
		html += "</div>";
		html += "</div>";
		$('body').append(html);
		$('select[name="quantity"]').fadeOut();
		$('#largeImageContainer').fadeIn('fast', function() {
			largeImg = new Image();
			largeImg.onload = largeImageLoaded;
			largeImg.src = image;
		});
	}
}

