//This is my basic ajax example to get the time when you click the moto at the top of my website.


function outputTime() 
{
    var xhr = createXMLHttpRequest();
    xhr.onreadystatechange = function() 
    {
        if (xhr.readyState==4) 
        { // Request is finished
            if (xhr.status==200) 
            {
                //Replace my moto div with the time.
                document.getElementById("moto").innerHTML = xhr.responseText;
            } 
            else 
            {
                alert("Sorry, we don't know the time.");
            }
        }
    }
    xhr.open("GET", "lib/time.php", true);
    xhr.send(null);
}

function createXMLHttpRequest() {
  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
  try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
  try { return new XMLHttpRequest(); } catch(e) {}
  alert("XMLHttpRequest not supported");
  return null;
}