/*--------------------------------------------------------------------------------------------------------------

 File            : CharterRequest.js

 Use             : Library of JavaScript functions called by  charter_request.htm

 Description     : This is a collection of functions that:
                      - Error check the charter request form.
                      - Display any errors to the form user.
                      - Format the charter request form field values.
                      - Submit via email the form if there are no errors.

 Dependants      : ../Reservations/CharterRequest.html

 Depends On      : XDate.js, XLibrary.js, XGlobal.js


 Modfications    : 2002/01/15 JPE Created

 Form Name       : frmReservation

 Field Names     : name_organization
 				   address_line1
 				   address_line2
				   city
				   province
				   country
				   postal_code
				   name_first
                                   name_last
				   email
				   phone_number
				   cell_number
				   phone_number_fax
 				   notes_itinerary
                   date_start
                   time_start
                   location_start
                   date_clear
                   time_clear
                   location_clear
                   is_reserve_ferry
                   is_pay_ferry_coach
                   is_pay_ferry_pax
                   is_pay_driver_room
                   is_pay_road_toll
                   pax_count

 Notes			 : In this source assume any occurrence of the variable "f" to be a
 				   reference to form "frmReservation"

 Functions		 :	
 					function DoOnLoad()
					function DoBeforeStep1()
                    function DoAfterStep1()
                    function DoAfterStep2()
                    function DoAfterStep3()

					function DoClearAll()
                    function DoClearTrip()
                    function DoFormatDate(s)
                    function DoFormatTime(s)

				   	function IsUserDataEntryOk(f))
					function IsUserConfirmSubmit(f)

  	        		function IsOkContact(f)
                    function IsOkDateTimeStart(f)
                    function IsOkLocationStart(f)
                    function IsOkDateTimeClear(f)
                    function IsStartBeforeClear(f)
                    function IsOkLocationClear(f)
					function IsOkLocationStart(f)
                    function IsOkPaxCount(f)
                    function IsOkReservationStatus(f)

					function BookingNumberHide(booking_number)
					function BookingNumberShow(booking_number)
					function GetBookingNumber()

 ---------------------------------------------------------------------------------------------------------------------------*/


