﻿/////////////////////////// 通用函数 ////////////////////////////////////
//使用文字加色功能需要扣除的积分
var c_nTextAddColorPMoney=5;

function cmCheckWrrantRet(strResponseHtml){
	if(strResponseHtml=="No Access") {
		alert(cmLang.AlertNoWrrant);
		return false;
	}else{
		return true;
	}
}

function cmSearchSetTextPrompt(strPropmtTextHtmlID,strPrompt){	
	var emPromptText = $G(strPropmtTextHtmlID);
	if( emPromptText != null){
		emPromptText.title = cmLang.PmtSearkeyInputPrefix + strPrompt + cmLang.PmtSearkeyInputSuffix;
		genPromptTextOnBlur(emPromptText);
	}	
}
var c_nSearchType_ByContent=0;
var c_nSearchType_ByID=1;
function cmSearchCheckInput(nSearchType,emSearchKey){
	var strSearchKey="";
	if( emSearchKey != null){
		strSearchKey=Trim(emSearchKey.value); 
		if( emSearchKey.className=="COMMON_PromptEdit_Idle_text" || strSearchKey == "" || strSearchKey == null) {
			alert(cmLang.AlertSearchKeyNull);	
			strSearchKey="";
		}
	}
	if( strSearchKey!=""){
		if(nSearchType==c_nSearchType_ByContent){ //按内容搜索
			var nLengErr=0;
			if( strSearchKey.length>30){
				nLengErr=2;
				alert(cmLang.AlertSearchKeyLong);
				strSearchKey=""; 
			}else{
				if(/[^\x00-\xff]/g.test(strSearchKey)) {
					if (strSearchKey.length<2) {
						nLengErr=1;
					}
				} else {
					if (strSearchKey.length<3) {
						nLengErr=1;
					} 
				}
				if( nLengErr==1){
					alert(cmLang.AlertSearchKeyShort);
					strSearchKey=""; 
				}
			}
		}else{ // 按ID搜索
			if(genIsNumber(strSearchKey)==false){
				alert(genLang.AlertInputNum);
				strSearchKey="";
			}			
		}
	}
	return strSearchKey;
}

function cmSearchCheckRet(strResponseHtml){
	if( strResponseHtml=="-528"){
		alert(cmLang.AlertSearchKeyErr);
		return false;
	}else{
		return true;
	}
}

function cmChangeListType(nNewListType,strNewURL){
	var strCookieKey="VLT";
	genCreateCookie(strCookieKey,nNewListType,14);
	location.href=strNewURL;
}

function cmAdd2Friend(emAddFriOp,nFriMemID,nOpType,nMemID){
	if(nFriMemID!=nMemID){
		var strReqForm="cID="+nFriMemID+"&opType="+nOpType;
		window.pwShow("/Common/cmAddFriPopWnd.do?"+strReqForm+"&time="+Math.random(),600,300,1,null);
	}
	else{
		alert(cmLang.IM_Alert14);
	}
}

function cmTxtCheckRank(nNeedPenddingFlag,strTxt){
	var bRet=false;
	var objXMLHTTP = genCreateXMLHTTP();
	if (objXMLHTTP!=null){
		objXMLHTTP.open("POST","/Common/cmMisc.do?action=TxtCheckRank",false);
		objXMLHTTP.setRequestHeader("content-type","application/x-www-form-urlencoded");
		objXMLHTTP.send("flag="+nNeedPenddingFlag+"&txt="+genEscape(strTxt));
		if (objXMLHTTP.readyState==4){
			genHideLoader();
			var strResponseHtml=objXMLHTTP.responseText;
			if( strResponseHtml==""){
				bRet=true;
			}else{
				var arrCheckRanks=strResponseHtml.split(c_strToken_Level0);
				if( arrCheckRanks.length!=2){
					alert(strResponseHtml);
					bRet=false;
				}else if (parseInt(arrCheckRanks[0])==32){
					bRet=confirm(arrCheckRanks[1]);
				}else{
					alert(arrCheckRanks[1]);
					bRet=false;
				}
			}
		}else{
			genShowLoader();
		}
	}
	return bRet;
}		

function cmPopHelp(nHelpID){
	window.pwShow("/Common/cmPop.do?type=2&oID="+nHelpID,600,400,1,null);	
}

function cmRefreshVerifyCodeImg(strRefreshHtmlID){
	var emReqRefresh=$G(strRefreshHtmlID);
	if( emReqRefresh!=null){
		function responseProcess(strResponseHtml){
			emReqRefresh.innerHTML = strResponseHtml;
		}		
		genXMLHttpReq(1,"/Common/cmMisc.do?action=GetVerifyCodeImg","",responseProcess);
	}	
}

function cmRefreshPostVerify(strHtmlIDPrefix,strHtmlIDType,strRefreshHtmlID){
	var emReqRefresh=$G(strRefreshHtmlID);
	if( emReqRefresh!=null){
		function responseProcess(strResponseHtml){
			emReqRefresh.innerHTML = strResponseHtml;
		}		
		genXMLHttpReq(1,"/Common/cmMisc.do?action=GetPostVerifyHtml","prefix="+strHtmlIDPrefix+"&idType="+strHtmlIDType,responseProcess);
	}	
}

function cmGetPostVerifyReq(strHtmlIDPrefix,strHtmlIDType){
	var emMsgPostButton = $G("uMs_MsgPost_Bt");
	var strReqForm="";
	var emVerifyCodeText=$G(strHtmlIDPrefix+"_"+strHtmlIDType+"_VerifyCode_text"); 
	if( emVerifyCodeText!=null){
		if( genTxtIsNull(emVerifyCodeText.value)==true){
			alert(cmLang.AlertInputVerifyCode);
			if(emMsgPostButton!=null){
				emMsgPostButton.disabled=false;
			}
			return "-1";
		}
		strReqForm=strReqForm+"&vCode="+emVerifyCodeText.value;
	}
	var emAuthorText = $G(strHtmlIDPrefix+"_"+strHtmlIDType+"_PostAuthor_text");
	var emPasswordText = $G(strHtmlIDPrefix+"_"+strHtmlIDType+"_PostPassword_password");
	if( emPasswordText!=null){
		if( genTxtIsNull(emAuthorText.value)==true){
			alert(cmLang.AlertInputVerifyCode);			
			return "-1";
		}
		strReqForm=strReqForm+"&nick="+genEscape(emAuthorText.value)+"&pwd="+genEscape(emPasswordText.value);
	}
	return strReqForm;
}

