function initForm()
{
	oWindowContainerMain = new dhtmlXWindows();
	oTabbar = new dhtmlXTabBar("container_form_reservation");
	oTabbar.setImagePath('css/imgs/');
	oTabbar.addTab("tabWhat", "Schritt 1", "70px");
	oTabbar.addTab("tabWho", "Schritt 2", "70px");
	oTabbar.addTab("tabOk", "Schritt 3", "70px");
	oTabbar.addTab("tabConfirm", "Fertig", "70px");
	
	oTabbar.setTabActive("tabWhat");
	oTabbar.disableTab("tabWho");
	oTabbar.disableTab("tabOk");
	oTabbar.disableTab("tabConfirm");
	
	oFormSelectReservation = oTabbar.cells("tabWhat").attachForm();
	oFormSelectReservation.loadStruct("xml.php?page=formSelectReservation");
	oFormSelectReservation.attachEvent("onButtonClick", onClick_formSelectReservation);
}

function initFormWho()
{
	oTabbar.cells("tabWho").detachObject();
	oFormEnterAdress = oTabbar.cells("tabWho").attachForm();
	oFormEnterAdress.loadStruct("xml.php?page=formEnterAdress");
	oFormEnterAdress.attachEvent("onButtonClick", onClick_formEnterAdress);
}

function initFormOk()
{
	oTabbar.cells("tabOk").detachObject();
	oFormSummary = oTabbar.cells("tabOk").attachForm();
	oFormSummary.loadStruct("xml.php?page=formSummary");
	oFormSummary.attachEvent("onButtonClick", onClick_formSummary);
}

function initFormConfirm()
{
	oTabbar.cells("tabConfirm").detachObject();
	oFormSummary = oTabbar.cells("tabConfirm").attachForm();
	oFormSummary.loadStruct("xml.php?page=formConfirm");
	oFormSummary.attachEvent("onButtonClick", onClick_formConfirm);
}

function formWhat(oResponse)
{
	if(processAjaxResponse(oResponse) === true)
	{
		oTabbar.enableTab("tabWho");
		oTabbar.setTabActive("tabWho");
		oTabbar.disableTab("tabWhat");
		initFormWho();
	}
}

function formWho(oResponse)
{
	if(processAjaxResponse(oResponse) === true)
	{
		oTabbar.enableTab("tabOk");
		oTabbar.setTabActive("tabOk");
		oTabbar.disableTab("tabWho");
		initFormOk();
	}
}

function formOk(oResponse)
{
	if(processAjaxResponse(oResponse) === true)
	{
		oTabbar.enableTab("tabConfirm");
		oTabbar.setTabActive("tabConfirm");
		oTabbar.disableTab("tabOk");
		initFormConfirm();
	}
}

function onClick_formSelectReservation(id)
{
	switch(id)
	{
		case 'continue':
			oFormSelectReservation.send("ajax.php", "post", formWhat);
			break;
	}
}

function onClick_formEnterAdress(id)
{
	switch(id)
	{
		case 'continue':
			oFormEnterAdress.send("ajax.php", "post", formWho);
			break;
	}
}

function onClick_formSummary(id)
{
	switch(id)
	{
		case 'btn_confirm':
			oFormSummary.send("ajax.php", "post", formOk);
			break;
	}
}

function onClick_formConfirm(id)
{
}
