// JScript-Datei
var ziel_portal = "http://schaumburg.pendlerportal.de";
var region = "Schaumburg";
pp_loadForm(ziel_portal,region);
function pp_loadForm(ziel_portal,region) {
var orte_request = new Element('script', {'id' : 'orte_request', 'src': 'http://www.pendlerportal.de/xml/orte_js.htm' });
var suchform = new Element('form', { action: ziel_portal, 'method' : 'post' , 'target' : '_blank'});
var h_aktion = new Element('input', { 'type': 'hidden', name : 'aktion', value : 'se'});
var h_search = new Element('input', { 'type': 'hidden', name : 'search', value : 'true'});
// Start wählen
var h_start = new Element('h2', { 'class': 'pp'}).update("Start wählen...");
var i_start = new Element('input', { 'type': 'text', name : 'start_ort', 'autocomplete' : 'off', style : 'width:300px;'});
i_start.observe('keyup',function(event){searchhelp(this,region,'');});
i_start.observe('keydown',function(event){moveDown();});
i_start.observe('click',function(event){searchhelp(this,region,'');});
// Ziel wählen
var h_ziel = new Element('h2', { 'class': 'pp'}).update("Ziel wählen...");
var i_ziel = new Element('input', { 'type': 'text', name : 'ziel_ort', 'autocomplete' : 'off', style : 'width:300px;'});
i_ziel.observe('keyup',function(event){searchhelp(this,'','');});
i_ziel.observe('keydown',function(event){moveDown();});
i_ziel.observe('click',function(event){searchhelp(this,'','');});
// Zeiten wählen
var h_zeiten = new Element('h2', { 'class': 'pp'}).update("Zeiten wählen...");
var div_uhrzeiten = new Element('div', { 'style': 'clear:both;width: 500px;'});
var i_von = new Element('input', { 'type': 'text', name : 'han_zeit', style : 'width:70px;float:left;'});
var i_bis = new Element('input', { 'type': 'text', name : 'rab_zeit', style : 'width:70px;float:left;'});
// Wochentage wählen
var div_wochentage = new Element('div', { 'style': 'clear:both;'});
var h_wochentage = new Element('h2', { 'class': 'pp', style:'margin-top:0px;padding-top:20px;'}).update("Wochentage wählen...");
var wt_tab = '
';
var div_buttons = new Element('div', { 'style': 'clear:both;', 'class':'ppbuttons'});
var b_suchen = new Element('input', {'type' : 'image', 'src' : 'http://www.pendlerportal.de/images/suchen.gif', 'style' : 'margin-top: 10px;'});
var a_angebot = new Element('a', {'href' : ziel_portal + '/index.htm?aktion=ped&ses=n', 'style' : 'margin-top: 10px;'}).update('
');
// Texte
var div_vontext = new Element('div', { 'style': 'width:200px;margin-right:0px;float:left;padding-bottom:5px;'}).update("Wann möchten Sie an Ihrem Zielpunkt ankommen?");
var div_bistext = new Element('div', { 'style': 'width:200px;float:left;padding-bottom:5px;'}).update("Wann möchten Sie von Ihrem Zielpunkt wieder abfahren?");
var div_ortinfo = new Element('div', { 'style': 'font-size:85%;width:300px;padding-top:10px;'}).update("(geben Sie hier bitte die gewünschte Postleitzahl oder den gewünschten Ortsnamen ein) ");
var div_ortinfo2 = new Element('div', { 'style': 'font-size:85%;width:300px;padding-top:10px;'}).update("(geben Sie hier bitte die gewünschte Postleitzahl oder den gewünschten Ortsnamen ein) ");
var div_uhr = new Element('div', { 'style': 'float:left;padding-left:5px;padding-top:2px;margin-right:100px;'}).update("Uhr");
var div_uhr2 = new Element('div', { 'style': 'padding-left:5px;padding-top:2px;float:left;'}).update("Uhr");
var div_ppfooter = new Element('div', { 'style': 'clear:both;'}).update('Ein Service von www.pendlerportal.de');
suchform.insert(h_start);
suchform.insert(i_start);
suchform.insert(div_ortinfo);
suchform.insert(h_ziel);
suchform.insert(i_ziel);
suchform.insert(div_ortinfo2);
suchform.insert(h_zeiten);
suchform.insert(div_vontext);
suchform.insert(div_bistext);
div_uhrzeiten.insert(i_von);
div_uhrzeiten.insert(div_uhr);
div_uhrzeiten.insert(i_bis);
div_uhrzeiten.insert(div_uhr2);
suchform.insert(div_uhrzeiten);
div_wochentage.insert(h_wochentage);
div_wochentage.insert(wt_tab);
suchform.insert(div_wochentage);
suchform.insert(h_aktion);
suchform.insert(h_search);
div_buttons.insert(b_suchen);
div_buttons.insert(a_angebot);
suchform.insert(div_buttons);
$("pp_suche").insert(orte_request);
$("pp_suche").insert(suchform);
$("pp_suche").insert(div_ppfooter);
$("pp_suche").style.backgroundImage = 'url(http://www.pendlerportal.de/images/ppSucheJavascript.jpg)';
$("pp_suche").style.backgroundRepeat = 'no-repeat';
$("pp_suche").style.backgroundPosition = 'top right';
}
function makeWeekday(strobj,strWeekday){
if (document.getElementById(strobj).checked){
var arrWeekday = strWeekday.split(",");
for (i=0;i<=arrWeekday.length-1;i++)$('wochentage'+arrWeekday[i]).checked="checked";
}else{
var arrWeekday = new Array('2','3','4','5','6','7');
for (i=0;i<=arrWeekday.length-1;i++)$('wochentage'+arrWeekday[i]).checked="";
}
}
var objDiv,objQ;
var ix=0;
var intTop;
var intLeft;
var formLeft;
var formTop;
var move=false;
function makeXMLobj(){
var xmlHttp = false;
if (typeof(XMLHttpRequest) != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
if (!xmlHttp) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
xmlHttp = false;
}
}
}
return xmlHttp;
}
function searchhelp(tq,strlocation,country) {
objQ = tq;
var q = objQ.value;
formLeft = getAbsPos(objQ,"Left");
formTop = getAbsPos(objQ,"Top")+20;
if(q!=""){
var strURL = "http://www.pendlerportal.de/xml/orte_js.htm?go=1®ion="+strlocation+"&land=" +country+"&suchstr=" +q;
$("orte_request").remove();
orte_request = new Element('script', {'id' : 'orte_request', 'src': strURL });
$("pp_suche").insert(orte_request);
writeResult(strOrteHTML);
//var strResult = getXML(strURL);
var strResult = strOrteHTML
}
}
function makeDIV(){
objDiv=document.createElement("DIV");
objDiv.id="divErg" + objQ.id
objDiv.style.zIndex="1";
objDiv.style.padding="0";
objDiv.style.position="absolute";
objDiv.style.top=formTop+"px";
objDiv.style.left=formLeft+"px";
objDiv.style.height="200px";
objDiv.style.minwidth="200px";
objDiv.style.overflow="auto";
objDiv.style.backgroundColor="white";
objDiv.style.border="1px solid black";
objDiv.style.display="block";
document.body.appendChild(objDiv);
}
function writeText(strtext){
if (!objDiv) makeDIV();
while(objDiv.childNodes.length>0)
objDiv.removeChild(objDiv.childNodes[0]);
objSpan=document.createElement("div");
objSpan.style.display="block";
objSpan.style.margin="0px";
objSpan.style.width="295px";
objDiv.appendChild(objSpan)
objSpan.innerHTML="";
objSpan=document.createElement("div");
objSpan.style.display="block";
objSpan.style.margin="0px";
objSpan.style.width="295px";
objDiv.appendChild(objSpan)
objSpan.innerHTML="";
objSpan=document.createElement("div");
objSpan.style.display="block";
objSpan.style.margin="0px";
objSpan.style.width="295px";
objDiv.appendChild(objSpan)
objSpan.innerHTML=strtext;
}
function writeResult(strResult){
if (!objDiv) makeDIV();
while(objDiv.childNodes.length>0)
objDiv.removeChild(objDiv.childNodes[0]);
var arrResult = strResult.split("
");
if (arrResult.length > 1){
objDiv.style.display="block";
}
ix = 0;
objSpan=document.createElement("div");
objSpan.style.display="block";
objSpan.style.margin="0px";
objSpan.style.width="295px";
objSpan.onmouseover = selectMouseRecord;
objSpan.onmouseout = deselectMouseRecord;
objSpan.onmousedown = returnMouseValue;
objDiv.appendChild(objSpan)
objSpan.innerHTML="keine Auswahl";
for(i=0; i < arrResult.length; i++) {
objSpan=document.createElement("div");
objSpan.style.display="block";
objSpan.style.margin="0px";
objSpan.style.width="295px";
objSpan.onmouseover = selectMouseRecord;
objSpan.onmouseout = deselectMouseRecord;
objSpan.onmousedown = returnMouseValue;
objDiv.appendChild(objSpan)
objSpan.innerHTML=arrResult[i];
}
}
function moveDown(){
document.onkeydown = checkKeyCode;
}
function checkKeyCode(Ereignis) {
if(navigator.appName == "Netscape"){
strKey = Ereignis.which;
}else{
strKey = window.event.keyCode;
}
if(strKey==40){
move = true;
if (ix>=0)deselectRecord();
ix++;
selectRecord();
}else if(strKey==38){
move = true;
deselectRecord();
ix--;
selectRecord();
}else if(strKey==13 || strKey==9) {
closeDD2();
}
}
function notMove(Ereignis){
if(navigator.appName == "Netscape"){
strKey = Ereignis.which;
}else{
strKey = window.event.keyCode;
}
if(strKey==40||strKey==38){
move = true;
}else{
move = false;
}
}
function selectRecord() {
objSpan = objDiv.childNodes[ix]
objSpan.style.backgroundColor="#ececec";
returnValue(objSpan.innerHTML);
//objSpan.focus();
}
function selectMouseRecord() {
objSpan = this;
objSpan.style.backgroundColor="#ececec";
//returnValue(objSpan.innerHTML);
}
function deselectRecord() {
objSpan = objDiv.childNodes[ix]
objSpan.style.backgroundColor="#ffffff";
objSpan.focus();
}
function deselectMouseRecord() {
objSpan = this;
objSpan.style.backgroundColor="#ffffff";
objSpan.focus();
}
function getAbsPos(obj,typ){
count=0;
while(obj!=null){
count=count+obj["offset"+typ];
obj=obj.offsetParent;}
return count;
}
function returnValue(strValue) {
strValue = strValue.replace(/ /g, " ");
strValue = strValue.replace(/ /g, " ");
strValue = strValue.replace(/ß/g, "ß");
//strValue = strValue.replace(/ü/, "ü");
//strValue = strValue.replace(/ä/, "ä");
//strValue = strValue.replace(/ö/, "ö");
//strValue = strValue.replace(/Ü/, "Ü");
//strValue = strValue.replace(/Ä/, "Ä");
//strValue = strValue.replace(/Ö/, "Ö");
objQ.value = strValue;
}
function returnMouseValue() {
objSpan = this;
var strValue = objSpan.innerHTML;
strValue = strValue.replace(/ /g, " ");
strValue = strValue.replace(/ /g, " ");
strValue = strValue.replace(/ß/g, "ß");
//strValue = strValue.replace(/"ü"/, "ü");
//strValue = strValue.replace(/"ä"/, "ä");
//strValue = strValue.replace(/"ö"/, "ö");
//strValue = strValue.replace(/"Ü"/, "Ü");
//strValue = strValue.replace(/"Ä"/, "Ä");
//strValue = strValue.replace(/"Ö"/, "Ö");
objQ.value = strValue;
closeDD();
}
function closeDD(){
document.body.removeChild(objDiv);
objDiv = '';
}
function closeDD2(){
var strValue=objQ.value;
var Suche = /^(\d\d\d\d\d).+\B/;
var Ergebnis = Suche.test(strValue);
if (Ergebnis != false){
document.body.removeChild(objDiv);
objDiv = '';
}else{
if (objDiv) {
objSpan = objDiv.childNodes[1]
if(objSpan.innerHTML!=""){
returnValue(objSpan.innerHTML);
document.body.removeChild(objDiv);
objDiv = '';
}else{
if(strValue!='')writeText("Es konnten keine zugehörigen Daten ermittelt werden oder Ihre Eingabe ist nicht eindeutig. <br <br>Bitte überprüfen Sie die Eingabe.");
document.body.removeChild(objDiv);
objDiv = '';
}
}
}
}