function cmGetFckEditor(strEditorInstanceName){
	var emEditorParent = $G(strEditorInstanceName+"_iframe");
	if( emEditorParent == null){
		return null;
	}
	return emEditorParent.contentWindow;
}

function cmSetFckEditorContent(strEditorInstanceName,strContent){	
	var emEditor=cmGetFckEditor(strEditorInstanceName);
	if( emEditor!=null){
		try {
			var objEditor =emEditor.FCKeditorAPI.GetInstance(strEditorInstanceName);
			objEditor.SetHTML(strContent);
			objEditor.Focus();
		} catch(e) {
			emEditor = emEditor.$G(strEditorInstanceName);
			if( emEditor != null){
				emEditor.value = strContent;
				emEditor.focus();
			}
		}
	}
}

function cmGetFckEditorContent(strEditorInstanceName){	
	var emEditor=cmGetFckEditor(strEditorInstanceName);
	var strContent="";
	if( emEditor!=null){
		try {
			var objEditor =emEditor.FCKeditorAPI.GetInstance(strEditorInstanceName);
			strContent=objEditor.GetXHTML();
		} catch(e) {
			emEditor = emEditor.$G(strEditorInstanceName);
			if( emEditor != null){
				strContent=emEditor.value;
			}
		}
	}
	return strContent;
}

function cmUserPop(emLink,strPopWndID,strMemNick,nMemVIPValue){
	var emPopWnd=$G(strPopWndID);
	if( emPopWnd!=null){
		var strHtml=emPopWnd.innerHTML.toString();
		strHtml=strHtml.replace(/\admin/g,strMemNick);
		strHtml=strHtml+"<div class=\"POP_User_Name_div\">"+strMemNick
		if( nMemVIPValue>0 ){
			strHtml=strHtml+"&nbsp;<img src=\"/images/cm_VIP.gif\"/>"			
		}
		strHtml=strHtml+"</div>"
		genPopSelectOpenInner(emLink,strHtml);
	}
}

function cmCheckAll(strObjName,bSelfChecked,objAux){
	var objEm=document.getElementsByName(strObjName);
	if(objEm!=null){
		for(var i=0;i<objEm.length;i++){
			objEm[i].checked=bSelfChecked;
		}
	}
	if(objAux!=null)
		objAux.disabled=!bSelfChecked;
}

//改变主题列表里主题发表人的图像的大小
//bBigOrSmall:如果为true则表示变大，否则表示变小
//nRowNumb:是主题的行号
function cmGetSubjAdminAva(strMemNick,bBigOrSmall,nRowNumb){
	var emImg=$G(strMemNick+"_"+nRowNumb);
	if(emImg!=null){
		if(bBigOrSmall){
			emImg.height="48";
			emImg.width="48";
		}
		else{
			emImg.height="16";
			emImg.width="16";
		}
	}
}
////////////////用户登录函数//////////////////////
function LoginAlert(pType){
	var strParam="";
	if(pType!=null&&pType!="") strParam="?pType="+pType;
	var nh=150;
	if(navigator.appName.toLowerCase()=="microsoft internet explorer") nh=nh+40;
	window.pwShow("/Common/cmLoginPopWnd.do"+strParam,300,nh,1,null);
}

function loginExpandSwitch(strType){
	function responseProcess(strResponseHtml){	
		$G("login_Extend_div").innerHTML=strResponseHtml;
	}
	strReqForm="action=GetExpandHtml&type="+strType;
	genXMLHttpReq(1,"/Common/cmLoginMisc.do",strReqForm,responseProcess);
}

function loginTextOnKeyDown(e,strParam){
	e = e || event ;
	if( e.keyCode ==13)	{
		return loginAction(strParam);
	}
}

function loginReload(nParentType){
	if( nParentType==0){
		window.top.pwHide();
		window.top.location.reload();
	}else{
		window.location.reload(true);		
	}
}

function loginAction(strParam){
	var arrParam=strParam.split(",");
	var nActionType=parseFloat(arrParam[0]);
	var nParentType=0;
	if( arrParam.length>=1){
		nParentType=parseInt(arrParam[1]);
	}

	var strHtmlIDPrefix="login";
	var strReqForm="";
	strReqForm=genTextCheckNotNull(strHtmlIDPrefix+"_Inner_form","");
	if( strReqForm==false) return;
	var strType="";
	var emPostBtn=$G(strHtmlIDPrefix+"_Act"+nActionType+"_button");
	var strPostBtnTitle="";
	switch(parseInt(nActionType)){
	case 0: 
		if( genIsValidUserName($G(strHtmlIDPrefix+"_Nick_text").value)==false){
			return;
		}
		if( genIsValidEmail($G(strHtmlIDPrefix+"_Email_text").value)==false){
			return;
		}
		strType="reg";
		var emPwd=$G(strHtmlIDPrefix+"_pwd");
		var emRePwd=$G(strHtmlIDPrefix+"_Re_pwd");
		if(emPwd.value!=emRePwd.value){
			alert(cmLang.AlertPwdNotIdentical);
			return;
		}		
		strReqForm=strReqForm+cfRegReqParam();
		break;
	case 1:		
		if(genTxtIsNull($G(strHtmlIDPrefix+"_Nick_text").value)||genTxtIsNull($G(strHtmlIDPrefix+"_pwd").value)){
			alert(cmLang.AlertLoginErr);
			return;
		}

		strType="login";
		var emSavePassCheck=$G(strHtmlIDPrefix+"_SavePwd_check");
		if( emSavePassCheck!=null && emSavePassCheck.checked){
			strReqForm+="&keep=1";
		}
		var emVerifyCode=$G(strHtmlIDPrefix+"_VerifyCode_text");
		if( emVerifyCode!=null && emVerifyCode.value!=""){
			strReqForm+="&vCode="+emVerifyCode.value;
		}
		break;
	case 2:
		var emCode=$G(strHtmlIDPrefix+"_Code_text");
		if( emCode==null || genTxtIsNull(emCode.value)==true){
			alert(cmLang.AlertInputActiveCode);
			return;
		}
		strType="active";
		break;
	case 3:
		strType="postACode";
		break;		
	case 4:
		strType="getPwd";
		break;
	case 5:
		strType="changeEmail";
		break;
	}
	
	if( emPostBtn!=null){
		emPostBtn.disabled="disabled";
		strPostBtnTitle=emPostBtn.value;
		emPostBtn.value=cmLang.Sending;
	}

	strReqForm="action="+strType+strReqForm;
	function responseProcess(strResponseHtml){
		if( emPostBtn!=null){
			emPostBtn.disabled="";
			emPostBtn.value=strPostBtnTitle;
		}
		switch(parseInt(nActionType)){
		case 0:
			cmRefreshVerifyCodeImg(strHtmlIDPrefix+"_VerifyCode_span");
			if( cfRegRespProcess(strResponseHtml)==true){
				var arrResp=strResponseHtml.split(c_strToken_Level0);
				if( arrResp.length>0){
					strResponseHtml=arrResp[0];
				}
				alert(strResponseHtml);
				genRetPrompt(strResponseHtml,strHtmlIDPrefix+"_RetInfo_div");
				if( arrResp.length>0 && arrResp[1]=="1"){
					loginReload(nParentType);
				}
				return;
			}			
			break;	
		case 1:
			cmRefreshVerifyCodeImg(strHtmlIDPrefix+"_VerifyCode_span");
			if( strResponseHtml=="1"){
				loginReload(nParentType);
				strResponseHtml="";
			}else if( strResponseHtml=="-1" || strResponseHtml=="-2"){
				$G(strHtmlIDPrefix+"_pwd").value="";
				if( strResponseHtml=="-1"){
					strResponseHtml=cmLang.AlertNickNotExist;
				}else{
					strResponseHtml=cmLang.AlertPwdIncorrect;
				}
			}else{
				var arrRet=strResponseHtml.split(c_strToken_Level0);
				if( arrRet[0]=="0"){
					$G(strHtmlIDPrefix+"_Extend_div").innerHTML=arrRet[1];
					strResponseHtml=cmLang.AlerttFirstSignin;				
					alert(strResponseHtml);
				}
			}
			break;
		case 2:
			if(strResponseHtml=="1"){
				strResponseHtml=cmLang.AlertActiveSuccess;
				alert(strResponseHtml);
				loginReload(nParentType);
			}
			break;
		case 3:
			alert(strResponseHtml);
			break;		
		case 5:
			break;
		default:
			break;		
		}
		if(strResponseHtml!=""){
			if($G(strHtmlIDPrefix+"_RetInfo_div"))
				genRetPrompt(strResponseHtml,strHtmlIDPrefix+"_RetInfo_div",true);
			else
				alert(strResponseHtml);
		}
	}
	
	genXMLHttpReq(1,"/Common/cmLoginMisc.do",strReqForm,responseProcess);
}﻿

