// BrowserWeiche CSS-Select Start

this.ver=navigator.appVersion; 
    this.dom=document.getElementById?1:0 ;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;  
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5); 
    
// BrowserWeiche CSS-Select Ende

// Image-MouseOver Start

function start()
{	
	preload();	
}


//Navigation-Mouse-Over
function preload() 
{
	// check if there is a port in hostname...
	// perhaps we can find a better solution for this but for now it works...
	var path = location.host.toString().search(/:.+/);
	var pathelements = location.pathname.toString().split("/");
	var additionalFolder = "";
	
	if (path != -1)
	{	

		additionalFolder = "/" + pathelements[1];
	}
	
	 /* Die normalen Nav-gifs*/
	bilder = new Array();
	bilder[0]= additionalFolder + "/img/clear.gif";
	bilder[1]= additionalFolder + "/img/home_0.gif";
	bilder[2]= additionalFolder + "/de/img/about_0.gif";
	bilder[3]= additionalFolder + "/img/service_0.gif";
	bilder[4]= additionalFolder + "/de/img/partner_0.gif";
	bilder[5]= additionalFolder + "/img/faq_0.gif";
	bilder[6]= additionalFolder + "/de/img/kontakt_0.gif";
	bilder[7]= additionalFolder + "/img/mylms_0.gif";
	
	/* Die gehighlighteten Nav-gifs*/
	bilder[8]= additionalFolder + "/img/home_1.gif";
	bilder[9]= additionalFolder + "/de/img/about_1.gif";
	bilder[10]= additionalFolder + "/img/service_1.gif";
	bilder[11]= additionalFolder + "/de/img/partner_1.gif";
	bilder[12]= additionalFolder + "/img/faq_1.gif";
	bilder[13]= additionalFolder + "/de/img/kontakt_1.gif";
	bilder[14]= additionalFolder + "/img/mylms_1.gif";	
	
	im = new Array();
	for (var i = 0; i < bilder.length; i++)
	{
		im[i] = new Image();
		im[i].src = bilder[i];
	}
}

function hilite_mo(num,imgname) 
{

	//sometimes javascript errors occured based on undefined variable 'im'
	if (typeof(im) == "undefined")
	{
		preload();
	}
	if(1)
	{
		imsave = imgname.src;
		imgname.src = im[num].src;	
	}
}

function imgrestore(imgname) 
{
	if (1) 
	{	
		imgname.src = imsave ;		
	}	
}
// Image-MouseOver Ende

//functions for xmlhttp

function initXml()
{
 	try 
 	{
  		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} 
 	catch (e) 
 	{
  		try 
  		{
   			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  		} 
  		catch (E) 
  		{
   			xmlhttp = false;
  		}
 	}
	
	if (!xmlhttp && typeof XMLHttpRequest!="undefined") 
	{
  		xmlhttp = new XMLHttpRequest();
	}
}


