$(function(){
	$('#captureDiv').css('display','none');
	$('#captureDiv').click(function(){
		$('#captureDiv').css('display','none');
	});
	$('.list-item').click(function(){
		var captureKey = $(this).attr('data');
		if(captureKey==null || captureKey.length<=0){
			return;
		}
		waiting();
		doPost(
				ctx+"/doorbell/getcallcapture?appId="+appId, 
				{
					captureKey : captureKey,
				}, 
				true, 
				function(data){
					waitingStop();
					if(data!=null && data.length>0){
						var json = eval('('+data+')');
						$('#captureDiv').empty();
						$('#captureDiv').append('<img src="'+json.url+'">');
						$('#captureDiv').css('display','block');
						$('#captureDiv img').css('display','none');
						
						$('#captureDiv img').load(function(){
							var w = (window.screen.width - $('#captureDiv img').width())/2;
							var h = (window.screen.height - $('#captureDiv img').height())/2;
							$('#captureDiv img').css('top',h+'px');
							$('#captureDiv img').css('left',w+'px');
							$('#captureDiv img').css('display','block');
						});
					}
				});
	});
});