function activityClassSelect(obj,val){
	for(var i = 0; i < activity_class_arr.length; i++){
		var space = "";
		for(var j = 0; j < activity_class_arr[i][2]; j++){
			space += "　";
		}
		if(activity_class_arr[i][3] != "0")
			space += "├";
		obj.options.add(new Option(space + activity_class_arr[i][1],activity_class_arr[i][0]));
	}
	obj.value = val;
}

function addEventForActivityAddForm(obj){
	if(obj.Title)
		obj.Title.onblur = function(){chkInfo(obj.Title,'text:活动主题; tag:label; color:#e0e5ea,#ff9900;','null,min:4,max:100');}
	if(obj.ClassID)
		obj.ClassID.onblur = function(){chkInfo(obj.ClassID,'text:活动类别; tag:label; color:#e0e5ea,#ff9900;','null');}
	if(obj.StartTime){
		obj.StartTime.onblur = function(){chkStartTime(obj);}
		obj.StartTime.onchange = function(){
			if(obj.ApplyEndTime && obj.AttendeeAmount && obj.AttendeeAmount.value != "0")
				obj.ApplyEndTime.value = obj.StartTime.value;
			chkStartTime(obj);
		}
	}
	if(obj.EndTime){
		obj.EndTime.onblur = function(){chkEndTime(obj);}
		obj.EndTime.onchange = function(){chkEndTime(obj);}
	}
	if(obj.ProvinceID)
		obj.ProvinceID.onblur = function(){chkInfo(obj.ProvinceID,'text:省份; tag:label; color:#e0e5ea,#ff9900;','null');}
	if(obj.CityID)
		obj.CityID.onblur = function(){chkInfo(obj.CityID,'text:城市; tag:label; color:#e0e5ea,#ff9900;','null');}
	if(obj.Address)
		obj.Address.onblur = function(){chkInfo(obj.Address,'text:活动地点; tag:label; color:#e0e5ea,#ff9900;','null,max:100');}
	if(obj.ApplyStartTime){
		obj.ApplyStartTime.onblur = function(){chkApplyStartTime(obj);}
		obj.ApplyStartTime.onchange = function(){chkApplyStartTime(obj);}
	}
	if(obj.ApplyEndTime){
		obj.ApplyEndTime.onblur = function(){chkApplyEndTime(obj);}
		obj.ApplyEndTime.onchange = function(){chkApplyEndTime(obj);}
	}
	if(obj.AttendeeAmount)
		obj.AttendeeAmount.onblur = function(){
			chkInfo(obj.AttendeeAmount,'text:参加人数; tag:label; color:#e0e5ea,#ff9900;','num,max:10');
			if(obj.AttendeeAmount.value == "0"){
				if(obj.ApplyStartTime){
					chkInfoClear(obj.ApplyStartTime,'tag:label; color:#e0e5ea,#ff9900;');
					obj.ApplyStartTime.disabled = true;
				}
				if(obj.ApplyEndTime){
					chkInfoClear(obj.ApplyEndTime,'tag:label; color:#e0e5ea,#ff9900;');
					obj.ApplyEndTime.disabled = true;
				}
			}else{
				if(obj.ApplyStartTime)
					obj.ApplyStartTime.disabled = false;
				if(obj.ApplyEndTime)
					obj.ApplyEndTime.disabled = false;
			}
		}
	if(obj.AttendeeAgeMin)
		obj.AttendeeAgeMin.onblur = function(){chkInfo(obj.AttendeeAgeMin,'text:参加者的最小年龄; tag:label; color:#e0e5ea,#ff9900;',',num,max:10');}
	if(obj.AttendeeAgeMax)
		obj.AttendeeAgeMax.onblur = function(){chkInfo(obj.AttendeeAgeMax,'text:参加者的最大年龄; tag:label; color:#e0e5ea,#ff9900;','num,max:10');}
	if(obj.OnceApplicantsMax)
		obj.OnceApplicantsMax.onblur = function(){chkInfo(obj.OnceApplicantsMax,'text:单次报名数; tag:label; color:#e0e5ea,#ff9900;','num,max:10');}
	if(obj.Cost)
		obj.Cost.onblur = function(){chkInfo(obj.Cost,'text:预计费用; tag:label; color:#e0e5ea,#ff9900;','num,max:10');}
	if(obj.Remark)
		obj.Remark.onblur = function(){chkInfo(obj.Remark,'text:费用说明; tag:label; color:#e0e5ea,#ff9900;','max:50');}
	if(obj.IndexOrderId)
		obj.IndexOrderId.onblur = function(){chkInfo(obj.IndexOrderId,'text:回顾排序; tag:label; color:#e0e5ea,#ff9900;','num,max:10');}
	if(obj.RecommendStartTime){
		obj.RecommendStartTime.onblur = function(){
			if(obj.RecommendEndTime && obj.RecommendEndTime.value != ""){
				chkInfo(obj.RecommendStartTime,'text:推荐开始时间; tag:label; color:#e0e5ea,#ff9900;','null');
				if(compareDate(obj.RecommendStartTime.value,obj.RecommendEndTime.value) == 3)
					chkInfo(obj.RecommendStartTime,'text:推荐开始时间不能大于推荐结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
				else
					chkInfoClear(obj.RecommendStartTime,'tag:label; color:#e0e5ea,#ff9900;')
			}
		}
		obj.RecommendStartTime.onchange = function(){
			if(obj.RecommendEndTime && obj.RecommendEndTime.value != ""){
				chkInfo(obj.RecommendStartTime,'text:推荐开始时间; tag:label; color:#e0e5ea,#ff9900;','null');
				if(compareDate(obj.RecommendStartTime.value,obj.RecommendEndTime.value) == 3)
					chkInfo(obj.RecommendStartTime,'text:推荐开始时间不能大于推荐结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
				else
					chkInfoClear(obj.RecommendStartTime,'tag:label; color:#e0e5ea,#ff9900;')
			}
		}
	}
	if(obj.RecommendEndTime){
		obj.RecommendEndTime.onblur = function(){
			if(obj.RecommendStartTime && obj.RecommendStartTime.value != ""){
				chkInfo(obj.RecommendEndTime,'text:推荐结束时间; tag:label; color:#e0e5ea,#ff9900;','null');
				if(compareDate(obj.RecommendStartTime.value,obj.RecommendEndTime.value) == 3)
					chkInfo(obj.RecommendStartTime,'text:推荐开始时间不能大于推荐结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
				else
					chkInfoClear(obj.RecommendStartTime,'tag:label; color:#e0e5ea,#ff9900;')
			}
		}
		obj.RecommendEndTime.onchange = function(){
			if(obj.RecommendStartTime && obj.RecommendStartTime.value != ""){
				chkInfo(obj.RecommendEndTime,'text:推荐结束时间; tag:label; color:#e0e5ea,#ff9900;','null');
				if(compareDate(obj.RecommendStartTime.value,obj.RecommendEndTime.value) == 3)
					chkInfo(obj.RecommendStartTime,'text:推荐开始时间不能大于推荐结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
				else
					chkInfoClear(obj.RecommendStartTime,'tag:label; color:#e0e5ea,#ff9900;')
			}
		}
	}
	
	function chkStartTime(obj){
		if(obj.StartTime.value != ""){chkInfoClear(obj.StartTime,'tag:label; color:#e0e5ea,#ff9900;');}
		chkInfo(obj.StartTime,'text:活动集合时间; tag:label; color:#e0e5ea,#ff9900;','null');
		if(obj.StartTime.value != "" && obj.EndTime && obj.EndTime.value != ""){
			if(compareDate(obj.StartTime.value,obj.EndTime.value) == 3)
				chkInfo(obj.StartTime,'text:活动集合时间不能大于活动结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
			else
				chkInfoClear(obj.StartTime,'tag:label; color:#e0e5ea,#ff9900;');
		}
		if(obj.StartTime.value != "" && obj.ApplyStartTime && obj.ApplyStartTime.value !="" && obj.AttendeeAmount && obj.AttendeeAmount.value != "0"){
			if(compareDate(obj.ApplyStartTime.value,obj.StartTime.value) == 3)
				chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于活动集合时间; tag:label; color:#e0e5ea,#ff9900;','false');
			else
				chkInfoClear(obj.ApplyStartTime,'tag:label; color:#e0e5ea,#ff9900;');
		}else{
			chkInfoClear(obj.ApplyStartTime,'tag:label; color:#e0e5ea,#ff9900;');
		}
	}
	function chkEndTime(obj){
		if(obj.EndTime.value != ""){chkInfoClear(obj.EndTime,'tag:label; color:#e0e5ea,#ff9900;');}
		chkInfo(obj.EndTime,'text:活动结束时间; tag:label; color:#e0e5ea,#ff9900;','null');	
		if(obj.StartTime && obj.StartTime.value != "" && obj.EndTime.value != ""){
			if(compareDate(obj.StartTime.value,obj.EndTime.value) == 3)
				chkInfo(obj.StartTime,'text:活动集合时间不能大于活动结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
			else
				chkInfoClear(obj.StartTime,'tag:label; color:#e0e5ea,#ff9900;');
		}
		if(obj.EndTime.value != "" &&　obj.ApplyEndTime && obj.ApplyEndTime.value !="" && obj.AttendeeAmount && obj.AttendeeAmount.value != "0"){
			if(compareDate(obj.ApplyEndTime.value,obj.EndTime.value) == 3)
				chkInfo(obj.ApplyEndTime,'text:报名结束时间不能大于活动结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
			else
				chkInfoClear(obj.ApplyEndTime,'tag:label; color:#e0e5ea,#ff9900;');
		}else{
			chkInfoClear(obj.ApplyEndTime,'tag:label; color:#e0e5ea,#ff9900;');
		}
	}
	function chkApplyStartTime(obj){
		if(obj.AttendeeAmount && obj.AttendeeAmount.value == "0"){return;}
		chkInfoClear(obj.ApplyStartTime,'tag:label; color:#e0e5ea,#ff9900;');
		chkInfoClear(obj.ApplyEndTime,'tag:label; color:#e0e5ea,#ff9900;');
		chkInfo(obj.ApplyStartTime,'text:报名开始时间; tag:label; color:#e0e5ea,#ff9900;','null');
		if(obj.ApplyStartTime.value != "" && obj.StartTime && obj.StartTime.value != ""){
			if(compareDate(obj.ApplyStartTime.value,obj.StartTime.value) == 3){
				chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于活动集合时间; tag:label; color:#e0e5ea,#ff9900;','false');
			}else if(obj.ApplyEndTime && obj.ApplyEndTime.value != ""){
				if(compareDate(obj.ApplyStartTime.value,obj.ApplyEndTime.value) == 3)
					chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于报名结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
			}
		}else if(obj.ApplyStartTime.value != "" && obj.ApplyEndTime && obj.ApplyEndTime.value != ""){
			if(compareDate(obj.ApplyStartTime.value,obj.ApplyEndTime.value) == 3)
				chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于报名结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
		}
	}
	function chkApplyEndTime(obj){
		if(obj.AttendeeAmount && obj.AttendeeAmount.value == "0"){return;}
		chkInfoClear(obj.ApplyStartTime,'tag:label; color:#e0e5ea,#ff9900;');
		chkInfoClear(obj.ApplyEndTime,'tag:label; color:#e0e5ea,#ff9900;');
		chkInfo(obj.ApplyEndTime,'text:报名结束时间; tag:label; color:#e0e5ea,#ff9900;','null');
		if(obj.ApplyEndTime.value != "" && obj.EndTime && obj.EndTime.value != ""){
			if(compareDate(obj.ApplyEndTime.value,obj.EndTime.value) == 3){
				chkInfo(obj.ApplyEndTime,'text:报名结束时间不能大于活动结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
			}else if(obj.ApplyStartTime && obj.ApplyStartTime.value != ""){
				if(compareDate(obj.ApplyStartTime.value,obj.ApplyEndTime.value) == 3)
					chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于报名结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
			}
		}else if(obj.ApplyEndTime.value != "" && obj.ApplyStartTime && obj.ApplyStartTime.value != ""){
			if(compareDate(obj.ApplyStartTime.value,obj.ApplyEndTime.value) == 3)
				chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于报名结束时间; tag:label; color:#e0e5ea,#ff9900;','false');
		}
	}

}

function chkActivityAdd(obj){
	var IsPassCheck = true;
	var ShowSelectResult = document.getElementById("ShowSelectResult");
	if(ShowSelectResult && document.getElementsByName("AreaResult"))
		if(document.getElementsByName("AreaResult").length == 0)
			if(chkInfo(ShowSelectResult,'text:请选择显示区域; tag:label; color:#e0e5ea,#ff9900;','false')==false)
				IsPassCheck = false;
	if(obj.Title)
		if(chkInfo(obj.Title,'text:活动主题; tag:label; color:#e0e5ea,#ff9900;','null,min:4,max:100')==false)
			IsPassCheck = false;
	if(obj.ClassID)
		if(chkInfo(obj.ClassID,'text:活动类别; tag:label; color:#e0e5ea,#ff9900;','null')==false)
			IsPassCheck = false;
	if(obj.StartTime)
		if(chkInfo(obj.StartTime,'text:活动集合时间; tag:label; color:#e0e5ea,#ff9900;','null')==false)
			IsPassCheck = false;
	if(obj.EndTime)
		if(chkInfo(obj.EndTime,'text:活动结束时间; tag:label; color:#e0e5ea,#ff9900;','null')==false)
			IsPassCheck = false;
	if(obj.StartTime && obj.EndTime && obj.StartTime.value != "" && obj.EndTime.value != "")
		if(compareDate(obj.StartTime.value,obj.EndTime.value) == 3)
			if(chkInfo(obj.StartTime,'text:活动集合时间不能大于活动结束时间; tag:label; color:#e0e5ea,#ff9900;','false')==false)
				IsPassCheck = false;
	if(obj.ProvinceID)
		if(chkInfo(obj.ProvinceID,'text:省份; tag:label; color:#e0e5ea,#ff9900;','null')==false)
			IsPassCheck = false;
	if(obj.CityID)
		if(chkInfo(obj.CityID,'text:城市; tag:label; color:#e0e5ea,#ff9900;','null')==false)
			IsPassCheck = false;
	if(obj.Address)
		if(chkInfo(obj.Address,'text:活动地点; tag:label; color:#e0e5ea,#ff9900;','null,max:100')==false)
			IsPassCheck = false;

	if(obj.AttendeeAmount && obj.AttendeeAmount.value != "0"){
		if(obj.ApplyStartTime){
			if(chkInfo(obj.ApplyStartTime,'text:报名开始时间; tag:label; color:#e0e5ea,#ff9900;','null')==false){
				IsPassCheck = false;
			}else{
				if(obj.StartTime && obj.StartTime.value != "")
					if(compareDate(obj.ApplyStartTime.value,obj.StartTime.value) == 3)
						if(chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于活动集合时间; tag:label; color:#e0e5ea,#ff9900;','false')==false)
							IsPassCheck = false;
				if(obj.ApplyEndTime && obj.ApplyEndTime.value != "")
					if(compareDate(obj.ApplyStartTime.value,obj.ApplyEndTime.value) == 3)
						if(chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于报名结束时间; tag:label; color:#e0e5ea,#ff9900;','false')==false)
							IsPassCheck = false;
			}
		}
		if(obj.ApplyEndTime){
			if(chkInfo(obj.ApplyEndTime,'text:报名结束时间; tag:label; color:#e0e5ea,#ff9900;','null')==false){
				IsPassCheck = false;
			}else{
				if(obj.EndTime && obj.EndTime.value != "")
					if(compareDate(obj.ApplyEndTime.value,obj.EndTime.value) == 3)
						if(chkInfo(obj.ApplyEndTime,'text:报名结束时间不能大于活动结束时间; tag:label; color:#e0e5ea,#ff9900;','false')==false)
							IsPassCheck = false;
				if(obj.ApplyStartTime && obj.ApplyStartTime.value != "")
					if(compareDate(obj.ApplyStartTime.value,obj.ApplyEndTime.value) == 3)
						if(chkInfo(obj.ApplyStartTime,'text:报名开始时间不能大于报名结束时间; tag:label; color:#e0e5ea,#ff9900;','false')==false)
							IsPassCheck = false;
			}
		}
	}
	if(obj.AttendeeAmount)
		if(chkInfo(obj.AttendeeAmount,'text:参加人数; tag:label; color:#e0e5ea,#ff9900;','num,max:10')==false)
			IsPassCheck = false;
	if(obj.AttendeeAgeMin && obj.AttendeeAgeMax){
		if(obj.AttendeeAgeMin.value != "" || obj.AttendeeAgeMax.value != ""){
			if(chkInfo(obj.AttendeeAgeMin,'text:参加者的最小年龄; tag:label; color:#e0e5ea,#ff9900;','null,num,max:10')==false)
				IsPassCheck = false;
			if(chkInfo(obj.AttendeeAgeMax,'text:参加者的最大年龄; tag:label; color:#e0e5ea,#ff9900;','null,num,max:10')==false)
				IsPassCheck = false;
			if(parseInt(obj.AttendeeAgeMin.value) > parseInt(obj.AttendeeAgeMax.value))
				IsPassCheck = chkInfo(obj.AttendeeAgeMin,'text:参加者的最小年龄不能大于参加者的最大年龄; tag:label; color:#e0e5ea,#ff9900;','false')
		}
	}
	if(obj.OnceApplicantsMax)
		if(chkInfo(obj.OnceApplicantsMax,'text:单次报名数; tag:label; color:#e0e5ea,#ff9900;','num,max:10')==false)
			IsPassCheck = false;
	if(obj.Cost)
		if(chkInfo(obj.Cost,'text:预计费用; tag:label; color:#e0e5ea,#ff9900;','num,max:10')==false)
			IsPassCheck = false;
	if(obj.Remark)
		if(chkInfo(obj.Remark,'text:费用说明; tag:label; color:#e0e5ea,#ff9900;','max:50')==false)
			IsPassCheck = false;
	if(obj.Description)
		obj.Description.value = window.EditFrame.FCKeditorAPI.GetInstance("Description").GetHTML(true);
	if(obj.Demand)
		obj.Demand.value = window.EditFrame.FCKeditorAPI.GetInstance("Demand").GetHTML(true);
	if(obj.Attentions)
		obj.Attentions.value = window.EditFrame.FCKeditorAPI.GetInstance("Attentions").GetHTML(true);
	if(obj.IsRecommend && obj.IsRecommend[1].checked){
		if(obj.RecommendStartTime)
			if(chkInfo(obj.RecommendStartTime,'text:推荐开始时间; tag:label; color:#e0e5ea,#ff9900;','null')==false)
				IsPassCheck = false;
		if(obj.RecommendEndTime)
			if(chkInfo(obj.RecommendEndTime,'text:推荐结束时间; tag:label; color:#e0e5ea,#ff9900;','null')==false)
				IsPassCheck = false;
		if(obj.RecommendStartTime && obj.RecommendEndTime)
			if(compareDate(obj.RecommendStartTime.value,obj.RecommendEndTime.value) == 3)
				if(chkInfo(obj.RecommendStartTime,'text:推荐开始时间不能大于推荐结束时间; tag:label; color:#e0e5ea,#ff9900;','false')==false)
					IsPassCheck = false;
	}
	if(obj.IndexOrderId)
		if(chkInfo(obj.IndexOrderId,'text:回顾排序; tag:label; color:#e0e5ea,#ff9900;','num,max:10')==false)
			IsPassCheck = false;
	if(!IsPassCheck){return false};
	if(obj.IsUpLoadCover || obj.IsSetCover){
		if(obj.IsUpLoadCover)
			alert("请上传一张封面图片！");
		if(obj.IsSetCover)
			alert("请设置一张封面图片！");
		var div = document.createElement("DIV");
		div.id = "showCoverIframe";
		div.style.width = "722px";
		div.style.height = "450px";
		div.innerHTML = "<iframe src=\"/user/activity/activitypictureedit.asp?ID=" + obj.ActivityID.value + "\" frameborder=\"0\" width=\"720\" height=\"450\" scrolling=\"no\" style=\"margin-left:1px;\"></iframe>";
		document.body.appendChild(div);
		tableCNTR("el:showCoverIframe; title:上传一张封面图片; color:orange; move:yes; onclick:delShowCoverIframe();");
		return false;
	}
	niceFrame("");
	obj.target = "myIframe";
}

function delShowCoverIframe(){
	var showCoverIframe = document.getElementById("showCoverIframe");
	if(showCoverIframe){
		document.body.removeChild(showCoverIframe);
		window.location.reload();
	}
}

function activityTitleColor(form){
	var color = showModalDialog("/Config/Fuc_selcolor.html", "", "dialogWidth:300px; dialogHeight:260px; help: no; scroll: no; status: no");
	form.Title.style.color = color;
	form.TitleColor.value = color;
}
function getActivityTitleColor(form){
	if(!form.TitleColor){return;}
	var Color = form.TitleColor.value;
	if(Color != "")
		form.Title.style.color = Color;
}

function chkActivityIsRecommend(val){
	var RecommendTimeDiv = document.getElementById("RecommendTimeDiv");
	if(val == "0")
		RecommendTimeDiv.style.display = "none";
	else
		RecommendTimeDiv.style.display = "";
	if(typeof(parent.resizeIframe) == "function"){parent.resizeIframe();}
}

function checkMoreActivity(form,url){
	if(!selectIsCheck("id")){alert("请选择要审核的活动！");return;}
	niceFrame();
	form.action = url + "?action=CheckMoreActivity";
	form.target = "myIframe";
	form.submit();
}

function enCheckMoreActivity(form,url){
	if(!selectIsCheck("id")){alert("请选择要取消审核的活动！");return;}
	niceFrame();
	form.action = url + "?action=EnCheckMoreActivity";
	form.target = "myIframe";
	form.submit();
}

function delMoreActivity(form,url){
	if(!selectIsCheck("id")){alert("请选择要删除的活动！");return;}
	if(!confirm("您确定要删除所选活动吗？")){return;}
	niceFrame();
	form.action = url + "?action=DelMoreActivity";
	form.target = "myIframe";
	form.submit();
}

function delAloneActivity(ID,url){
	if(!confirm("您确定要删除该活动吗？")){return;}
	niceFrame(url + "?ID=" + ID + "&action=DelAloneActivity");
}

function saveActivityReview(form,url){
	niceFrame();
	form.action = url + "?action=SaveActivityReview";
	form.target = "myIframe";
}

function fastChkActivity(ID,url){
	niceFrame(url + "?ID=" + ID + "&action=FastChkActivity");
}

//************************************************************************************************//
function reloadPictrueUpload(){
	var batchUploadIframe = document.getElementById('batchUploadIframe');
	batchUploadIframe.src = batchUploadIframe.src.replace(/&reloadtime.*/gi,"") + "&reloadtime=" + new Date().getTime();
}
function prictureSelectedAll(state,name){
	var ids = document.getElementsByName(name);
	for (var i = 0; i < ids.length; i++){
		if(ids[i].checked != state)
			ids[i].click();
	}
}
function prictureSelected(obj){
	var prictureBorder = obj.parentNode.parentNode;
	if(obj.checked){
		prictureBorder.style.borderLeft = "#069 solid 1px";
		prictureBorder.style.borderTop = "#069 solid 1px";
		prictureBorder.style.borderRight = "#069 solid 1px";
		prictureBorder.style.borderBottom = "#069 solid 1px";
	}else{
		prictureBorder.style.borderLeft = "#cccccc solid 1px";
		prictureBorder.style.borderTop = "#cccccc solid 1px";
		prictureBorder.style.borderRight = "#cccccc solid 1px";
		prictureBorder.style.borderBottom = "#cccccc solid 1px";
	}
}

function myFormSubmit(){
	var form = document.PictureUploacForm;
	if(form.Title.value == ""){alert("无法获取上传图片名称！");return;}
	if(form.Picture.value == ""){alert("无法获取上传图片！");return;}
	if(form.batchUploadSourceF.value == ""){alert("无法获取上传图片路径！");return;}
	niceFrame("");
	form.target = "myIframe";
	form.submit();
}

function pictureEditSetup(obj){
	var parent = obj.parentNode.parentNode;
	var ID = parent.getElementsByTagName("input")[0].value;
	var PictruePreview = parent.getElementsByTagName("ul")[0].getElementsByTagName("a")[0].getElementsByTagName("img")[0].src;
	var Title = parent.getElementsByTagName("samp")[0].getElementsByTagName("a")[0].innerHTML;
	var OrderID = parent.getElementsByTagName("label")[0].innerHTML;
	var IsCoverPicture = (parent.getElementsByTagName("i").length > 0) ? true : false;
	var IsCheck = (parent.getElementsByTagName("b").length > 0) ? true : false;

	var Form = document.PictureEditForm;
	Form.getElementsByTagName("img")[0].src = PictruePreview;
	Form.Title.value = Title;
	Form.OrderId.value = OrderID;
	Form.ID.value = ID;
	if(IsCoverPicture)
		Form.ActivityPictrueId[0].checked = true;
	else
		Form.ActivityPictrueId[1].checked = true;
	if(IsCheck)
		if(Form.IsCheck)
			Form.IsCheck[0].checked = true;
	else
		if(Form.IsCheck)
			Form.IsCheck[1].checked = true;
}

function chkPictureEditForm(obj){
	var IsPassCheck = true;
	if(chkInfo(obj.Title,'text:图片名称; tag:label; color:#e0e5ea,#ff9900;','null,max:50')==false)
		IsPassCheck = false;
	if(chkInfo(obj.OrderId,'text:排序; tag:label; color:#e0e5ea,#ff9900;','null,max:50')==false)
		IsPassCheck = false;
	if(!IsPassCheck){return false};
	niceFrame("");
	obj.target = "myIframe";
}

function setCoverPicture(ID,ActivityID,url){
	niceFrame(url + "?action=SetCoverPicture&ID=" + ID + "&ActivityID=" + ActivityID);
}

function checkPicture(ID,State,url){
	var action = "";
	if(State == 1)
		action = "CheckPicture";
	else if(State == 0)
		action = "EnCheckPicture";
	niceFrame(url +"?action=" + action + "&ID=" + ID);
}

function delAlonePicture(ID,url){
	if(!confirm("您确定要删除这张图片吗？")){return;}
	niceFrame(url +"?action=DelAlonePicture&ID=" + ID);
}

function checkMorePicture(form,State,url){
	var action = "";
	if(State == 1){
		if(!selectIsCheck("id")){alert("请选择要审核的图片！");return;}
		action = "CheckMorePicture";
	}else if(State == 0){
		if(!selectIsCheck("id")){alert("请选择要取消审核的图片！");return;}
		action = "EnCheckMorePicture";
	}
	niceFrame();
	form.action = url + "?action=" + action;
	form.target = "myIframe";
	form.submit();
}

function delMorePicture(form,url){
	if(!selectIsCheck("id")){alert("请选择要删除的图片！");return;}
	if(!confirm("您确定要删除所选图片吗？")){return;}
	niceFrame();
	form.action = url + "?action=DelMorePicture";
	form.target = "myIframe";
	form.submit();
}

//************************************************************************************************//
function confirmMoreAttendee(form,url){
	if(!selectIsCheck("id")){alert("请选择要确认的报名者！");return;}
	niceFrame();
	form.action = url + "?action=ConfirmMoreAttendee";
	form.target = "myIframe";
	form.submit();
}
function cancelConfirmMoreAttendee(form,url){
	if(!selectIsCheck("id")){alert("请选择要取消确认的报名者！");return;}
	niceFrame();
	form.action = url + "?action=CancelConfirmMoreAttendee";
	form.target = "myIframe";
	form.submit();
}

function activityEnterEditInfo(obj){
	var tr = obj.parentNode.parentNode;
	var tds = tr.cells;
	var ID = tds[0].getElementsByTagName("input")[0].value;
	var NickName = tds[1].innerHTML;
	var AttendeeNumber = tds[4].innerHTML;
	var Mobile = tds[5].innerHTML;
	var QQ = tds[6].innerHTML;
	var SubmitTime = tds[7].innerHTML;
	var IsConfirm = tds[8].innerHTML;
	var Remark = tds[10].getElementsByTagName("textarea")[0].value;

	var EnterEidtDiv = document.getElementById("EnterEidtDiv");
	var table = EnterEidtDiv.getElementsByTagName("table")[0];
	table.rows[0].cells[1].innerHTML = NickName;
	table.rows[2].cells[1].innerHTML = Mobile;
	table.rows[3].cells[1].innerHTML = QQ;
	table.rows[4].cells[1].innerHTML = SubmitTime;

	var form = document.EnterEidtForm;
	form.AttendeeNumber.value = AttendeeNumber.replace("人","");
	form.ID.value = ID;
	if(!/.*linkOper\('\d{1,}'\,(\d)\,.*/.test(IsConfirm)){
		form.IsConfirm[2].checked = true;
	}else{
		IsConfirm = parseInt(IsConfirm.replace(/.*linkOper\('\d{1,}'\,(\d)\,.*/gi,"$1"));
		if(IsConfirm == 0){
			form.IsConfirm[1].checked = true;
		}else{
			form.IsConfirm[0].checked = true;
		}
	}
	form.Remark.value = Remark;
}
function chkEnterEidtForm(obj,url){
	if(chkInfo(obj.AttendeeNumber,'text:报名人数; tag:null; color:#e0e5ea,#ff9900;','null,num,max:10') == false){return false;}
	if(chkInfo(obj.Remark,'text:备注; tag:null; color:#e0e5ea,#ff9900;','max:200') == false){return false;}
	niceFrame();
	obj.action = url + "?action=EnterEidt";
	obj.target = "myIframe";
	obj.submit();
	handleAlphaDiv("正在处理您的请求..");
	return false;
}

function delAloneAttendee(ID,url){
	if(!confirm("您确定要删除该报名者吗？")){return;}
	niceFrame(url + "?ID=" + ID + "&action=DelAloneAttendee");
}

function delMoreAttendee(form,url){
	if(!selectIsCheck("id")){alert("请选择要删除的报名者？");return;}
	if(!confirm("您确定要删除所选报名者吗？")){return;}
	niceFrame();
	form.action = url + "?action=DelMoreAttendee";
	form.target = "myIframe";
	form.submit();
}

function activityJoinEditInfo(obj){
	var tr = obj.parentNode.parentNode;
	var tds = tr.cells;
	var ID = tds[0].getElementsByTagName("INPUT")[0].value;
	var ClassName = tds[1].innerHTML;
	var Title = tds[2].innerHTML;
	var State = tds[3].innerHTML;
	var Mobile = tds[4].innerHTML;
	var QQ = tds[5].innerHTML;
	var AttendeeNumber = parseInt(tds[6].innerHTML.replace("人",""));
	var OnceApplicantsMax = tds[10].innerHTML;

	var JoinEidtDiv = document.getElementById("JoinEidtDiv");
	var table = JoinEidtDiv.getElementsByTagName("table")[0];
	table.rows[0].cells[1].innerHTML = ClassName;
	table.rows[1].cells[1].innerHTML = Title;
	table.rows[2].cells[1].innerHTML = State;
	OnceApplicantsMax = parseInt(OnceApplicantsMax.replace(/.*value="(\d{1,})".*/gi,"$1"));
	if(OnceApplicantsMax > 1){
		var SelectStr = "<select name=\"AttendeeNumber\">";
		for(var i = 1; i <= OnceApplicantsMax; i++){
			if(AttendeeNumber == i)
				SelectStr += "<option value=\"" + i + "\" selected>" + i + "人</option>";
			else
				SelectStr += "<option value=\"" + i + "\">" + i + "人</option>";
		}
		SelectStr += "</select>";
		table.rows[5].cells[1].innerHTML = SelectStr;
	}else{
		table.rows[5].cells[1].innerHTML = "1人";
	}


	var form = document.JoinEidtForm;
	form.Mobile.value = Mobile;
	form.QQ.value = QQ;
	form.ID.value = ID;
}

function chkJoinEidtForm(obj,url){
	if(chkInfo(obj.Mobile,'text:手机号码; tag:null; color:#e0e5ea,#ff9900;','mobile') == false){return false;}
	if(chkInfo(obj.QQ,'text:QQ号码; tag:null; color:#e0e5ea,#ff9900;','qq') == false){return false;}
	if(obj.Mobile.value == "" && obj.QQ.value == ""){
		chkInfo(obj.Mobile,'text:请填写任意一种联系方式; tag:null; color:#e0e5ea,#ff9900;','false');return false;
	}
	niceFrame();
	obj.action = url + "?action=JoinEidt";
	obj.target = "myIframe";
	obj.submit();
	handleAlphaDiv("正在处理您的请求..");
	return false;
}

function delAloneJoin(ID,url){
	if(!confirm("您确定要删除该报名者吗？")){return;}
	niceFrame(url + "?ID=" + ID + "&action=DelAloneJoin");
}

function delMoreJoin(form,url){
	if(!selectIsCheck("id")){alert("请选择要删除的报名记录？");return;}
	if(!confirm("您确定要删除所选报名记录吗？")){return;}
	niceFrame();
	form.action = url + "?action=DelMoreJoin";
	form.target = "myIframe";
	form.submit();
}

//************************************************************************************************//

//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月11日星期一
//检测用户的登录状态(活动页面)
//************************************************/
function chkActivityEnterState(ID){
	publicAjax("/Activity/ActivityLib.asp?action=ActivityEnterState&ID=" + ID,"printActivityEnterLoginResult()");
}
//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月11日星期一
//输出用户登录状态对应的内容(活动页面)
//************************************************/
function printActivityEnterLoginResult(text){
	var activity_attendee_border = document.getElementById("activity_attendee_border");
	if(text != ""){
		activity_attendee_border.style.display = "";
		activity_attendee_border.innerHTML = text;
		eval(text.replace(/.*{(fucInhour\(.*\))}.*/gi,"$1"));	//存在倒时函数则执行倒时
	}else{
		activity_attendee_border.style.display = "none";
	}

}
function startActivityApply(time){
	fucInhour("el:inhourDiv; time:" + time + "; title:限时报名：离截止报名时间，还剩[%dd天hh时mm分ss秒%]！; color:#FF6C00; fuc:endActivityApply();");
	var activityEnterDiv = document.getElementById("activityEnterDiv");
	activityEnterDiv.style.display = "";
}
function endActivityApply(){
	var inhourDiv = document.getElementById("inhourDiv");
	if(inhourDiv){inhourDiv.innerHTML = "限时报名：已截止报名！";}
	var activityEnterDiv = document.getElementById("activityEnterDiv");
	activityEnterDiv.style.display = "none";
}

//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月11日星期一
//检测活动报名表单信息的合法性
//obj:表单对象
//************************************************/
function chkActivityEnterForm(obj){
	if(chkInfo(obj.Mobile,'text:手机号码; tag:null; color:#e0e5ea,#ff9900;','mobile') == false){return false;}
	if(chkInfo(obj.QQ,'text:QQ号码; tag:null; color:#e0e5ea,#ff9900;','qq')==false){return false;}
	if(obj.Mobile.value == "" && obj.QQ.value == ""){
		chkInfo(obj.Mobile,'text:请填写任意一种联系方式; tag:null; color:#e0e5ea,#ff9900;','false');return false;
	}
	var ActivityID = document.getElementById("ActivityID").innerHTML;
	if(ActivityID == ""){alert("活动ID不存在");return false;}
	niceFrame();
	obj.action = "/Activity/ActivityLib.asp?action=ActivityEnter&ID=" + ActivityID;
	obj.target = "myIframe";
	obj.submit();
	handleAlphaDiv("正在处理您的请求..");
	return false;
}

//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月12日星期二
//获取活动报名统计信息
//************************************************/
function activityAttendeeListTotal(ID){
	publicAjax("/Activity/ActivityLib.asp?action=ActivityAttendeeListTotal&ID=" + ID,"printActivityAttendeeListTotal()");
}
//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月12日星期二
//输出活动报名统计信息
//************************************************/
function printActivityAttendeeListTotal(text){
	var activity_attendeeList_title = document.getElementById("activity_attendeeList_title");
	activity_attendeeList_title.innerHTML = text;
}
//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月12日星期二
//获取活动确认名单
//************************************************/
function activityAttendeeListConfirm(ID,Page){
	publicAjax("/Activity/ActivityLib.asp?action=ActivityAttendeeListConfirm&ID=" + ID + "&Page=" + Page,"printActivityAttendeeListConfirm(" + ID + ")");
}
//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月12日星期二
//输出活动确认名单
//************************************************/
function printActivityAttendeeListConfirm(ID,text){
	var activity_attendeeList_confirm = document.getElementById("activity_attendeeList_confirm");
	text = text.replace(/此栏目暂无内容/gi,"暂无确认名单");
	text = text.replace(/(href=")(\?page=)(\d)&amp;(\")(>\[)/gi,"$1javascript:;$4 onclick=\"activityAttendeeListConfirm(" + ID + ",$3)\" $5");
	text = text.replace(/(href=")\?(\")(>\[)/gi,"$1javascript:;$2 onclick=\"activityAttendeeListConfirm(" + ID + ",0)\" $3");
	text = text.replace(/(onchange=").*(this.value).*(\")/gi,"$1activityAttendeeListConfirm(" + ID + ",$2);$3");
	activity_attendeeList_confirm.innerHTML = text;
}

//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月12日星期二
//获取活动报名名单
//************************************************/
function activityAttendeeListAll(ID,Page){
	publicAjax("/Activity/ActivityLib.asp?action=ActivityAttendeeListAll&ID=" + ID + "&Page=" + Page,"printActivityAttendeeListAll(" + ID + ")");
}
//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月12日星期二
//输出活动报名名单
//************************************************/
function printActivityAttendeeListAll(ID,text){
	var activity_attendeeList_confirm = document.getElementById("activity_attendeeList_all");
	text = text.replace(/此栏目暂无内容/gi,"暂无报名会员");
	text = text.replace(/(href=")(\?page=)(\d)&amp;(\")(>\[)/gi,"$1javascript:;$4 onclick=\"activityAttendeeListAll(" + ID + ",$3)\" $5");
	text = text.replace(/(href=")\?(\")(>\[)/gi,"$1javascript:;$2 onclick=\"activityAttendeeListAll(" + ID + ",0)\" $3");
	text = text.replace(/(onchange=").*(this.value).*(\")/gi,"$1activityAttendeeListAll(" + ID + ",$2);$3");
	if(text.indexOf("暂无报名会员") != -1){
		activity_attendeeList_confirm.parentNode.style.display = "none";
	}else{
		activity_attendeeList_confirm.parentNode.style.display = "";
		activity_attendeeList_confirm.innerHTML = text;
	}
}

//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月12日星期二
//获取活动图片
//************************************************/
function getActivityPictrue(ID){
	publicAjax("/Activity/ActivityLib.asp?action=GetActivityPictrue&ID=" + ID,"printActivityPictrue()");
}
//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月12日星期二
//输出活动图片
//************************************************/
function printActivityPictrue(text){
	var activity_pictrue_border = document.getElementById("activity_pictrue_border");
	if(text != ""){
		activity_pictrue_border.style.display = "";
		activity_pictrue_border.innerHTML = text;
		rollActivityPictrue();
	}else{
		activity_pictrue_border.style.display = "none";
	}
}

//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月15日星期五
//获取精彩回顾图片
//************************************************/
function getActivityReviewPictrue(ID,type){
	publicAjax("/Activity/ActivityLib.asp?action=GetActivityReviewPictrue&ID=" + ID + "&ShowType=" + type,"printActivityReviewPictrue()");
}
//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月15日星期五
//输出精彩回顾图片
//************************************************/
function printActivityReviewPictrue(text){
	var ReviewPictrue = document.getElementById("ReviewPictrue");
	if(text != ""){
		ReviewPictrue.style.display = "";
		ReviewPictrue.innerHTML = text;
		changeReviewPictrueSize();
	}else{
		ReviewPictrue.style.display = "none";
	}
	
}
//************************************************/
//Powered by ECENCO.COM-Tech2  2009年5月15日星期五
//改变精彩回顾图片的大小
//************************************************/
function changeReviewPictrueSize(){
	var ReviewStyle = document.getElementById("ReviewStyle");
	if(!ReviewStyle){return;}
	var imgs = ReviewStyle.getElementsByTagName("IMG");
	var MaxSize = 600
	var imgW;
	var imgH;
	for(var i = 0; i < imgs.length; i++){
		imgW = parseInt(imgs[i].width);
		imgH = parseInt(imgs[i].height);
		if(imgW > MaxSize){
			imgs[i].width = MaxSize;
			imgs[i].height = (imgH * MaxSize) / imgW;
		}
	}
}

function activityClickTimes(ID){
	publicAjax("/Activity/ActivityLib.asp?action=ClickTimes&ID=" + ID,"printClickTimes()");
}
function printClickTimes(text){
	var ClickTimes = document.getElementById("ClickTimes");
	ClickTimes.innerHTML = text;
}

function activityIndexSearchFocus(obj){
	if(obj.value == "在此输入关键字")
		obj.value = "";
}
function activityIndexSearchBlus(obj){
	if(obj.value == "")
		obj.value = "在此输入关键字";
}
function chkActivityIndexForm(obj){
	if(obj.C1.value !="" || obj.C2.value != ""){
		if(chkInfo(obj.C1,'text:费用下限; tag:null; color:#e0e5ea,#ff9900;','null,num,max:4') == false){return false;}
		if(chkInfo(obj.C2,'text:费用上限; tag:null; color:#e0e5ea,#ff9900;','null,num,max:4') == false){return false;}
		if(parseInt(obj.C1.value) > parseInt(obj.C2.value)){
			if(chkInfo(obj.C1,'text:费用下限不能大于费用上限; tag:null; color:#e0e5ea,#ff9900;','false') == false){return false;}
		}
	}
	if(obj.T.value == "在此输入关键字")
		obj.T.value = "";
}

function getActivitySimilarList(ID,Type,text){
	if(Type == "get"){
		publicAjax("/Activity/ActivityLib.asp?action=GetActivitySimilarList&ID=" + ID,"getActivitySimilarList(" + ID + ",'print')");
	}else if(Type == "print"){
		document.getElementById("activity_similar_list").innerHTML = text;
	}
}

function rollActivityPictrue(){
	var speed = 30;
	var step = 1;
	var maskDiv = document.getElementById("maskDiv");
	var rollDiv = document.getElementById("rollDiv");
	//如果图片超过maskDiv层所能容纳的总长度,则对齐实现滚动轮播
	if(rollDiv.scrollWidth <= parseInt(maskDiv.style.width)){return;}
	//如果maskDiv层内只要一组图片,则复制多一组图片用于轮播
	if(maskDiv.getElementsByTagName("NOBR").length <= 1){
		var nobr = document.createElement("NOBR");
		nobr.innerHTML =rollDiv.innerHTML.replace(/(clearbox\[)/gi,"$1rep_");
		maskDiv.appendChild(nobr);
	}
	
	//maskDiv层滚动函数
	function Marquee(){
		if(maskDiv.scrollLeft >= rollDiv.scrollWidth)
			maskDiv.scrollLeft = 0;
		else
			maskDiv.scrollLeft += step;
	}

	var MyMar = setInterval(Marquee,speed);
	maskDiv.onmouseover = function(){clearInterval(MyMar);} 
	maskDiv.onmouseout = function(){MyMar = setInterval(Marquee,speed)} 
}
