	function DoSubscribe () {
	var theform;
	var name;
	var from;
	
	//get name and email
	name=document.frm.subname;
	from=document.frm.subfrom;
	
	//validate name 
	if ((name.value==null)||(name.value=="")){
		alert("Please Enter your Name")
		name.focus()
		
		return 
	}
	//email
	if ((from.value==null)||(from.value=="")){
		alert("Please Enter your Email address")
		from.focus()
		return 
	}
	if (echeck(from.value)==false){
		from.value=""
		from.focus()
		return 
	}
	
	
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.forms["frmSubscribe"];
		theform.name.value=name.value;
		theform.from.value=from.value;
		
	}
	else {
		theform = document.forms["frmSubscribe"];
		theform.name.value=name.value;
		theform.from.value=from.value;
	}
	
	
	//submit
	theform.submit();
	
	
	}
	
	function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var strINVALID = "Sorry, the email address entered appears to be invalid.";
		
		if (str.indexOf(at)==-1){
		   alert(strINVALID)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(strINVALID)
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(strINVALID)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(strINVALID)
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(strINVALID)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(strINVALID)
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert(strINVALID)
		    return false
		 }

 		 return true					
	}
	
	function TextboxSubmit(oEvent, sCommand, sArgument) {
		if (oEvent.keyCode == 13) {
			document.forms[0].Command.value=sCommand;
			document.forms[0].Argument.value=sArgument;
			document.forms[0].submit();
			oEvent.cancelBubble = true;
			oEvent.returnValue = false;
			
		}
	}

	function SetFocus(sControlID) {
		var oControl=window.document.getElementById(sControlID);
		if (oControl != null){oControl.focus()};
	}	

	function IntegerOnly(oEvent) {
		return oEvent.keyCode>47 && oEvent.keyCode<58;
	}

	function IntegerMinusOnly(oEvent) {
		return oEvent.keyCode>47 && oEvent.keyCode<58 || oEvent.keyCode==45;
	}
	
	function NumberOnly(oEvent) {
		return (oEvent.keyCode>47 && oEvent.keyCode<58) || (oEvent.keyCode==46 || oEvent.keyCode==45);
	}	
	
	
	function PreLoadImage(sImageSource) {
		oImage = new Image();
		oImage.src = sImageSource;
	}
	
	//Functions to set Css styles
	setStyle = function(obj, style, value) {
		getRef(obj).style[style] = value;
	}      
	getRef = function (obj){
		return (typeof obj == "string") ?
				document.getElementById(obj) : obj;
	}
	
	function ToggleSection(sSection) {
		//oSection=document.getElementById(sSection);
		oSection=GetObjectById(sSection);
		
		if (oSection.style.display=='none') {
			oSection.style.display='';
		} else {
			oSection.style.display='none';
		}
	}
	
	function GetObjectById(sID) {
		if (document.getElementById) {
			return document.getElementById(sID);	
		} else {
			return document.layers[sID];
		}
	}


function DoRequest() {

	if (ValidateRequest()){
		document.forms[0].action="ConsultationRequest.asp";
		document.forms[0].method="Post";
		document.forms[0].submit();
	}
}


