﻿/*
 * StandortService - 05.10.2007 (mj)
 * © 2004 xmachina GmbH, Heidelberg.
 * All rights reserved. Alle Rechte vorbehalten.
 *
 * xmachina und das xmachina-Logo sind eingetragene
 * Warenzeichen der xmachina GmbH, Heidelberg.
 *
 * xmachina and the xmachina logo are registered
 * trademarks of xmachina GmbH, Heidelberg, Gemany.
 *
 * xmachina GmbH - Maaﬂstr. 24 - D-69123 Heidelberg, Germany
 * Fon: +49 (0)6221.8220.20    - Fax: +49 (0)6221.8220.40
 * E-Mail: deus@xmachina.de    - http://www.xmachina.de/
 * 
 * 
 */
 
function standortService(serviceDomain) {

	var serviceURL = "http://" + serviceDomain;
	
	// Event observer
	Event.observe(window, 'load', appInit);
	
	function appInit() {
		loadStandortList();
	}
	
	// Load the standort select
	function loadStandortList() {
		var pars = 'action=gettuehstandortlist&lang=ger';
		var myAjax = new Ajax.Updater('standortListContainer', serviceURL + '/standortPage.tuv', 
		{
			method: 'post', 
			parameters: pars,
			asynchronous: false
		});
		
		Event.observe('btnSubmit', 'click', loadStandortPage);
		Event.observe('standortID', 'change', loadStandortPage);
	}
	
	// Load the standort HTML fragment
	function loadStandortPage() {
		if ($('standortID').selectedIndex == 0) {
			alert("Bitte wählen Sie einen Standort");
			return;
		}
		
		var pars = Form.serialize('frmStandort');
		$('standortPageContainer').innerHTML = "";
		
		var myAjax = new Ajax.Updater('standortPageContainer', serviceURL + '/standortPage.tuv', 
		{
			method: 'post', 
			parameters: pars
		});

	}
}
