var imServer = getParameter("imserver");
var lvid = getParameter("lvid");
var groupid = getParameter("groupid");
var sign = getParameter("sign");
imServer = getImServer(imServer);
var creatorid, myuserid, groupid;
var uploadProgress = [];
var convertMap = {};
var isnew2D;
var projectaddNum = 0,
	projectdelNum = 0;

function Project() {
	this.Items = {};
}
Project.prototype.add = function(id, iArray) {
	this.Items[id] = iArray;
}

var pros = new Project(); // 项目信息列表
var currentPage = 1,
	currentProjectid = "";
document.onkeydown = function(event) {
	// 网页内按下回车触发
	var e = event || window.event || arguments.callee.caller.arguments[0];
	if(e && e.keyCode == 13) { // enter 键 //要做的事情
		if($(".announPopup").is(":hidden") == false) {
			dodelete();
		}
		if($(".PopupQueding").is(":hidden") == false) {
			$(".PopupQueding").hide();
		}
		if($(".copyPopup").is(":hidden") == false) {
			doCupy();
		}
	}
	if(event.ctrlKey) {
		if(e.keyCode == 65) {
			return false;
		}
	}
}
$(document).ready(function() {
	try {
		sendCommand('{command:9015, params:{title:"项目列表", content:"lvid: ' + lvid + ', groupId: ' + groupid + ' 项目列表初始化", iswritefile:1}}');
	} catch(e) {}
	if($(".annMainTop").outerWidth() < 340) {
		$(".loadBut").css({
			"float": "left"
		});
		$(".loadBut").css({
			"margin-right": "0px"
		});
	} else {
		$(".loadBut").css({
			"float": "right"
		});
		$(".loadBut").css({
			"margin-right": "5px"
		});
	}
	$(window).resize(function() {
		if($(".annMainTop").outerWidth() < 340) {
			$(".loadBut").css({
				"float": "left"
			});
			$(".loadBut").css({
				"margin-right": "0px"
			});
		} else {
			$(".loadBut").css({
				"float": "right"
			});
			$(".loadBut").css({
				"margin-right": "5px"
			});
		}
		scrollOverflow();
	});
	$(".infoLoadicon").css('display', 'block');
	$("#uploadProgress").click(function() {
		var params = '{command:9018,params:{}}';
		sendCommand(params);
	});
	// 输入框回车事件
	$("#newproname").keydown(function(t, event) {
		var e = event ? event : window.event;
		if(e.keyCode == 13) {
			updatesub();
		}
	});
	lvConfirmInit("annWarp", "dodelete", null, null);
	lvAlertInit("annWarp");
	try {
		sendCommand('{command:9015, params:{title:"项目列表", content:"lvid: ' + lvid + ', groupId: ' + groupid + ' 读取项目列表", iswritefile:1}}');
	} catch(e) {}
	gopage(1);
});

function fix(value) {
	return value.toFixed(2);
}

//点击刷新按钮
function reloadData() {
	projectaddNum = 0;
	projectdelNum = 0;
	$('.newsTip').hide();
	gopage(currentPage);
}

// 刷新数据
function gopage(page) {
	$(".annList ul").html("<div class='infoLoadicon'><dl><dt><img src='../images/infoLoad.gif' alt=''></dt></dl></div>");
	if(debugStatus) {
		//alert(page);
	}
	currentPage = page;
	try {
		try {
			sendCommand('{command:9015, params:{title:"项目列表", content:"lvid: ' + lvid + ', groupId: ' + groupid + ' 获取最新sign值", iswritefile:1}}');
		} catch(e) {}
		var data = sendCommand('{command:9004,params:{"lvid":' + lvid + '}}');
		if(data) {
			var result = $.parseJSON(data);
			if(result['errorid'] == 0) {
				sign = result['sign'];
			}
		}
		if(debugStatus) {
			alert(sign);
		}
	} catch(e) {
		try {
			sendCommand('{command:9015, params:{title:"项目列表", content:"lvid: ' + lvid + ', groupId: ' + groupid + ' 获取最新sign异常", iswritefile:1}}');
		} catch(e) {}
	}
	var params = {
		'groupid': groupid,
		"from": 1,
		'lvid': lvid,
		'sign': sign,
		'pageindex': page,
		'pagesize': 20
	};
	var showicon = $('.showicons').html();
	try {
		sendCommand('{command:9015, params:{title:"项目列表", content:"lvid: ' + lvid + ', groupId: ' + groupid + ' 加载项目列表", iswritefile:1}}');
	} catch(e) {}
	$.getJSON(requestUrlMap['listGroupProject']['url'], params, searchCallBack);
	scrollOverflow();
}