// Global Constants:--------------------------------------------------------------------------------------------------------

	//index for reservation status radio button
	RSV_STATUS_CONFIRM 					= 0;
	RSV_STATUS_QUOTE 					= 1;

	//field Names for values to save as cookies
	NAME_ORGANIZATION 		= "name_organization";
	ADDRESS_LINE1			= "address_line1";
	ADDRESS_LINE2			= "address_line2";
	CITY					= "city";
	PROVINCE				= "province";
	COUNTRY 				= "country";
	POSTAL_CODE				= "postal_code";
	NAME_FIRST			    = "name_first";
	NAME_LAST			    = "name_last";
	EMAIL					= "email";
	PHONE_NUMBER			= "phone_number";
	CELL_NUMBER             = "cell_number";
	PHONE_NUMBER_FAX		= "fax_number";

	//message box text when user presses submit button and everything is ok.
	CONFIRM_BOOKING     				= "Click OK to have your request sent to Wilson's Transportation." + CRLF +
										  "Click CANCEL to go back and make changes.";

	//Error messages
    ERROR_NAME_ORGANIZATION_BLANK   	= "The Organization cannot be left blank.";
    ERROR_ADDRESS_LINE1_BLANK        	= "The first address line cannot be left blank.";
    ERROR_CITY_BLANK                 	= "The city cannot be left blank.";
    ERROR_POSTAL_CODE                	= "The Postal code cannot be left blank.";
    ERROR_NAME_FIRST_BLANK          	= "Your first name cannot be left blank.";
    ERROR_NAME_LAST_BLANK         	= "Your last name cannot be left blank.";
    ERROR_PHONE_NUMBER_BLANK         	= "The phone number cannot be left blank.";
    ERROR_FAX_NUMBER_BLANK           	= "The fax number cannot be left blank.";
    ERROR_LOCATION_START_BLANK       	= "The trip start location cannot be left blank.";
    ERROR_LOCATION_CLEAR_BLANK       	= "The trip clear location cannot be left blank.";
    ERROR_PAX_COUNT_BLANK            	= "The passenger count cannot be left blank.";
    ERROR_STATUS_ID_BLANK            	= "Please indicate if you want us to confirm this reservation for you.";
    ERROR_EMAIL_BLANK                	= "The E-mail address cannot be left blank.";
    ERROR_DATE_START_BLANK           	= "The start date cannot be left blank.";
    ERROR_DATE_START_INVALID    		= "The start date must be of the form " + DATE_FORMAT + ".";
    ERROR_DATE_START_TBA    			= "You must specify a start date.";
    ERROR_DATE_CLEAR_BLANK           	= "The clear date cannot be left blank.";
    ERROR_DATE_CLEAR_INVALID    		= "The clear date must be of the form " + DATE_FORMAT + ".";
    ERROR_TIME_START_BLANK           	= "The start time cannot be left blank.";
    ERROR_TIME_START_INVALID    		= "The start time must be from 00:00 to 23:59.";
    ERROR_TIME_CLEAR_BLANK           	= "The clear time cannot be left blank.";
    ERROR_TIME_CLEAR_INVALID    		= "The clear time must be from 00:00 to 23:59.";
    ERROR_CLEAR_BEFORE_START			= "This trip clears before it starts!";
	ERROR_EMAIL_ADDRESS_INVALID			= "This does not look like an email address to me.";
	ERROR_PAX_COUNT_INVALID				= "The pax count must be a number 0 or greater.";

	MESSAGE_CELL_ID_HEADER				= "MessageCellHeader";
	MESSAGE_CELL_ID_BODY				= "MessageCellBody";
	MESSAGE_CELL_ID_FOOTER				= "MessageCellFooter";
	BOOKNUM_CELL_ID                     = "BookingNumberCell";
	
	IMAGE_DIR						= 'xImages\/';

    HTML_QUOTATION                      = "quotation";
    HTML_CONFIRMATION                   = "confirmation";
    HTML_REQUEST_TYPE					= "quotation or confirmation";

	HTML_BUTTON_CANCEL					= "<a href=\"#\" onMouseOut=\"MM_swapImgRestore();\""
										+ "              onMouseOver=\"MM_swapImage('butCancel','','" + IMAGE_DIR + "butCancel_f2.gif',1);\""
										+ "              onClick=\"DoCancel();\" >"
										+ "              <img name=\"butCancel\" src=\"" + IMAGE_DIR + "butCancel.gif\" border=\"0\">"
										+ "<\/a> ";

	HTML_BUTTON_NEXT					= "<a href=\"#\" onMouseOut=\"MM_swapImgRestore();\""
										+ "              onMouseOver=\"MM_swapImage('butNext','','" + IMAGE_DIR + "butNext_f2.gif',1);\" "
										+ "              onClick=\"DoAfterStep1();\" >"
										+ "              <img name=\"butNext\" src=\"" + IMAGE_DIR + "butNext.gif\" border=\"0\">"
										+ "<\/a> ";

	HTML_BUTTON_SUBMIT					= "<a href=\"#\" onMouseOut=\"MM_swapImgRestore();\""
										+ "              onMouseOver=\"MM_swapImage('butSubmit','','" + IMAGE_DIR + "butSubmit_f2.gif',1);\""
										+ "              onClick=\"DoAfterStep2();\" >"
										+ "              <img name=\"butSubmit\" src=\"" + IMAGE_DIR + "butSubmit.gif\" border=\"0\">"
										+ "<\/a> ";

	HTML_BUTTON_ANOTHER					= "<a href=\"#\" onMouseOut=\"MM_swapImgRestore();\""
										+ "              onMouseOver=\"MM_swapImage('butAnother','','" + IMAGE_DIR + "butAnother_f2.gif',1);\""
										+ "              onClick=\"DoAfterStep3();\" >"
										+ "              <img name=\"butAnother\" src=\"" + IMAGE_DIR + "butAnother.gif\" border=\"0\">"
										+ "<\/a> ";

    HTML_STEP_1_HEADER 					= "<h5>&nbsp;Step 1. Fill Out The Form</h5>";
    HTML_STEP_2_HEADER 					= "<h5>&nbsp;Step 2. Check It Over</h5>";
    HTML_STEP_3_HEADER                  = "<h5>&nbsp;Step 3. You Are Done!</h5>";

	HTML_STEP_1_FOOTER					= "<center> "
	                                    + HTML_BUTTON_CANCEL + HTML_BUTTON_NEXT
	                                    + "<br><b>Step 1.</b> -> <i>Step 2.</i> -> <i>Done.</i>";
	HTML_STEP_2_FOOTER					= "<center> "
	                                    + HTML_BUTTON_CANCEL + HTML_BUTTON_SUBMIT
	                                    + "<br><i>Step 1.</i> -> <b>Step 2.</b> -> <i>Done.</i>";
	HTML_STEP_3_FOOTER					= "<center> "
	                                    + HTML_BUTTON_ANOTHER
	                                    + "<br><i>Step 1.</i> -> <i>Step 2.</i> -> <b>Done.<b>";


    HTML_STEP_1_BODY					= "<ul>"
                                        + "    <li>You can reserve a coach or get a quotation by filling out this form."
                                        + "        Once you've filled out the form click <b>Next</b> to go to <i>Step 2</i><br>"
                                        + "        <img src='" + IMAGE_DIR + "icoBus.gif'><p>"
                                        + "    <li>If you would prefer to speak to an agent you can"
                                        + "        call<br> 250-475-3235.<br>"
                                        + "        <img src='" + IMAGE_DIR + "icoPhone.gif'><p>"
                                        + "    <li>Our reservations department hours of operation are:<br>"
                                        + "        Monday-Friday 8am - 5pm<br>"
                                        + "        Saturday 9am - 1pm<br>"
                                        + "        Sunday Closed<br>"
                                        + "        <img src='" + IMAGE_DIR + "icoTicket.gif'>"
                                        + "<\/ul>";

	HTML_STEP_2_BODY         			= "<ul>"
                                        + "    <li>Thank you for providing the information we need to process your " + HTML_REQUEST_TYPE
                                        + "        <br><img src='" + IMAGE_DIR + "icoThankYou.gif'><p>"
										+ "    <li>Review what you have entered. You can make changes now if you need to. "
										+          "When you are ready to go to <i>Step 3</i> click <b>Submit</b>."
                                        + "        <br><img src='" + IMAGE_DIR + "icoForm.gif'><p>"
										+ "    <li>After you click submit a booking number will be displayed. "
										+         "This booking number is the best way to refer to this request.<br>" 
										+         "<img src='" + IMAGE_DIR + "icoCalendar.gif'>"
                                        + "<\/ul>";

    HTML_STEP_3_BODY   					= "<ul>"
                                        + "    <li>Your request has been sent to our reservations depatment."
                                        + "        You will receive confirmation within 24 hours"
                                        + "        (Sunday to Thursday).<br>"
                                        + "        <img src='" + IMAGE_DIR + "ico24.gif'><br>"
										+ "    <li>If you would like a printed copy of this form select <b>File|Print</b> "
	                                    + "        from your browser's menu."
                                        + "        <br><img src='" + IMAGE_DIR + "icoPrinter.gif'><br>"
                                        + "    <li>If you need to modify this reservation please call <br>250-475-3235.<br>"
                                        + "        <img src='" + IMAGE_DIR + "icoPhone.gif'><br>"
                                        + "    <li>Thank you for using the WebRez© system.<br>"
                                        + "        <img src='" + IMAGE_DIR + "icoPresent.gif'>"
                                        + "<\/ul>";