function logout(){
	function responseProcess(strResponseHtml){	
		location.reload();
	}
	strReqForm="action=logout";
	genXMLHttpReq(1,"/Common/cmLoginMisc.do",strReqForm,responseProcess);
}

function loginRedirect(strUrl){
	location.href=strUrl;
}

function regEnable(emCheck){
	$G("login_Act0_button").disabled=!emCheck.checked;	
}

function editArtKeyw(strHtmlIDPrefix,nNoteID,strKeyW){
	var strNewMood=prompt(cmLang.AlertInputKeyword,strKeyW);
	var arrKw=oeGetKWArr(strNewMood,true);
	if(arrKw.length>6){
		alert(cmLang.AlertInputMoreError);
		editArtKeyw(strHtmlIDPrefix,nNoteID,strNewMood);
		return;
	}
	if (strNewMood!=null && strNewMood!=strKeyW){		
		function responseProcess(strResponseHtml){	
			$G(strHtmlIDPrefix+"_Keywords_ul").innerHTML=strResponseHtml;	
			$G(strHtmlIDPrefix+"_EditKw_li").onclick=function(){
				editArtKeyw(strHtmlIDPrefix,nNoteID,strNewMood);
			}
		}
		var strReqForm="nObjID="+nNoteID+"&keyW="+genEscape(strNewMood)+"&prefix="+strHtmlIDPrefix;
		genXMLHttpReq(1,"/Common/cmMisc.do?action=EditArtKeyW",strReqForm,responseProcess);
		
	}
}

//用户选择器，通用
//参数说明：strAuxTitle选择器的扩展title,nCurIndex右边3个用户列表类型的索引号（依次为0、1、2）
//strDefUsers左边昵称文本框里的默认昵称字符串，
//_o这个为点击对象，一般传this,通过这个对象来定位弹窗的位置,
//jsParam这个参数必须包含strHtmlIDPrefix（这个是页面描述字符串）和_separator（最终的赋值对象里所要求的分割符号，比如要求用逗号或分号或空格分割）,且必须用“|”隔开
//jsFunc该函数用来做最终或非最终的操作，如果是最终操作，则需要调用最终操作的方法，同时最终操作的方法的参数由jsParam里的某些组成
//_osource目的昵称对象，_osrcids目的id对象，根据需要传，没有需要可以不传或者传null
function cmUserSelector(strAuxTitle,nCurIndex,strDefUsers,_o,jsFunc,jsParam,_osource,_osrcids){
	var strHtmlIDPrefix=jsParam.split("|")[0];
	var _separator=jsParam.split("|")[1];
	var _op=getPos(_o);
	function responseProcess(strResponseHtml){	
		if(strResponseHtml=="") {
			alert(cmLang.AlertOpFailure);
			return;
		}
		var arrRep=strResponseHtml.split(c_strToken_Level0);
		if($G(strHtmlIDPrefix+"_Selector")!=null) $G(strHtmlIDPrefix+"_Selector").parentNode.removeChild($G(strHtmlIDPrefix+"_Selector"));
		var emP=document.createElement("DIV");
		emP.id=strHtmlIDPrefix+"_Selector";
		emP.className="x-selector";
		emP.style.position="absolute";
		emP.style.zIndex="201";
		//emP.style.left=_op.x+"px";
		//emP.style.top=_op.y+20+"px";
		emP.innerHTML=arrRep[1];
		document.body.appendChild(emP);	
		genCtrlElemInScreen(emP,_op.x,_op.y+20,472,237);
		var scls=$G("x-selector-close");
		if(scls!=null){
			scls.onclick=function(){
				if(emP!=null) emP.parentNode.removeChild(emP);
				_osource.removeAttributeNode(_osource.attributes["disabled"]);
			}
		}
		var slist=$G("x-tool-frilist");
		var offen=$G("x-tool-offen");
		var friend=$G("x-tool-friend");
		var allu=$G("x-tool-all");
		var _oidxchg=genGetElemsByName("index-chg","li");
		if(_oidxchg!=null&&_oidxchg.length>0){
			for(var i=0;i<_oidxchg.length;i++){
				_oidxchg[i].onclick=function(){
					var curidx=this.getAttribute("nvalue");
					for(var j=0;j<_oidxchg.length;j++){
						_oidxchg[j].className="x-selector-normal";
					}
					this.className="x-selector-active";					
					function responseProcess(strResponseHtml){
						if(slist!=null) {
							slist.innerHTML=strResponseHtml;
							bindListEvt(_separator);
							var _ok=$G("x_key_text");
							if(_ok!=null){
								_ok.onkeydown=function(evt){
									if(!evt)evt=window.event;
									var keyCode = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
									if(keyCode == 13){
										getSrchList(_ok,_separator);
									}
								}
							}
							var _osbtn=$G("x-selector-srch-btn");
							if(_osbtn!=null){
								_osbtn.onclick=function(){
									getSrchList(_ok,_separator);
								}
							}
						}
					}
					var strReqForm="nIndex="+curidx;
					genXMLHttpReq(1,"/Common/cmMisc.do?action=GetNickList",strReqForm,responseProcess);
				}
			}
		}		
		bindListEvt(_separator);
		setInput(_separator,_osource,_osrcids);
		_osource.setAttribute("disabled","disabled");
		var osubmit=$G("x-selector-submit");
		if(osubmit!=null){
			osubmit.onclick=function(){	
				_osource.removeAttributeNode(_osource.attributes["disabled"]);
				jsFunc(jsParam,emP,_osource,_separator,_osrcids);				
			}
		}
	}
	var strReqForm="strTitle="+strAuxTitle+"&nIndex="+nCurIndex+"&prefix="+strHtmlIDPrefix+"&defNicks="+strDefUsers;
	genXMLHttpReq(1,"/Common/cmMisc.do?action=NickSelector",strReqForm,responseProcess);
}
//设置左侧文本框的值
function setInput(_separator,_osource,_osrcids){
	var _oinput=$G("x-nick-input");
	var _oids=$G("x-id-input");
	if(_osource!=null){		
		if(Trim(_osource.value)!=""){
			_oinput.value=_osource.value.split(_separator).join(" ");
			if(_osrcids!=null) _oids.value=_osrcids.value;
		}
	}
}