//点击显示水印和隐藏水印掉的方法 {projectid:xxxx, ismark:[1|0]}
function setmark(result) {
	var projectId = result['projectid'];
	var project = $.parseJSON(pros.Items[projectId]);
	if(project && project['ismark'] != result['ismark']) {
		project['ismark'] = result['ismark'];
		pros.Items[projectId] = $.toJSON(project);
	}
}

//右击事件获取当前鼠标右击点击的项目
function right_click(projectid) {
	var project = pros.Items[projectid];
	if(!project) {
		return;
	}
	var params = '{command:2003, params:' + project + '}';
	sendCommand(params);
}

// 提交的回调函数
function searchCallBack(data) {
	$('.newsTip').hide();
	try {
		sendCommand('{command:9015, params:{title:"项目列表", content:"lvid: ' + lvid + ', groupId: ' + groupid + ' 输出项目列表信息", iswritefile:1}}');
	} catch(e) {}
	$(".infoLoadicon").hide();
	$("#projectsData").html("");
	if(data.errorid != 0) {
		$("#noList").html("非法请求").show();
		return;
	}
	$("#idpronum").html(data.count);
	if(data['count'] == 0) {
		$('.FbackPaging').hide();
		$("#noList").show();
		return;
	}
	$('.FbackPaging').show();
	$("#noList").hide();
	var proArr = data.listgroupprojects;
	pros.Items = [];
	var uploadTime, updateTime;
	var fileSize;
	var html;
	var project;
	var icon;
	var typeicon;
	var errorIcon,type;
	var is2D = false;
	var stateLoad = '<div class="loading loadingbg"><span class="loadingnum">1%</span></div>';
	// for循环开始
	for(var i = 0; i < proArr.length; i++) {
		project = proArr[i];
		if(project.projecttype == 0) {
			is2D = true;
		}else{
			is2D = false;
		}
		type = project.filetype;
		icon = project.iconurl;
		if(icon == '' || !icon){
			if(is2D) {
				if(type == 'docx' || type == 'xlsx' || type == 'pptx'){
					errorIcon = '../images/officeIcon.png';
					icon = '../images/officeIcon.png';;
				}else if(type == 'dwg'){
					errorIcon = '../images/cadIcon.png';
					icon = '../images/cadIcon.png';
				}else{
					icon = '../images/blue/projectImg.png';
					errorIcon = '../images/blue/projectImg.png';
				}
			}else{
				errorIcon = '../images/3dIcon.png';
				icon = '../images/3dIcon.png';
			}
		}
		if(!is2D) {
			errorIcon = '../images/3dIcon.png';
		}
		isnew2D = project.isnew2d;
		pros.add(project.projectid, $.toJSON(project), isnew2D);
		fileSize = formatFileSize(project['projectsize']);
		uploadTime = $.formatDateStyle1(new Date(project['uploadtime'] * 1000));
		updateTime = $.formatDateStyle4(new Date(project['updatetime'] * 1000));
		html = '<li onselectstart="return false;" ondblclick="openproject(' + project.projectid + ')" oncontextmenu="right_click(' + project.projectid + ')">';
		html += "<div id='" + project.projectid + "' class=\"annListMain\" statusId='" + project.projecttype + "'>";
		html += "<div class=\"annListImg\"><img src='" + icon + "' onerror=\"javascript:this.src ='"+errorIcon+"'\" draggable='false' width='64px' height='48px'/></div>";
		html += " <div class=\"annImgMian\">";
		html += "<dl>";
		html += '<dt>';
		html += "<B class='projectname'>" + project.projectname;
		html += project['state'] == 1 ? '' : ' （未上传）';
		html += "</B>"
		html += "</dt>"
		html += "  <dd>";
		html += '<span class="typeminw">';
		if(is2D) {
			html += ' 硫酸纸 (<a class="num">' + project.handlenum + '</a>)';
			typeicon = '<img class="typeicon" src="../images/2D.png">';
		} else {
			typeicon = '<img class="typeicon" src="../images/3D.png">';
			html += ' 3D模型 (<a class="num">' + project.handlenum + '</a>)';
		}
		html += '<i class="tip"></i></span>';
		html += '<span style=\"width:9%;min-width:48px\" title=\"项目大小：' + fileSize + '\">' + fileSize + '</span>';
		var creatName = project.creatorname ? project.creatorname : '未知';
		html += "<span class='creatName' title=\"创建人：" + creatName + "\">" + creatName + "</span>";
		html += "<span class='loadTime' title=\"上传时间: " + $.formatDateStyle4(new Date(project['uploadtime'] * 1000)) + "\">" + uploadTime + "</span>";
		html += "<span class='updataTime' title=\"最后修改时间: " + updateTime + "\">" + updateTime + "</span>";
		html += " </dd>";
		html += "</dl>";
		html += "</div>";
		switch(project['transtate']) {
			case 0: //正在转码
				html += stateLoad;
				break;
			case 1: //转码成功
				html += typeicon;
				if(convertMap[project.projectid]) {
					clearTimeout(convertMap[project.projectid]);
				}
				break;
			case -1:
				html += typeicon;
				break;
			case 2: //转码失败
				var msg = !project['errmsg'] ? '转码失败' : project['errmsg'];
				html += '<div class="loading"><span class="loadingnum red">'+msg+'</span></div>';
				if(convertMap[project.projectid]) {
					clearTimeout(convertMap[project.projectid]);
				}
				break;
		}
		html += "</div>";
		html += "</li>";
		$("#projectsData").append(html);
		if($('div').attr('loadNum')){
			$('#'+project.projectid).find('.loadingnum').text($('#'+project.projectid).attr('loadNum'))
		}
	}
	//输出页码信息
	printPageInfo(data);
	$('#projectsData li').mousedown(function(e) {
		$(this).addClass("liClick").siblings().removeClass();
	});
	scrollOverflow();
	//通知客户端加载完成
	sendCommand('{command:9005,params:{"page":1}}');
}