function loadDestinationCreateBooking(name, sid)
{	
	if(name=="")
	{
		document.bookingForm["destinationAddress.title"][0].checked = false;
		document.bookingForm["destinationAddress.title"][1].checked = false;
		document.bookingForm["destinationAddress.firstName"].value = "";
		document.bookingForm["destinationAddress.lastName"].value = "";
		document.bookingForm["destinationAddress.company"].value = "";
		document.bookingForm["destinationAddress.street"].value = "";
		document.bookingForm["destinationAddress.streetNumber"].value = "";
		document.bookingForm["destinationAddress.addressInfo1"].value = "";
		document.bookingForm["destinationAddress.addressInfo2"].value = "";
		document.bookingForm["destinationAddress.zipCode"].value = "";
		document.bookingForm["destinationAddress.city"].value = "";
		document.bookingForm["destinationAddress.isoCountryCode"].value = "";
		if (document.bookingForm["destinationAddress.state"] != null)
			document.bookingForm["destinationAddress.state"].value = "";
		document.bookingForm["destinationAddress.phoneArea"].value = "";
		document.bookingForm["destinationAddress.phoneNumber"].value = "";
		document.bookingForm["destinationAddress.phoneState"].value = "";
		document.bookingForm["destinationAddress.faxArea"].value = "";
		document.bookingForm["destinationAddress.faxNumber"].value = "";
		document.bookingForm["destinationAddress.faxState"].value = "";
		document.bookingForm["destinationAddress.mobileArea"].value = "";
		document.bookingForm["destinationAddress.mobileNumber"].value = "";
		document.bookingForm["destinationAddress.mobileState"].value = "";
		document.bookingForm["destinationAddress.email"].value = "";
		document.bookingForm["destinationAddress.identifier"].value = "";
		document.bookingForm["destinationAddress.zipCode"].disabled = false;
	}
	else
	{
		initXml();
		if (document.bookingForm.dispatchType.value == "import") {
			xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + sid + "?method=pickup&name="+name,true);  //call server
		}
		else if (document.bookingForm.dispatchType.value == "j-importstandard") {
			xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + sid + "?method=pickup&name="+name,true);  //call server
		}else {
//			xmlhttp.open("GET", "/get.xmlhttp?method=destination&name="+name,true);  //call server
			xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + sid + "?method=destination&name=" +name,true);  //call server
		}
	 	xmlhttp.onreadystatechange=function()  //wait for answer
	 	{
	  		if (xmlhttp.readyState==4)   //answer received...
	  		{
				xmldoc = xmlhttp.responseXML;  // get answer in xml...
	
				//if we have an address with a coubntry that has states --> we have to go
				// into an action...
				if(xmldoc.getElementsByTagName('isoCountryCode')[0].hasChildNodes())
				{
					country = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
	 				if(country =='CA' || country =='US')
	 				{
	 					document.bookingForm.method.value = "loadDestinationAddress";
	 					document.bookingForm.submit();
	 				}
					document.bookingForm["destinationAddress.isoCountryCode"].value = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
					if(xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue == 'US')
					{
						document.bookingForm["destinationAddress.state"].disabled=false;
						document.getElementById("star").style.display="inline";
					}
					else if(xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue == 'CA')
					{
						document.bookingForm["destinationAddress.state"].disabled=false;
						document.getElementById("star").style.display="inline";
					}
					else
					{
						document.bookingForm["destinationAddress.state"].value="";
						document.bookingForm["destinationAddress.state"].disabled=true;
						document.getElementById("star").style.display="none";
					}
				}
	
				// test each element for existence, if empty --> set the field blank
				//                         	  element exists --> fill field with data...
	
				if(xmldoc.getElementsByTagName('title')[0].hasChildNodes())
				{
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Frau')
					{
						document.bookingForm["destinationAddress.title"][0].checked = true;
					}
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Herr')
					{
						document.bookingForm["destinationAddress.title"][1].checked = true;
					}
				}
				else
				{
					document.bookingForm["destinationAddress.title"][0].checked = false;
					document.bookingForm["destinationAddress.title"][1].checked = false;
				}
				if(xmldoc.getElementsByTagName('firstName')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.firstName"].value = xmldoc.getElementsByTagName('firstName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.firstName"].value = "";
				}			
				if(xmldoc.getElementsByTagName('lastName')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.lastName"].value = xmldoc.getElementsByTagName('lastName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.lastName"].value = "";
				}			
				if(xmldoc.getElementsByTagName('company')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.company"].value = xmldoc.getElementsByTagName('company')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.company"].value = "";
				}			
				if(xmldoc.getElementsByTagName('street')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.street"].value = xmldoc.getElementsByTagName('street')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.street"].value = "";
				}			
				if(xmldoc.getElementsByTagName('streetNumber')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.streetNumber"].value = xmldoc.getElementsByTagName('streetNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.streetNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('addressInfo1')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.addressInfo1"].value = xmldoc.getElementsByTagName('addressInfo1')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.addressInfo1"].value = "";
				}			
				if(xmldoc.getElementsByTagName('addressInfo2')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.addressInfo2"].value = xmldoc.getElementsByTagName('addressInfo2')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.addressInfo2"].value = "";
				}			
				if(xmldoc.getElementsByTagName('zipCode')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.zipCode"].value = xmldoc.getElementsByTagName('zipCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.zipCode"].value = "";
				}			
				if(xmldoc.getElementsByTagName('city')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.city"].value = xmldoc.getElementsByTagName('city')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.city"].value = "";
				}			
				if(xmldoc.getElementsByTagName('isoCountryCode')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.isoCountryCode"].value = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.isoCountryCode"].value = "";
				}			
				if(xmldoc.getElementsByTagName('state')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.state"].value = xmldoc.getElementsByTagName('state')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.state"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneArea')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.phoneArea"].value = xmldoc.getElementsByTagName('phoneArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.phoneArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneNumber')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.phoneNumber"].value = xmldoc.getElementsByTagName('phoneNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.phoneNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneState')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.phoneState"].value = xmldoc.getElementsByTagName('phoneState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.phoneState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxArea')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.faxArea"].value = xmldoc.getElementsByTagName('faxArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.faxArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxNumber')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.faxNumber"].value = xmldoc.getElementsByTagName('faxNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.faxNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxState')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.faxState"].value = xmldoc.getElementsByTagName('faxState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.faxState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileArea')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.mobileArea"].value = xmldoc.getElementsByTagName('mobileArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.mobileArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileNumber')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.mobileNumber"].value = xmldoc.getElementsByTagName('mobileNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.mobileNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileState')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.mobileState"].value = xmldoc.getElementsByTagName('mobileState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.mobileState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('email')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.email"].value = xmldoc.getElementsByTagName('email')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.email"].value = "";
				}			
				if(xmldoc.getElementsByTagName('identifier')[0].hasChildNodes())
				{
					document.bookingForm["destinationAddress.identifier"].value = xmldoc.getElementsByTagName('identifier')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["destinationAddress.identifier"].value = "";
				}			
	  			
	  			// test type of zipcode and disable field if necessary...
	  			if(xmldoc.getElementsByTagName('hasZipCode')[0].childNodes[0].nodeValue == 'true')
	  			{
	  				document.bookingForm["destinationAddress.zipCode"].disabled = false;
	  			}
	  			if(xmldoc.getElementsByTagName('hasZipCode')[0].childNodes[0].nodeValue == 'false')
	  			{
	  				document.bookingForm["destinationAddress.zipCode"].disabled = true;
	  			}
	  			//
		 		if(checkForPickupDatesStandardReload) {
		 			checkForPickupDatesStandardReload();
		 		}
	  		}
	 	}
 		xmlhttp.send(null);
 	}
}

