(function(win){
	
	win.VhcImg = {};
	
	var curVhcImg = null;//当前图片对象
	var vhcId = 0;
	
	VhcImg.openWin2 = function(el){//设备更多命令打开，传入点击的节点
	
		var id = $(el).attr('name').split('_')[2];
		VhcImg.openWin(id);
	}
	
	VhcImg.openWin = function(vhcId){
		openPopuWin(basePath_ZH + "/jsp/monitor/vhcImg.jsp?vhcId=" + vhcId);
		initWin();
	};
	
	function initWin(){
	
		vhcId = $("#img_vhc_id").val();

		curVhcImg = {};
		
		$("#popu_title").html("车牌拍照 ->" + equipmentObject[vhcId].vehicleName);
		
		loadImg(0);
		
		$("#prev_vhc_img_btn").unbind().click(function(){
			loadImg(1);//1上一张
		});
		
		$("#next_vhc_img_btn").unbind().click(function(){
			loadImg(2);//1下一张
		});		
	}
	
	function loadImg(type){//type 指上一张，下一张，类型
		
		var path = basePath_ + "pub/upImgAction_vhcImg.action";
		
		var params = {
						"vhcId" : vhcId,
						"curVhcImgId" : (curVhcImg == null ? 0 : curVhcImg[0]),
						"vhcImgOpeatType" : type
					 };
		
		asyncdoRequest(path, params, function(result){
			
			if(result.flag){
				
				if(result.data != null){
				
					curVhcImg = result.data;
				
					$("#vhc_img_msg").html("&nbsp;");
				
					var basePath = "http://" + $("#serverip").val();
					
					$("#vhc_img").attr("src", basePath + "/Interface/vhcphoto/" + curVhcImg[4]);
				
				}else{
				
					if(type == 0){
						$("#vhc_img_msg").html("此设备无照片记录!");						
					}else if(type == 1){
						$("#vhc_img_msg").html("已是最后一张照片!");
					}else if(type == 2){
						$("#vhc_img_msg").html("已是最新照片!");
					}
				}
			}
		});
	}
	
})(window);