// 1. HIER GAR NICHTS MACHEN //=============================================================== // XML REQUEST //============================================================== function initXMLHttpRequest() { // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { // branch for IE/Windows ActiveX version req = new ActiveXObject("Microsoft.XMLHTTP"); } return(req); } function makeCustomHandlerForObject(reqString, targetObjectString, returnProperty) { out = "var xmlOutput = processReadyStateChange(window[\"" + reqString + "\"],\"" + returnProperty + "\");"; out = out + "if ( ! (typeof(xmlOutput) == \"string\" && xmlOutput == \"\") ) {" + targetObjectString + "= xmlOutput; window[\"" + reqString +"\"] = null;}"; return out; } function makeCustomHandlerForFunction(reqString, targetObjectString, returnProperty) { out = "var xmlOutput = processReadyStateChange(window[\"" + reqString + "\"],\"" + returnProperty + "\");"; out = out + "if ( ! (typeof(xmlOutput) == \"string\" && xmlOutput == \"\") ) {" + targetObjectString.substr(0,targetObjectString.length - 1) + ",xmlOutput); window[\"" + reqString +"\"] = null;}"; return out; } function loadXMLDoc(url, reqIndex, target,property) { req = window[reqIndex]; if (target.substr(target.length-1,1) == ")") { req.onreadystatechange = new Function( makeCustomHandlerForFunction(reqIndex,target,property) ); } else { req.onreadystatechange = new Function( makeCustomHandlerForObject(reqIndex,target,property) ); } req.open("GET", url, true); if (window.XMLHttpRequest) { req.send(null); } else { req.send(); } } function processReadyStateChange(req, property) { // only if req shows "complete" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { return req[property]; } else { alert("There was a problem retrieving the RSS feed\n" + req.statusText) } } return ""; } var reqNum = 0; function getXMLText(source, target) { var reqIndex = "req" + (++reqNum); window[reqIndex] = initXMLHttpRequest(); loadXMLDoc(source, reqIndex, target, "responseText"); } function getXMLDoc(source, target) { var reqIndex = "req" + (++reqNum); window[reqIndex] = initXMLHttpRequest(); loadXMLDoc(source, reqIndex, target, "responseXML"); } function getFirstElement(node,elementName) { child = node.firstChild; while ( child != null ) { if (child.nodeType == 1) { if ( child.nodeName == elementName) { return child; } } child = child.nextSibling; } return null; } function getLastElement(node,elementName) { child = node.lastChild; while ( child != null ) { if (child.nodeType == 1) { if ( child.nodeName == elementName) { return child; } } child = child.previousSibling; } return null; } function getNthElement(node, elementName, n) { foundCount = 0; child = node.firstChild; while (child != null) { if (child.nodeType == 1) { if (child.nodeName == elementName) { foundCount = foundCount + 1; if (foundCount == n) { return child; } } } child = child.nextSibling; } return null; } function getElementText(node) { if (node == null) { return(""); } child = node.firstChild; foundCDATA = false; foundPlainText = false; while (child != null) { if (child.nodeType == 4) { // CDATA node result = child.nodeValue; foundCDATA = true; } else { if (child.nodeType == 3) { // Text node result = child.nodeValue; foundPlainText = true; } } if (foundCDATA == true) { return result } child = child.nextSibling } if (foundPlainText == false) { return("") } return result; } //##################################################################################################### // 2. HIER WERDEN DIE SPALTENINFOS GELESEN //=============================================================== function parseXML(issue, xmlDoc) { if (typeof(xmlDoc) != "object") { return; } //########################################################################## //### WRITE DATA ########################################################## entries = xmlDoc.documentElement; entry = getFirstElement(entries,"viewentry"); entryCount = 1; while ( entry != null ) { // user userEntry = getFirstElement(entry,"entrydata", 1); userEl = getFirstElement(userEntry,"text"); userText = getElementText(userEl); // from - till information fromTillEntry = getNthElement(entry,"entrydata",2); fromTillEl = getFirstElement(fromTillEntry,"text"); fromTillText = getElementText(fromTillEl); // subject subjectEntry = getNthElement(entry,"entrydata", 3); subjectEl = getFirstElement(subjectEntry,"text"); subjectText = getElementText(subjectEl); // resource resEntry = getNthElement(entry,"entrydata",4); resEl = getFirstElement(resEntry,"text"); resName = getElementText(resEl); //======================================================= // ........................ //======================================================= entryCount += 1; entry = getNthElement(entries,"viewentry",entryCount); } } // 3. FUNKTION WIRD MIT PARAMETERN AUFGERUFEN // Ausgabe als Text ====================================================== function getAJAXData(iFunction, iURL, issue, iTarget) { if( ! ((issue == '-1') || (issue == '')) ) { getXMLText( iURL + issue, iFunction + "(\"" + issue + "\",\"" + iTarget + "\")"); } } function outputAJAX( iReturnString , iXMLOutput) { alert( "AJAX call result:" + iXMLOutput); } // Rückgabe von Plain Text zur weiteren Verarbeitung ===================== // ---------------------------------------------------------------------- function readRemoteData(xURL, issue, xTarget) { getXMLText( xURL + issue, "getRemoteData(\"" + issue + "\",\"" + xTarget + "\")"); } function getRemoteData( iReturnString ,iTarget, iXMLOutput) { xElement = document.getElementById(iTarget); if( xElement ) { xElement.innerHTML = xElement.innerHTML + iXMLOutput; } } function toggleOpeningHours( iReturnString , iTarget, iXMLOutput ) { //console.log(iReturnString + "\n" + iTarget + "\n" + iXMLOutput); var xElement = document.getElementById(iTarget); var xText = unescape(decodeURI(iXMLOutput)); //try{ console.log( xText ) }catch(e){} var xGlobalList = xText.split('$'); var xOpeningHourList = xGlobalList[0].split('#'); var xPhoneNumber = xGlobalList[1]; var xAddress = xGlobalList[2]; var xWeekdayList = xGlobalList[6].split('~'); var xTextHOUR = xGlobalList[7]; var xTextTEL = xGlobalList[8]; var xTextCLOSED = xGlobalList[9]; var xTextHEADLINE = xGlobalList[10]; var xHTML =""; var xOpenList; var xCloseList; var xHourList; var openHours = new Array(); xHTML = xTextHEADLINE; for(var i=0; i' + xWeekdayList[i] + ''; xOpenList = xOpeningHourList[i].split('*')[0].split(';'); xCloseList = xOpeningHourList[i].split('*')[1].split(';'); if(xCloseList == '00:00') { openHours[i] = xTextCLOSED; xHTML=xHTML + '' + xTextCLOSED + ''; } else { xHTML=xHTML + ''; xHourList=''; for(var j=0; j< xOpenList.length; j++) { if( xHourList.length == 0) xHourList = xOpenList[j] + '-' + xCloseList[j]; else xHourList = xHourList + ', ' + xOpenList[j] + '-' + xCloseList[j]; } openHours[i] = xHourList + ' ' + xTextHOUR; xHTML=xHTML + xHourList + ' ' + xTextHOUR + ''; } xHTML=xHTML + ''; } xHTML=xHTML + ''; //alert(xHTML) // get pick-up date var PickupORReturn = ''; var sWeekDayIndex = ''; //try{console.log(xWeekdayList )}catch(e){} if( xElement.id == 'openingHoursPickup' ){ PickupORReturn = 'ETA'; sWeekDayIndex = getWeekDay(gETADay, gETAMonth.substr(0, 2), gETAMonth.substr(2, 4), xWeekdayList ); //try{console.log(sWeekDayIndex)}catch(e){} } else{ PickupORReturn = 'ETT'; sWeekDayIndex = getWeekDay(gETTDay, gETTMonth.substr(0, 2), gETTMonth.substr(2, 4), xWeekdayList ); //try{console.log(sWeekDayIndex)}catch(e){} } var aTemp = new Array(); aTemp = sWeekDayIndex.split('|'); // display weekday in the front of the day var oField = document.getElementById(xElement.id + 'Weekday'); if(oField){ oField.innerHTML = aTemp[0] + ' '; } // display opening hours above day //try{console.log()}catch(e){} xElement.innerHTML = xTextHEADLINE + ' ' + openHours[aTemp[1]]; xElement.style.visibility = 'visible'; } function displayWeekDay(_FieldId) { // swap places in Weekdays array, Sunday must be first var arrayWeekDays = new Array(dp_dayArrayLong[6], dp_dayArrayLong[0], dp_dayArrayLong[1], dp_dayArrayLong[2], dp_dayArrayLong[3], dp_dayArrayLong[4], dp_dayArrayLong[5]); var aTemp = new Array(); var PickupORReturn = ''; var Field = document.getElementById( _FieldId ); if( Field ) { if( _FieldId== 'openingHoursPickupWeekday' ) PickupORReturn = 'ETA'; else PickupORReturn = 'ETT'; if( PickupORReturn =="ETA") var sWeekDayIndex = getWeekDay( gETADay ,gETAMonth.substr(0, 2) ,gETAMonth.substr(2, 4), arrayWeekDays ); else var sWeekDayIndex = getWeekDay( gETTDay ,gETTMonth.substr(0, 2) ,gETTMonth.substr(2, 4), arrayWeekDays ); aTemp = sWeekDayIndex.split('|'); Field.innerHTML = aTemp[0] + ' '; } } function getWeekDay(dd,mm,yyyy, aWeekdayList) { //alert( dd +" "+ mm+" "+ yyyy+" "+ aWeekdayList ) // aWeekDayList can contain short day translations, like (Mo, Tu,...) or a list with complete names // coming from the staion's doc, like (Monday, Tuesday,...) // return only the abbreviated day name depending on how much letters are entered in the translation var strLength = dp_dayArrayShort[0].length; if( isNaN(strLength) || (strLength == '')) strLength = 3; var oDate = new Date(parseInt( yyyy, 10), parseInt( mm, 10) - 1, parseInt( dd, 10)); var aWeekday = new Array(6); aWeekday[0] = aWeekdayList[0].substr(0, strLength) + "|0"; // SUNDAY aWeekday[1] = aWeekdayList[1].substr(0, strLength) + "|1"; // MONDAY aWeekday[2] = aWeekdayList[2].substr(0, strLength) + "|2"; // TUESDAY aWeekday[3] = aWeekdayList[3].substr(0, strLength) + "|3"; // WEDNESDAY aWeekday[4] = aWeekdayList[4].substr(0, strLength) + "|4"; // THURSDAY aWeekday[5] = aWeekdayList[5].substr(0, strLength) + "|5"; // FRIDAY aWeekday[6] = aWeekdayList[6].substr(0, strLength) + "|6"; // SATURDAY var daySelected = aWeekday[oDate.getDay()]; return daySelected; } function removeStationInformation(station) { if( station == 'ETA' ) { document.getElementById('openingHoursPickup').style.visibility = 'hidden'; document.getElementById('openingHoursPickup').innerHTML = ' '; } else { document.getElementById('openingHoursReturn').style.visibility = 'hidden'; document.getElementById('openingHoursReturn').innerHTML = ' '; } } function setOpeningHours(where) { var xAgentParam = '&RAN=' + Math.random() + '&LANG=' + gLng + '&COUNTRY='; var xFieldValue = ''; var xTarget = ''; var oPickup = document.getElementById('STA'); var oReturn = document.getElementById('ILC'); var xDate = ''; if(where == 'ETA') { if( oPickup.selectedIndex) xFieldValue = oPickup[oPickup.selectedIndex].value; else xFieldValue = oPickup.value; xTarget = 'openingHoursPickup'; xDate = '&DATE=' + gETADay + gETAMonth; // display week day in front of the day displayWeekDay('openingHoursPickupWeekday'); } else { if( oReturn.selectedIndex) xFieldValue = oReturn[oReturn.selectedIndex].value; else xFieldValue = oReturn.value; xTarget = 'openingHoursReturn'; xDate = '&DATE=' + gETTDay + gETTMonth; displayWeekDay('openingHoursReturnWeekday') } if( xFieldValue == '' || xFieldValue == '-1' || xFieldValue == 'xx'){ removeStationInformation(where); } else{ getAJAXData('toggleOpeningHours', gStationsURL + '/AjaxWebService?OpenAgent' + xAgentParam + xDate + '&F=getOpeningHoursPerLocation&STA=', xFieldValue, xTarget); } } function toggleCarGroup( iReturnString , iTarget, iXMLOutput ) { var xElement = document.getElementById(iTarget); var xText = iXMLOutput; xText = xText.replace(/%00/ig,''); xText = unescape(decodeURI( xText )); var xHTML =""; var xHTMLList = xText.split('~'); if( xElement ) { xHTML =''; for( i=0; i< xHTMLList .length;i++) { xHTML = xHTML + '' + xHTMLList [i]; } xHTML = xHTML + '
'; xElement.innerHTML = xHTML ; } } function processConfirmationEmail( iReturnString , iTarget, iXMLOutput ) { var xElement = document.getElementById(iTarget); var xElement2 = document.getElementById( 'RESENDMAILSTART' ); var xText = iXMLOutput; xText = xText.replace(/%00/ig,''); xText = unescape(decodeURI( xText )); if( xElement && xElement2 ) { xElement2.style.display='none'; xElement.style.display='block'; } } function toggleCarList( iReturnString , iTarget, iXMLOutput ) { var xElement = document.getElementById(iTarget); var xText = iXMLOutput; xText = xText.replace(/%00/ig,''); xText = unescape(decodeURI( xText )); var xHTML =""; var xHTMLList = xText.split('~'); var xOption = null; var xDefault = 0; var xDefaultGRP =""; if( xElement ) { var xLen = xElement.length; for( i=0; i'); if( xHTMLList.length > 1 ) xElement.innerHTML= xHTMLList[1]; } if( xElement2 ) { xHTMLList = xText.split(''); if( xHTMLList.length > 1 ) xElement2.innerHTML= xHTMLList[1]; } }