function loadSenderAddress(name)
{	
	if(name=="")
	{
		document.senderAddressForm["sAddress.title"][0].checked = false;
		document.senderAddressForm["sAddress.title"][1].checked = false;
		document.senderAddressForm["sAddress.firstName"].value = "";
		document.senderAddressForm["sAddress.lastName"].value = "";
		document.senderAddressForm["sAddress.company"].value = "";
		document.senderAddressForm["sAddress.street"].value = "";
		document.senderAddressForm["sAddress.streetNumber"].value = "";
		document.senderAddressForm["sAddress.addressInfo1"].value = "";
		document.senderAddressForm["sAddress.addressInfo2"].value = "";
		document.senderAddressForm["sAddress.zipCode"].value = "";
		document.senderAddressForm["sAddress.city"].value = "";
		document.senderAddressForm["sAddress.isoCountryCode"].value = "";
		document.senderAddressForm["sAddress.state"].value = "";
		document.senderAddressForm["sAddress.phoneArea"].value = "";
		document.senderAddressForm["sAddress.phoneNumber"].value = "";
		document.senderAddressForm["sAddress.phoneState"].value = "";
		document.senderAddressForm["sAddress.faxArea"].value = "";
		document.senderAddressForm["sAddress.faxNumber"].value = "";
		document.senderAddressForm["sAddress.faxState"].value = "";
		document.senderAddressForm["sAddress.mobileArea"].value = "";
		document.senderAddressForm["sAddress.mobileNumber"].value = "";
		document.senderAddressForm["sAddress.mobileState"].value = "";
		document.senderAddressForm["sAddress.email"].value = "";
		document.senderAddressForm["sAddress.identifier"].value = "";
		document.senderAddressForm["sAddress.taxCode"].value = "";
		document.senderAddressForm["sAddress.costCentre"].value = "";
		document.senderAddressForm["sAddress.zipCode"].disabled = false;
	}
	else
	{
		initXml();
//		xmlhttp.open("GET", "/get.xmlhttp?method=sender&name="+name,true);  //call server
		xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + "?method=sender&name=" +name,true);  //call server
	 	xmlhttp.onreadystatechange=function()  //wait for answer
	 	{
	  		if (xmlhttp.readyState==4)   //answer received...
	  		{
				xmldoc = xmlhttp.responseXML;  // get answer in xml...
	
				// test each element for existence, if empty --> set the field blank
				//                         	  element exists --> fill field with data...
	
				if(xmldoc.getElementsByTagName('title')[0].hasChildNodes())
				{
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Frau')
					{
						document.senderAddressForm["sAddress.title"][0].checked = true;
					}
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Herr')
					{
						document.senderAddressForm["sAddress.title"][1].checked = true;
					}
				}
				else
				{
					document.senderAddressForm["sAddress.title"][0].checked = false;
					document.senderAddressForm["sAddress.title"][1].checked = false;
				}
				if(xmldoc.getElementsByTagName('firstName')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.firstName"].value = xmldoc.getElementsByTagName('firstName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.firstName"].value = "";
				}			
				if(xmldoc.getElementsByTagName('lastName')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.lastName"].value = xmldoc.getElementsByTagName('lastName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.lastName"].value = "";
				}			
				if(xmldoc.getElementsByTagName('company')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.company"].value = xmldoc.getElementsByTagName('company')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.company"].value = "";
				}			
				if(xmldoc.getElementsByTagName('street')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.street"].value = xmldoc.getElementsByTagName('street')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.street"].value = "";
				}			
				if(xmldoc.getElementsByTagName('streetNumber')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.streetNumber"].value = xmldoc.getElementsByTagName('streetNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.streetNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('addressInfo1')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.addressInfo1"].value = xmldoc.getElementsByTagName('addressInfo1')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.addressInfo1"].value = "";
				}			
				if(xmldoc.getElementsByTagName('addressInfo2')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.addressInfo2"].value = xmldoc.getElementsByTagName('addressInfo2')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.addressInfo2"].value = "";
				}			
				if(xmldoc.getElementsByTagName('zipCode')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.zipCode"].value = xmldoc.getElementsByTagName('zipCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.zipCode"].value = "";
				}			
				if(xmldoc.getElementsByTagName('city')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.city"].value = xmldoc.getElementsByTagName('city')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.city"].value = "";
				}			
				if(xmldoc.getElementsByTagName('isoCountryCode')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.isoCountryCode"].value = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.isoCountryCode"].value = "";
				}			
				if(xmldoc.getElementsByTagName('state')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.state"].value = xmldoc.getElementsByTagName('state')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.state"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneArea')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.phoneArea"].value = xmldoc.getElementsByTagName('phoneArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.phoneArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneNumber')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.phoneNumber"].value = xmldoc.getElementsByTagName('phoneNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.phoneNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneState')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.phoneState"].value = xmldoc.getElementsByTagName('phoneState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.phoneState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxArea')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.faxArea"].value = xmldoc.getElementsByTagName('faxArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.faxArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxNumber')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.faxNumber"].value = xmldoc.getElementsByTagName('faxNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.faxNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxState')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.faxState"].value = xmldoc.getElementsByTagName('faxState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.faxState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileArea')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.mobileArea"].value = xmldoc.getElementsByTagName('mobileArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.mobileArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileNumber')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.mobileNumber"].value = xmldoc.getElementsByTagName('mobileNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.mobileNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileState')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.mobileState"].value = xmldoc.getElementsByTagName('mobileState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.mobileState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('email')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.email"].value = xmldoc.getElementsByTagName('email')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.email"].value = "";
				}			
				if(xmldoc.getElementsByTagName('identifier')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.identifier"].value = xmldoc.getElementsByTagName('identifier')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.identifier"].value = "";
				}			
				if(xmldoc.getElementsByTagName('taxCode')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.taxCode"].value = xmldoc.getElementsByTagName('taxCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.taxCode"].value = "";
				}			
				if(xmldoc.getElementsByTagName('costCentre')[0].hasChildNodes())
				{
					document.senderAddressForm["sAddress.costCentre"].value = xmldoc.getElementsByTagName('costCentre')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.senderAddressForm["sAddress.costCentre"].value = "";
				}			
	  			
	  			// test type of zipcode and disable field if necessary...
	  			if(xmldoc.getElementsByTagName('hasZipCode')[0].childNodes[0].nodeValue == 'true')
	  			{
	  				document.senderAddressForm["sAddress.zipCode"].disabled = false;
	  			}
	  			if(xmldoc.getElementsByTagName('hasZipCode')[0].childNodes[0].nodeValue == 'false')
	  			{
	  				document.senderAddressForm["sAddress.zipCode"].disabled = true;
	  			}
	  		}
	 	}
	 	xmlhttp.send(null);
	}
}