//设置目的输入框的值，可能是隐藏文本框，也可能是可见的，根据具体情况不同而不同
function setSrcInput(emP,_osource,_separator,_osrcids){
	var _oinput=$G("x-nick-input");	
	var arrNickLst=oeGetKWArr(_oinput.value,true);
	if(arrNickLst!=null&&arrNickLst.length>0) {
		_osource.value=arrNickLst.join(_separator);
		function responseProcess(strResponseHtml){
			if(strResponseHtml!=""&&_osrcids!=null) _osrcids.value=strResponseHtml;	
			else {
				if(_osrcids!=null) _osrcids.value="";
			}
		}
		var strReqForm="strNick="+genEscape(arrNickLst.join());
		genXMLHttpReq(1,"/Common/cmMisc.do?action=SetFreContact",strReqForm,responseProcess);		
	}		
	if(emP!=null) emP.parentNode.removeChild(emP);
}
//工作台发站内消息时调用的方法
function setMsgUserList(jsParam,emP,_osource,_separator,_osrcids){	
	setSrcInput(emP,_osource,_separator,_osrcids);
}
//文章推荐操作
function setRel(jsParam,emP,_osource,_separator,_osrcids){
	var arrP=jsParam.split("|");
	setSrcInput(emP,_osource,_separator,_osrcids);
	if(Trim(_osource.value)!="") {
		fwRelActRec(arrP[0].toString(),arrP[2],arrP[3],arrP[4],arrP[5],arrP[6]);
	}
	_osource.value="";
	if(_osrcids!=null) _osrcids.value="";
}

//添加主题成员
function setAddSubMem(jsParam,emP,_osource,_separator,_osrcids){
	setSrcInput(emP,_osource,_separator,_osrcids);
}

function getSrchList(_o,_separator){
	if(cmSearchCheckInput(0,_o)=="") return;
	if(_o.value==_o.title||Trim(_o.value)==""){
		alert(cmLang.AlertSearchKeyNull);	
		return;
	}
	function responseProcess(strResponseHtml){
		if($G("x-srchkey-list")!=null) $G("x-srchkey-list").innerHTML=strResponseHtml;
		bindListEvt(_separator);
	}
	var strReqForm="nickKey="+genEscape(_o.value);
	genXMLHttpReq(1,"/Common/cmMisc.do?action=GetSrchKeyList",strReqForm,responseProcess);
}

function bindListEvt(_separator){
	var onClickObj=genGetElemsByName("ext-sl-onc","div");
	if(onClickObj!=null&&onClickObj.length>0){
		for(var i=0 ; i<onClickObj.length ; i++){
			onClickObj[i].onclick=function(){	
				var nId=this.id.split("_")[1];
				if($G("ext-gensl-"+nId).style.display!="block"){
					for(var j=0 ; j<onClickObj.length ; j++){
						var nnId=onClickObj[j].id.split("_")[1];
						$G("ext-gensl-"+nnId).style.display="none";
					}			
					if($G("ext-gensl-"+nId).style.display=="none"){
						$G("ext-compsl-"+nId).className="x-panel x-tree";
						$G("ext-gensl-"+nId).style.display="block";
					}else{
						$G("ext-compsl-"+nId).className="x-panel x-tree x-panel-collapsed";
						$G("ext-gensl-"+nId).style.display="none";
					}
				}
			}	
		}
	}
	var onCItenObj=genGetElemsByName("x-selector-node","li");
	var onMItemO=genGetElemsByName("x-selector-div","div");
	var _oinput=$G("x-nick-input");
	var _oids=$G("x-id-input");
	if(onCItenObj!=null&&onCItenObj.length>0){			
		for(var i=0 ; i<onCItenObj.length ; i++){
			onCItenObj[i].onclick=function(){
				if(_oinput!=null){
					if(Trim(_oinput.value)=="") {
						_oinput.value=this.getAttribute("strvalue");
						_oids.value=this.getAttribute("nvalue");
					}
					else {
						var arrNick=oeGetKWArr(_oinput.value,true);
						var curStr=_separator+arrNick.join(_separator)+_separator;							
						if(curStr.indexOf(_separator+this.getAttribute("strvalue")+_separator)==-1){
							_oinput.value=_oinput.value.replace(","," ")+" "+this.getAttribute("strvalue");
							_oids.value+=";"+this.getAttribute("nvalue");
						}
					}
				}
			}			
		}
	}	
	if(onMItemO!=null&&onMItemO.length>0){			
		for(var i=0 ; i<onMItemO.length ; i++){
			onMItemO[i].onmouseover=function(){
				if(this!=null) this.className="x-tree-node-el x-tree-node-leaf x-tree-node-over";
			}
			onMItemO[i].onmouseout=function(){
				if(this!=null) this.className="x-tree-node-el x-tree-node-leaf";
			}
		}
	}
}