function printPageInfo(data) {
	var pagehtml = "";
	if(data.pageindex == 1) {
		pagehtml += '<span style="cursor:Default" class="page-none"><a class="mouserde" title="已是首页" href="javascript:void(0)"><img src="../images/pageUp.png" title="已是首页" style="cursor:Default"></a></span>';
	} else {
		pagehtml += '<span class="pages"><a href="javascript:gopage(' + (data.pageindex - 1) + ')"><img src="../images/pageUp.png"></a></span>';
	}
	var startPage = Math.min(data.pageindex - 1, data["totalpage"] - 5);
	if(startPage <= 0) {
		startPage = 1;
	}
	var endPage = Math.min(startPage + 2, data["totalpage"]);
	for(var i = startPage; i <= endPage; i++) {
		if(i == data["pageindex"]) {
			pagehtml += '<span><a href="javascript:;" style="color:#3598db;">' + i + '</a></span>';
		} else {
			pagehtml += '<span><a href="javascript:gopage(' + i + ')">' + i + '</a></span>';
		}
	}
	startPage = endPage + 1;
	if(endPage < data["totalpage"]) {
		if(endPage + 3 >= data["totalpage"]) {
			pagehtml += "<span><a href=\"javascript:gopage(" + startPage + ")\"" + (i == data["pageindex"] ? " style=\"color:#3598db;\"" : "") + ">" + startPage + "</a></span>";
		} else {
			pagehtml += "<span><a href=\"javascript:;\">...</a></span>";
		}
		startPage = (startPage + 2 <= data['totalpage']) ? endPage + 2 : startPage + 1;
		for(var i = startPage; i <= data["totalpage"]; i++) {
			if(i == data["pageindex"]) {
				pagehtml += '<span><a href="javascript:;" style="color:#3598db;">' + i + '</a></span>';
			} else {
				pagehtml += '<span><a href="javascript:gopage(' + i + ')">' + i + '</a></span>';
			}
		}
	}
	if(data.pageindex >= data.totalpage) {
		pagehtml += "<span class='page-none' style='cursor:Default'><a class='mouserde' title='已是末页' href=\"javascript:void(0)\" ><img src='../images/pageDown.png' title='已是末页' alt='' style='cursor:Default'></a></span>";
	} else {
		pagehtml += "<span class='pages'><a href=\"javascript:gopage(" + (data.pageindex + 1) + ")\"><img src='../images/pageDown.png' alt=''></a></span>";
	}
	$("#pagingWarp").html(pagehtml);
}

