function getXMLHTTPRequest(){
var req = false;
try{
req = new XMLHttpRequest(); //firefox and other browsers NOTE the case sensitivity
} catch(e){
	try{
	req = new ActiveXObject("Msxml2.XMLHTTP");	//ie 7
	} catch(e){
		try{
	req = new AtiveXObject("Microsoft.XMLHTTP"); //ie other
	} catch(E){
		req = false; //if it fails
		alert("You must enable javascript in your internet options to view this page properly.")
	}
}
}

return req; //returns the result
}

var http = getXMLHTTPRequest();
var http1 = getXMLHTTPRequest();



function getDetails(page) { //the page is described in the xhtml
	var myurl = 'includes/' + page + '.php';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http.open('GET', modurl, true); 
	http.onreadystatechange= useHTTPResponse; //this is how to call an undefined function 
	http.send(null);
}



function getContact(page, submitted, name,telephone,email,question) { //the page is described in the xhtml
	var myurl = 'includes/' + page + '.php';
	var submitted = submitted; 
	var name=name;
	var telephone=telephone;
	var email=email;
	var question=question;
	
	var query = "submitted="+submitted +"&fullname="+name+"&telephone="+telephone+"&email="+email+"&question="+question; 
	http.open('POST', myurl, 1); //needs to be set to one or 0 for POST
	http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); //needed for POST ajax
	http.onreadystatechange= useHTTPResponse; //this is how to call an undefined function 
	http.send(query);
}

function getRecommend(page, submitted, name,fname,femail) { //the page is described in the xhtml
	var myurl = 'includes/' + page + '.php';
	var submitted = submitted; 
	var fname=fname
	var femail=femail;
	
	var query = "submitted="+submitted +"&fullname="+name+"&fname="+fname+"&femail="+femail; 
	http.open('POST', myurl, 1); //needs to be set to one or 0 for POST
	http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); //needed for POST ajax
	http.onreadystatechange= useHTTPResponse; //this is how to call an undefined function 
	http.send(query);
}

function postLogIn(page, submitted, username, password) { //the page is described in the xhtml
	var myurl = 'includes/' + page + '.php';
	var submitted=submitted;
	var username=username;
	var password=password;
	
	var query = "submitted="+submitted+"&username="+username+"&password="+password; 
	http.open('POST', myurl, 1); //needs to be set to one or 0 for POST
	http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); //needed for POST ajax
	http.onreadystatechange= useHTTPResponse; //this is how to call an undefined function 
	http.send(query);
}


