// JavaScript Document
var PostID;
function postFileReady() {
   if (xmlhttp.readyState==4) {
      if (xmlhttp.status==200) {
         document.getElementById(PostID).innerHTML= xmlhttp.responseText;
      }
   }
}
function getFile(pURL) {
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
      xmlhttp=new XMLHttpRequest();
      xmlhttp.onreadystatechange=postFileReady;
      xmlhttp.open("GET", pURL, true);
      xmlhttp.send(null);
   } else if (window.ActiveXObject) { //IE
      xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
      if (xmlhttp) {
         xmlhttp.onreadystatechange=postFileReady;
         xmlhttp.open('GET', pURL, false);
         xmlhttp.send();
      }
   }
}

function VerifyName(id){
var value;
var url;
value =document.getElementById(id).value;
url = "includes/verifyname.php?field=" + id + "&value=" + value;
PostID = 'info';
getFile(url);
}

function chkDelete(mx){
var chkd=0;
for (var i=1; i<=mx; i++){
if (document.getElementById("msgchk[" + i + "]").checked){
chkd++;
}
}
if (chkd){
var input_box=confirm('Are you sure you want to delete these messages?');
if (input_box){
document.msgform.action = "personalmsg.php?action=del";
document.msgform.submit();
}}
else{alert("No messages checked!");}
return false;

}
function chkEmail(mx){
var chkd=0;
for (var i=1; i<=mx; i++){
if (document.getElementById("msgchk[" + i + "]").checked){
chkd++;
}
}
if (chkd){
document.msgform.action = "personalmsg.php?action=email";
document.msgform.submit();
}
else{alert("No messages checked!");}
return false;

}

function chkMsgs(){
var url;
url = "includes/pmstatus.php";
PostID = 'msgstatus';
getFile(url);
setTimeout('chkMsgs();', 1800000);
}