//上传完成（由客户端调用）
function UploadFinish() {
	gopage(1);
	$('.infoLoadicon').hide();
}

// 双击项目列表事件
function openproject(projectid) {
	var json = pros.Items[projectid];
	var project = $.parseJSON(json);
	if(project['state'] == 0) {
		return;
	}
	if(project['transtate'] == 0) {
		showAlert("正在转码中请稍后...");
		return;
	}
	if(project['transtate'] == 2) {
		showAlert("转码失败, 请联系图驴客服!");
		return;
	}
	$('#' + projectid).find('i.tip').hide();
	$('#' + projectid).find('.typeminw').attr('title', '');
	var params = "{command:1008,params:" + json + "}";
	sendCommand(params);
}

function openprojectAjax(projectid) {
	// 右键点击打开事件
	var params = {
		'projectid': projectid,
		"from": 1,
		'lvid': lvid,
		'sign': sign
	};
	$.getJSON(requestUrlMap['projectInfo']['url'], params, function(data) {
		if(data.errorid != 0) {
			showAlert('打开失败, 请重试!');
			return;
		}
		var project = data.projectinfo;
		var params = "{command:1008,params:" + $.toJSON(project) + "}";
		sendCommand(params);
	});
}

// 上传项目文件
function uploadproject() {
	var params = "{command:1007,params:{mylvid:" + lvid + ",groupid:" + groupid + "}}";
	sendCommand(params);
}

// 确定要删除项目
function dodeletePro(obj) {
	var params = {
		'groupid': obj.groupid,
		'projectid': obj.projectid,
		'lvid': obj.lvid,
		'sign': obj.sign
	};
	$.getJSON(requestUrlMap['delProject']['url'], params, function(data) {
		if(data.errorid != 0) {
			showAlert(data.errmsg);
			return;
		}
		$('#' + obj.projectid).parent('li').remove();
		pros.Items[obj.projectid] = '';
		$("#idpronum").text(Number($("#idpronum").text()) - 1);
		scrollOverflow();
		var currentPageCount = $('#projectsData').children().length;
		if(currentPageCount == 0) {
			if(currentPage == 1) {
				reloadData();
			} else {
				gopage(currentPage - 1);
			}
		}
	});
}