//Global Variables-----------------------------------------------------------------------------------------



//Function Definitions-------------------------------------------------------------------------------------

//Hey kids: This is Jonathan's Dynamic html setting routine!
//The code in this routine will only run under Windows Explorer 5, 6 (maybe 3, 4 probably not 2 but who cares about "2")
//What this function does: changes the html code in a cell by first getting the cell object
//then setting the innerHTML property to some new value
function JSetCell(cell_id, html_text){
	document.all[cell_id].innerHTML = html_text;
}



function DoOnLoad() {
	DoBeforeStep1();
}



function DoBeforeStep1() {
	GetContactInfo(document.frmReservation);
	BookingNumberHide();
	JSetCell(MESSAGE_CELL_ID_HEADER, HTML_STEP_1_HEADER);
	JSetCell(MESSAGE_CELL_ID_BODY,   HTML_STEP_1_BODY);
	JSetCell(MESSAGE_CELL_ID_FOOTER, HTML_STEP_1_FOOTER);
}



function DoAfterStep1() {
    if (IsUserDataEntryOk(document.frmReservation)) {
		JSetCell(MESSAGE_CELL_ID_HEADER, HTML_STEP_2_HEADER);
		JSetCell(MESSAGE_CELL_ID_FOOTER, HTML_STEP_2_FOOTER);
    	if (document.frmReservation.status_id[RSV_STATUS_QUOTE].checked) {
    		HTML_REQUEST_TYPE = HTML_QUOTATION
		} else {
    		HTML_REQUET_TYPE = HTML_CONFIRMATION
		}
		JSetCell(MESSAGE_CELL_ID_BODY, HTML_STEP_2_BODY);
    }
}



