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 checkTableForm(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 doThreadSubmit(val) {
	document.threadflatform.approve.value = val;
	document.threadflatform.submit();
}
function doScript(url) {
    window.location = url;
    return;
}

function goLogin(login_url){
	 var a = window.location.href;
	 a = encodeURIComponent(a);
	 window.location=login_url+"?fromWhere="+a;
}
