var sid = 0;

function delete_status(s_id, uid){
    sid = s_id
    var bk = document.getElementById("status_space_" + sid).innerHTML;
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Browser does not support HTTP Request");
        return;
    }
    
    var url = "status_op.php";
    url = url + "?action=del";
    url = url + "&sid=" + sid;
    url = url + "&uid=" + uid;
    url = url + "&dcoz=deleted my user";
    url = url + "&rid=" + Math.random();
    xmlHttp.onreadystatechange = function(){
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
            if (xmlHttp.responseText == '1') 
                document.getElementById("status_space_" + sid).style.display = 'none';
            else {
                alert('Failed to delete status. Please try again.');
                document.getElementById("status_space_" + sid).innerHTML = bk;
                
            }
           //alert(xmlHttp.responseText)
            delete xmlHttp;
            xmlHttp = null;
        }
    };
    document.getElementById("status_space_" + sid).innerHTML = '<img src="images/wait_saving.gif" />';
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function view_next_status(space, uid,start){

    var bk = document.getElementById(space).innerHTML;
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Browser does not support HTTP Request");
        return;
    }
    
    var url = "status_op.php";
    url = url + "?action=show_more_status_myaccount";
    url = url + "&start=" + start;
    url = url + "&rid=" + Math.random();
    xmlHttp.onreadystatechange = function(){
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
   
                document.getElementById(space).innerHTML = xmlHttp.responseText;

          
       //alert(xmlHttp.responseText)
            delete xmlHttp;
            xmlHttp = null;
        }
    };
    document.getElementById(space).innerHTML = '<img src="images/wait_saving.gif" />';
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}