function loginLogChg(_o){
	if(_o!=null){
		_o.onclick=null;
		if(_o.getAttribute("rel")=="login") {
			_o.value=cmLang.CancelReg;
			_o.setAttribute("rel","reg");
			loginExpandSwitch('reg');			
		}else{
			_o.value=cmLang.RegJust;
			_o.setAttribute("rel","login");
			loginExpandSwitch('login');	
		}
		_o.onclick=function(){
			loginLogChg(this);
		}
	}
}

function clubADEditAction(strHtmlIDPrefix,nObjType,nSysCateID){
	var strReqForm="prefix="+strHtmlIDPrefix+"&objType="+nObjType+"&cID="+nSysCateID;
	function responseProcess(strResponseHtml){	
		if(nSysCateID==0){
			$G(strHtmlIDPrefix+"_AD_div").innerHTML=strResponseHtml;
		}
		else{
			$G(strHtmlIDPrefix+"_BannarContent_div").innerHTML=strResponseHtml;
		}
	}
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=GetADEditHtml",strReqForm,responseProcess);	
}

function clubADSave(strHtmlIDPrefix,nObjType,nSysCateID){
	var strReqForm="prefix="+strHtmlIDPrefix+"&objType="+nObjType+"&cID="+nSysCateID;
	var strContent=cmGetFckEditorContent(strHtmlIDPrefix+"_AD_Editor");
	strReqForm+="&ad="+genEscape(strContent);
	function responseProcess(strResponseHtml){	
		try{
			var emEditor=cmGetFckEditor(strHtmlIDPrefix+"_AD_Editor");
			var objEditor =emEditor.FCKeditorAPI.GetInstance(strHtmlIDPrefix+"_AD_Editor");
			objEditor.ResetIsDirty();
		}catch(e) {
			
		}
		location.reload();
	}
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=SaveAD",strReqForm,responseProcess);	
}

function clubSelActiveTime(eP,d_start,d_end,t_object,nIndex,jsFunc,jsParam){
	show_cele_date(eP,d_start,d_end,t_object,nIndex,jsFunc,jsParam);		
}



function ListKeywordEvtOnKeyDown(event,_emList,onMovefunc,onEnterfunc,strCol,strAuxCol) {
	var evt=genGetEvent(event);
	if (_emList != null) {
		if (evt.keyCode==38) {
			ListKeywordMove(1,_emList,strCol,strAuxCol)
		} else if (evt.keyCode==40) {
			ListKeywordMove(2,_emList,strCol,strAuxCol)
		} else if (evt.keyCode==13) {
			//_emList.style.display="none";
			//oeArtKeywordsGet(strHtmlIDPrefix,1,'',strCol,strAuxCol);
		} else {
			//strTempKw=''
			//_emList.style.display="none";
			//oeArtKeywordsGet(strHtmlIDPrefix,1,'');
		}
	}
}
function ListKeywordMove(nType,_emList,strCol,strAuxCol) {
	//nType 1是向上移动 2是向下移
	arrKwemItem=_emList.getElementsByTagName("a");
	var nCol=-1
	var emKWID='';
	for (i=0;i<arrKwemItem.length;i++) {
		emKWID=$G(strCol+i+strAuxCol)
		if (emKWID.className=="Active") {
			nCol=i
			emKWID.className="Normal";
		}
	}
	if (nType==1) {
		nCol=nCol-1
	} else if (nType==2) {
		nCol=nCol+1
	}
	if (nCol>=0) {
		if (nCol<arrKwemItem.length) {
			emKWID=$G(strCol+nCol+strAuxCol)
			emKWID.className="Active";
		}
	} else if (nCol<=-1) {
		nCol=arrKwemItem.length-1
		emKWID=$G(strCol+nCol+strAuxCol)
		emKWID.className="Active";
	}
}

function clubMcPop(strHtmlIDPrefix,nType,wth,hth,nIndex){	
	var date = new Date();
	window.pwShow("/Framework/Club/clubSubjPopWnd.do?prefix="+strHtmlIDPrefix+"&type="+nType+"&nCurSquareID="+nIndex+"&time="+date.toGMTString(),wth,hth,1);		
}

function clubBfPop(strHtmlIDPrefix,nObjId,nCommId){	
	var date = new Date();
	window.pwShow("/Framework/Club/clubSubjPopWnd.do?prefix="+strHtmlIDPrefix+"&type=7&nObjID="+nObjId+"&nCommID="+nCommId+"&time="+date.toGMTString(),300,200,1);		
}

function clubOpBf(strHtmlIDPrefix,nObjId,nCommId,opType){
	var strCommTxt="";
	if(opType==2){
		if(!confirm("您确实要删除该楼层吗？\n\n温馨提示：点击确定即可删除，请慎重操作！")) return;
	}else {
		strCommTxt=$G(strHtmlIDPrefix+"_Mc_BfText").value;
		if(Trim(strCommTxt)=="") {
			alert("请填写要盖的内容！");
			return;
		}
		var colorTxt=$G("cm_TxtColor_hidden");
		if(colorTxt==null) colorTxt="#000000";
		else colorTxt=colorTxt.value;		
		if(colorTxt!="#000000"){
			if(!confirm("您使用了文字加色功能，需要花费积分"+c_nTextAddColorPMoney+"分，确定继续吗？")) return;
		}
	}
	function responseProcess(strResponseHtml) {
		if(opType==1){
			window.top.pwHide(true);
			if(strResponseHtml.length>0) window.top.clubRefBf(strHtmlIDPrefix,nObjId,nCommId,strResponseHtml,opType);		
		}else{
			clubRefBf(strHtmlIDPrefix,nObjId,nCommId,strResponseHtml,opType);	
		}
	}
	var strRegForm="prefix="+strHtmlIDPrefix+"&opType="+opType+"&nCommId="+nCommId+"&nObjID="+nObjId+"&strCommTxt="+genEscape(strCommTxt)+"&colorTxt="+genEscape(colorTxt);
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=OpBf",strRegForm,responseProcess);	
}