function ValidateRequest(){

	var theform;
	var fname;
	var lname;
	var dobDay;
	var dobMonth;
	var dobYear;
	var Gender;
	var Address1;
	var Address2;
	var City;
	var Postcode;
	var Country;
	var Telephone;
	var Email;
	
	
	
	
	theform=document.forms[0];
	
	//get name and email
	fname=theform.txtfName;
	lname=theform.txtsName;
	
	dobDay=theform.lstDobDay;
	dobMonth=theform.lstDobMonth;
	dobYear=theform.lstDobYear;
	
	Gender=theform.radGender;
	
	Address1=theform.txtAddress1;
	Address2=theform.txtAddress2;
	City=theform.txtCity;
	Postcode=theform.txtPostcode;
	Country=theform.lstCountry;
	
	
	Email=theform.txtEmailAddress;
	
	
	//validate forename 
	if ((fname.value==null)||(fname.value=="")){
		alert("Please Enter your Forename")
		fname.focus()
		
		return 
	}
	//validate surname
	if ((lname.value==null)||(lname.value=="")){
		alert("Please Enter your Surname")
		lname.focus()
		
		return 
	}
	
	//Date of birth
	if ((dobDay.value==null)||(dobDay.value=="")){
		alert("Please Enter your Full Date of Birth")
		dobDay.focus()
		
		return 
	}
	if ((dobMonth.value==null)||(dobMonth.value=="")){
		alert("Please Enter your Full Date of Birth")
		dobMonth.focus()
		
		return 
	}
	if ((dobYear.value==null)||(dobYear.value=="")){
		alert("Please Enter your Full Date of Birth")
		dobYear.focus()
		
		return 
	}
	
	

	//validate address1
	if ((Address1.value==null)||(Address1.value=="")){
		alert("Please Enter your Address")
		Address1.focus()
		
		return 
	}
		
	//validate city 
	if ((City.value==null)||(City.value=="")){
		alert("Please Enter your City")
		City.focus()
		
		return 
	}
	
	//validate postcode
	if ((Postcode.value==null)||(Postcode.value=="")){
		alert("Please Enter your Postcode / Zip")
		Postcode.focus()
		
		return 
	}
	
	//validate country
	if (Country.selectedIndex<=0){
		alert("Please select your Country")
		Country.focus()
		
		return 
	}
	
	//email
	if ((Email.value==null)||(Email.value=="")){
		alert("Please Enter your Email address")
		Email.focus()
		return 
	}
	if (echeck(Email.value)==false){
		Email.value=""
		Email.focus()
		return 
	}
	
return true;
}

function DoFunctionalTest(){
	
	//check all questions are answered
		
	if (GetRadioGroupValue("Q1")=='') {
		alert('Please answer all questions! (Q. #1)');
		return false;
	}
		
	if (GetRadioGroupValue("Q2")=='') {
		alert('Please answer all questions! (Q. #2)');
		return false;
	}
		
	if (GetRadioGroupValue("Q3")=='') {
		alert('Please answer all questions! (Q. #3)');
		return false;
	}
		
	if (GetRadioGroupValue("Q4")=='') {
		alert('Please answer all questions! (Q. #4)');
		return false;
	}
		
	if (GetRadioGroupValue("Q5")=='') {
		alert('Please answer all questions! (Q. #5)');
		return false;
	}
		
	if (GetRadioGroupValue("Q6")=='') {
		alert('Please answer all questions! (Q. #6)');
		return false;
	}
		
	if (GetRadioGroupValue("Q7")=='') {
		alert('Please answer all questions! (Q. #7)');
		return false;
	}
		
	if (GetRadioGroupValue("Q8")=='') {
		alert('Please answer all questions! (Q. #8)');
		return false;
	}
		
	if (GetRadioGroupValue("Q9")=='') {
		alert('Please answer all questions! (Q. #9)');
		return false;
	}									
			
	if (GetRadioGroupValue("Q10")=='') {
		alert('Please answer all questions! (Q. #10)');
		return false;
	}
	
	//has name ?
	if ((document.forms[0].txtTestName.value==null)||(document.forms[0].txtTestName.value=="")){
		alert("Please Enter your Name");
		document.forms[0].txtTestName.focus();
		return false;
	}
	//has valid email?
	if ((document.forms[0].txtTestEmail.value==null)||(document.forms[0].txtTestEmail.value=="")){
		alert("Please Enter your Email address");
		document.forms[0].txtTestEmail.focus();
		return false;
	}
	if (echeck(document.forms[0].txtTestEmail.value)==false){
		document.forms[0].txtTestEmail.value="";
		document.forms[0].txtTestEmail.focus();
		return false;
	}
	
	//set action & submit
	document.forms[0].action="FunctionalTestSubmit.asp";
	document.forms[0].method="Post";
	document.forms[0].submit();
}

function GetRadioGroupValue(GroupName,bSetFocus){
	var i;
	var oGroup;
	
	oGroup=document.getElementsByName(GroupName);
	
	for (i=0;i<=oGroup.length-1;i++){
		if (oGroup[i].checked){
			return oGroup[i].value;
		}
	}
	
	if (bSetFocus==true){
		oGroup.focus();
	}
	return "";
}


	function DoElimination () {
	var theform;
	var name;
	var from;
	
	//get name and email
	name=document.frm.txtEliminationName;
	from=document.frm.txtEliminationFrom;
	
	//validate name 
	if ((name.value==null)||(name.value=="")){
		alert("Please Enter your Name")
		name.focus()
		
		return 
	}
	//email
	if ((from.value==null)||(from.value=="")){
		alert("Please Enter your Email address")
		from.focus()
		return 
	}
	if (echeck(from.value)==false){
		from.value=""
		from.focus()
		return 
	}
	
	
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.forms["frmSubscribe"];
		theform.name.value=name.value;
		theform.from.value=from.value;
		
		theform.meta_web_form_id.value="7900924";
		theform.unit.value="elimination";
		
	}
	else {
		theform = document.forms["frmSubscribe"];
		theform.name.value=name.value;
		theform.from.value=from.value;
		theform.meta_web_form_id.value="7900924";
		theform.unit.value="elimination";
	}
	
	//submit
	theform.submit();
	
	
	}


