<!--
function checkEmail(emailin) {
  if ((emailin.length < 6) ||
      (emailin.indexOf('@',0) < 1) ||
      (emailin.lastIndexOf('@') != emailin.indexOf('@',0)) ||
      (emailin.lastIndexOf('@') > (emailin.length - 5)) ||
      (emailin.lastIndexOf('.') > (emailin.length - 3)) ||
      (emailin.lastIndexOf('.') < (emailin.length - 4)) ||
      (emailin.indexOf('..',0) > -1) ||
      (emailin.indexOf('@.',0) > -1) ||
      (emailin.indexOf('.@',0) > -1) ||
      (emailin.indexOf(',',0) > -1)) {
      alert("Please enter a valid email address");
      return false;
  }
  return true;
}
function resetM(b) {
   if (b.value == "join our mailing list!") {
       b.value = '';
   } else {
       b.focus();
   }
   return true;
}
function getXMLHttpRequestObject(){
var xmlobj;
// check for existing requests
if(xmlobj!=null&&xmlobj.readyState!=0&&xmlobj.readyState!=4){
    xmlobj.abort();
}
try{
// instantiate object for Mozilla, Nestcape, etc.
    xmlobj=new XMLHttpRequest();
}
catch(e){
try{
// instantiate object for Internet Explorer
xmlobj=new ActiveXObject('Microsoft.XMLHTTP');
}
catch(e){
// Ajax is not supported by the browser
xmlobj=null;
return false;
}
}
return xmlobj;
}

// instantiate email XMLHttpRequest object
var emailXMLHttpObj=getXMLHttpRequestObject();

function sendEmailRequest() {
    if (checkEmail(document.getElementById("message").value)) {
    emailXMLHttpObj.open("POST", "http://www.chris-price.com/website/sendmail.php", true);
    emailXMLHttpObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    emailXMLHttpObj.send(getFormValues(document.getElementsByTagName('form')[0]));
    emailXMLHttpObj.onreadystatechange=emailStatusChecker;
    } else {
        return false;
    }
}

function emailStatusChecker() {
    if (emailXMLHttpObj.readyState==4) {
        if (emailXMLHttpObj.status==200) {
	    displayServerResponse();
	} else {
	    alert(emailXMLHttpObj.responseText);
	    alert(emailXMLHttpObj.statusText);
	}
    }
}

function displayServerResponse() {
    document.getElementById("message").value = '';
    alert("Your e-mail address has been added to our mailing list.  Thanks!");
    return true;
}

function getFormValues(fobj) {
    var str='';
    for (var i=0; i<fobj.elements.length; i++) {
        str+=fobj.elements[i].name+'='+escape(fobj.elements[i].value)+'&';
    }
    str=str.substr(0,(str.length-1));
    return str;
}

// PRELOADING IMAGES
 if (document.images) {
   pp_img_on =new Image();  pp_img_on.src ="images/postpop-over.jpg"; 
   pp_img_off=new Image();  pp_img_off.src="images/postpop.jpg"; 

   fut_img_on =new Image();  fut_img_on.src ="images/futures-over.jpg"; 
   fut_img_off=new Image();  fut_img_off.src="images/futures.jpg"; 

   shop_img_on =new Image();  shop_img_on.src ="images/shop-over.jpg"; 
   shop_img_off=new Image();  shop_img_off.src="images/shop.jpg"; 

   cont_img_on =new Image();  cont_img_on.src ="images/contact-over.jpg"; 
   cont_img_off=new Image();  cont_img_off.src="images/contact.jpg"; 

   news_img_on =new Image();  news_img_on.src ="images/news-over.jpg"; 
   news_img_off=new Image();  news_img_off.src="images/news.jpg"; 

   mail_img_on =new Image();  mail_img_on.src ="images/button.jpg"; 
   mail_img_off=new Image();  mail_img_off.src="images/button-UP.jpg"; 
  }

  function handleOver(n) { 
    if (document.images) {
        if (n == 'postpop') document.getElementById("postpop").src=pp_img_on.src;
        if (n == 'futures') document.getElementById("futures").src=fut_img_on.src;
        if (n == 'shop') document.getElementById("shop").src=shop_img_on.src;
        if (n == 'contact') document.getElementById("contact").src=cont_img_on.src;
        if (n == 'news') document.getElementById("news").src=news_img_on.src;
        if (n == 'mail') document.getElementById("mailinglistimg").src=mail_img_on.src;
    }
  }

  function handleOut(n) {
    if (document.images) {
        if (n == 'postpop') document.getElementById("postpop").src=pp_img_off.src;
        if (n == 'futures') document.getElementById("futures").src=fut_img_off.src;
        if (n == 'shop') document.getElementById("shop").src=shop_img_off.src;
        if (n == 'contact') document.getElementById("contact").src=cont_img_off.src;
        if (n == 'news') document.getElementById("news").src=news_img_off.src;
        if (n == 'mail') document.getElementById("mailinglistimg").src=mail_img_off.src;
    }
  }
//-->
