var xmlhttp;

var gemail;
var zoomer;

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("displayHere").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
  
function openDiv(thisId) {
	if(document.getElementById(thisId).style.display==""){
//SlideClosed(thisId);
document.getElementById(thisId).style.display="none";
	}
	else{
document.getElementById(thisId).style.display="none";
//SlideOpen(thisId);
document.getElementById(thisId).style.display="";
}
}

function openDivSpecial(thisId) {
	if(document.getElementById(thisId).style.display==""){
document.getElementById(thisId).style.display="none";
document.getElementById("b"+thisId).innerHTML="<img src=/resource/graphics/arrowdown.gif>&nbsp;&nbsp;Show Tests";
	}
	else{
document.getElementById(thisId).style.display="";
document.getElementById("b"+thisId).innerHTML="<img src=/resource/graphics/arrowup.gif>&nbsp;&nbsp;Hide Tests";
}
}

function selectColour(obj){
xmlHttp=GetXmlHttpObject();
var url="/resource/working/setColour.asp";
url=url+"?col="+obj;
document.location.href=url;
}

function setSize(obj){
xmlHttp=GetXmlHttpObject();
var url="/resource/working/setSize.asp";
url=url+"?sz="+obj;
document.location.href=url;
}

function setFont(obj){
//xmlHttp=GetXmlHttpObject();
//var url="/resource/working/setFont.asp";
//url=url+"?ft="+obj;
//document.location.href=url;
alert("The set font function has been disabled for the MCL website");
}

function refresh(){
document.location.href="/template.asp"
}

