// This function sends emails from the "post-it note" on the pages
function sendmessage()
{
if (('' + document.getElementById('fullname').value + document.getElementById('email').value
	   + document.getElementById('comment').value) == '')
{
	alert('Please fill in the fields on the note before clicking Submit');
	return (false);
}
var re = new RegExp('^[a-zA-Z0-9.\-_]{1,}@.{1,}\..{1,}$');
if (!document.getElementById('email').value.match(re))
{
	alert('Your email address appears to be incorrect.');
	return (false);
}

var xmlhttp=false;
var hasError=0;

try 
    { 
        xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); 
    }
catch(e) 
    {
    try 
        { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
    catch(e) 
        { hasError=1;}
    }
if (!xmlhttp && typeof(XMLHttpRequest) != "undefined") 
    {
    try { xmlhttp = new XMLHttpRequest();hasError=0; }
    catch(e) { hasError=1;}
    }
if (!xmlhttp && window.createRequest) 
    {
    try { xmlhttp = window.createRequest();hasError=0; }
    catch(e) { hasError=1;}
    }



 if (hasError == 0)
 { 

	try {
    		netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
   	} 
	catch (e) {}


	xmlhttp.open("HEAD", "http://www.complianceconsulting.com.au/PostItEmail.aspx?mailto=info@complianceconsulting.com.au&mailFrom=" +
		document.getElementById('fullname').value + '&email=' + document.getElementById('email').value
		+ "&mailMsg=" + document.getElementById('comment').value,true);
	
	 xmlhttp.onreadystatechange=function()
	 {
	  if (xmlhttp.readyState==4) 
		{
		   if (xmlhttp.status==200) alert("Thanks for leaving a note. We will get in touch with you shortly.")
			else if (xmlhttp.status==404) alert("URL doesn't exist.")
			 else alert("We are sorry, your note could not be left.  Please use the contact page.")
		    document.getElementById('fullname').value = " ";
		    document.getElementById('email').value = " ";
		    document.getElementById('comment').value = " ";
		}
	 }
	 xmlhttp.send(null) 
	}

}