function ajaxRequest(){
 var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
 if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
  for (var i=0; i<activexmodes.length; i++){
   try{
    return new ActiveXObject(activexmodes[i])
   }
   catch(e){
    //suppress error
   }
  }
 }
 else if (window.XMLHttpRequest) // if Mozilla, Safari etc
  return new XMLHttpRequest()
 else
  return false
}


function callAjaxUpdater(url, div) {
  var loader = new ajaxRequest();
  loader.onreadystatechange=function(){
    if (loader.readyState==4){
      if (loader.status==200 || window.location.href.indexOf("http")==-1){
        document.getElementById(div).innerHTML=loader.responseText
      } else{
        alert("An error has occured making the request")
      }
    }
  }
  loader.open("GET", url, true);
  loader.send(null);
}

function showHide(id) {
  var e = document.getElementById(id);
  var l = document.getElementById("showHide");
  if ( e.style.display != 'none' ) {
    e.style.display = 'none';
    l.innerHTML = 'show';
  }
  else {
    e.style.display = '';
    l.innerHTML = 'hide';
  }
}

function sendForm(muralurl) {
  var nameValue = document.getElementById('firstname').value;
  var styleValue = document.getElementById('style').value;
  var params = "firstname=" + nameValue + "&style=" + styleValue;
  var postLoader = new ajaxRequest();
  postLoader.onreadystatechange=function(){
    if (postLoader.readyState==4){
      if (postLoader.status==200 || window.location.href.indexOf("http")==-1){
        document.getElementById('muralform').innerHTML=postLoader.responseText
      } else{
        alert("An error has occured making the request")
      }
    }
  }
  postLoader.open("GET", muralurl + "?" + params, true);
  postLoader.send(null);
}