//check again that all field values are still ok if they are check that the user really wants to go ahead with sending form
function DoAfterStep2() {
	if ( IsUserDataEntryOk(document.frmReservation)
	&&   IsUserConfirmSubmit(document.frmReservation) ) {
		JSetCell(MESSAGE_CELL_ID_HEADER, HTML_STEP_3_HEADER);
		JSetCell(MESSAGE_CELL_ID_BODY,   HTML_STEP_3_BODY);
		JSetCell(MESSAGE_CELL_ID_FOOTER, HTML_STEP_3_FOOTER);
		BookingNumberShow( GetBookingNumber() );
		document.frmReservation.submit();
	    SetContactInfo(document.frmReservation);
	}
}



function DoAfterStep3() {
	DoClearTrip();
	DoBeforeStep1();
}



function DoCancel() {
	DoClearAll();
	DoBeforeStep1();
}



//clear the reservations form
function DoClearAll(){
     document.frmReservation.reset();
     document.frmReservation.name_organization.focus();
}



//clear the trip section of the reservation form so that user can reenter the trip info
function DoClearTrip(){
    document.frmReservation.notes_itinerary.value = "";
    document.frmReservation.date_start.value = DATE_BLANK;
    document.frmReservation.date_clear.value = DATE_BLANK;
    document.frmReservation.time_start.value = TIME_BLANK;
    document.frmReservation.time_clear.value = TIME_BLANK;
    document.frmReservation.location_start.value = "";
    document.frmReservation.location_clear.value = "";
    document.frmReservation.is_reserve_ferry.checked = false;
    document.frmReservation.is_pay_ferry_coach.checked = false;
    document.frmReservation.is_pay_ferry_pax.checked = false;
    document.frmReservation.is_pay_driver_room.checked = false;
    document.frmReservation.is_pay_road_toll.checked = false;
    document.frmReservation.is_pay_road_toll.checked = false;
    document.frmReservation.pax_count.value = "";
    document.frmReservation.status_id.value = "";
    document.frmReservation.status_id[0].checked = false;
    document.frmReservation.status_id[1].checked = false;
    document.frmReservation.date_start.focus();
}



// booking number is of format: "yyMMdd-hhmm" ex.: "020630-1240"
function GetBookingNumber() {
	var now = new Date();
	return Date2String( now, "yyMMdd-HHmm" );
}



function DoFormatDate(s) {
	s.value = DateFormat(s.value, DATE_FORMAT);
}



function DoFormatTime(s) {
	s.value = TimeFormat(s.value, TIME_FORMAT);
}



function BookingNumberHide(booking_number) {
	JSetCell(BOOKNUM_CELL_ID,"<!-- the booking number goes here -->");
}



function BookingNumberShow(booking_number) {
	JSetCell(BOOKNUM_CELL_ID, "<b>WebRez Booking Number: " + booking_number + "</b>&nbsp;&nbsp");
	document.frmReservation.notes_itinerary.value = document.frmReservation.notes_itinerary.value + CRLF + "WebRez Booking Number:" + booking_number;  
	document.frmReservation.subject.value = "WebRez Charter Request - Booking Number: " + booking_number;  
}



//ask the user if it is ok to submit the form
function IsUserConfirmSubmit(f) {
	return confirm(CONFIRM_BOOKING);
}



//look at field values and determine if ok return the first element that is not ok;
//"errors_here" is the first form object containing errors
function IsUserDataEntryOk(f) {
	if ( !IsOkContact(f) )       		return false;
	if ( !IsOkDateTimeStart(f) ) 		return false;
	if ( !IsOkLocationStart(f) ) 		return false;
	if ( !IsOkDateTimeClear(f) ) 		return false;
	if ( !IsStartBeforeClear(f) )      	return false;
	if ( !IsOkLocationClear(f) )       	return false;
	if ( !IsOkPaxCount(f) )            	return false;
	if ( !IsOkReservationStatus(f) )	return false;
    return true;
}



