
	function onLayer(whichLayer)
	{
	if (document.getElementById)
	{
	// this is the way the standards work
	var style3 = document.getElementById(whichLayer).style;
	style3.display = "block";
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style3 = document.all[whichLayer].style;
	style3.display = "block";
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style3 = document.layers[whichLayer].style;
	style3.display = "block";
	}
	}


	function offLayer(whichLayer)
	{
	if (document.getElementById)
	{
	// this is the way the standards work
	var style4 = document.getElementById(whichLayer).style;
	style4.display = "none";
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style4 = document.all[whichLayer].style;
	style4.display = "none";
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style4 = document.layers[whichLayer].style;
	style4.display = "none";
	}
	}


	function onInlineLayer(whichLayer)
	{
	if (document.getElementById)
	{
	// this is the way the standards work
	var style3 = document.getElementById(whichLayer).style;
	style3.display = "inline";
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style3 = document.all[whichLayer].style;
	style3.display = "inline";
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style3 = document.layers[whichLayer].style;
	style3.display = "inline";
	}
	}






function checkForm()	// check form prior to submission (client-side validation)
{

	var formOK = true;

	var warningString = "Please correct the following:\n";
	var validated=true;



	with (document.enquiryForm)
	{



	    if (name.value=="")
		{
			warningString= warningString+ '\nNo name has been entered';
			formOK =false;
		}



	    if (phone.value=="")
		{
			warningString= warningString+ '\nNo phone number has been entered';
			formOK =false;
		}



		if ( !formOK )
		{
			alert(warningString);
			validated=false;
		}


	}

	return validated;	// if all checks in checkForm are passed a TRUE will be returned
}



function xmlhttpPost(strURL)
{


	if (checkForm())
	{

													//this is the main function - called when the button is clicked
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function()
    {
        if (self.xmlHttpReq.readyState == 4)
        {
            updatepage(self.xmlHttpReq.responseText);	 //update page with data returned from script
        }
    }
    self.xmlHttpReq.send(getquerystring());              //send data to the script



	}

    //clearform();
}



function getquerystring()
{
    var form         = document.forms['enquiryForm'];

    var name	= form.name.value;
    var phone	= form.phone.value;

    var secondary,primary,microclass,onetoone;
    
    
    
    if (form.secondary.checked)
    {
    	secondary="Y"
    }
    else
    {
    	secondary="N"
    }


    if (form.primary.checked)
    {
    	primary="Y"
    }
    else
    {
    	primary="N"
    }    


    if (form.microclass.checked)
    {
    	microclass="Y"
    }
    else
    {
    	microclass="N"
    }    


    if (form.onetoone.checked)
    {
    	onetoone="Y"
    }
    else
    {
    	onetoone="N"
    }
    
     
    
	// NOTE: no '?' before querystring



    qstr =        'namevalue=' + escape(name) + '&phonevalue=' + escape(phone);
    qstr = qstr + '&secondaryvalue=' + escape(secondary) + '&primaryvalue=' + escape(primary);
    qstr = qstr + '&microclassvalue=' + escape(microclass) + '&onetoonevalue=' + escape(onetoone);

	return qstr;
}





function updatepage(str)
{



	if (str == "Y")
	{
		onLayer('confirmation_message');offLayer('form_block');
	}
	else
	{
		onLayer('error_message');offLayer('form_block');
	}




}


function MM_openBrWindow(theURL,winName,features)
{
	//v2.0
	window.open(theURL,winName,features);
}
