/* Javascript File for Out of the blue */
var ajax = null;
var target = "";
// Ajax Stuff

function notify() {
ajax=GetXmlHttpObject();
if (ajax==null)  // browser does not support AJAX
  {
  alert ("Your browser does not support AJAX!"); // let them know!
  return;
  }
document.getElementById('overlay').style.display = "block";
document.getElementById('image').style.display = "block";  
}

function sendit() {
var telno = document.getElementById('telno').value;
if(telno == "")
  {
   alert('We really need to know your mobile number for this to work! \n Please fill in this item.');
   document.getElementById('telno').focus();
   return;
  }
var town = document.getElementById('town').value;
if(town == "")
  {
   alert('We really need to know where you are for this to work! \n Please fill in this item.');
   document.getElementById('town').focus();
   return;
  }
//var name = document.getElementById('sname').value;
var scripturl = "http://www.philipenglish.ie/cgi-bin/notify.pl?type=add&telno="+ telno+"&town="+town+"";
ajax.onreadystatechange=stateChanged;
ajax.open("GET",scripturl,true);
ajax.send(null);
}

function GetXmlHttpObject()
{
try
  {
  // Firefox, Opera 8.0+, Safari
  ajax=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    ajax=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    ajax=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return ajax;
}


function stateChanged()
{
if (ajax.readyState==4) // when request has completed
  {
   document.getElementById('imagebox').innerHTML = ajax.responseText;
  }
//ajax = null;
return;
}

function closepage() {
document.getElementById('overlay').style.display = "none";
document.getElementById('image').style.display = "none";
}