function Init() {
          __dlg_init();
          var param = window.dialogArguments;
          if (param) {
              document.getElementById("f_url").value = param["f_url"];
          }
        };

function onOK(url) {
          // pass data back to the calling window
          var param = new Object();
          param["f_url"] = url;
          __dlg_close(param);
          return false;
        };
function onCancel() {
          __dlg_close(null);
          return false;
        };       
function delEntry(entry_id) {
		if (window.confirm("ÊÇ·ñÈ·¶¨É¾³ýÎÄÕÂ£¿")) {
			window.location.href="del_entry.jspa?entry_id="+entry_id;
		}
	}
function vote(option,pollId,objectId)
	{
		var action = "/ajaxVote.jspa";
		var pars ="pollId="+pollId+"&option="+option+"&objectId="+objectId;		
		var myAjax = new Ajax.Request(action,{method: 'post', parameters: pars, onComplete: updatePage} );
	}	
function isClicked() {
    if (!clicked) { clicked = true; return true; }
    return false;
}
function NewWin(newURL,wth,hgh) {
			window.open(newURL,'','width='+wth+',height='+hgh+',left=70,top=130,scrollbars=yes');
		}
function winOpen(url){
		    window.open(url,'newwindow','height=800,width=700,scrollbars=yes');
		    return false;
		}
function selectCategory(catID, forumID) {
				window.location.replace('FORUM_LIST_'+catID+'_'+forumID+'_0_0.HTM');
		  }	
function resetForum(obj){
			var topic =obj.options[obj.selectedIndex].text;
			if(topic.indexOf("---")==-1)
				obj.options[obj.selectedIndex+1].selected=true;
			else
				obj.options[obj.selectedIndex].selected=true;
		}		
function doInsertAddress(el, targetEl) {
    // Look for an address book redirect
    if (el.value == '***') {
        location.href='addressbook.jspa';
    }

    // If the username is blank, return
    var username = el.value;
    if (username == '') {
        return;
    }
    // turn the current list of usernames into an array, check if the
    // specified username is already in the username list.
    var currentVal = targetEl.value;
    var usernames = currentVal.split(",");
    for (var i=0; i<usernames.length; i++) {
        if (usernames[i] == '') {
            usernames.splice(i,1);
            i--;
        }
        else {
            if (username == usernames[i].trim()) {
                return;
            }
        }
    }
    // At this point, the username was not found so add
    // the usename to the list of usernames:
    var newUsernames = username;
    for (var i=0; i<usernames.length; i++) {
        newUsernames += ", ";
        newUsernames += usernames[i];
    }
    targetEl.value = newUsernames;
    el.selectedIndex = 0;
}
function gotoeditab() {
    location.href = 'addressbook.jspa';
}	
function checkForm(frm,max,min) {
	if (frm.body.value.length>500){
		alert(max);
		frm.body.focus();
		return false;
	}else if(frm.body.value.length == 0){
		alert(min);
		frm.body.focus();
		return false;
	}
	return true;			
}
function delConfirm(url) {
			if (window.confirm(document.forms[1].confirmdelete.value)) {
				window.location=url+"";
			}
		}
function doSubmit(val) {
			document.forms[1].approve.value = val;
			document.forms[1].submit();
		}
function doScript(url) {
    window.location = url;
    return;
}	
function saveProperty(threadId) {
	var styleClass=document.getElementById('titleColor').value
	var  bold="";
	if(document.getElementById("boldfaced").checked == true)
	{
		bold="Y";
	}
	window.location.href="EditStyle.jspa?styleContent="+styleClass+"&threadId="+threadId+"&bold="+bold;
}
function setTabShow(showTab,tabNames,showTd,tdNames){
	for(var i=0;i<tabNames.length;i++){
		if(tabNames[i]==showTab){
			document.getElementById(tabNames[i]).style.display="";
		}else{
			document.getElementById(tabNames[i]).style.display="none";
		}
	}	
	for(var i=0;i<tdNames.length;i++){
		if(tdNames[i]==showTd){
			document.getElementById(tdNames[i]).className="tabon";
		}else{
			document.getElementById(tdNames[i]).className="taboff";
		}
	}
}	

function doDeletePostSubmit(form){			
if(window.confirm("are you sure delete?")){				
		form.action="approve!delThread.jspa";
		form.submit();							
 }
} 
			
function doDeleteMessageSubmit(form,targetMessageID){
	if(window.confirm("are you sure delete?")){
		form.action="approve!delMessage.jspa";
		var   targetMessageID   =   document.getElementsByName(targetMessageID);
		var delMessage = "";	
      	for( var i=0;i<targetMessageID.length;i++){       
		  if(targetMessageID[i].checked == true){  
	               delMessage += targetMessageID[i].value+":";  
	       }   
	  	}
		form.delMessage.value=delMessage;			
		form.submit();
	}
}

function checkthisPost(frm,message){
	if(frm.body01.value==""){
		alert(message);
		return false;
	}
	var content = frm.body01.value.replace(/\r\n/g,"<br/>");
	content = content.replace(/\n/g,"<br/>");
	frm.body.value = content;
}			