function clear_()
{
    var name = document.getElementById( "name" );
    var address0 = document.getElementById( "address_0" );
    var address1 = document.getElementById( "address_1" );
    var phone = document.getElementById( "phone" );
    var mobile = document.getElementById( "mobile" );
    var email = document.getElementById( "email" );
    var bestTimeToCall = document.getElementById( "best_time_to_call" );
    var preferredTimeOfAppointment = document.getElementById( "preferred_time_of_appointment" );
    var whereDidYouHearAboutProwealth = document.getElementById( "where_did_you_hear_about_prowealth" );
    
    name.value = "";
    address0.value = "";
    address1.value = "";
    phone.value = "";
    mobile.value = "";
    email.value = "";
    bestTimeToCall.value = "";
    preferredTimeOfAppointment.value = "";
    whereDidYouHearAboutProwealth.value = "";
}
function submit()
{
    var name = document.getElementById( "name" );
    var address0 = document.getElementById( "address_0" );
    var address1 = document.getElementById( "address_1" );
    var phone = document.getElementById( "phone" );
    var mobile = document.getElementById( "mobile" );
    var email = document.getElementById( "email" );
    var bestTimeToCall = document.getElementById( "best_time_to_call" );
    var preferredTimeOfAppointment = document.getElementById( "preferred_time_of_appointment" );
    var whereDidYouHearAboutProwealth = document.getElementById( "where_did_you_hear_about_prowealth" );

    if( name.value == "" ) alert( "Please enter your name." );
    else if( address0.value == "" && address1.value == "" ) alert( "Please enter an address." );
    else if( phone.value == "" ) alert( "Please enter a phone number." );
    else if( mobile.value == "" ) alert( "Please enter a mobile number." );
    else if( email.value == "" ) alert( "Please enter an email address." );
    else if( bestTimeToCall.value == "" ) alert( "Please enter a best time to call." );
    else if( preferredTimeOfAppointment.value == "" ) alert( "Please enter a preferred time of appointment." );
    else if( whereDidYouHearAboutProwealth.value == "" ) alert( "Please enter where you heard about prowealth." );
    else
    {
        startLoad();
        ajaxSend( "/ajax.aspx", "<request><command>appointment booking</command><name>" + xmlEncode( name.value ) + "</name><address0>" + xmlEncode( address1.value ) + "</address0><address1>" + xmlEncode( name.value ) + "</address1><phone>" + xmlEncode( phone.value ) + "</phone><mobile>" + xmlEncode( mobile.value ) + "</mobile><email>" + xmlEncode( email.value ) + "</email><best_time_to_call>" + xmlEncode( bestTimeToCall.value ) + "</best_time_to_call><preferred_time_of_appointment>" + xmlEncode( preferredTimeOfAppointment.value ) + "</preferred_time_of_appointment><where_did_you_hear_about_prowealth>" + xmlEncode( whereDidYouHearAboutProwealth.value ) + "</where_did_you_hear_about_prowealth></request>", function( response )
        {
            endLoad();
            if(response){
	            if( response.getElementsByTagName( "exception" ).length > 0 ) alert( "Please enter a valid email address." );
	            else alert( "Thankyou! Your booking has been submitted successfully. You may be contacted regarding your booking." );
            }
	    	else{
	    		alert("Failed! Please try again later.");
	    	}
        } );
    }
}