function getWidth(){
var x,y;
if (self.innerHeight) // all except Explorer
{
	x = self.innerWidth;
	y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
{
	x = document.documentElement.clientWidth;
	y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
	x = document.body.clientWidth;
	y = document.body.clientHeight;
}
return x;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function sendContactForm(){

var thisLot;
thisLot =  "iname=" + encodeURIComponent(document.forms[0].inam.value);
thisLot = thisLot + "&reason=" + encodeURIComponent(document.forms[0].iadd.value);
thisLot = thisLot + "&telephone=" + encodeURIComponent(document.forms[0].itel.value);
thisLot = thisLot + "&emailaddress=" + encodeURIComponent(document.forms[0].iema.value);
thisLot = thisLot + "&message=" + encodeURIComponent(document.forms[0].imes.value);
//alert(thisLot);

var result = "&nbsp<b>Required</b>&nbsp";
document.getElementById('snam').innerHTML = "";
document.getElementById('sema').innerHTML = "";
document.getElementById('smes').innerHTML = "";

if(document.forms[0].inam.value==""){
document.getElementById('snam').innerHTML = result;
return;
}
if(document.forms[0].iema.value==""){
document.getElementById('sema').innerHTML = result;
return;
}
if(document.forms[0].imes.value==""){
document.getElementById('smes').innerHTML = result;
return;
}

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/sendMessage.asp";
xmlHttp.onreadystatechange = messageResponse;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


function sendFirstForm(){

var thisLot;
thisLot =  "firstname=" + encodeURIComponent(document.forms[0].inam.value);
thisLot = thisLot + "&surname=" + encodeURIComponent(document.forms[0].surname.value);
thisLot = thisLot + "&company=" + encodeURIComponent(document.forms[0].itel.value);
thisLot = thisLot + "&emailaddress=" + encodeURIComponent(document.forms[0].iema.value);
if (document.forms[0].area1.checked==true){
thisLot = thisLot + "&area1=Yes";
} else {
	thisLot = thisLot + "&area1=No";
}
if (document.forms[0].area4.checked==true){
thisLot = thisLot + "&area4=Yes";
} else {
	thisLot = thisLot + "&area4=No";
}
if (document.forms[0].area2.checked==true){
thisLot = thisLot + "&area2=Yes";
} else {
	thisLot = thisLot + "&area2=No";
}
if (document.forms[0].area3.checked==true){
thisLot = thisLot + "&area3=Yes";
} else {
	thisLot = thisLot + "&area3=No";
}
if (document.forms[0].area5.checked==true){
thisLot = thisLot + "&area5=Yes";
} else {
	thisLot = thisLot + "&area5=No";
}
if (document.forms[0].area6.checked==true){
thisLot = thisLot + "&area6=Yes";
} else {
	thisLot = thisLot + "&area6=No";
}
if (document.forms[0].cancontact.checked==true){
thisLot = thisLot + "&cancontact=Yes";
} else {
	thisLot = thisLot + "&cancontact=No";
}



var result = "&nbsp<b>Required</b>&nbsp";
document.getElementById('snam').innerHTML = "";
document.getElementById('stow').innerHTML = "";
document.getElementById('sema').innerHTML = "";

if(document.forms[0].inam.value==""){
document.getElementById('snam').innerHTML = result;
return;
}
if(document.forms[0].surname.value==""){
document.getElementById('stow').innerHTML = result;
return;
}

if(document.forms[0].iema.value==""){
document.getElementById('sema').innerHTML = result;
return;
}


xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/sendFirst.asp";
xmlHttp.onreadystatechange = messageResponseNew;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


function messageResponse() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('thanksHere').innerHTML = xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
   
   function messageResponseNew() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('thanksHereNew').innerHTML = xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
   
   function sendQuote(){

var thisLot;
thisLot =  "dateoftravel=" + encodeURIComponent(document.forms[0].dateoftravel.value);
thisLot = thisLot + "&departuretime=" + encodeURIComponent(document.forms[0].departuretime.value);
thisLot = thisLot + "&coachsize=" + encodeURIComponent(document.forms[0].coachsize.value);
thisLot = thisLot + "&departfrom=" + encodeURIComponent(document.forms[0].departfrom.value);
thisLot = thisLot + "&destination=" + encodeURIComponent(document.forms[0].destination.value);
thisLot = thisLot + "&additionalpickups=" + encodeURIComponent(document.forms[0].additionalpickups.value);
thisLot = thisLot + "&dateofreturn=" + encodeURIComponent(document.forms[0].dateofreturn.value);
thisLot = thisLot + "&yourname=" + encodeURIComponent(document.forms[0].yourname.value);
thisLot = thisLot + "&companyname=" + encodeURIComponent(document.forms[0].companyname.value);
thisLot = thisLot + "&address=" + encodeURIComponent(document.forms[0].address.value);
thisLot = thisLot + "&postcode=" + encodeURIComponent(document.forms[0].postcode.value);
thisLot = thisLot + "&telephone=" + encodeURIComponent(document.forms[0].telephone.value);
thisLot = thisLot + "&emailaddress=" + encodeURIComponent(document.forms[0].emailaddress.value);
thisLot = thisLot + "&furtherinformation=" + encodeURIComponent(document.forms[0].furtherinformation.value);
thisLot = thisLot + "&returntime=" + encodeURIComponent(document.forms[0].returntime.value);
//alert(thisLot);

var result = "&nbsp<b>Required</b>&nbsp";
document.getElementById('dateoftravelalert').innerHTML = "";
document.getElementById('departuretimealert').innerHTML = "";
document.getElementById('coachsizealert').innerHTML = "";
document.getElementById('destinationalert').innerHTML = "";
document.getElementById('dateofreturnalert').innerHTML = "";
document.getElementById('returntimealert').innerHTML = "";
document.getElementById('yournamealert').innerHTML = "";
document.getElementById('telephonealert').innerHTML = "";
document.getElementById('emailaddressalert').innerHTML = "";

if(document.forms[0].dateoftravel.value==""){
document.getElementById('dateoftravelalert').innerHTML = result;
return;
}
if(document.forms[0].departuretime.value==""){
document.getElementById('departuretimealert').innerHTML = result;
return;
}
if(document.forms[0].coachsize.value==""){
document.getElementById('coachsizealert').innerHTML = result;
return;
}
if(document.forms[0].destination.value==""){
document.getElementById('destinationalert').innerHTML = result;
return;
}
if(document.forms[0].dateofreturn.value==""){
document.getElementById('dateofreturnalert').innerHTML = result;
return;
}
if(document.forms[0].returntime.value==""){
document.getElementById('returntimealert').innerHTML = result;
return;
}
if(document.forms[0].yourname.value==""){
document.getElementById('yournamealert').innerHTML = result;
return;
}
if(document.forms[0].telephone.value==""){
document.getElementById('telephonealert').innerHTML = result;
return;
}
if(document.forms[0].emailaddress.value==""){
document.getElementById('emailaddressalert').innerHTML = result;
return;
}

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/sendQuote.asp";
xmlHttp.onreadystatechange = messageResponse;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


function goNow(){
var sX = findPosX(document.getElementById('stickHere'));
var sY = findPosY(document.getElementById('stickHere')); 
var obj = document.getElementById('shadowHere');
obj.style.position="absolute";
//obj.style.zindex=1;
sX+=282;
obj.style.left=sX + "px";
obj.style.top=sY + "px";

}

function searchLocation(obj){
document.location.href="/string-gallery-dealers.asp?idn=" + obj;
}

function faqSearch(){
document.location.href="/bubble-tea-faqs.asp?searchby=" + document.forms[0].searchby.value;
}

function supportSoftwareSearch(){
document.location.href="/software-downloads.asp?searchby=" + document.forms[0].searchby.value;
}

function supportMaterialSearch(){
document.location.href="/product-support-material.asp?searchby=" + document.forms[0].searchby.value;
}

function openDivOnlyNews(thisId) {
	if(document.getElementById(thisId).style.display==""){
//nothing
	}
	else{
document.getElementById(thisId).style.display="none";
SlideOpen(thisId);
document.getElementById('newsScroller').style.height="130px";
}
}

function openDivMe(thisId) {
	if(document.getElementById(thisId).style.display==""){
//document.getElementById(thisId).style.display="none";
SlideClosed(thisId);
	}
	else{

//document.getElementById(thisId).style.display="";
SlideOpen(thisId);
}
}

function closeDivOnly(thisId) {
	if(document.getElementById(thisId).style.display==""){
SlideClosed(thisId);
	}
	else{
//nothing
}
}

function getVidLib(obj){
var thisLot="imgLib=" + encodeURIComponent(obj);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/inc/furniture/videoArchive.asp";
xmlHttp.onreadystatechange = vidLibHere;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function vidLibHere() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('vidLibHere').innerHTML = xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }


function popVideo(obj){
if(getCookie('interact'))
{
document.getElementById('divThis2').style.display='';
document.getElementById('apDiv12').style.display='';
document.body.scroll="no";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/resource/working/popVideo.asp";
url=url+"?youTubeRef="+obj + "&$=" +new Date().getTime();
//document.location.href=url;
xmlHttp.onreadystatechange=displayAlert2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} else {
openAlert('View Videos','To view video content, you must be a registered member of this website. If you are not a registered user, please do so using [ Register ] from the menu at the top of this page.<br><br>If you are already registered and have activated your account, please log-in using [ log-in ] from the menu at the top of this page. <br><br>If you are both a registered user with an activated account and are logged in, please enable your computer to accept cookies. <br><br>Each time you log-in, we place a cookie on your computer that expires within 24 hours or if you log-out');
}
}

//-----------------------------------------------------------

function returnCal(mon)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  if(mon==13){
  returnCalAll();
  }
  else {
var url="/events-diary.asp";
url=url+"?mon="+mon;
document.location.href=url;
}
}

function returnCalAll()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/events-diary.asp";
url=url+"?mon=13";
document.location.href=url;
}



function getYearAll()
{ 
var obj=document.forms[0].selectYear.value;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/events-diary.asp";
url=url+"?mon=13&yr=" + obj;
document.location.href=url;
}

function displayCal() 
{ 
document.getElementById("loadHere").innerHTML="<img src=/resource/graphics/loader.gif>";
if (xmlHttp.readyState==4)
{ 
document.getElementById("calHere").innerHTML=xmlHttp.responseText;
document.getElementById("loadHere").innerHTML="";
}
else {
document.getElementById("loadHere").innerHTML="<img src=/resource/graphics/loader.gif>";
}
}

function ebMeClose(){
document.getElementById('divThis').style.display='none';
document.getElementById('apDiv1').style.display='none';
document.body.scroll="yes";
}

function ebMe(id){
document.body.scroll="no";
document.getElementById('divThis').style.display='';
document.getElementById('apDiv1').style.display='';
returnImage(id);
}

function returnEvent(id) { 
var url="/eaaa-event.asp";
url=url+"?id="+id;
document.location.href=url;
}

function returnImage(id){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/resource/working/displayimage.asp";
url=url+"?id="+id;
//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=dispim;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function dispim(){ 
         if (xmlHttp.status == 200) {
            document.getElementById('apDiv1').innerHTML = xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
}

function popit(obj){
document.body.scroll="no";
document.getElementById('divThis').style.display='';
document.getElementById('apDiv1').style.display='';
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/resource/working/popit.asp";
url=url+"?id="+obj;
//document.location.href=url
//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=dispim;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}


function addOutlook(obj) {
alert("If asked if you want to 'Save' or 'Open', please click [ Open ]\n\nThis event will automatically add to your electronic calendar");
document.location.href="/ics/" + obj + ".ics";

}

function displayNews() { 
	document.getElementById("apDiv1").innerHTML="<img src=/resource/graphics/loader.gif>";

if (xmlHttp.readyState==4){
         if (xmlHttp.status == 200) {    
            document.getElementById('apDiv1').innerHTML= xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
}
}

function sendFriend(){
	
var thisLot="toemail=" + encodeURIComponent(document.forms[0].toemail.value);
thisLot = thisLot + "&tosubject=" + encodeURIComponent(document.forms[0].tosubject.value);
thisLot = thisLot + "&toname=" + encodeURIComponent(document.forms[0].toname.value);
thisLot = thisLot + "&fname=" + encodeURIComponent(document.forms[0].fname.value);
thisLot = thisLot + "&femail=" + encodeURIComponent(document.forms[0].femail.value);
thisLot = thisLot + "&eid=" + encodeURIComponent(document.forms[0].eid.value);

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="/resource/working/sendFriend.asp";
xmlHttp.onreadystatechange = showSent;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function showSent() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            alert("Your email has been sent\n\nThank you for recommending the East Anglian Air Ambulance");
			document.location.href="/events-diary.asp";         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
   
   function doSearch()
{ 
var k=document.forms[0].keyword.value;
var url="/event-search-results.asp";
url=url+"?k=" + k;;
document.location.href=url;
}


  function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function makeDonationNow(){
	var thisAmount=document.forms[0].donation.value;
	document.location.href="http://ww6.aitsafe.com/cf/add.cfm?userid=81122333&product=Cash Donation&amp;price="+thisAmount+"&return=www.ijf.org.uk";
}

function CommerceSearch(){
var searchterm = document.forms[0].searchMeProduct.value;
document.location.href="/commerce-search.asp?kw="+searchterm;
}

function eventSearch(){
var searchterm = document.forms[0].keyword.value;
document.location.href="/camcog-events.asp?kw="+searchterm;
}

function siteSearch(){
	var kw=document.forms[0].searchMe.value;
	document.location.href="/search-results.asp?kw="+kw;
}

function submitenter(sfunction,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   if(sfunction=='siteSearch'){
	 siteSearch();  
   }
      if(sfunction=='faqSearch'){
	 faqSearch();  
   }
            if(sfunction=='eventSearch'){
	 eventSearch();  
   }   
   
   if(sfunction=='supportMaterialSearch'){
	 supportMaterialSearch();  
   }
      if(sfunction=='productSearch'){
	 CommerceSearch();  
   }
      if(sfunction=='productSearch2'){
	 CommerceSearch2();  
   }
   return false;
   }
else
   return true;
}

function swapPics(obj){
document.getElementById('tImage').src=obj;
var newIm=obj;
window.zoomer=newIm;
changeIt();
}

function LoadMyJs(obj) {
var docHeadObj = document.getElementsByTagName("head")[0];
var newScript = document.createElement("script");
newScript.type = "text/javascript";
newScript.src = obj;
//alert(newScript.src)
docHeadObj.appendChild(newScript);
}


function Login(){
if(document.forms[0].emailaddress.value==""){
alert("Username is required");
return;
}

if(document.forms[0].password.value==""){
alert("Password is required");
return;
}
sendLogin();
}

function LoginReset(){
document.forms[0].reset();
}

var gemail;

function sendLogin(){
var thisLot;
thisLot = "emailaddress=" + encodeURIComponent(document.forms[0].emailaddress.value);
thisLot = thisLot + "&ipassword=" + encodeURIComponent(document.forms[0].password.value);

window.gemail= encodeURIComponent(document.forms[0].emailaddress.value);

if(document.forms[0].rememberme.checked==true){
thisLot = thisLot + "&rememberme=yes";
}
else{
thisLot = thisLot + "&rememberme=no";	
}

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
//alert(thisLot);
var url="/resource/working/checkLogin.asp";
//document.location.href=url
xmlHttp.onreadystatechange = checkLogin;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function checkLogin() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
			 //alert(xmlHttp.responseText);
          if(xmlHttp.responseText=="1"){
//window.location.reload();
window.location.href="/cambridge-cognition-secure.asp";
		  }
		            if(xmlHttp.responseText=="2"){
alert("Your username has not been recognised");
return;
		  }
		  		            if(xmlHttp.responseText=="4"){
alert("Your registration has been suspended. Please contactus if you think you have been treated unfairly or believe the suspension to be an error.");
return;
		  }
		  		  		            if(xmlHttp.responseText=="5"){
alert("Your registration has not been activated. On registration, we sent you an email containing a link you must click to activate your account. Once activated, you will be able to log-in normally.");
return;
		  }          
		  if(xmlHttp.responseText=="3"){
alert("Your password has not been recognised");
//document.getElementById('pshow').innerHTML="<span class=loginText><a href=/forgotten-password.asp>Forgot your Password?</a>"
return;
		  }
         } else {
           alert(xmlHttp.responseText);
         }
      }   
   } 
   
   function sendLoginProfile(){
var thisLot;
thisLot = "emailaddress=" + encodeURIComponent(document.forms[0].emailaddress2.value);
thisLot = thisLot + "&ipassword=" + encodeURIComponent(document.forms[0].password2.value);



if(document.forms[0].rememberme2.checked==true){
thisLot = thisLot + "&rememberme=yes";
}
else{
thisLot = thisLot + "&rememberme=no";	
}

//alert(thisLot)

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/checkLoginProfile.asp";
xmlHttp.onreadystatechange = checkLoginProfile;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function checkLoginProfile() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
			 			 // alert(xmlHttp.responseText);
          if(xmlHttp.responseText=="1"){

document.location.href="/profile.asp";
		  }
		            if(xmlHttp.responseText=="2"){
alert("Your username has not been recognised");
return;
		  }
		  		            if(xmlHttp.responseText=="4"){
alert("Your registration has been suspended. Please contactus if you think you have been treated unfairly or believe the suspension to be an error.");
return;
		  }
		  		  		            if(xmlHttp.responseText=="5"){
alert("Your registration has not been activated. On registration, we sent you an email containing a link you must click to activate your account. Once activated, you will be able to log-in normally.");
return;
		  }          
		  if(xmlHttp.responseText=="3"){
alert("Your password has not been recognised");

return;
		  }
         } else {
            //
         }
      }   
   } 
   
  function p1(){
 document.getElementById('dPass').innerHTML = "When you registered, I asked you a <b>security question</b><br><br><input type=button name=Button value=Next onClick=p2();>";
 }
 
function p2(){
var thisLot;
thisLot = "emailaddress=1"

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/fp1.asp";
xmlHttp.onreadystatechange = fp1;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
 
 function fp1() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
          if(xmlHttp.responseText=="1"){
document.location.href="/log-in.asp"
		  }
		  else{
document.getElementById('dPass').innerHTML = xmlHttp.responseText;
		  }
         } else {
            alert("There was a problem with the request");
         }
      }   
   } 
   
   function p3(){
var thisLot;
thisLot = "securityanswer=" + encodeURIComponent(document.forms[0].securityanswer.value);

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/fp2.asp";
xmlHttp.onreadystatechange = fp2;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

 function fp2() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {       
document.getElementById('dPass').innerHTML = xmlHttp.responseText;
         } else {
            alert("There was a problem with the request");
         }
      }   
   } 
   function getDownload(obj){
	   document.location.href="/downloadsMCL/download.asp?doc=" + obj;
   }
   
      function registerMe(){
   
var canMail

document.location.href="#top";

if(document.forms[0].canMail.checked==true){
canMail="No";
}
else
{
canMail="Yes";
}

var thisLot;
thisLot =  "fnam=" + encodeURIComponent(document.forms[0].fnam.value);
thisLot = thisLot + "&snam=" + encodeURIComponent(document.forms[0].snam.value);
thisLot = thisLot + "&email=" + encodeURIComponent(document.forms[0].email.value);
thisLot = thisLot + "&telephone=" + encodeURIComponent(document.forms[0].telephone.value);
thisLot = thisLot + "&securityQuestion=" + encodeURIComponent(document.forms[0].securityQuestion.value);
thisLot = thisLot + "&securityAnswer=" + encodeURIComponent(document.forms[0].securityAnswer.value);
thisLot = thisLot + "&ipassword=" + encodeURIComponent(document.forms[0].ipassword.value);
thisLot = thisLot + "&ad1=" + encodeURIComponent(document.forms[0].ad1.value);
thisLot = thisLot + "&ad2=" + encodeURIComponent(document.forms[0].ad2.value);
thisLot = thisLot + "&ad3=" + encodeURIComponent(document.forms[0].ad3.value);
thisLot = thisLot + "&ad4=" + encodeURIComponent(document.forms[0].ad4.value);
thisLot = thisLot + "&town=" + encodeURIComponent(document.forms[0].town.value);
thisLot = thisLot + "&county=" + encodeURIComponent(document.forms[0].county.value);
thisLot = thisLot + "&postcode=" + encodeURIComponent(document.forms[0].postcode.value);
thisLot = thisLot + "&country=" + encodeURIComponent(document.forms[0].country.value);
thisLot = thisLot + "&canMail=" + encodeURIComponent(canMail);
//alert(thisLot);

var result = "&nbsp;Required&nbsp;";
document.getElementById('sfnam').innerHTML = "";
document.getElementById('ssnam').innerHTML = "";
document.getElementById('semail').innerHTML = "";
document.getElementById('sque').innerHTML = "";
document.getElementById('sans').innerHTML = "";
document.getElementById('spas').innerHTML = "";
document.getElementById('sad1').innerHTML = "";
document.getElementById('stown').innerHTML = "";

if(document.forms[0].fnam.value==""){
document.getElementById('sfnam').innerHTML = result;
return;
}
if(document.forms[0].snam.value==""){
document.getElementById('ssnam').innerHTML = result;
return;
}
if(document.forms[0].email.value==""){
document.getElementById('semail').innerHTML = result;
return;
}
if(document.forms[0].ad1.value==""){
document.getElementById('sad1').innerHTML = result;
return;
}
if(document.forms[0].town.value==""){
document.getElementById('stown').innerHTML = result;
return;
}
if(document.forms[0].securityQuestion.value=="none"){
document.getElementById('sque').innerHTML = result;
return;
}
if(document.forms[0].securityAnswer.value==""){
document.getElementById('sans').innerHTML = result;
return;
}
if(document.forms[0].ipassword.value==""){
document.getElementById('spas').innerHTML = result;
return;
}



if (echeck(document.forms[0].email.value)==false){
return;
}


xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/registerMe.asp";
//document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = messageResponse;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("You have entered an invalid email address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("You have entered an invalid email address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("You have entered an invalid email address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("You have entered an invalid email address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("You have entered an invalid email address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("You have entered an invalid email address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("You have entered an invalid email address")
		    return false
		 }
 		 return true					
	}
	
	function messageResponse() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('thanksHere').innerHTML = xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
   
   function submitnewsletter(){

var thisLot;
thisLot =  "newsname=" + encodeURIComponent(document.forms[0].name.value);
thisLot = thisLot + "&newsemail=" + encodeURIComponent(document.forms[0].email.value);

//alert(thisLot);

var result = "&nbsp<b>Required</b>&nbsp";
document.getElementById('nnam').innerHTML = "";
document.getElementById('nema').innerHTML = "";


if(document.forms[0].name.value==""){
document.getElementById('nnam').innerHTML = result;
return;
}
if(document.forms[0].email.value==""){
document.getElementById('nema').innerHTML = result;
return;
}

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
 window.external.AutoCompleteSaveForm(document.forms[0]); 
var url="/resource/working/sendNewsletter.asp";
xmlHttp.onreadystatechange = alertNewsletter;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function alertNewsletter() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('alertNewsletter').innerHTML = "<b>Thank you for signing up to receive our newsletter</b>";         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
   
   	function messageResponse() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('thanksHere').innerHTML = xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
   
 function fireCont(obj){

var thisLot;
thisLot =  "continent=" + encodeURIComponent(obj);


xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/getDistributors.asp";
xmlHttp.onreadystatechange = alertCont;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

 function fireCountry(obj){

var thisLot;
thisLot =  "country=" + encodeURIComponent(obj);


xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/resource/working/getDistributors.asp";
xmlHttp.onreadystatechange = alertCont;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function alertCont() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('displayDist').innerHTML = xmlHttp.responseText;         
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
   
   
 function updateProfile(){


thisLot = "emailAddress=" + encodeURIComponent(document.forms[0].email.value);
thisLot = thisLot + "&password1=" + encodeURIComponent(document.forms[0].password1.value);
thisLot = thisLot + "&dName=" + encodeURIComponent(document.forms[0].name.value);
thisLot = thisLot + "&dAd1=" + encodeURIComponent(document.forms[0].address1.value);
thisLot = thisLot + "&dAd2=" + encodeURIComponent(document.forms[0].address2.value);
thisLot = thisLot + "&dAd3=" + encodeURIComponent(document.forms[0].address3.value);
thisLot = thisLot + "&dAd4=" + encodeURIComponent(document.forms[0].address4.value);
thisLot = thisLot + "&dTown=" + encodeURIComponent(document.forms[0].town.value);
thisLot = thisLot + "&dTelephone=" + encodeURIComponent(document.forms[0].telephone.value);
thisLot = thisLot + "&dCounty=" + encodeURIComponent(document.forms[0].state.value);
thisLot = thisLot + "&dPostcode=" + encodeURIComponent(document.forms[0].zip.value);
thisLot = thisLot + "&dCountry=" + encodeURIComponent(document.forms[0].region.value);
thisLot = thisLot + "&securityQuestion=" + encodeURIComponent(document.forms[0].securityQuestion.value);
thisLot = thisLot + "&securityAnswer=" + encodeURIComponent(document.forms[0].securityAnswer.value);
thisLot = thisLot + "&mypass=" + encodeURIComponent(document.forms[0].mypass.value);
//alert(thisLot);

var mypassy=document.forms[0].mypass.value;

document.getElementById('alertPasswordHere').innerHTML = "";

if(mypassy==""){
document.getElementById('alertPasswordHere').innerHTML = "Please enter your password to update your profile";
return;
}

if (echeck(document.forms[0].email.value)==false){
return;
}

if(document.forms[0].canMail.checked==true){
	thisLot=thisLot+"&isallowedotmail=yes";
}
	else
	{
		thisLot=thisLot+"&isallowedotmail=no";
	}
	


xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
window.external.AutoCompleteSaveForm(document.forms[0]); 
var url="/resource/working/updateProfile.asp";
//document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = updateProfileAlert;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function updateProfileAlert() {
document.getElementById('profileUpdate').innerHTML ="<img src=/imagesMCL/loader.gif>"
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
			 if(xmlHttp.responseText=="1"){
				document.getElementById('profileUpdate').innerHTML ="" 
				document.getElementById('alertPasswordHere').innerHTML="Password does not match your saved password"
				return;
			 }
			 if(xmlHttp.responseText=="2"){
				 document.getElementById('profileUpdate').innerHTML ="<img src=/resource/graphics/tickme.gif>" 
				 return;
			 }     
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
      
scrollStep=10
timerLeft=""
timerRight=""
 
function toLeft(id){
  document.getElementById(id).scrollLeft=0;
}
 
function scrollDivLeft(id){
  clearTimeout(timerRight) ;
  document.getElementById(id).scrollLeft+=scrollStep;
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10);
}
 
function scrollDivRight(id){
  clearTimeout(timerLeft);
  document.getElementById(id).scrollLeft-=scrollStep;
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10);
}
 
function toRight(id){
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth;
}
 
function stopMe(){
  clearTimeout(timerRight) ;
  clearTimeout(timerLeft);
}

function openYear(obj){
	if(document.getElementById('y'+obj).style.display=="none"){
		document.getElementById('y'+obj).style.display="";
		document.getElementById('py'+obj).src="/resource/graphics/archiveOn.gif";
	}
	else{
		document.getElementById('y'+obj).style.display="none";
		document.getElementById('py'+obj).src="/resource/graphics/archiveOff.gif";
	}
}

function openMonth(obj){
	if(document.getElementById('m'+obj).style.display=="none"){
		document.getElementById('m'+obj).style.display="";
		document.getElementById('pm'+obj).src="/resource/graphics/archiveOn.gif";
	}
	else{
		document.getElementById('m'+obj).style.display="none";
		document.getElementById('pm'+obj).src="/resource/graphics/archiveOff.gif";
	}
}

function quitMe(){
document.location.href="/resource/working/killCookie.asp";
}

function franchiseOpener(obj,obj2){
	var thisone=obj;
	var thiscommand=obj2;
	
	if(thisone=="partnerdiv"){
		if(thiscommand=="Yes"){
		document.getElementById('partnerdiv').style.display="";
	}
	else{
		document.getElementById('partnerdiv').style.display="none";
	}
	}
	
	if(thisone=="devotediv"){
		if(thiscommand=="No"){
		document.getElementById('devotediv').style.display="";
	}else{
		document.getElementById('devotediv').style.display="none";
	}
	}
}

function sendFranchise(){
	
var mtitle=encodeURIComponent(document.forms[0].ititle.value);
var mfname=encodeURIComponent(document.forms[0].fname.value);
var msname= encodeURIComponent(document.forms[0].sname.value);
var memail1=encodeURIComponent(document.forms[0].email1.value);
var memail2= encodeURIComponent(document.forms[0].email2.value);

var mhouseno=encodeURIComponent(document.forms[0].houseno.value);
var mroad=" " + encodeURIComponent(document.forms[0].road.value);
var mtown=encodeURIComponent(document.forms[0].town.value);
var mcounty=" " + encodeURIComponent(document.forms[0].county.value);
var mzip=encodeURIComponent(document.forms[0].postcode.value);
var mcountry=" " + encodeURIComponent(document.forms[0].country.value);
var mtelephone=encodeURIComponent(document.forms[0].telephone.value);
var mtelephonealt=" " + encodeURIComponent(document.forms[0].telephonealt.value);

var wcemployer=" " + encodeURIComponent(document.forms[0].employer.value);
var wnature=" " + encodeURIComponent(document.forms[0].businessnature.value);
var wposition=" " + encodeURIComponent(document.forms[0].iposition.value);
var wsupervisor=" " + encodeURIComponent(document.forms[0].supervisor.value);
var wtown=" " + encodeURIComponent(document.forms[0].town2.value);
var wcounty=" " + encodeURIComponent(document.forms[0].county2.value);
var wzip=" " + encodeURIComponent(document.forms[0].postcode2.value);
var wcountry=" " + encodeURIComponent(document.forms[0].wcountry.value);
var wtelephone=" " + encodeURIComponent(document.forms[0].telephonecontact.value);


var wcemployer2=" " + encodeURIComponent(document.forms[0].employer2.value);
var wnature2=" " + encodeURIComponent(document.forms[0].businessnature2.value);
var wposition2=" " + encodeURIComponent(document.forms[0].iposition2.value);
var wsupervisor2=" " + encodeURIComponent(document.forms[0].supervisor2.value);
var wtown2=" " + encodeURIComponent(document.forms[0].town22.value);
var wcounty2=" " + encodeURIComponent(document.forms[0].county22.value);
var wzip2=" " + encodeURIComponent(document.forms[0].postcode22.value);
var wcountry2=" " + encodeURIComponent(document.forms[0].wcountry2.value);
var wtelephone2=" " + encodeURIComponent(document.forms[0].telephonecontact2.value);

var lcity=encodeURIComponent(document.forms[0].itow12.value);
var lcounty=encodeURIComponent(document.forms[0].itow8.value);
var lcity2=" " + encodeURIComponent(document.forms[0].itow23.value);
var lcounty2=" " + encodeURIComponent(document.forms[0].itow24.value);
var lcity3=" " + encodeURIComponent(document.forms[0].itow25.value);
var lcounty3=" " + encodeURIComponent(document.forms[0].itow26.value);
var lcity4=" " + encodeURIComponent(document.forms[0].itow27.value);
var lcounty4=" " + encodeURIComponent(document.forms[0].itow28.value);

var devotetime=encodeURIComponent(document.forms[0].devotetime.value);

var devotetimereason=" ";
	 devotetimereason=" " + encodeURIComponent(document.forms[0].devotetimereason.value);

var havepartner=encodeURIComponent(document.forms[0].havepartner.value);

var pinvolve=" " ;
var ptitle = " ";
var pfname=" ";
var psname=" ";
var prelation=" ";


	 pinvolve=encodeURIComponent(document.forms[0].ptitle2.value);
	 ptitle=encodeURIComponent(document.forms[0].ptitle.value);
	 pfname=encodeURIComponent(document.forms[0].pfname.value);
	 psname=encodeURIComponent(document.forms[0].psname.value);
	 prelation=encodeURIComponent(document.forms[0].prelation.value);


var income=" " + encodeURIComponent(document.forms[0].income.value);

// That's all the vars then! ------------------------------------------------------------------------------------------

// nuke the alerts!

document.getElementById('stow2').innerHTML="";
document.getElementById('stow').innerHTML="";
document.getElementById('stow3').innerHTML="";
document.getElementById('stow4').innerHTML="";
document.getElementById('stow5').innerHTML="";
document.getElementById('stow6').innerHTML="";
document.getElementById('stow7').innerHTML="";
document.getElementById('stow9').innerHTML="";
document.getElementById('stow11').innerHTML="";
document.getElementById('stow12').innerHTML="";
document.getElementById('stow14').innerHTML="";
if(document.getElementById('partnerdiv').style.display=""){
document.getElementById('stow10').innerHTML="";
document.getElementById('stow15').innerHTML="";
document.getElementById('stow13').innerHTML="";
document.getElementById('stow16').innerHTML="";
}

var result="<a name=#></a>&nbsp;REQUIRED&nbsp;"

if(mfname==""){
document.getElementById('stow').innerHTML=result;	
document.location.href="#";
return;
}
if(msname==""){
document.getElementById('stow3').innerHTML=result;	
document.location.href="#";
return;
}
if(memail1==""){
document.getElementById('stow4').innerHTML=result;	
document.location.href="#";
return;
}
if(memail2==""){
document.getElementById('stow5').innerHTML=result;	
document.location.href="#";
return;
}
if(mhouseno==""){
document.getElementById('stow6').innerHTML=result;	
document.location.href="#";
return;
}
if(mtown==""){
document.getElementById('stow7').innerHTML=result;	
document.location.href="#";
return;
}
if(mzip==""){
document.getElementById('stow9').innerHTML=result;	
document.location.href="#";
return;
}
if(mtelephone==""){
document.getElementById('stow11').innerHTML=result;	
document.location.href="#";
return;
}
if(lcity==""){
document.getElementById('stow12').innerHTML=result;	
document.location.href="#";
return;
}
if(lcounty==""){
document.getElementById('stow14').innerHTML=result;	
document.location.href="#";
return;
}

if(document.getElementById('partnerdiv').style.display=""){
if(pinvolve==""){
document.getElementById('stow10').innerHTML=result;	
document.location.href="#";
return;
}
if(pfname==""){
document.getElementById('stow15').innerHTML=result;	
document.location.href="#";
return;
}
if(psname==""){
document.getElementById('stow16').innerHTML=result;	
document.location.href="#";
return;
}	
}

if(memail1!=memail2){
document.getElementById('stow5').innerHTML="<a name=#></a>&nbsp;Email Addresses do not match&nbsp;";	
document.location.href="#";
return;	
}

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
  var thisLot
  
  thisLot="mtitle=" + mtitle;
thisLot=thisLot+"&mfname= " + mfname;
thisLot=thisLot+"&msname=" + msname;
thisLot=thisLot+"&memail2=" + memail2;
thisLot=thisLot+"&mhouseno=" + mhouseno;
thisLot=thisLot+"&mroad=" + mroad;
thisLot=thisLot+"&mtown=" + mtown;
thisLot=thisLot+"&mcounty=" + mcounty;
thisLot=thisLot+"&mzip=" + mzip;
thisLot=thisLot+"&mcountry=" + mcountry;
thisLot=thisLot+"&mtelephone=" + mtelephone;
thisLot=thisLot+"&mtelephonealt=" + mtelephonealt;
thisLot=thisLot+"&wcemployer=" + wcemployer
thisLot=thisLot+"&wnature=" + wnature
thisLot=thisLot+"&wposition=" + wposition;
thisLot=thisLot+"&wsupervisor="+ wsupervisor;
thisLot=thisLot+"&wtown=" + wtown;
thisLot=thisLot+"&wcounty=" + wcounty;
thisLot=thisLot+"&wzip="+ wzip
thisLot=thisLot+"&wcountry=" + wcountry
thisLot=thisLot+"&wtelephone=" + wtelephone;
thisLot=thisLot+"&wcemployer2=" + wcemployer2;
thisLot=thisLot+"&wnature2=" + wnature2;
thisLot=thisLot+"&wposition2=" + wposition2;
thisLot=thisLot+"&wsupervisor2="+ wsupervisor2;
thisLot=thisLot+"&wtown2=" + wtown2;
thisLot=thisLot+"&wcounty2=" + wcounty2;
thisLot=thisLot+"&wzip2="+ wzip2;
thisLot=thisLot+"&wcountry2=" + wcountry2;
thisLot=thisLot+"&wtelephone2=" + wtelephone2;
thisLot=thisLot+"&lcity=" + lcity;
thisLot=thisLot+"&lcounty=" + lcounty;
thisLot=thisLot+"&lcity2=" + lcity2;
thisLot=thisLot+"&lcounty2=" + lcounty2; 
thisLot=thisLot+"&lcity3=" + lcity3;
thisLot=thisLot+"&lcounty3=" + lcounty3;
thisLot=thisLot+"&lcity4=" + lcity4;
thisLot=thisLot+"&lcounty4=" + lcounty4;
thisLot=thisLot+"&devotetime=" + devotetime;
thisLot=thisLot+"&devotetimereason="  + devotetimereason;
thisLot=thisLot+"&havepartner=" + havepartner;
thisLot=thisLot+"&pinvolve=" + pinvolve;
thisLot=thisLot+"&ptitle=" + ptitle;
thisLot=thisLot+"&pfname=" + pfname;
thisLot=thisLot+"&psname=" + psname;
thisLot=thisLot+"&prelation=" + prelation;
thisLot=thisLot+"&income=" + income;

//alert(thisLot);
  
window.external.AutoCompleteSaveForm(document.forms[0]); 
var url="/resource/working/sendFranchise.asp";
//document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = franchiseResponse;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);

}

	function franchiseResponse() {
      if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
            document.getElementById('thanksHere').innerHTML = xmlHttp.responseText; 
			document.location.href="#";
         } else {
            alert('There was a problem with the request.');
         }
      }     
   }
   
   function franchiseok(obj){
	   if(obj=="I agree with the above statments"){
		   document.forms[0].senderme.disabled=false;
	   }
	   else
	   {
		   document.forms[0].senderme.disabled=true;
		   alert("Please contact us to discuss...");
	   }
   }
   
   function printthis(){
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
   }
   
   function fireheading(obj){
	   document.getElementById(obj).className="h2MeOn"
   }
   
   function extheading(obj){
	   document.getElementById(obj).className="h2Me"
   }
   
   function getLang(){
	   var language=(navigator["language"])?navigator["language"]:navigator["userLanguage"];
	   alert(language);
   }