// 下载照相机
function downCamera(id) {
	var data = pros.Items[id];
	var json = jQuery.parseJSON(data);
	var length_1 = json.projectname.length;
	var params = {
		"from": 1,
		'projectid': json.projectid,
		'lvid': lvid,
		'sign': sign
	};
	$.getJSON(requestUrlMap['cameraScript']['url'], params, function(datajson) {
		if(json.projecttype == 1 && datajson.errorid == 0) {
			var cfilename = json.projectname.substring(0, length_1 - 4) + ".ms";
			window.location.href = datajson.fileurl;
		} else {
			showAlert("该项目尚未创建相机数据");
		}
	});

}

// 重命名
function renamePro(projectid) {
	var project = $.parseJSON(pros.Items[projectid]);
	var proname = project['projectname'].Trim();
	$("#updateProjectId").val(projectid);
	$("#newproname").val(proname);
	$(".newlyClose").click(function() {
		$(".popup").css("display", "none");
	});
	$(".cancelBut").click(function() {
		$(".popup").css("display", "none");
	});
	$(".popup").css("display", "block");
	$('.popup .newlyInput input').focus().select();
}

function updatesub() {
	var upid = $('#updateProjectId').val();
	var newname = $("#newproname").val().Trim();
	if(newname == '') {
		var paramStr = "{title:'提示',cat:0,content:'项目名称不可为空！'}";
		var params = "{command:9006,params:" + paramStr + "}";
		var resultS = sendCommand(params);
		return;
	}
	$(".popup").css("display", "none");
	var params = {
		'groupid': groupid,
		"from": 1,
		'projectid': upid,
		'proname': newname,
		'lvid': lvid,
		'sign': sign
	};
	$.getJSON(requestUrlMap['updateProName']['url'], params, function(data) {
		if(data.errorid != 0) {
			showAlert(data.errmsg);
			return;
		}
		var project = $.parseJSON(pros.Items[upid]);
		project['projectname'] = newname;
		pros.Items[upid] = $.toJSON(project);
		var nameView = $('#' + upid).find('B.projectname');
		nameView.text(newname);
	});
}
// 复制项目到其它组
var copyproject = function(id) {
	$(".copyPopup").show();
	currentProjectid = id;
	var params = {
		'lvid': lvid,
		'projectid': id,
		'sign': sign
	};
	$.getJSON(requestUrlMap['copyGroupList']['url'], params, function(data) {
		if(data.errorid != 0) {
			showAlert('拉取群组列表失败, 请确认网络正常后重试!');
			return;
		}
		$('.copytitle').text('请选择群组');
		var grouplistTit = data.collearray;
		var grouplist = data.grouplist;
		if(grouplistTit.length == 0) {
			return;
		}
		var strArr = [];
		var groupHeaurl;
		$.each(grouplistTit, function(key, val) {
			if(val.parentid == '-1') {
				strArr.push('<li class="checklist">', '<h4 class="groupTit">', val.teamname, '</h4>')
				$.each(grouplist, function(key2, val2) {
					if(val2.teamid == val.teamid) {
						groupHeaurl = val2.iconurl == '' ? '../images/classic/HEAD-Group-16.jpg' : val2.iconurl;
						strArr.push('<p class = ' + val2.groupid + '><label>', '<input type="checkbox" name="groupidsc" value="', val2.groupid, '"/>', '<img src="', groupHeaurl, '" alt="" >', '<span class="groupname">', val2.cloudgroupname, '</span></label></p>')
					}
				})
				$.each(grouplistTit, function(key2, val2) {
					if(val2.parentid != '-1') {
						if(val2.parentid == val.teamid) {
							strArr.push('<div class="twoTit">', '<h4 class="groupTit">', val2.teamname, '</h4>')
							$.each(grouplist, function(key3, val3) {
								if(val3.teamid == val2.teamid) {
									groupHeaurl = val3.iconurl == '' ? '../images/classic/HEAD-Group-16.jpg' : val3.iconurl;
									strArr.push('<p class = ' + val2.groupid + '><label>', '<input type="checkbox" name="groupidsc" value="', val3.groupid, '"/>', '<img src="', groupHeaurl, '" alt="" >', '<span class="groupname">', val3.cloudgroupname, '</span></label></p>')
								}
							})
							strArr.push('</div>')
						}
					}
				})
				strArr.push('</li>')
			}
		})
		$("#copyListul").html(strArr.join(''));
		$("." + groupid).find('span').css({
			'color': '#b2b2b2',
			'cursor': 'default'
		});
		$("." + groupid).find('input').attr('disabled', true).css('border-color', '#dbdbdb');
		$('#copyListul h4').click(function() {
			$(this).siblings('p,div').toggle();
			$(this).toggleClass('Titact');
			copyProList();
		})
		if($("#copyListul li").length < 10) {
			$('.copyObj').css('overflow', 'hidden');
		}
		$('#copyListul h4').eq(0).click();
	});
}