function loadPickUpCreateBooking(name, sid)
{
	if(name=="")
	{
		document.bookingForm["pickUpAddress.title"][0].checked = false;
		document.bookingForm["pickUpAddress.title"][1].checked = false;
		document.bookingForm["pickUpAddress.firstName"].value = "";
		document.bookingForm["pickUpAddress.lastName"].value = "";
		document.bookingForm["pickUpAddress.company"].value = "";
		document.bookingForm["pickUpAddress.street"].value = "";
		document.bookingForm["pickUpAddress.streetNumber"].value = "";
		document.bookingForm["pickUpAddress.addressInfo1"].value = "";
		document.bookingForm["pickUpAddress.addressInfo2"].value = "";
		document.bookingForm["pickUpAddress.zipCode"].value = "";
		document.bookingForm["pickUpAddress.city"].value = "";
		document.bookingForm["pickUpAddress.isoCountryCode"].value = "";
		document.bookingForm["pickUpAddress.phoneArea"].value = "";
		document.bookingForm["pickUpAddress.phoneNumber"].value = "";
		document.bookingForm["pickUpAddress.phoneState"].value = "";
		document.bookingForm["pickUpAddress.faxArea"].value = "";
		document.bookingForm["pickUpAddress.faxNumber"].value = "";
		document.bookingForm["pickUpAddress.faxState"].value = "";
		document.bookingForm["pickUpAddress.mobileArea"].value = "";
		document.bookingForm["pickUpAddress.mobileNumber"].value = "";
		document.bookingForm["pickUpAddress.mobileState"].value = "";
		document.bookingForm["pickUpAddress.email"].value = "";
		document.bookingForm["pickUpAddress.identifier"].value = "";
		document.bookingForm["pickUpAddress.zipCode"].disabled = false;
	}
	else
	{
		initXml();
		if (document.bookingForm.dispatchType.value=="import") {
//			xmlhttp.open("GET", "/get.xmlhttp?method=destination&name="+name,true);
			xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + sid + "?method=destination&name=" +name,true);  //call server
		}
		else if (document.bookingForm.dispatchType.value=="j-importstandard") {
//			xmlhttp.open("GET", "/get.xmlhttp?method=destination&name="+name,true);
			xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + sid + "?method=destination&name=" +name,true);  //call server
		}else {
//			xmlhttp.open("GET", "/get.xmlhttp?method=pickup&name="+name,true);
			xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + sid + "?method=pickup&name="+name,true);  //call server
		}
	 	xmlhttp.onreadystatechange=function() 
	 	{
	  		if (xmlhttp.readyState==4) 
	  		{
				xmldoc = xmlhttp.responseXML;
				if(xmldoc.getElementsByTagName('isoCountryCode')[0].hasChildNodes())
				{
					country = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
	 				if(country =='CA' || country =='US')
	 				{
	 					document.bookingForm.method.value = "loadPickUpAddress";
	 					document.bookingForm.submit();
	 				}
					document.bookingForm["pickUpAddress.isoCountryCode"].value = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
					if(xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue == 'US')
					{
						document.bookingForm["pickUpAddress.state"].disabled=false;
						document.getElementById("star").style.display="inline";
					}
					else if(xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue == 'CA')
					{
						document.bookingForm["pickUpAddress.state"].disabled=false;
						document.getElementById("star").style.display="inline";
					}
					else
					{
						document.bookingForm["pickUpAddress.state"].value="";
						document.bookingForm["pickUpAddress.state"].disabled=true;
						document.getElementById("star").style.display="none";
					}
				}
				if(xmldoc.getElementsByTagName('title')[0].hasChildNodes())
				{
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Frau')
					{
						document.bookingForm["pickUpAddress.title"][0].checked = true;
					}
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Herr')
					{
						document.bookingForm["pickUpAddress.title"][1].checked = true;
					}
				}
				else
				{
					document.bookingForm["pickUpAddress.title"][0].checked = false;
					document.bookingForm["pickUpAddress.title"][1].checked = false;
				}
				if(xmldoc.getElementsByTagName('firstName')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.firstName"].value = xmldoc.getElementsByTagName('firstName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.firstName"].value = "";
				}
				if(xmldoc.getElementsByTagName('lastName')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.lastName"].value = xmldoc.getElementsByTagName('lastName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.lastName"].value = "";
				}
				if(xmldoc.getElementsByTagName('company')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.company"].value = xmldoc.getElementsByTagName('company')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.company"].value = "";
				}
				if(xmldoc.getElementsByTagName('street')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.street"].value = xmldoc.getElementsByTagName('street')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.street"].value = "";
				}
				if(xmldoc.getElementsByTagName('streetNumber')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.streetNumber"].value = xmldoc.getElementsByTagName('streetNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.streetNumber"].value = "";
				}
				if(xmldoc.getElementsByTagName('addressInfo1')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.addressInfo1"].value = xmldoc.getElementsByTagName('addressInfo1')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.addressInfo1"].value = "";
				}
				if(xmldoc.getElementsByTagName('addressInfo2')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.addressInfo2"].value = xmldoc.getElementsByTagName('addressInfo2')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.addressInfo2"].value = "";
				}
				if(xmldoc.getElementsByTagName('zipCode')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.zipCode"].value = xmldoc.getElementsByTagName('zipCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.zipCode"].value = "";
				}
				if(xmldoc.getElementsByTagName('city')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.city"].value = xmldoc.getElementsByTagName('city')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.city"].value = "";
				}
				if(xmldoc.getElementsByTagName('isoCountryCode')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.isoCountryCode"].value = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.isoCountryCode"].value = "";
				}
				if(xmldoc.getElementsByTagName('phoneArea')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.phoneArea"].value = xmldoc.getElementsByTagName('phoneArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.phoneArea"].value = "";
				}
				if(xmldoc.getElementsByTagName('phoneNumber')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.phoneNumber"].value = xmldoc.getElementsByTagName('phoneNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.phoneNumber"].value = "";
				}
				if(xmldoc.getElementsByTagName('phoneState')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.phoneState"].value = xmldoc.getElementsByTagName('phoneState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.phoneState"].value = "";
				}
				if(xmldoc.getElementsByTagName('faxArea')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.faxArea"].value = xmldoc.getElementsByTagName('faxArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.faxArea"].value = "";
				}
				if(xmldoc.getElementsByTagName('faxNumber')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.faxNumber"].value = xmldoc.getElementsByTagName('faxNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.faxNumber"].value = "";
				}
				if(xmldoc.getElementsByTagName('faxState')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.faxState"].value = xmldoc.getElementsByTagName('faxState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.faxState"].value = "";
				}
				if(xmldoc.getElementsByTagName('mobileArea')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.mobileArea"].value = xmldoc.getElementsByTagName('mobileArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.mobileArea"].value = "";
				}
				if(xmldoc.getElementsByTagName('mobileNumber')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.mobileNumber"].value = xmldoc.getElementsByTagName('mobileNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.mobileNumber"].value = "";
				}
				if(xmldoc.getElementsByTagName('mobileState')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.mobileState"].value = xmldoc.getElementsByTagName('mobileState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.mobileState"].value = "";
				}
				if(xmldoc.getElementsByTagName('email')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.email"].value = xmldoc.getElementsByTagName('email')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["pickUpAddress.email"].value = "";
				}
				if(xmldoc.getElementsByTagName('identifier')[0].hasChildNodes())
				{
					document.bookingForm["pickUpAddress.identifier"].value = xmldoc.getElementsByTagName('identifier')[0].childNodes[0].nodeValue;
	  			}
				else
				{
					document.bookingForm["pickUpAddress.identifier"].value = "";
				}
	  		}
	 	}
	 	xmlhttp.send(null);
	}
}