function popcountry(){
	document.getElementById('countryme').style.display=""
}

function closecountry(){
	document.getElementById('countryme').style.display="none"
}

function clearme(obj){
	var x = document.getElementById(obj);
	x.value=""
}

function getnom(){
	var x = document.forms[0].firstknow.value
	if(x =="" || x =="email address"){
	alert("Please enter a valid email address");
} else
{
document.location.href="/cantab-newsletter.asp?e="+ document.forms[0].firstknow.value ;	
}
}

var thisreason

function goMobile(){
var thisun=document.forms[0].boslecta.value;

thisreason=thisun

if(thisun==1 || thisun==2 || thisun==3){
	document.getElementById('h1').style.display="";
	document.getElementById('h2').style.display="";
	document.getElementById('h3').style.display="none";
	document.getElementById('h4').style.display="";
	document.getElementById('h5').style.display="";
	document.getElementById('h6').style.display="";
	document.getElementById('h7').style.display="";
	document.getElementById('h8').style.display="";
	document.getElementById('h9').style.display="";
}

if(thisun==4){
	document.getElementById('h1').style.display="";
	document.getElementById('h2').style.display="";
	document.getElementById('h3').style.display="";
	document.getElementById('h4').style.display="none";
	document.getElementById('h5').style.display="none";
	document.getElementById('h6').style.display="";
	document.getElementById('h7').style.display="";
	document.getElementById('h8').style.display="";
	document.getElementById('h9').style.display="";
}

if(thisun==5){
	document.getElementById('h1').style.display="";
	document.getElementById('h2').style.display="none";
	document.getElementById('h3').style.display="none";
	document.getElementById('h4').style.display="none";
	document.getElementById('h5').style.display="none";
	document.getElementById('h6').style.display="";
	document.getElementById('h7').style.display="";
	document.getElementById('h8').style.display="";
	document.getElementById('h9').style.display="";
}
}

function mobileGo(){

var thisLot="";

if(document.forms[0].iname){
thisLot=thisLot+"iname="+document.forms[0].iname.value;
}
if(document.forms[0].ititle){
thisLot=thisLot+"&ititle="+document.forms[0].ititle.value;
}
if(document.forms[0].iorg){
thisLot=thisLot+"&iorg="+document.forms[0].iorg.value;
}
if(document.forms[0].iposition){
thisLot=thisLot+"&iposition="+document.forms[0].iposition.value;
}
if(document.forms[0].iaddress){
thisLot=thisLot+"&iaddress="+document.forms[0].iaddress.value;
}
if(document.forms[0].iphone){
thisLot=thisLot+"&iphone="+document.forms[0].iphone.value;
}
if(document.forms[0].iemail){
thisLot=thisLot+"&iemail="+document.forms[0].iemail.value;
}
if(document.forms[0].imessage){
thisLot=thisLot+"&imessage="+document.forms[0].imessage.value;
}

thisLot=thisLot+"&ireason=" + thisreason
	
	url="/send-mobile.asp";
	document.location.href=url+"?"+thisLot;		
}