/**
 * 复制项目到其他组
 */
function doCupy() {
	var groupids = "";
	$('input[name="groupidsc"]:checked').each(function() { // 遍历每一个名字为interest的复选框，其中选中的执行函数
		groupids += $(this).val() + ","; // 将选中的值添加到数组chk_value中
	});
	if(groupids == "" || groupids.length < 2) {
		$(".copyPopup").hide();
		return;
	}
	var params = {
		'groupids': groupids,
		'lvid': lvid,
		'projectid': currentProjectid,
		'sign': sign
	};

	$.getJSON(requestUrlMap['copyProject']['url'], params, function(data) {
		$(".copyPopup").hide();
		if(data.errorid == 0) {
			showAlert("复制成功");
		} else {
			showAlert(data.errmsg);
		}
	});
}

function closeCopyNotice() {
	$(".copyPopup").hide();
}

/*判断内容是否超过区域  如超过显示滚动条  不超过隐藏滚动条*/
function scrollOverflow() {
	//win高
	var tipHei = 40;
	if($('.newsTip').is(':visible')) {
		tipHei = 64;
	}
	var winHeight = $(window).height() - tipHei;
	//cont高
	var heightList = $('#projectsData').height();
	//区域滚动条  
	$('.annList').css({
		'height': winHeight
	})
	var annList = $('.annList').height()
	if(heightList < annList) {
		$('.annList').css('overflow', 'hidden')
	} else {
		$('.annList').css({
			'overflow-y': 'scroll',
			'overflow-x': 'hidden'
		})
	}
}

function copyProList() {
	var winHei = $('.copyObj').height();
	var conHei = $('.copyList').height();
	if(winHei > conHei) {
		$('.copyObj').css('overflow', 'hidden')
	} else {
		$('.copyObj').css({
			'overflow-y': 'scroll',
			'overflow-x': 'hidden'
		})
	}
}
//显示上传进度动画
function showProgress(json) {
	var taskid = json.taskid;
	var progress = json.progress;
	if(progress != 100) {
		if(uploadProgress.indexOf(taskid) == -1) {
			uploadProgress.push(taskid);
			$('#uploadProgress').addClass('updata_ani').removeClass('updata');
		}
	} else {
		var index = uploadProgress.indexOf(taskid);
		if(index == -1) {
			return;
		}
		uploadProgress.splice(index, 1);
		if(uploadProgress.length == 0) {
			$('#uploadProgress').addClass('updata').removeClass('updata_ani');
		}
	}
}

function notifyTranscodeTime(data) {
	var statusTime = data.time * 1000;
	var pid = data.projectid;
	var second = statusTime / 60;
	var progress = 1;
	var random = function(min, max) {
		return Math.floor(Math.random() * (max - min + 1) + min);
	};
	var timeSet = setInterval(function() {
		progress += random(1, 5);
		if(progress > 98) {
			progress = 98;
		}
		$('#' + pid).attr('loadNum',progress + '%');
		$('#' + pid).find('.loadingnum').text(progress + '%');
	}, second);
	convertMap[pid] = timeSet;
	setTimeout(function() {
		clearTimeout(timeSet);
	}, statusTime)
}
/**
 * 修改3D项目状态
 * {projectid:111, transtate: 1}
 */