function loadPickUp(name, sid)
{	
	if(name=="")
	{
		document.pickupAddressForm["pickUpAddress.title"][0].checked = false;
		document.pickupAddressForm["pickUpAddress.title"][1].checked = false;
		document.pickupAddressForm["pickUpAddress.firstName"].value = "";
		document.pickupAddressForm["pickUpAddress.lastName"].value = "";
		document.pickupAddressForm["pickUpAddress.company"].value = "";
		document.pickupAddressForm["pickUpAddress.street"].value = "";
		document.pickupAddressForm["pickUpAddress.streetNumber"].value = "";
		document.pickupAddressForm["pickUpAddress.addressInfo1"].value = "";
		document.pickupAddressForm["pickUpAddress.addressInfo2"].value = "";
		document.pickupAddressForm["pickUpAddress.zipCode"].value = "";
		document.pickupAddressForm["pickUpAddress.city"].value = "";
		document.pickupAddressForm["pickUpAddress.isoCountryCode"].value = "";
		document.pickupAddressForm["pickUpAddress.phoneArea"].value = "";
		document.pickupAddressForm["pickUpAddress.phoneNumber"].value = "";
		document.pickupAddressForm["pickUpAddress.phoneState"].value = "";
		document.pickupAddressForm["pickUpAddress.faxArea"].value = "";
		document.pickupAddressForm["pickUpAddress.faxNumber"].value = "";
		document.pickupAddressForm["pickUpAddress.faxState"].value = "";
		document.pickupAddressForm["pickUpAddress.mobileArea"].value = "";
		document.pickupAddressForm["pickUpAddress.mobileNumber"].value = "";
		document.pickupAddressForm["pickUpAddress.mobileState"].value = "";
		document.pickupAddressForm["pickUpAddress.email"].value = "";
		document.pickupAddressForm["pickUpAddress.identifier"].value = "";
		document.pickupAddressForm["pickUpAddress.zipCode"].disabled = false;
	}
	else
	{
		initXml();
//		xmlhttp.open("GET", "/get.xmlhttp?method=pickup&name="+name,true);
		xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + sid + "?method=pickup&name=" +name,true);  //call server
	 	xmlhttp.onreadystatechange=function() 
	 	{
	  		if (xmlhttp.readyState==4) 
	  		{
				xmldoc = xmlhttp.responseXML;
				if(xmldoc.getElementsByTagName('title')[0].hasChildNodes())
				{
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Frau')
					{
						document.pickupAddressForm["pickUpAddress.title"][0].checked = true;
					}
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Herr')
					{
						document.pickupAddressForm["pickUpAddress.title"][1].checked = true;
					}
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.title"][0].checked = false;
					document.pickupAddressForm["pickUpAddress.title"][1].checked = false;
				}
				if(xmldoc.getElementsByTagName('firstName')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.firstName"].value = xmldoc.getElementsByTagName('firstName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.firstName"].value = "";
				}
				if(xmldoc.getElementsByTagName('lastName')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.lastName"].value = xmldoc.getElementsByTagName('lastName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.lastName"].value = "";
				}
				if(xmldoc.getElementsByTagName('company')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.company"].value = xmldoc.getElementsByTagName('company')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.company"].value = "";
				}
				if(xmldoc.getElementsByTagName('street')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.street"].value = xmldoc.getElementsByTagName('street')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.street"].value = "";
				}
				if(xmldoc.getElementsByTagName('streetNumber')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.streetNumber"].value = xmldoc.getElementsByTagName('streetNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.streetNumber"].value = "";
				}
				if(xmldoc.getElementsByTagName('addressInfo1')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.addressInfo1"].value = xmldoc.getElementsByTagName('addressInfo1')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.addressInfo1"].value = "";
				}
				if(xmldoc.getElementsByTagName('addressInfo2')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.addressInfo2"].value = xmldoc.getElementsByTagName('addressInfo2')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.addressInfo2"].value = "";
				}
				if(xmldoc.getElementsByTagName('zipCode')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.zipCode"].value = xmldoc.getElementsByTagName('zipCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.zipCode"].value = "";
				}
				if(xmldoc.getElementsByTagName('city')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.city"].value = xmldoc.getElementsByTagName('city')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.city"].value = "";
				}
				if(xmldoc.getElementsByTagName('isoCountryCode')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.isoCountryCode"].value = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.isoCountryCode"].value = "";
				}
				if(xmldoc.getElementsByTagName('phoneArea')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.phoneArea"].value = xmldoc.getElementsByTagName('phoneArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.phoneArea"].value = "";
				}
				if(xmldoc.getElementsByTagName('phoneNumber')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.phoneNumber"].value = xmldoc.getElementsByTagName('phoneNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.phoneNumber"].value = "";
				}
				if(xmldoc.getElementsByTagName('phoneState')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.phoneState"].value = xmldoc.getElementsByTagName('phoneState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.phoneState"].value = "";
				}
				if(xmldoc.getElementsByTagName('faxArea')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.faxArea"].value = xmldoc.getElementsByTagName('faxArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.faxArea"].value = "";
				}
				if(xmldoc.getElementsByTagName('faxNumber')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.faxNumber"].value = xmldoc.getElementsByTagName('faxNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.faxNumber"].value = "";
				}
				if(xmldoc.getElementsByTagName('faxState')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.faxState"].value = xmldoc.getElementsByTagName('faxState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.faxState"].value = "";
				}
				if(xmldoc.getElementsByTagName('mobileArea')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.mobileArea"].value = xmldoc.getElementsByTagName('mobileArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.mobileArea"].value = "";
				}
				if(xmldoc.getElementsByTagName('mobileNumber')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.mobileNumber"].value = xmldoc.getElementsByTagName('mobileNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.mobileNumber"].value = "";
				}
				if(xmldoc.getElementsByTagName('mobileState')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.mobileState"].value = xmldoc.getElementsByTagName('mobileState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.mobileState"].value = "";
				}
				if(xmldoc.getElementsByTagName('email')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.email"].value = xmldoc.getElementsByTagName('email')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.pickupAddressForm["pickUpAddress.email"].value = "";
				}
				if(xmldoc.getElementsByTagName('identifier')[0].hasChildNodes())
				{
					document.pickupAddressForm["pickUpAddress.identifier"].value = xmldoc.getElementsByTagName('identifier')[0].childNodes[0].nodeValue;
	  			}
				else
				{
					document.pickupAddressForm["pickUpAddress.identifier"].value = "";
				}
			}
	 	}
	 	xmlhttp.send(null);
	}
}

