function doSubscribeChannel() {
    subscribeChannel(currentchid);
}
function subscribeChannel(chid) {
     ajax("/services/dosubscribe_srvc.php", "&chid="+chid, handleSubscribeChannelResponse);
}
function handleSubscribeChannelResponse(contents, responseDoc) {
    var statusElems = responseDoc.getElementsByTagName("status");
    if (statusElems.length > 0) {
        var status=statusElems[0];
        var statusValue = status.getAttribute("value");
        var statusDesc = status.getAttribute("desc");
        if (status.getAttribute("value") == "1") {
            window.location.href = "/?wp=my";
        } else if (status.getAttribute("value") == "100") {
            doRegisterAndSubscribe();
        } else {
            alert(statusDesc);
        }
    }
}
function doRegisterAndSubscribe() {
    window.location.href="/?wp=join&subscribe="+currentchid;
}