function transcodeProjectStatus(projectInfo) {
	var pid = projectInfo['projectid'];
	var transtate = projectInfo['transtate'];
	var statusSpan = $('#' + pid).find('span.transIng');
	if(statusSpan) {
		//转码成功
		if(transtate == 1) {
			$('#' + pid).find($('.loadingnum')).text('100%');
			setTimeout(function() {
				$('#' + pid).find('div.loading').hide();
				if($('#' + pid).attr('statusId') == 1) {
					$('#' + pid).append("<img class='typeicon' src='../images/3D.png' title=''>");
				} else {
					$('#' + pid).append("<img class='typeicon' src='../images/2D.png' title=''>");
				}
			}, 1000)
			statusSpan.remove();
		} else {
			statusSpan.remove();
			var timeSet = convertMap[pid];
			if(timeSet) {
				clearTimeout(timeSet);
			}
			$('#' + pid).find('.loading').removeClass('loadingbg');
			var errmsg = !projectInfo['errmsg'] ? '转码失败' : projectInfo['errmsg'];
			$('#' + pid).find('.loadingnum').addClass('red').text(errmsg);
		}
		var project = $.parseJSON(pros.Items[pid]);
		project['transtate'] = Number(transtate);
		pros.Items[pid] = $.toJSON(project);
	}
}
function updateImg(id){
	$.getJSON(requestUrlMap['projectInfo']['url'],{'lvid':lvid,'sign':sign,'projectid':id},function(data){
		$('#'+id).find('.annListImg img').attr('src',data.projectinfo.iconurl);
	})
}
/**
 * 修改2D项目硫酸纸数量
 */
function transcodeProjectNum(pid) {
	var statusSpan = $('#' + pid).find('a.num');
	if(statusSpan) {
		var params = {
			'projectid': pid,
			"from": 1,
			'lvid': lvid,
			'sign': sign
		};
		$.getJSON(requestUrlMap['projectInfo']['url'], params, function(data) {
			if(data.errorid != 0) {
				return;
			}
			var pInfo = data.projectinfo;
			statusSpan.html(pInfo['handlenum']);
			$('#' + pid).find('i.tip').show();
			$('#' + pid).find('.typeminw').attr('title', '数量变更');
			pros.Items[pInfo['projectid']] = $.toJSON(pInfo);
		});
	}
}
$(function() {
	$(".annListImg").click(function() {
		$(".popup").css("display", "block");
	});

	$(".newlyClose").click(function() {
		$(".popup").css("display", "none");
	});

	$(".cancelBut").click(function() {
		$(".popup").css("display", "none");
	});
	$("#alertpopupSureBut").click(function() {
		$(".PopupQueding").hide();
	});
	$("#alertnewlyClose").click(function() {
		$(".PopupQueding").hide();
	});
});

function closeNews(dom) {
	$(dom).parents('.newsTip').hide();
	scrollOverflow();
}
$('.newsTip span').click(function() {
	$(this).parents('.newsTip').hide();
	gopage(1);
	projectdelNum = 0, projectaddNum = 0;
});

//增加项目通知
function addProject(data) {
	projectaddNum = projectaddNum + 1;
	var name = data.name;
	showTip();
}
//删除项目通知
function delProject(data) {
	projectdelNum = projectdelNum + 1;
	var name = data.name;
	var operation = data.lvid;
	if(lvid == operation) {
		return;
	}
	showTip();
}
//显示浮窗通知
function showTip() {
	$('.newsTip').show();
	var tipText = '';
	if(projectaddNum == 0) {
		tipText += '';
	} else {
		tipText += '有新增项目: (' + projectaddNum + ')个，';
	}
	if(projectdelNum == 0) {
		tipText += '';
	} else {
		tipText += '删除项目: (' + projectdelNum + ')个，';
	}
	$('.newsTip span').text('' + tipText + ' 点击刷新');
	scrollOverflow();
}