function loadDestination(name, sid)
{	
	if(name=="")
	{
		document.recipientAddressForm["destinationAddress.title"][0].checked = false;
		document.recipientAddressForm["destinationAddress.title"][1].checked = false;
		document.recipientAddressForm["destinationAddress.firstName"].value = "";
		document.recipientAddressForm["destinationAddress.lastName"].value = "";
		document.recipientAddressForm["destinationAddress.company"].value = "";
		document.recipientAddressForm["destinationAddress.street"].value = "";
		document.recipientAddressForm["destinationAddress.streetNumber"].value = "";
		document.recipientAddressForm["destinationAddress.addressInfo1"].value = "";
		document.recipientAddressForm["destinationAddress.addressInfo2"].value = "";
		document.recipientAddressForm["destinationAddress.zipCode"].value = "";
		document.recipientAddressForm["destinationAddress.city"].value = "";
		document.recipientAddressForm["destinationAddress.isoCountryCode"].value = "";
		document.recipientAddressForm["destinationAddress.state"].value = "";
		document.recipientAddressForm["destinationAddress.phoneArea"].value = "";
		document.recipientAddressForm["destinationAddress.phoneNumber"].value = "";
		document.recipientAddressForm["destinationAddress.phoneState"].value = "";
		document.recipientAddressForm["destinationAddress.faxArea"].value = "";
		document.recipientAddressForm["destinationAddress.faxNumber"].value = "";
		document.recipientAddressForm["destinationAddress.faxState"].value = "";
		document.recipientAddressForm["destinationAddress.mobileArea"].value = "";
		document.recipientAddressForm["destinationAddress.mobileNumber"].value = "";
		document.recipientAddressForm["destinationAddress.mobileState"].value = "";
		document.recipientAddressForm["destinationAddress.email"].value = "";
		document.recipientAddressForm["destinationAddress.identifier"].value = "";
		document.recipientAddressForm["destinationAddress.identifier"].value = "";
		document.recipientAddressForm["destinationAddress.identifier"].value = "";
		document.recipientAddressForm["destinationAddress.zipCode"].disabled = false;
	}
	else
	{
		initXml();
//		xmlhttp.open("GET", "/get.xmlhttp?method=destination&name="+name,true);
		xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + sid + "?method=destination&name=" +name,true);  //call server
	 	xmlhttp.onreadystatechange=function() 
	 	{
	  		if (xmlhttp.readyState==4) 
	  		{
				xmldoc = xmlhttp.responseXML;
				
				if(xmldoc.getElementsByTagName('isoCountryCode')[0].hasChildNodes())
				{
					country = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
	 				if(country =='CA' || country =='US')
	 				{
	 					location.href=document.addform.currpage.value + ";jsessionid=" + sid + "?method=loadAddressWithState&id=" + name;
//			 			location.href="/bin/mylms/recipientAddress;jsessionid=" + sid + "?method=loadAddressWithState&id=" + name;
	 					return;
	 				}
					document.recipientAddressForm["destinationAddress.isoCountryCode"].value = xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue;
					if(xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue == 'US')
					{
						document.recipientAddressForm["destinationAddress.state"].disabled=false;
						document.getElementById("star").style.display="inline";
					}
					else if(xmldoc.getElementsByTagName('isoCountryCode')[0].childNodes[0].nodeValue == 'CA')
					{
						document.recipientAddressForm["destinationAddress.state"].disabled=false;
						document.getElementById("star").style.display="inline";
					}
					else
					{
						document.recipientAddressForm["destinationAddress.state"].value="";
						document.recipientAddressForm["destinationAddress.state"].disabled=true;
						document.getElementById("star").style.display="none";
					}
				}
				else
				{
					document.recipientAddressForm["destinationAddress.isoCountryCode"].value = "";
				}			
				
				if(xmldoc.getElementsByTagName('title')[0].hasChildNodes())
				{
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Frau')
					{
						document.recipientAddressForm["destinationAddress.title"][0].checked = true;
					}
					if(xmldoc.getElementsByTagName('title')[0].childNodes[0].nodeValue == 'Herr')
					{
						document.recipientAddressForm["destinationAddress.title"][1].checked = true;
					}
				}
				else
				{
					document.recipientAddressForm["destinationAddress.title"][0].checked = false;
					document.recipientAddressForm["destinationAddress.title"][1].checked = false;
				}
				if(xmldoc.getElementsByTagName('firstName')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.firstName"].value = xmldoc.getElementsByTagName('firstName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.firstName"].value = "";
				}			
				if(xmldoc.getElementsByTagName('lastName')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.lastName"].value = xmldoc.getElementsByTagName('lastName')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.lastName"].value = "";
				}			
				if(xmldoc.getElementsByTagName('company')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.company"].value = xmldoc.getElementsByTagName('company')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.company"].value = "";
				}			
				if(xmldoc.getElementsByTagName('street')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.street"].value = xmldoc.getElementsByTagName('street')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.street"].value = "";
				}			
				if(xmldoc.getElementsByTagName('streetNumber')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.streetNumber"].value = xmldoc.getElementsByTagName('streetNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.streetNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('addressInfo1')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.addressInfo1"].value = xmldoc.getElementsByTagName('addressInfo1')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.addressInfo1"].value = "";
				}			
				if(xmldoc.getElementsByTagName('addressInfo2')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.addressInfo2"].value = xmldoc.getElementsByTagName('addressInfo2')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.addressInfo2"].value = "";
				}			
				if(xmldoc.getElementsByTagName('zipCode')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.zipCode"].value = xmldoc.getElementsByTagName('zipCode')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.zipCode"].value = "";
				}			
				if(xmldoc.getElementsByTagName('city')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.city"].value = xmldoc.getElementsByTagName('city')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.city"].value = "";
				}			
				if(xmldoc.getElementsByTagName('state')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.state"].value = xmldoc.getElementsByTagName('state')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.state"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneArea')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.phoneArea"].value = xmldoc.getElementsByTagName('phoneArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.phoneArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneNumber')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.phoneNumber"].value = xmldoc.getElementsByTagName('phoneNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.phoneNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('phoneState')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.phoneState"].value = xmldoc.getElementsByTagName('phoneState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.phoneState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxArea')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.faxArea"].value = xmldoc.getElementsByTagName('faxArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.faxArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxNumber')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.faxNumber"].value = xmldoc.getElementsByTagName('faxNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.faxNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('faxState')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.faxState"].value = xmldoc.getElementsByTagName('faxState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.faxState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileArea')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.mobileArea"].value = xmldoc.getElementsByTagName('mobileArea')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.mobileArea"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileNumber')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.mobileNumber"].value = xmldoc.getElementsByTagName('mobileNumber')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.mobileNumber"].value = "";
				}			
				if(xmldoc.getElementsByTagName('mobileState')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.mobileState"].value = xmldoc.getElementsByTagName('mobileState')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.mobileState"].value = "";
				}			
				if(xmldoc.getElementsByTagName('email')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.email"].value = xmldoc.getElementsByTagName('email')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.email"].value = "";
				}
				if(xmldoc.getElementsByTagName('identifier')[0].hasChildNodes())
				{
					document.recipientAddressForm["destinationAddress.identifier"].value = xmldoc.getElementsByTagName('identifier')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.recipientAddressForm["destinationAddress.identifier"].value = "";
				}			
	  			if(xmldoc.getElementsByTagName('hasZipCode')[0].childNodes[0].nodeValue == 'true')
	  			{
	  				document.recipientAddressForm["destinationAddress.zipCode"].disabled = false;
	  			}
	  			if(xmldoc.getElementsByTagName('hasZipCode')[0].childNodes[0].nodeValue == 'false')
	  			{
	  				document.recipientAddressForm["destinationAddress.zipCode"].disabled = true;
	  			}
	  		}
	 	}
	 	xmlhttp.send(null);
	}
}