function IsOkContact(f) {
    if (IsStringNull(f.name_organization.value)) {
        AlertErrorFocus(ERROR_NAME_ORGANIZATION_BLANK, f.name_organization);
        return false;
    }
    if (IsStringNull(f.address_line1.value)) {
        AlertErrorFocus(ERROR_ADDRESS_LINE1_BLANK, f.address_line1);
        return false;
    }
    if (IsStringNull(f.city.value)) {
        AlertErrorFocus(ERROR_CITY_BLANK, f.city);
        return false;
        }
    if (IsStringNull(f.postal_code.value)) {
        AlertErrorFocus(ERROR_POSTAL_CODE, f.postal_code);
        return false;

    }
    if (IsStringNull(f.name_first.value)) {
        AlertErrorFocus(ERROR_NAME_FIRST_BLANK, f.name_first);
        return false;
        }
    if (IsStringNull(f.name_last.value)) {
        AlertErrorFocus(ERROR_NAME_LAST_BLANK, f.name_last);
        return false;

    }
    if (IsStringNull(f.email.value) ) {
        AlertErrorFocus(ERROR_EMAIL_BLANK, f.email);
        return false;
    }
	if ( !IsEmailAddress( f.email.value ) ) {
        AlertErrorFocus(ERROR_EMAIL_ADDRESS_INVALID, f.email);
        return false;
    }
    if (IsStringNull(f.phone_number.value) ) {
        AlertErrorFocus(ERROR_PHONE_NUMBER_BLANK, f.phone_number);
        return false;
    }
    if (IsStringNull(f.fax_number.value) ) {
        AlertErrorFocus(ERROR_FAX_NUMBER_BLANK, f.fax_number);
        return false;
    }
    return true;
}



function IsOkDateTimeStart(f) {
	//start date: check the nullness, format, and TBA-ness
    if (IsStringNull(f.date_start.value)
    ||  f.date_start.value == DATE_BLANK) {
        AlertErrorFocus(ERROR_DATE_START_BLANK, f.date_start);
        return false;
    }
    if ( !IsStringDate( f.date_start.value, DATE_FORMAT ) ) {
        AlertErrorFocus(ERROR_DATE_START_INVALID, f.date_start);
        return false;
    }
	if (f.date_start.value == TBA_FORMAT) {
		AlertErrorFocus(ERROR_DATE_START_TBA, f.date_start);
		return false;
	}
	//start time: check the nullness and format
    if (IsStringNull(f.time_start.value)
    ||  f.time_start.value == TIME_BLANK) {
        AlertErrorFocus(ERROR_TIME_START_BLANK, f.time_start);
        return false;
    }
    if ( !IsStringDate( f.time_start.value, TIME_FORMAT ) ) {
        AlertErrorFocus(ERROR_TIME_START_INVALID, f.time_start);
        return false;
    }
	return true;
}




function IsOkDateTimeClear(f) {
	//date_clear: nullness and format
    if (IsStringNull(f.date_clear.value)
    ||  f.date_clear.value == DATE_BLANK) {
        AlertErrorFocus(ERROR_DATE_CLEAR_BLANK, f.date_clear);
        return false;
    }
    if ( !IsStringDate( f.date_clear.value, DATE_FORMAT ) ) {
        AlertErrorFocus(ERROR_DATE_CLEAR_INVALID, f.date_clear);
        return false;
    }
    if (IsStringNull(f.time_clear.value)
    ||  f.time_clear.value == TIME_BLANK) {
        AlertErrorFocus(ERROR_TIME_CLEAR_BLANK, f.time_clear);
        return false;
    }
    if ( !IsStringDate( f.time_clear.value, TIME_FORMAT ) ) {
        AlertErrorFocus(ERROR_TIME_CLEAR_INVALID, f.time_clear);
        return false;
    }
	return true;
}



function IsStartBeforeClear(f){
	//check if the trip clears before it starts
	if (f.time_start.value == TBA_FORMAT) {
		trip_starts = f.date_start.value;
	} else {
		trip_starts = f.date_start.value + f.time_start.value ;
	}
	if (f.date_clear.value == TBA_FORMAT) {
		trip_clears = "9999/99/99";
	} else {
		trip_clears = f.date_clear.value;
	}
	if (f.time_clear.value == TBA_FORMAT) {
		trip_clears = trip_clears + "99:99";
	} else {
		trip_clears = trip_clears + f.time_clear.value;;
	}
	if ( trip_clears < trip_starts ) {
        AlertErrorFocus(ERROR_CLEAR_BEFORE_START, f.date_start);
        return false;
    }
	return true;
}



