/* formSend */
/* ©2008 Grzegorz Brzeski, bugfix: brov */
/* 7lab.pl */
/* For software licenced 
   ask on www.7lab.pl */

   
var ajax = new sack();
ajax.onLoading = wczytywanie;
ajax.onLoaded = eofWczytywanie;

function doFormSend()
{
	ajax.resetData();
	var form = document.getElementById('new_reservation');
	ajax.setVar("name", form.reservation_name.value);
	ajax.setVar("surname", form.reservation_surname.value);
	ajax.setVar("phone", form.reservation_surname.value); 	
	ajax.setVar("terminOd", form.reservation_from.value); 
	ajax.setVar("terminDo", form.reservation_to.value); 
	ajax.setVar("pokoj_jednoosobowy", form.reservation_room_1_os.value);
	ajax.setVar("pokoj_dwuosobowy", form.reservation_room_2_os.value);
	ajax.setVar("pokoj_trzyosobowy", form.reservation_room_3_os.value);
	ajax.setVar("apartament_1", form.reservation_room_1_ap.value);
	ajax.setVar("apartament_2", form.reservation_room_2_ap.value);
	ajax.setVar("notes", form.reservation_notes.value);
		
	ajax.setVar("potw_email", form.reservation_confirm_email.value);
	ajax.setVar("potw_fax", form.reservation_confirm_fax.value);
	
	ajax.setVar("firma", form.reservation_company.value);
	ajax.setVar("adres", form.reservation_address.value);
	ajax.setVar("nip", form.reservation_nip.value);
	
	ajax.requestFile = 'libs/formSend_kontakt.php';	// Specifying which file to get
	ajax.onCompletion = whenCompleted;	// Specify function that will be executed after file has been found
	ajax.runAJAX();		// Execute AJAX function

}

function whenCompleted(){

	var e = document.getElementById('formSendInfo'); 
	var zwracamy;
	var wyslany;
	document.getElementById('formSendInfo').style.display = "block";
	eval(ajax.response);
	e.innerHTML = zwracamy;	
	if(wyslany == "TAK"){
		document.getElementById('formSend').reset();
	}
	
}

function wczytywanie(){
	document.getElementById('ajaxprogres').innerHTML = "Wysyłanie danych formularza...";
}

function eofWczytywanie(){
	document.getElementById('ajaxprogres').innerHTML = "";
}

function zamykamyInfo(){
	document.getElementById('formSendInfo').style.display = "none";
}