function loadParcelName(name,i)
{	
  if(name=="")
	{
		

		document.bookingForm["packages["+i+"].strLength"].value = "0";
		document.bookingForm["packages["+i+"].strWidth"].value = "0";
		document.bookingForm["packages["+i+"].strHeight"].value = "0";
		document.bookingForm["packages["+i+"].stWeight"].value = "0";
		document.bookingForm["packages["+i+"].quantity"].value = "1";
		document.bookingForm["packages["+i+"].packageName"].value = "";
		
	}
	else
	{
		initXml();
		
//		xmlhttp.open("GET", "/get.xmlhttp?method=packageInformation&name="+name+"&id="+i,true);
		xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + i + "?method=packageInformation&name="+name+"&id="+i,true);
	 	xmlhttp.onreadystatechange=function() 
	 	{
	  		if (xmlhttp.readyState==4) 
	  		{
				xmldoc = xmlhttp.responseXML;
				
				if(xmldoc.getElementsByTagName('strLength')[0].hasChildNodes())
				{
					document.bookingForm["packages["+i+"].strLength"].value = xmldoc.getElementsByTagName('strLength')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["packages["+i+"].strLength"].value =""
				}
				
				if(xmldoc.getElementsByTagName('strWidth')[0].hasChildNodes())
				{
					document.bookingForm["packages["+i+"].strWidth"].value = xmldoc.getElementsByTagName('strWidth')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["packages["+i+"].strWidth"].value =""
				}
				
				if(xmldoc.getElementsByTagName('strHeight')[0].hasChildNodes())
				{
					document.bookingForm["packages["+i+"].strHeight"].value = xmldoc.getElementsByTagName('strHeight')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["packages["+i+"].height"].value =""
				}
				
				if(xmldoc.getElementsByTagName('stWeight')[0].hasChildNodes())
				{
					document.bookingForm["packages["+i+"].stWeight"].value = xmldoc.getElementsByTagName('stWeight')[0].childNodes[0].nodeValue;
				}
				else
				{
					document.bookingForm["packages["+i+"].stWeight"].value =""
				}
				
				
				
				
				
							
				
	  		}
	 	}
	 	xmlhttp.send(null);
	}
}

