function keydown(event){
	if((event.ctrlKey)&&(event.keyCode==13)){
		if(subFrm()){
			document.cmt_frm.submit();
		}
	}
}
function subFrm(){
	clearAlertStyle("aa");
	var ofrm=document.cmt_frm;
	if(!checkMaxLength(ofrm.content_.value,"内容",5000)){setObjFocus("aa");makeAlertStyle("aa");
		return false;
	}
	if(!isEmpty(ofrm.content_.value,"内容")){setObjFocus("aa");makeAlertStyle("aa");
		return false;
	}
	ofrm.content.value=filtertxt(ofrm.content_.value);
	ofrm.content.value=ubbToHtml(ofrm.content.value);
	afterSubmitForm();
	return true;
}
function showMyPhoto(){
	setBackGroundGray();
	showFixedWin("selphotowin",0,-200,600,550);
	loadPhotList(1);
}
function closeMyPhoto(){
	photoArr.length=0;
	hideFixedWin("selphotowin");
	clearBackGroundGray();
}
function selphoto(photoId,path){
	if(photoArr.length>=6){
		alert("最多选择6张图片");
		return;
	}
	for(var i=0;i<photoArr.length;i++){
		if(photoArr[i][0]==photoId){
			return;
		}
	}
	photoArr[photoArr.length]=new Array(photoId,path);
	initSelPhoto();
}
function delFromPhotoArr(idx){
	photoArr=photoArr.del(idx);
	initSelPhoto();
}
function initSelPhoto(){
	var s="";
	for(var i=0;i<photoArr.length;i++){
		s+="<div class='img64a' align='center'>"+"<img src='"+photoArr[i][1]+"'/><br/><a href='javascript:delFromPhotoArr("+i+");' class='fen funa'>删除</a></div>";
	}
	s+="<div class='clearall'></div>";
	setHTML("selphotolist",s);
}
function loadPhotList(v){
	doAjax(path+"/photo.do",loadPhotListCall,"method=photolist2&pageNo="+v);
}
function loadPhotListCall(v){
	eval(v);
	if(plen==0){
	}
	else{
		var s="";
		for(var i=0;i<photoList.length;i++){
			s+="<div class='img64a' align='center'>"+"<a href='javascript:selphoto("+photoList[i][0]+",\""+photoList[i][1]+"\")'><img src='"+photoList[i][1]+"'/></a><br/><a href='javascript:delphoto("+photoList[i][0]+");' class='fen funa'>删除</a></div>";
		}
		s+="<div class='clearall'></div>";
		setHTML("photolist",s);
		initPageTool(pageNo,21);
		setLen(plen);
		setHTML("page",printPage("skiptoJS2"));
		setHTML("selphoto_status","");
	}
}
function skiptoJS2(v){
	pageNo=v;
	loadPhotList(v);
}
function tosetURL(){
	setBackGroundGray();
	showFixedWin("seturlwin",0,0,600,50);
}
function hideUrlWin(){
	hideFixedWin("seturlwin");
}
function setContentUbb(id,ubb,urlId,flg){
	setUbb2(id,ubb,urlId);
	hideFixedWin("seturlwin");
	clearBackGroundGray();
}
function touploadpic(event){
	loadUpLoadPhotoWin(event);
}
function loadUpLoadPhotoWin(event){
	setBackGroundGray();
	if(getProxyObj("uploadphotowin")!=null){
		getProxyObj("uploadphotowin").style.display="block";
	}
	else{
		getObj("uploadphotowin").style.width="500px";
		showFixedWin("uploadphotowin",0,0,550,0);
	}
}
function prepareUpload(){
		getProxyObj("uploadphotowin").style.display="none";
		var shield = document.createElement("div");
		shield.id = "shield";
		shield.style.position = "absolute";
		shield.style.left = "0px";
		shield.style.top = "0px";
		shield.style.width = "100%";
		shield.style.height = document.body.scrollHeight+"px";
		shield.style.background = "#333";
		shield.style.textAlign = "center";
		shield.style.zIndex = "10005";
		shield.style.filter = "alpha(opacity=50)";
		shield.style.opacity = 0.5;
		document.body.appendChild(shield);
		showStatusWin("tipwin",0,100);
		return true;
}
function finishUpload(magickErrorCount,formatErrorCount,ioErrorCount,flg){
	if(photoArr.length==0){
		alert("请选择图片");
		return;
	}
	var frm=document.cmt_frm;
	frm.del_picid.value=del_picid;
	frm.onsubmit="";
	frm.action=path+"/b.do?method=toeditphotodescforreply";
	var s="";
	for(var i=0;i<photoArr.length;i++){	
		s+="<input type='hidden' name='photoId' value='"+photoArr[i][0]+"'>";
	}
	setHTML("photoIdcon",s);
	frm.content.value=frm.content_.value;
	frm.magickErrorCount.value=magickErrorCount;
	frm.formatErrorCount.value=formatErrorCount;
	frm.ioErrorCount.value=ioErrorCount;
	frm.target="";
	frm.submit();
}
function tobbs(p){
	window.location.href=CLUBSERVER+"/b.do?method=getbbs&bbsId="+bbsId+"&classId="+classId+"&isReply=1&pageNo="+p;
}
var photoArr=new Array();
var photoList=new Array();
function skiptoJS(v){
	pageNo=v;
	loadPhotList(v);
}
var tmp_pid=0;
function delphoto(pid){
	if(window.confirm("确定要删除？")){
		tmp_pid=pid;
		doAjax(path+"/photo.do",delphotocall,"method=delphoto&pid="+pid);
	}
}
function delphotocall(v){
	if(v=="2"){
		if(window.confirm("图片已经被其他话题引用,确定要删除此图片？")){
			doAjax(path+"/photo.do",delphotocall,"method=delphoto&pid="+tmp_pid+"&delFlg=1");
		}
	}
	else{
		if(v=="0"){
			skiptoJS(pageNo);
		}
	}
}