function printImage() {	

var NumberOfImagesToRotate = 70;

// Specify the first and last part of the image tag.

FirstPart = '<img src="/images/footer/ftr_';
LastPart = '.jpg" alt="Dax Moy Samui">';

var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
document.write(FirstPart + r + LastPart);

}

function setCookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function getCookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}				
	

		 function DoMenu(sMenuID,bShow) {
            var oMnu;            
            var oFrmField;
            var sCurrentVal;
            var iMnuTop;
            var iMnuBottom;
            var iMnuList;
            
            iMnuTop=1;    
            iMnuList=3;                       
            iMnuBottom=5;
            
            //get the menu object
            oMnu = document.getElementById (sMenuID);            
             
             //if IE then node length is 3
             if (oMnu.childNodes.length==3){
                iMnuTop=0;    
                iMnuList=1;                       
                iMnuBottom=2;                
             }
             
            //hide or show?
            if (oMnu.childNodes[iMnuList].style.display=='none' && (bShow==true || bShow==undefined)) 
            {
                //show
            
                //change image of the top
                oMnu.childNodes[iMnuTop].className='mnuListTop';
                
                //show the contents of the menu
                oMnu.childNodes[iMnuList].style.display='';               
                
                //show the mnu bottom
                oMnu.childNodes[iMnuBottom].style.display='';
                
                //set the sMenuID in the mnuState input field
                oFrmField=document.getElementById('mnuState');
                oFrmField.value=oFrmField.value + ' ' + sMenuID;               
                
            }
            else
            {
                //hide
            
                //change image of the top                
                oMnu.childNodes[iMnuTop].className='mnuListTopClosed';                
                
                
                //hide the contents of the menu
                oMnu.childNodes[iMnuList].style.display='none';
                
                //hide the mnu bottom
                oMnu.childNodes[iMnuBottom].style.display='none';
                
                
                //remove the sMenuID in the mnuState input field
                oFrmField=document.getElementById('mnuState');
                oFrmField.value=oFrmField.value.replace(new RegExp( sMenuID, "gi" ),'');
            }            
            
            

            }	

    function CloseAllMenus() {
        
        DoMenu('mnuListServices',false);
        DoMenu('mnuListGentle',false);
        DoMenu('mnuListFree',false);
        DoMenu('mnuListArticles',false);
        DoMenu('mnuListLinks',false);
        
    }
	
	
	function SetMenus(){
	    var sCookie;
	    var oFrm;
	    //setup the initial menu state	    
			        
	    //get the menu cookie
	    //if (getCookie('DaxMoy-PTS-mnuState'))
	    //{
	        //get the cookie n set the hidden field
	     //  sCookie=getCookie('DaxMoy-PTS-mnuState');	        
        //   oFrm = document.getElementById('mnuState');
       //    oFrm.value=sCookie;
            
            //we have to close the menus thats ID is NOT in our cookie
       //     if (sCookie.indexOf('mnuListServices')== -1 ){DoMenu('mnuListServices',false);}
       //     if (sCookie.indexOf('mnuListGentle')== -1 ){DoMenu('mnuListGentle',false);}
       //     if (sCookie.indexOf('mnuListFree')== -1 ){DoMenu('mnuListFree',false);}
       //     if (sCookie.indexOf('mnuListArticles')== -1 ){DoMenu('mnuListArticles',false);}
       //     if (sCookie.indexOf('mnuListLinks')== -1 ){DoMenu('mnuListLinks',false);}            
	   // }
	   // else 
	   // {
	        //no cookie so close em by default	        
	   //     CloseAllMenus();
	   // }
	}
	


function SetMenuCookie(){
    var oFrm;
    
    oFrm = document.getElementById('mnuState');
    setCookie('DaxMoy-PTS-mnuState',oFrm.value);
}

//called when the page unLoads
window.onunload=SetMenuCookie;
