// JavaScript Administration options
function aremuser(id) {
  confir = confirm("Are You Sure You Want To Remove This User?");
  
  if(confir == true) {
    var params = 'id='+id;
    
    // get the ajax object
    xmlHttp = GetXmlHttpObject();
    xmlHttp.onreadystatechange = comcheck;    
    xmlHttp.open('POST', '/admin/removeUser.php', true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(params);
  }
}

function comcheck() 
{ 
  if(xmlHttp.readyState == 4)
  { 
    if(xmlHttp.responseText == 'valid'){
      alert('User Has Been Removed');
      return false;
    }
  }
}

function ablock(id) {
  confir = confirm("Are You Sure You Want To Un-Block This User?");
  
  if(confir == true) {
    var params = 'id='+id;
    
    // get the ajax object
    xmlHttp = GetXmlHttpObject();
    xmlHttp.onreadystatechange = bcheck;    
    xmlHttp.open('POST', '/admin/unBlock.php', true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(params);
  }
}

function bcheck() 
{ 
  if(xmlHttp.readyState == 4)
  { 
    if(xmlHttp.responseText == 'valid'){
      alert('User Has Been Un-Blocked');
      return false;
    }
  }
}

function delvideo(id) {
  confir = confirm("Are You Sure You Want To Delete This Video?");
  
  if(confir == true) {
    var params = 'id='+id;
    
    // get the ajax object
    xmlHttp = GetXmlHttpObject();
    xmlHttp.onreadystatechange = delcheck;    
    xmlHttp.open('POST', '/admin/delVideo.php', true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(params);
  }
}

function delcheck() 
{ 
  if(xmlHttp.readyState == 4)
  { 
    if(xmlHttp.responseText == 'valid'){
      alert('Video Has Been Removed');
      return false;
    }
  }
}