function clubRefBf(strHtmlIDPrefix,nObjId,nCommId,strRetHtml,opType){
	var arrArr=strRetHtml.split(c_strToken_Level0);	
	var _o=$G(strHtmlIDPrefix+"_SquareArtComm"+nObjId+"_ul");
	var _oc1=$G(strHtmlIDPrefix+"_BfCnt"+nObjId+"1_span");
	var _oc2=$G(strHtmlIDPrefix+"_BfCnt"+nObjId+"2_span");
	var _oc3=$G(strHtmlIDPrefix+"_TxtEndCnt"+nObjId+"_span");
	if(_o==null) return;
	_oc1.innerHTML=arrArr[0];	
	if(_oc2!=null) _oc2.innerHTML=arrArr[0];	
	if(arrArr[0]>0) _oc3.innerHTML="[<span style=\"font-weight:bold;padding:0px 2px\">"+arrArr[0]+"</span>楼]";
	_o.innerHTML=arrArr[1];	
}

function clubDelNoteArt(strHtmlIDPrefix,nObjID,nSqID,strParam,nPage){
	if(!confirm("您确定删除该60秒日记吗？\n\n温馨提示：该操作不可恢复，请仔细操作～！")) return;
	function responseProcess(strResponseHtml) {
		clubMcAction(strParam,nPage);
	}
	var strRegForm="prefix="+strHtmlIDPrefix+"&oeSquareID="+nSqID+"&nObjID="+nObjID;
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=DelSqArt",strRegForm,responseProcess);	
}

function clubOpMc(strHtmlIDPrefix){
	var oeTime=$G(strHtmlIDPrefix+"_Mc_PostTimeType");
	var oeSquare=$G(strHtmlIDPrefix+"_Mc_Square");
	var oeContent=$G(strHtmlIDPrefix+"_Mc_Content");
	var nHiddenID=$G(strHtmlIDPrefix+"_Mc_SquareID_hidden");
	var nHiddenSq=$G(strHtmlIDPrefix+"_Mc_Square_hidden");
	var colorTxt=$G("cm_TxtColor_hidden");
	var nNotice=$G(strHtmlIDPrefix+"_Mc_Notice");
	if(colorTxt==null) colorTxt="#000000";
	else colorTxt=colorTxt.value;
	if(nHiddenID.value==0||Trim(nHiddenSq.value)==""){
		alert("请选择地点");
		return;
	}
	if(Trim(oeContent.value)==""){
		alert("请填写内容");
		return;
	}
	if(colorTxt!="#000000"){
		if(!confirm("您使用了文字加色功能，需要花费积分"+c_nTextAddColorPMoney+"分，确定继续吗？")) return;
	}
	function responseProcess(strResponseHtml) {
		var _o=$G(strHtmlIDPrefix+"_Mc_Notice");
		if (_o == null) {
			window.top.pwHide(true);
			window.top.location.reload();
		} else {
			if(!_o.checked){
				window.top.pwHide(true);
				window.top.location.reload();
			}else{
				var strHtml="<div><ul>"
					+"<li style=\"padding:4px\"><img src=\"/images/cm_checked.gif\" align=\"absmiddle\"/> 恭喜您，已成功发表在校园广播里面</li>"
					+"<li style=\"padding:4px\"><img src=\"/images/cm_Report.gif\" align=\"absmiddle\"/> 校际广播审核中，请您耐心等待...</li>"
					+"<li style=\"padding:4px\"><span style=\"padding-left:22px\">校际广播要求：</span></li>"
					+"</ul></div>"
					+"<div class=\"POP_BottomBar_div\"><div class=\"COMMON_CenterInner_div\"><button onclick=\"window.top.pwHide(true);window.top.location.reload();\" class=\"COMMON_button\">确定</button></div></div>";
				var _o=$G("pop_"+strHtmlIDPrefix+"_Html_div");
				var _oi=window.top.$G("popup_Frame_iframe");
				var _otop=window.top.$G("popup_Container_div");
				_oi.style.height="240px";
				_otop.style.height="269px";
				_o.innerHTML=strHtml;
			}
		}
	}
	var strRegForm="oeTime="+genEscape(oeTime.options[oeTime.selectedIndex].text)+"&oeTimeID="+oeTime.value+"&oeSquareID="+nHiddenID.value+"&oeContent="+genEscape(oeContent.value)+"&oeSquare="+genEscape(nHiddenSq.value)+"&colorTxt="+genEscape(colorTxt);
	if (nNotice !=null) {
		if(nNotice.checked) strRegForm+="&nNotice=1";
		else strRegForm+="&nNotice=0";
	} else {
		strRegForm+="&nNotice=0";
	}
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=OpMc",strRegForm,responseProcess);	
}



function clubClkSq(strHtmlIDPrefix,_o,bGo){
	var nHiddenID=$G(strHtmlIDPrefix+"_Mc_SquareID_hidden");
	var nHiddenSq=$G(strHtmlIDPrefix+"_Mc_Square_hidden");
	if(nHiddenID!=null) nHiddenID.value=_o.getAttribute("nvalue");
	if(nHiddenSq!=null) nHiddenSq.value=_o.getAttribute("value");
	$G(strHtmlIDPrefix+"_Mc_Square").value=_o.getAttribute("value");
	$G('pop_sqlist').parentNode.removeChild($G('pop_sqlist'));
	//if(bGo) clubGoSquare(strHtmlIDPrefix);
}

function clubOnKeyDown(strHtmlIDPrefix,_o,nHeight){
	if(_o.value=="中文/全拼") _o.value="";
	if(nHeight!=null)
		clubSpellSq(strHtmlIDPrefix,nHeight);
	else
		clubSpellSq(strHtmlIDPrefix);
}

function clubOpSquare(strHtmlIDPrefix){
	var oeSquare=$G(strHtmlIDPrefix+"_Mc_Square");
	if(Trim(oeSquare.value)==""){
		alert("请填写具体地点");
		return;
	}
	function responseProcess(strResponseHtml) {
		window.top.pwHide(true);
		alert("您已经成功提交了新的地名，谢谢！\n\n温馨提示：您提交的地名将在管理员审核后进入地名列表");
	}
	var strRegForm="oeSquare="+oeSquare.value;
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=OpSquare",strRegForm,responseProcess);
}

function clubClearSpell(_o){
	if(Trim(_o.value)=="") {
		_o.value="中文/全拼";
		return;
	}
	var patrn=/^[\w]*$/;
	var nSqType;
	if (patrn.exec(Trim(_o.value))){
		nSqType=1;
	}else{
		nSqType=0;
	}
	function responseProcess(strResponseHtml) {
		if(Trim(strResponseHtml).length>0){
			_o.value=strResponseHtml;
		}else{
			_o.value="中文/全拼";
		}
	}
	var strRegForm="oeSquare="+_o.value+"&nSpType="+nSqType;
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=GetCurSquare",strRegForm,responseProcess,true);
}

