// JavaScript Document
	function getHTTPObject() {
	  var xmlhttp;
	  /*@cc_on
	  @if (@_jscript_version >= 5)
		try {
		  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		  try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (E) {
			xmlhttp = false;
		  }
		}
	  @else
	  xmlhttp = false;
	  @end @*/
	  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
		  xmlhttp = new XMLHttpRequest();
		} catch (e) {
		  xmlhttp = false;
		}
	  }
	  return xmlhttp;
	}
	var http = getHTTPObject(); // We create the HTTP Object	
	// End XML Object Loader
	var url = "urlhereisvoid"; // The server-side script

	function submitform(){
		ERROR = "";
		if (document.getElementById("name").value == "")ERROR = ERROR + "Your name is missing.\n";
		if (document.getElementById("email1").value == "")ERROR = ERROR + "Your Email is missing.\n";
		if (document.getElementById("websitename").value == "")ERROR = ERROR + "Your Website name is missing.\n";
		if (document.getElementById("websiteurl").value == "")ERROR = ERROR + "Your Website address is missing.\n";
		if (document.getElementById("reason").value == "0")ERROR = ERROR + "Reason for report is missing.\n";
		if (document.getElementById("email1").value !== document.getElementById("email2").value)ERROR = ERROR + "Your Email's do not match.\n";
		
		if (ERROR == ""){
			document.getElementById("Submit").disabled = true;
			document.getElementById("messagediv").innerHTML = "<img src=\"<? echo $websiteurl;?>images/loadingbar.gif\" width=\"200\" height=\"40\" alt=\"Please Wait, Loading....\" />";
			
			var URL = "<? echo $websiteurl;?>AJAX/advicerequest.php";
			PARAMETERS = "name="+encodeURI(document.getElementById("name").value);
			PARAMETERS = PARAMETERS + "&email1="+encodeURI(document.getElementById("email1").value);
			PARAMETERS = PARAMETERS + "&email2="+encodeURI(document.getElementById("email2").value);
			PARAMETERS = PARAMETERS + "&websitename="+encodeURI(document.getElementById("websitename").value);
			PARAMETERS = PARAMETERS + "&websiteurl="+encodeURI(document.getElementById("websiteurl").value);
			PARAMETERS = PARAMETERS + "&reason="+encodeURI(document.getElementById("reason").value);
			PARAMETERS = PARAMETERS + "&Submit=Submit";
				
			http.onreadystatechange = advicerequested;
			http.open('POST', URL, true);
			http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			http.setRequestHeader("Content-length", PARAMETERS.length);
			http.setRequestHeader("Connection", "close");
			http.send(PARAMETERS);
		} else {
			alert("There was an error with your submittion.\n"+ERROR+"Please check and try again.");
		}
	}

	function advicerequested(){
		if (http.readyState == 4){
			RESPONSE = "";
			RESPONSE = http.responseText;
			document.getElementById("Submit").disabled = false;

			if( typeof( window.innerWidth ) == 'number' ) {
				//Non-IE
				myWidth = window.innerWidth;
				myHeight = window.innerHeight;
			} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				//IE 6+ in 'standards compliant mode'
				myWidth = document.documentElement.clientWidth;
				myHeight = document.documentElement.clientHeight;
			} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;
			}
			document.getElementById("alert_background_layer").style.left = '0px';
			document.getElementById("alert_background_layer").style.top = '0px';
			document.getElementById("alert_background_layer").style.width = myWidth + 'px';
			document.getElementById("alert_background_layer").style.height = myHeight + 'px';
			
			var x = (myWidth / 2) -250;
			var y = (myHeight / 2) - 300;

			document.getElementById("alert_content_layer").style.left = parseInt(x)+'px';
			document.getElementById("alert_content_layer").style.top = '50px';
			
			alert(RESPONSE);

			if (RESPONSE == "1"){
				// setup the innerHTML section to what we want
				document.getElementById("alert_content_layer").innerHTML = "<div style=\"width:500px;\"><div style=\"background-color:#352070; color:#FFFFFF; font-weight:bold; width:100%; display:block;\" align=\"center\">Advice Request </div><div>We have received your advice request and will respond within 14 days.<br><br>A receipt of your request has been sent to the email you specified.<div align=\"center\"><input name=\"Close\" type=\"button\" id=\"Close\" onclick=\"hidelayers();\" value=\"Close\"/></div></div></div>";
			} else {
				document.getElementById("alert_content_layer").innerHTML = "<div style=\"width:500px;\"><div style=\"background-color:#352070; color:#FFFFFF; font-weight:bold; width:100%; display:block;\" align=\"center\">Request Advice</div><div><img src=\"<? echo $websiteurl;?>warning.jpg\" width=\"150\" height=\"134\" align=\"left\" alt=\"Warning\" style=\"margin:5px;\" />One or more problems where found with your submision. Please check the following errors and try again.<br><br>"+RESPONSE+"<br /><div align=\"center\"><input name=\"close\" type=\"button\" id=\"close\" style=\"margin:10px;\" onclick=\"hidelayers();\" value=\"Close\"/></div></div></div>";
			}
			document.getElementById("messagediv").innerHTML = "";
			document.getElementById("alert_background_layer").className = "showdeletelayer";
			document.getElementById("alert_content_layer").className = "showalertlayer";			
		}
	}
	function hidelayers(){
		document.getElementById("alert_content_layer").className = "hidelayer";
		document.getElementById("alert_background_layer").className = "hidelayer";
	}