function IsOkLocationStart(f) {
	//location_start: nullness
    if (IsStringNull(f.location_start.value) ) {
        AlertErrorFocus(ERROR_LOCATION_START_BLANK, f.location_start);
        return false;
    } else {
        return true;
	}
}



function IsOkLocationClear(f) {
	//location clear: nullness
    if (IsStringNull(f.location_clear.value) ) {
        AlertErrorFocus(ERROR_LOCATION_CLEAR_BLANK, f.location_clear);
        return false;
    }
	return true
}



function IsOkPaxCount(f) {
	//pax count is it null or not a number or less than zero?
    if (IsStringNull(f.pax_count.value) ) {
        AlertErrorFocus(ERROR_PAX_COUNT_BLANK, f.pax_count);
        return false;
    }
	if ( !IsNumber( f.pax_count.value ) || f.pax_count.value <0 ) {
        AlertErrorFocus(ERROR_PAX_COUNT_INVALID, f.pax_count);
        return false;
    }
	return true;
}



function IsOkReservationStatus(f) {
	//has the user indicated wether she wants a confirmation or a quotation
    if ( !f.status_id[RSV_STATUS_CONFIRM].checked
    &&   !f.status_id[RSV_STATUS_QUOTE].checked ) {
        AlertErrorFocus(ERROR_STATUS_ID_BLANK, f.status_id[RSV_STATUS_CONFIRM]);
        return false;
    }
	return true;
}



function SetContactInfo(f) {
	var cookie_expires = new Date();
	var milliseconds_in_one_year = 365 * 24 * 60 * 60 * 1000;
	//set cookie to expire in one year
    FixDate(cookie_expires); // fix the bug in Navigator 2.0, Macintosh
    cookie_expires.setTime(cookie_expires.getTime() + milliseconds_in_one_year);
	//one cookie for every field value to save
	SetCookie( NAME_ORGANIZATION, f.name_organization.value, cookie_expires );
	SetCookie( ADDRESS_LINE1,     f.address_line1.value,     cookie_expires );
	SetCookie( ADDRESS_LINE2,     f.address_line2.value,     cookie_expires );
	SetCookie( CITY,			  f.city.value,              cookie_expires );
	SetCookie( PROVINCE,		  f.province.value,          cookie_expires );
	SetCookie( COUNTRY, 		  f.country.value,           cookie_expires );
	SetCookie( POSTAL_CODE,		  f.postal_code.value,       cookie_expires );
	SetCookie( NAME_FIRST,	      f.name_first.value,        cookie_expires );
	SetCookie( NAME_LAST,	      f.name_last.value,         cookie_expires );
	SetCookie( EMAIL,			  f.email.value,             cookie_expires );
	SetCookie( PHONE_NUMBER,	  f.phone_number.value,      cookie_expires );
	SetCookie( PHONE_NUMBER_FAX,  f.fax_number.value,        cookie_expires );
 }



//recover contact information from client computer's cookies
function GetContactInfo(f) {
	f.name_organization.value = Null2Blank( GetCookie( NAME_ORGANIZATION ) );
	f.address_line1.value     = Null2Blank( GetCookie( ADDRESS_LINE1 ) );
	f.address_line2.value     = Null2Blank( GetCookie( ADDRESS_LINE2 ) );
	f.city.value		      = Null2Blank( GetCookie( CITY ) );
	f.province.value 		  = Null2Blank( GetCookie( PROVINCE ) );
	f.country.value           = Null2Blank( GetCookie( COUNTRY ) );
	f.postal_code.value       = Null2Blank( GetCookie( POSTAL_CODE ) );
	f.name_first.value        = Null2Blank( GetCookie( NAME_FIRST ) );
	f.name_last.value         = Null2Blank( GetCookie( NAME_LAST ) );
	f.email.value             = Null2Blank( GetCookie( EMAIL ) );
	f.phone_number.value      = Null2Blank( GetCookie( PHONE_NUMBER ) );
	f.fax_number.value        = Null2Blank( GetCookie( PHONE_NUMBER_FAX ) );
}