function clubChgSqPage(strHtmlIDPrefix,nDirect){
	var oePageCount=$G("mc_SqPageCount_hidden");
	var oeCurPageNum=$G("mc_SqCurPageNum_hidden");
	var oeLeft=$G("left_sq");
	var oeRight=$G("right_sq");	
	if(oePageCount.value==oeCurPageNum.value&&nDirect==1) return;
	if(oeCurPageNum.value==1&&nDirect==-1) return;
	oeLeft.onclick=null;
	oeRight.onclick=null;
	function responseProcess(strResponseHtml) {
		if(Trim(strResponseHtml).length>0) $G("mc_SquareList_div").innerHTML=strResponseHtml;	
		oeLeft.onclick=function(){
			clubChgSqPage(strHtmlIDPrefix,-1);
		}
		oeRight.onclick=function(){
			clubChgSqPage(strHtmlIDPrefix,1);
		}
	}
	var strRegForm="nDirect="+nDirect+"&nPageCount="+oePageCount.value+"&nCurPage="+oeCurPageNum.value+"&prefix="+strHtmlIDPrefix;
	oeCurPageNum.value=parseInt(oeCurPageNum.value)+nDirect;
	
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=ChgPageSquare",strRegForm,responseProcess);
}

function clubSpellSq(strHtmlIDPrefix,nHeight){
	var oeSquare=$G(strHtmlIDPrefix+"_Mc_Square");
	var nPos=getPos(oeSquare);
	var patrn=/^[\w]*$/;
	var splType=0;//中文模式
	if (patrn.exec(Trim(oeSquare.value))){
		splType=1;//全拼模式
	}
	function responseProcess(strResponseHtml) {
		if(strResponseHtml.length==0) {
			if($G(strHtmlIDPrefix+"_SpSq_h4")!=null&&Trim(oeSquare.value)!="") $G(strHtmlIDPrefix+"_SpSq_h4").innerHTML="对不起，找不到："+oeSquare.value;
			return;
		}
		if($G("pop_sqlist")!=null){
			$G("pop_sqlist").innerHTML=strResponseHtml;
		}else{
			var emSqPop=document.createElement("DIV");
			emSqPop.id="pop_sqlist";
			emSqPop.className="CLUB_SqPop_div";
			emSqPop.innerHTML=strResponseHtml;
			emSqPop.style.position="absolute";
			emSqPop.style.zIndex="101";
			emSqPop.style.top=nPos.y+20+"px";
			emSqPop.style.left=nPos.x+"px";
			document.body.appendChild(emSqPop);			
		}
		if($G("pop_sqlist")!=null&&nHeight!=null) $G("pop_sqlist").style.height=nHeight+"px";		
/*		document.onkeydown=function(event){
			ListKeywordEvtOnKeyDown(event,$G("pop_sqlist"),'','','mc_','');
		}*/
		genAddEvent(document.body,"mousedown",clubSqPopClose)
	}
	var strRegForm="oeSquare="+oeSquare.value+"&prefix="+strHtmlIDPrefix+"&nSpType="+splType;
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=GetSquare",strRegForm,responseProcess,true);		
}

function clubSqPopClose(evt,n){
	var emPopSelect=$G("pop_sqlist");
	if(!genIsOnPopArea(evt,n,emPopSelect)) return;	
    if (emPopSelect!=null) emPopSelect.parentNode.removeChild(emPopSelect);
	genRemoveEvent(document.body,"mousedown",genSubjInfoClose);
}

function clubGoSquare(strHtmlIDPrefix){
	var oeSquare=$G(strHtmlIDPrefix+"_Mc_Square");
	if(oeSquare.value=="中文/全拼") return;
	var oeNoSquare=$G("club_NoSquare_alert");
	if(Trim(oeSquare.value)==""){
		return;
	}	
	function responseProcess(strResponseHtml) {
		window.top.pwHide(true);
		if(parseInt(strResponseHtml)>0) window.top.location.href="/MyCampasHome/"+strResponseHtml;
		else {
			oeNoSquare.innerHTML="地点不存在，请确认，同时您也可以向管理员提交此地点";
			setTimeout("clubClearAlert()",1500);
		}
	}
	var strRegForm="oeSquare="+oeSquare.value;
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=GoSquare",strRegForm,responseProcess,true);
}
function clubClearAlert(){

}

function clubMcAction(strParam,nPage){
	var arrParam=strParam.split(",");
	var strHtmlIDPrefix=arrParam[0];
	var nMcSqID=arrParam[1];
	var emPanel=$G("mc_SquareArtList_div");
	function responseProcess(strResponseHtml) {
		if(strResponseHtml.length>0) emPanel.innerHTML=strResponseHtml;
	}
	var strRegForm="oeSquareID="+nMcSqID+"&prefix="+strHtmlIDPrefix+"&page="+nPage;
	genXMLHttpReq(1,"/Framework/Club/clubMisc.do?action=ChgPage",strRegForm,responseProcess,true);
}

function cmInsertImgToText(_o,nL,nT,_oID){
	var nzindex="50000";
	if(_oID!=null){
		nL=parseInt($G(_oID).style.left)+6;
		nT=parseInt($G(_oID).style.top)+120;
	}
	var strPopInHtml="<table class=\"cm_em_tb\"><tbody>";
	for(var i=0;i<3;i++){
		strPopInHtml+="<tr>";
		for(var j=1;j<=8;j++){
			strPopInHtml+="<td onmouseover=\"this.className='hover';\" onmouseout=\"this.className='';\"><img border=0 src=\"/images/img/"+(i*8+j)+".gif\" onclick=\"cmInsImgOp('"+_o.id+"',"+(i*8+j)+")\"></td>";
		}
		strPopInHtml+="</tr>";
	}
	strPopInHtml+="</tr></tbody></table>";
	var emPop=$G("cm_em");
	if(emPop==null){
		emPop=document.createElement("DIV");
		emPop.id="cm_em";
		emPop.className="cm_em";
		emPop.innerHTML=strPopInHtml;
		emPop.style.position="absolute";		
		document.body.appendChild(emPop);
	}else{
		genSwitchElementDisplay("cm_em");		
	}
	emPop.style.zIndex=nzindex;		
	emPop.style.left=nL+"px"; //56
	emPop.style.top=nT+"px";	//90
	genAddEvent(document.body,"mousedown",cmEmClose);
}