function useHTTPResponse(){
	if(http.readyState == 4){ //ajax is working
		if(http.status == 200){ //operation is complete
			var detailsValue = http.responseText;
			document.getElementById('ajax_content1').innerHTML = detailsValue; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	drivel=new Array("...central heating installations...","...quality boiler repairs...","...Corgi registered engineers...","...boiler and heating repairs...","...for all your heating needs...","...central heating specialists...");
	
		document.getElementById('ajax_content1').innerHTML = '<div style="margin-left:auto;margin-right:auto;width:37em; height:30em; overflow:hidden;"><div style="position:relative; left:0px;top: 0px;"><p><img src="images/ajax-loader-bar.gif" /></p></div><div style="font-size:1.6em; color:#FFCC99;margin-left:auto;margin-right:auto;width:37em;"><p>' + drivel[Math.floor(Math.random()*6)] +'</p></div></div></div>';
	}//else ajax has failed
}

function getFAQ0() { //the page is described in the xhtml
	var myurl = 'includes/FAQ.xml';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q0; //this is how to call an undefined function 
	http1.send(null);
}


function Q0(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var detailsValue = http1.responseXML;
			var d= detailsValue.getElementsByTagName('answer').item(0); 
			var e= detailsValue.getElementsByTagName('question').item(0); 
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "50px";
			document.getElementById('FAQ_ajax').style.height= "250px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>'+e.firstChild.data+'</strong><br /><br />' +d.firstChild.data+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}
function getFAQ1() { //the page is described in the xhtml
	var myurl = 'includes/FAQ.xml';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q1; //this is how to call an undefined function 
	http1.send(null);
}


function Q1(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var detailsValue = http1.responseXML;
			var d= detailsValue.getElementsByTagName('answer').item(1); 
			var e= detailsValue.getElementsByTagName('question').item(1);
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "50px";
			document.getElementById('FAQ_ajax').style.height= "250px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>'+e.firstChild.data+'</strong><br /><br />' +d.firstChild.data+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}
function getFAQ2() { //the page is described in the xhtml
	var myurl = 'includes/FAQ.xml';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q2; //this is how to call an undefined function 
	http1.send(null);
}


function Q2(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var detailsValue = http1.responseXML;
			var d= detailsValue.getElementsByTagName('answer').item(2); 
			var e= detailsValue.getElementsByTagName('question').item(2);
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "50px";
			document.getElementById('FAQ_ajax').style.height= "250px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>'+e.firstChild.data+'</strong><br /><br />' +d.firstChild.data+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}




function getFAQ3() { //the page is described in the xhtml
	var myurl = 'includes/prices.php';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q3; //this is how to call an undefined function 
	http1.send(null);
}


function Q3(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var d = http1.responseText;
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "-50px";
			document.getElementById('FAQ_ajax').style.height= "500px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>CURRENT PRICES</strong>' +d+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}
function getFAQ4() { //the page is described in the xhtml
	var myurl = 'includes/prices.php';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q4; //this is how to call an undefined function 
	http1.send(null);
}


function Q4(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var d = http1.responseText;
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "-50px";
			document.getElementById('FAQ_ajax').style.height= "500px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>CURRENT PRICES</strong>' +d+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}

function getFAQ5() { //the page is described in the xhtml
	var myurl = 'includes/FAQ.xml';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q5; //this is how to call an undefined function 
	http1.send(null);
}


function Q5(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var detailsValue = http1.responseXML;
			var d= detailsValue.getElementsByTagName('answer').item(5); 
			var e= detailsValue.getElementsByTagName('question').item(5);
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "50px";
			document.getElementById('FAQ_ajax').style.height= "250px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>'+e.firstChild.data+'</strong><br /><br />' +d.firstChild.data+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}
function getFAQ6() { //the page is described in the xhtml
	var myurl = 'includes/FAQ.xml';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q6; //this is how to call an undefined function 
	http1.send(null);
}


function Q6(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var detailsValue = http1.responseXML;
			var d= detailsValue.getElementsByTagName('answer').item(6); 
			var e= detailsValue.getElementsByTagName('question').item(6);
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "50px";
			document.getElementById('FAQ_ajax').style.height= "250px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>'+e.firstChild.data+'</strong><br /><br />' +d.firstChild.data+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}
function getFAQ7() { //the page is described in the xhtml
	var myurl = 'includes/FAQ.xml';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q7; //this is how to call an undefined function 
	http1.send(null);
}


function Q7(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var detailsValue = http1.responseXML;
			var d= detailsValue.getElementsByTagName('answer').item(7);
			var e= detailsValue.getElementsByTagName('question').item(7);
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "50px";
			document.getElementById('FAQ_ajax').style.height= "250px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>'+e.firstChild.data+'</strong><br /><br />' +d.firstChild.data+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}
function getFAQ8() { //the page is described in the xhtml
	var myurl = 'includes/FAQ.xml';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q8; //this is how to call an undefined function 
	http1.send(null);
}


function Q8(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var detailsValue = http1.responseXML;
			var d= detailsValue.getElementsByTagName('answer').item(8); 
			var e= detailsValue.getElementsByTagName('question').item(8);
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "50px";
			document.getElementById('FAQ_ajax').style.height= "250px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>'+e.firstChild.data+'</strong><br /><br />' +d.firstChild.data+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}
function getFAQ9() { //the page is described in the xhtml
	var myurl = 'includes/FAQ.xml';
	var myRand = parseInt(Math.random()*999999999999999) //to prevent browser caching
	var modurl = myurl +"?rand="+ myRand; //creates a unique url to fool browser cache
	http1.open('GET', modurl, true); 
	http1.onreadystatechange= Q9; //this is how to call an undefined function 
	http1.send(null);
}


function Q9(){
	if(http1.readyState == 4){ //ajax is working
		if(http1.status == 200){ //operation is complete
			var detailsValue = http1.responseXML;
			var d= detailsValue.getElementsByTagName('answer').item(9); 
			var e= detailsValue.getElementsByTagName('question').item(9);
			document.getElementById('FAQ_ajax').style.visibility= "visible";
			document.getElementById('FAQ_ajax').style.top= "50px";
			document.getElementById('FAQ_ajax').style.height= "250px";
			document.getElementById('FAQ_ajax').innerHTML ='<p style="padding:10px;"><strong>'+e.firstChild.data+'</strong><br /><br />' +d.firstChild.data+ '</p>'; //writes to div
		}
	}else{ //the process hasnt finished so display animation to indicate it is working
	
		document.getElementById('FAQ_ajax').innerHTML = '';
	}//else ajax has failed
}

function FAQ_show(id, h){
	var id=id;
	var h=h;
document.getElementById('FAQ_bubble').style.visibility='visible';
document.getElementById('FAQ_bubble').style.display='block';
document.getElementById('FAQ_bubble').style.height=h;
document.getElementById(id).style.visibility='visible';
document.getElementById(id).style.display='block';

}
function FAQ_hide(id){
document.getElementById('FAQ_bubble').style.visibility='hidden';
document.getElementById('FAQ_bubble').style.display='none';
document.getElementById(id).style.visibility='hidden';
document.getElementById(id).style.height='0em';
document.getElementById(id).style.display='none';
}

