function windowWidth() {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function windowHeight() {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

function rebuild() {
	if (typeof(Weite) == 'undefined') {
	  Weite = 0;
  }

  if (typeof(Hoehe) == 'undefined') {
    Hoehe = 0;
  }

  if (Weite != windowWidth() || Hoehe != windowHeight()) {
    //location.href = location.href;
	  Weite = windowWidth();
	  Hoehe = windowHeight() - 585;

	  if (Hoehe > 0) {
    	document.getElementById('left').style.height = 480 + Hoehe;
    	document.getElementById('main').style.height = 480 + Hoehe;
	    document.getElementById('main_center').style.height = 370 + Hoehe;
	    document.getElementById('bdr_btm').style.top = 455 + Hoehe;
	    document.getElementById('bdr_ctr_img').height = 370 + Hoehe;
	  } else {
	    document.getElementById('left').style.height = 480;
	    document.getElementById('main').style.height = 480;
	    document.getElementById('main_center').style.height = 370;
	    document.getElementById('bdr_btm').style.top = 455;
	    document.getElementById('bdr_ctr_img').height = 370;
	  }
  }
}

function show(obj, zIndex){
	obj.lastChild.style.display="";

  if (typeof(zIndex) != "undefined") {
		obj.style.zIndex=zIndex;
  }
}

function hidden(obj, zIndex){
	obj.lastChild.style.display="none";

  if (typeof(zIndex) != "undefined") {
		obj.style.zIndex=zIndex;
  }
}

function light(obj){
	obj.firstChild.src = obj.firstChild.src.replace(".png", "_lgt.png");
}

function dark(obj){
	obj.firstChild.src = obj.firstChild.src.replace("_lgt.png", ".png");
}

function roadmap(obj, station) {
  today = new Date();

  day = ((today.getDate() < 10) ? "0" : "") + today.getDate();
  month = today.getMonth() + 1;
  month = ((today.getMonth() < 10) ? "0" : "") + month;
  year  = today.getFullYear();
  datum = day+'.'+month+'.'+year;

  hours = today.getHours(); minutes = today.getMinutes(); seconds = today.getSeconds();
  if(hours < 10){hours = '0'+hours;}
  if(minutes < 10){minutes = '0'+minutes;}
  if(seconds < 10){seconds = '0'+seconds;}
  zeit = hours+':'+minutes+':'+seconds;
  window.status = zeit;

  obj.href = 'http://reiseauskunft.bahn.de/bin/query.exe/dn?revia=yes&existOptimizePrice=1&et_cid=979&et_lid=493272&et_sub=Suchanfrage&trip-type=single&S=&Z=' + station + '&date=' + datum + '&time=' + zeit + '&timesel=depart&returnTimesel=depart&optimize=1&travelProfile=-1&adult-number=1&children-number=0&infant-number=0&tariffTravellerType.1=E&tariffTravellerReductionClass.1=0&tariffTravellerAge.1=&qf-trav-bday-1=&tariffClass=2&start=1&qf.bahn.button.suchen=.href';
}
