
var xmlHttp;
function getPage(name) {
  //document.getElementById("results").innerHTML = "<table><tr><td style=\"color: #FFFFFF; font-family: Lucida Sans Unicode; font-size: 8pt\"><img src=\"http://bloggerbuster.com/images/loading.gif\"/></td></tr></table>";
  xmlHttp = new XMLHttpRequest();
  var url = name + "/" + name + ".php";
  xmlHttp.onreadystatechange = stateChanged;
  xmlHttp.open("GET", url, true);
  xmlHttp.send(null);
}

function stateChanged() { 
  if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById("pageContent").innerHTML = xmlHttp.responseText;
  } 
}

function showImage(filename, title, width, height) {
  window.open('image.php?id='+filename+'&title='+title+'&height='+height, 'imageWindow', 'width='+(width+60)+', height='+(height+90));
}

function displayMail(user, domain, text) {
  document.write('<a class="sidebar" href='+'"mail'+'to:'+user+'@'+domain+'" target="main">'+text+'</a>');
}

function saveComment() {
  var alertList = '';
  if(document.commentForm.commentName.value == '') {
    alertList = alertList + 'You must enter a name.\n';
  }
  if(document.commentForm.commentBody.value == '') {
    alertList = alertList + 'You must enter a comment.\n';
  }
  if(alertList == '') {
    document.commentForm.submit();
  } else {
    alert(alertList);
  }
}

function sendMail() {
  var alertList = '';
  if(document.emailForm.name.value == '') {
    alertList = alertList + ' Your Name\n';
  }
  if(document.emailForm.email.value == '') {
    alertList = alertList + ' Your E-mail Address\n';
  }
  if(document.emailForm.subject.value == '') {
    alertList = alertList + ' Subject\n';
  }
  if(document.emailForm.message.value == '') {
    alertList = alertList + ' Message\n';
  }
  if(alertList == '') {
    document.emailForm.submit();
  } else {
    alert('Please fill in the following fields:\n\n' + alertList);
  }
}
