function userStatus(statusType,statusDefaultTxt,otherStatusTypeTxt) {
    this.thereIsAnother = false;
    this.statusType = statusType;
    this.statusDefaultTxt = statusDefaultTxt;
    this.otherStatusTypeTxt = otherStatusTypeTxt;
    
    this.clearStatus = function() {
        this.testOther();
        this.statusDisplayFlip("edit");
        dojo.byId("userhomepage_status_"+this.statusType).value = this.statusDefaultTxt;
        setMiscConfig('userhomepage_status_message', "");
        if(this.thereIsAnother) this.handleOthers("clear");
        return 1;
    }
    this.editToggle = function(editDivId, editModuleName, unset) {
        var editDiv = dojo.byId(editDivId);
        if(editDiv) {
            editDiv.style.display = (editDiv.style.display=="none") ? "block" : "none";
            if (typeof(unset)!="undefined") { PageModuleManagerObj.unsetModuleInEditmode(editModuleName); }
        }
    }
    this.getOthersDetails = function() {
        this.otherStatusObj = eval(this.otherStatus);
        this.otherStatusType = this.otherStatusObj.statusType;
        this.otherStatusEl = dojo.byId("userhomepage_statusupdate_status_text_"+this.otherStatusType);
        this.otherStatusElParent = this.otherStatusEl.parentNode;
        this.currentStatusEl = dojo.byId("userhomepage_statusupdate_status_text_"+this.statusType);
    }
    this.handleOthers = function(type) {
        this.getOthersDetails();
        
        if(type && type=="clear") {
            this.statusDisplayFlip("edit",this.otherStatusType);
            dojo.byId("userhomepage_status_"+this.otherStatusType).value = this.otherStatusObj.statusDefaultTxt;
        } else {    
            if(this.otherStatusElParent && this.otherStatusElParent.style.display == "none") {
                this.otherStatusElParent.style.display = "block";
                dojo.byId("userhomepage_statusupdate_edit_"+this.otherStatusType).style.display="none";
            }
            this.otherStatusEl.innerHTML=this.currentStatusEl.innerHTML;
        }
    }
    this.keyPress = function(e) {
        if(e.keyCode == 13) { this.postStatus(); }
    }
    this.postStatus = function(def_text) {
        this.testOther();
        reloadAdFrames();
        var userhomepage_status = dojo.byId("userhomepage_status_"+this.statusType);
        if(userhomepage_status.value.replace(/^\s+|\s+$/g, '')=='' || userhomepage_status.value==def_text){
            userhomepage_status.value = def_text;
            return false;
        }
        var userhomepage_status_value = escape(userhomepage_status.value);
            
        dojo.io.bind({
               "mimetype":"text/html",
               "url": "/interface/post/setstatus/?status="+userhomepage_status_value,
               "load":this.postStatusReply});
    
        setMiscConfig('userhomepage_status_message', userhomepage_status_value);
        
        dojo.byId("userhomepage_statusupdate_status_text_"+this.statusType).innerHTML = unescape(userhomepage_status_value);
        if(this.thereIsAnother) this.handleOthers();
        this.statusDisplayFlip();
        return 1;
    }
    this.postStatusReply = function(t, data, e) {
        var retdata = eval('('+data+')');
        this.statusDisplayFlip();
        return 1;
    }
    this.statusBlur = function(e,ele) {
        if(ele.value=='') {
            if(this.clickModeStatus) {
                this.statusDisplayFlip();
                this.clickModeStatus = false;
            } else {
                ele.value = this.statusDefaultTxt;
            }
        } 
    }
    this.statusClick = function(e) {
        var userhomepage_status = dojo.byId("userhomepage_status_"+this.statusType);
        this.clickModeStatus = true;
        userhomepage_status.value="";
        this.statusDisplayFlip("edit");
        userhomepage_status.focus();
    }
    this.statusDisplayFlip = function(mode,target) {
        var statusTarget = (target) ? target : this.statusType;
    
        if(mode == "edit") {
            dojo.byId("userhomepage_statusupdate_edit_"+statusTarget).style.display = "block";
            dojo.byId("userhomepage_statusupdate_status_"+statusTarget).style.display = "none";
        } else {
            dojo.byId("userhomepage_statusupdate_edit_"+statusTarget).style.display = "none";
            dojo.byId("userhomepage_statusupdate_status_"+statusTarget).style.display = "block";
        }
    }
    this.testOther = function() {
        if(this.otherStatusTypeTxt) {
            this.otherStatus = "userStatus"+this.otherStatusTypeTxt;
            this.otherInput = "userhomepage_status_"+this.otherStatusTypeTxt.toLowerCase();
            if(navigator.userAgent.indexOf("MSIE") != -1) {
                if(dojo.byId(this.otherInput)) this.thereIsAnother = true;
            } else {
                if(dojo.byId(this.otherInput) && typeof(dojo.byId(this.otherInput)) == "object") this.thereIsAnother = true;
            }        
        }
    }
}