function cmInsImgOp(_o,nIdx){
	if(nIdx<10) nIdx="0"+nIdx;
	$G(_o).value+="[em"+nIdx+"]";
	$G(_o).focus();
	//$G("cm_em").style.display="none";
	$G("cm_em").parentNode.removeChild($G("cm_em"));
}

function cmEmClose(evt,n){
	var emPopSelect=$G("cm_em");
	if(!genIsOnPopArea(evt,n,emPopSelect)) return;	
	
    if (emPopSelect!=null) emPopSelect.style.display="none";
	genRemoveEvent(document.body,"mousedown",cmEmClose);
}

function cmSetColorForText(_o,nL,nT){
	var arrColor=new Array("#800000","#993300","#ff6600","#808000","#008080","#0000ff","#666699","#333399","#FF0000","#FF9900","#99CC00","#339966","#33CCCC","#3366FF","#800080","#808080","#FF00FF","#FFCC00","#FF0000","#00FF00","#00FFFF","#00CCFF","#993366","#999999","#FF99CC","#FFCC99","#FFFF99","#CCFFCC","#CCFFFF","#99CCFF","#CC99FF","#C0C0C0");
	var strPopInHtml="<table class=\"cm_em_tb\"><tbody>";
	for(var i=0;i<4;i++){
		strPopInHtml+="<tr>";
		for(var j=0;j<8;j++){
			strPopInHtml+="<td onmouseover=\"this.className='hover';\" onmouseout=\"this.className='';\"><div onclick=\"cmSetColorOp('"+_o.id+"','"+arrColor[i*8+j]+"')\" style=\"width:20px;height:20px;margin:0px auto;background-color:"+arrColor[i*8+j]+"\">&nbsp;</div></td>";
		}
		strPopInHtml+="</tr>";
	}
	strPopInHtml+="</tr></tbody></table>";
	if($G("cm_color")==null){
		var emPop=document.createElement("DIV");
		emPop.id="cm_color";
		emPop.className="cm_em";
		emPop.innerHTML=strPopInHtml;
		emPop.style.position="absolute";
		emPop.style.zIndex="10000";
		emPop.style.left=nL+"px"; 
		emPop.style.top=nT+"px";
		document.body.appendChild(emPop);
	}else{
		genSwitchElementDisplay("cm_color");
	}
	genAddEvent(document.body,"mousedown",cmEmColorClose);
}

function cmSetColorOp(_o,color){
	var colorTxt=$G("cm_TxtColor_hidden");
	colorTxt.value=color;
	$G(_o).style.color=color;
	$G(_o).focus();
	$G("cm_color").style.display="none";
}

function cmEmColorClose(evt,n){
	var emPopSelect=$G("cm_color");
	if(!genIsOnPopArea(evt,n,emPopSelect)) return;	
	
    if (emPopSelect!=null) emPopSelect.style.display="none";
	genRemoveEvent(document.body,"mousedown",cmEmColorClose);
}

function cmCheckBoxAlert(strHtmlIDPrefix){
	var _oid=strHtmlIDPrefix+"_Mc_NoticeTxt";
	var _o=$G(strHtmlIDPrefix+"_Mc_Notice")
	genSwitchElementDisplay(_oid);
	if($G(_oid).style.display=="none") _o.checked=false;
	else _o.checked=true;
}

var nNoticeID=0;

function cmGetNotice(action,nPage){
	var strReqForm="nPage="+nPage;
	function responseProcess(strResponseHtml){
		var arrData=strResponseHtml.split(c_strToken_Level0);
		switch(action){
		case "getList":
			var _o=$G("sb_Navig_Sheet_div");			
			var _opage=$G("notice_page");
			if(nPage>arrData[0]||nPage<1) return;
			if(_opage!=null&&arrData[0]>1) _opage.innerHTML="<img src=\"/images_i/notice-left.gif\" onclick=\"cmGetNotice('"+action+"',"+(nPage-1)+")\" style=\"cursor:pointer\"/> <img src=\"/images_i/notice-right.gif\" onclick=\"cmGetNotice('"+action+"',"+(nPage+1)+")\" style=\"cursor:pointer\"/>";			
			if(_o!=null) {
				if(parseInt(arrData[0])>0) _o.innerHTML=arrData[1];
				else _o.innerHTML="<ul class=\"SB_MyFav_ul\"><li>暂无数据</li></ul>";
			}
			//if(_o!=null) _o.innerHTML=strResponseHtml;
			break;
		case "view":
			var _o=$G("pop_window_"+nPage);
			nNoticeID=nPage;			
			_o.style.left=474+document.documentElement.scrollLeft+"px"; 
			_o.style.top=100+document.documentElement.scrollTop+"px";
			_o.style.position="absolute";
			_o.style.zIndex="50002";
			_o.style.display="";
			drag(nPage,true,true);
			setBgroundGray();
			genAddEvent(document.body,"mousedown",hideNocite);
			break;
		}
	}
	genXMLHttpReq(1,"/schoolnotice.do?action="+action,strReqForm,responseProcess,true);
}
function setBgroundGray(){
	var sWidth,sHeight;
	sWidth=document.body.offsetWidth;
	//sHeight=screen.height+document.documentElement.scrollTop;
	sHeight=document.body.offsetHeight;
	var bgObj=document.createElement("div");
	bgObj.setAttribute('id','bgDiv');
	bgObj.style.position="absolute";
	bgObj.style.top="0";
	bgObj.style.background="#777";
	bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75)";
	bgObj.style.opacity="0.6";
	bgObj.style.left="0";
	bgObj.style.width=sWidth + "px";
	bgObj.style.height=sHeight + "px";
	bgObj.style.zIndex = "50000";
	document.body.appendChild(bgObj);
}
function closeNotice(_o){
	var bgObj=$G("bgDiv");
	if (bgObj!=null) bgObj.parentNode.removeChild(bgObj);
	_o.style.display="none";
}

function hideNocite(evt,n){
	var emPopSelect=$G("pop_window_"+nNoticeID);
	var bgObj=$G("bgDiv");
	if(!genIsOnPopArea(evt,n,emPopSelect)) return;	
	
    if (emPopSelect!=null) emPopSelect.style.display="none";
	if (bgObj!=null) bgObj.parentNode.removeChild(bgObj);
	nNoticeID=0;
	genRemoveEvent(document.body,"mousedown",hideNocite)
}