function loadDestinationCountryPhoneCode(isocountrycode)
{	
	initXml();
	xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + "?method=countryIsoCode&isoCountryCode=" +isocountrycode,true);  //call server
 	xmlhttp.onreadystatechange=function() 
 	{
  		if (xmlhttp.readyState==4) 
  		{
			xmldoc = xmlhttp.responseXML;
			
			if(xmldoc.getElementsByTagName('phoneState')[0].hasChildNodes())
			{
				document.bookingForm["destinationAddress.phoneState"].value = xmldoc.getElementsByTagName('phoneState')[0].childNodes[0].nodeValue;
			}
			else
			{
				document.bookingForm["destinationAddress.phoneState"].value = "";
			}			
  		}
 	}
 	xmlhttp.send(null);	
}

function loadDestinationCountryPhoneCode2(isocountrycode)
{	
	initXml();
	
	xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + "?method=countryIsoCode&isoCountryCode=" +isocountrycode,true);
 	xmlhttp.onreadystatechange=function() 
 	{
  		if (xmlhttp.readyState==4) 
  		{
			xmldoc = xmlhttp.responseXML;
			if(xmldoc.getElementsByTagName('phoneState')[0].hasChildNodes())
			{
				document.recipientAddressForm["destinationAddress.phoneState"].value = xmldoc.getElementsByTagName('phoneState')[0].childNodes[0].nodeValue;				
			}
			else
			{
				document.recipientAddressForm["destinationAddress.phoneState"].value = "";
			}			
  		}
 	}
 	xmlhttp.send(null);	
}

function loadPickupCountryPhoneCode(isocountrycode)
{	
	initXml();
	
	xmlhttp.open("GET", document.addform.srvlt.value + ";jsessionid=" + "?method=countryIsoCode&isoCountryCode=" +isocountrycode,true);
 	xmlhttp.onreadystatechange=function() 
 	{
  		if (xmlhttp.readyState==4) 
  		{
			xmldoc = xmlhttp.responseXML;
			
			if(xmldoc.getElementsByTagName('phoneState')[0].hasChildNodes())
			{
				document.bookingForm["pickUpAddress.phoneState"].value = xmldoc.getElementsByTagName('phoneState')[0].childNodes[0].nodeValue;
			}
			else
			{
				document.bookingForm["pickUpAddress.phoneState"].value = "";
			}			
  		}
 	}
 	xmlhttp.send(null);
	
}

function popupPage()
{
	var page = document.confirmform.confpopup.value;
	
	windowprops = "width=350,height=100,locationbar=no," +
 	"scrollbars=no,menubars=no,toolbars=no,resizable=no,dependent=yes,status=no,top=400,left=400";

	window.open(page, "", windowprops);
}

function popupPageProForma()
{
	var	invoiceGenerated = document.proFormaForm.invoiceGenerated.value;
	
//	var page = "/de/mylms/proFormaConfirm2.jsp";
	var page = document.confform2.invgenerated.value;

	windowprops = "width=350,height=100,locationbar=no," +
 	"scrollbars=no,menubars=no,toolbars=no,resizable=no,dependent=yes,status=no,top=400,left=400";

	if (invoiceGenerated == "false")
	{
		window.open(page, "", windowprops);
	}
	else
	{
//		this.location.href = '/bin/mylms/createBooking';
		this.location.href = document.confform2.invnotgenerated.value;
	}
}

function popupHome()
{
	var page = document.priceComparisonForm.confpopup.value;
	
	windowprops = "width=380,height=300,locationbar=no," +
 	"scrollbars=no,menubars=no,toolbars=no,resizable=no,dependent=yes,status=no,top=400,left=400";

	window.open(page, "", windowprops);
}

function popupHomeCH()
{
	var page = document.loginForm.confpopup.value;
	
	windowprops = "width=350,height=250,locationbar=no," +
 	"scrollbars=no,menubars=no,toolbars=no,resizable=no,dependent=yes,status=no,top=400,left=400";

	window.open(page, "", windowprops);
}





