JRTab = function(JRt, id1, left, top, z, mov) {
  this.self = this;
  this.id = id1;
  this.JRt = JRt;
  this.left = left;
  this.top = top;
  this.z = z;
  this.movableJR = mov;
  this.d = new Date();
  this.hour = this.d.getHours();
  this.min = this.d.getMinutes();
  this.output = document.createElement("div");
  this.output.id = this.id1;
  this.output1 = document.createElement("div");
  this.output1.id = 'pozn' + this.id1;
  this.blankdiv = document.createElement("div");
  this.blankdiv.style.height = "5px";
  this.output1.appendChild(this.blankdiv);
  this.maintab = document.createElement("table");
  this.maintab.className = "jrtable";
  this.maintab.style.left = this.left;
  this.maintab.style.top = this.top;
  this.maintab.style.marginLeft = "15px";
  this.maintab.style.marginRight = "15px";
//  this.maintab.style.marginTop = "15px";
//  this.maintab.style.marginBottom = "15px";
  this.zasttab = document.createElement("table");
  this.zasttab.className = "zastavkytable";
  this.tab = document.createElement("table");
  this.tab.className  = "tableJR";
  this.detailtab = document.createElement("table");
  this.detailtab.className  = "detailtable";
  this.detailtab.id = "detail";
  this.nactiobr = false;
  this.pouzitePozn = new TPoznamky();
  this.pouzitePoznZastavky = new TPoznamky();
  this.activetarif = 0;
  this.moving = false;

  this.JRt.TrasaDisable();

  this.mainrowbtop = this.maintab.insertRow(0);
  col1 = this.mainrowbtop.insertCell(0);
  col1.className = "tableBorderLeftTop";
  col2 = this.mainrowbtop.insertCell(1);
  col2.className = "tableBorderCenterTop";
  col3 = this.mainrowbtop.insertCell(2);
  col3.className = "tableBorderCenterTop";
  this.col4 = this.mainrowbtop.insertCell(3);
  this.col4.className = "tableBorderCenterTop";
  col6 = this.mainrowbtop.insertCell(4);
  col6.className = "tableBorderCenterTop";
  col6.style.width = "auto";
  col5 = this.mainrowbtop.insertCell(5);
  col5.className = "tableBorderRightTop";

  this.mainrow = this.maintab.insertRow(1);
  col1 = this.mainrow.insertCell(0);
  col1.className = "tableBorderLeftMid";
  col1 = this.mainrow.insertCell(1);
  //    col1.style.background = "#ffffff";
  col1.style.verticalAlign = "top";
  col1.style.fontSize = "24px";
  col1.colSpan = 3;

  t = document.createElement("table");
  t.className = "header";
  r = t.insertRow(0);
  var c = r.insertCell(0);
  //    a1 = document.createElement("a");
  comboLinky = document.getElementById('combolinky');
  obr = document.createElement("img");
  obr.style.verticalAlign = "bottom";
  doprava = Linky.getLinkabyId(comboLinky.options[comboLinky.selectedIndex].value).doprava;
  if (doprava == 'A') {
    obr.src = "http://www.mhdspoje.cz/jrw20/png/tra19.PNG";
  }
  if (doprava == 'T') {
    obr.src = "http://www.mhdspoje.cz/jrw20/png/bus19.PNG";
  }
  if (doprava == 'O') {
    obr.src = "http://www.mhdspoje.cz/jrw20/png/tro19.PNG";
  }
  c.appendChild(obr);

  c = r.insertCell(1);
  a = document.createElement("a");
  a.style.verticalAlign = "top";
  a.style.paddingLeft = "8px";
  a.style.fontWeight = "bold";
  //uprava
  a.innerHTML = comboLinky.options[comboLinky.selectedIndex].text ;
  c.appendChild(a);

  a = document.createElement("a");
  a.style.verticalAlign = "top";
  a.style.paddingLeft = "8px";
  a.style.fontSize = "18px";
  //uprava
  a.innerHTML = " (" + formatDDMMYYY(cCalendar.activeday, cCalendar.activemonth, cCalendar.activeyear) + ")";
  c.appendChild(a);

  a1 = document.createElement("a");
  a1.style.verticalAlign = "top";
  a1.style.paddingLeft = "5px";
  a1.style.fontSize = "24px";
  //    if (cCalendar != null) {
  a1.innerHTML = "-  " + cCalendar.getTypeDay();
  c.appendChild(a1);
  //    }

  colb = this.mainrow.insertCell(2);
  obr = document.createElement("img");
  if (doprava == 'A') {
    obr.src = "http://www.mhdspoje.cz/jrw20/png/tra19smerinactive.PNG";
  }
  if (doprava == 'T') {
    obr.src = "http://www.mhdspoje.cz/jrw20/png/bus19smerinactive.PNG";
  }
  if (doprava == 'O') {
    obr.src = "http://www.mhdspoje.cz/jrw20/png/tro19smerinactive.PNG";
  }
  /*    obr.style.border = "1px";
    obr.style.borderStyle = "solid";
    obr.style.bordeColor = "#c3c3c3";*/
  colb.style.textAlign = "right";
  colb.style.verticalAlign = "top";
  obr.style.width = "42px";
  obr.style.height = "23px";
  if (language == 1) {
    obr.title = "opačný směr";
  }
  if (language == 2) {
    obr.title = "opačný smer";
  }
  if (language == 3) {
    obr.title = "oposite direction";
  }
  if (doprava == 'A') {
    obr.onmouseover = function() {
      this.src = "http://www.mhdspoje.cz/jrw20/png/tra19smeractive.PNG"; this.style.cursor = "pointer";
    }
    obr.onmouseout = function() {
      this.src = "http://www.mhdspoje.cz/jrw20/png/tra19smerinactive.PNG"; this.style.cursor = "auto";
    }
  }
  if (doprava == 'T') {
    obr.onmouseover = function() {
      this.src = "http://www.mhdspoje.cz/jrw20/png/bus19smeractive.PNG"; this.style.cursor = "pointer";
    }
    obr.onmouseout = function() {
      this.src = "http://www.mhdspoje.cz/jrw20/png/bus19smerinactive.PNG"; this.style.cursor = "auto";
    }
  }
  if (doprava == 'O') {
    obr.onmouseover = function() {
      this.src = "http://www.mhdspoje.cz/jrw20/png/tro19smeractive.PNG"; this.style.cursor = "pointer";
    }
    obr.onmouseout = function() {
      this.src = "http://www.mhdspoje.cz/jrw20/png/tro19smerinactive.PNG"; this.style.cursor = "auto";
    }
  }
  J = this.JRt;
  obr.idtarif = this.JRt.activeZastavka;
  obr.onclick = function() {
    otocSmer(this, J);
  }
  colb.appendChild(obr);

  obr = document.createElement("img");
  obr.src = "http://www.mhdspoje.cz/jrw20/png/printinactive.png";
  colb.style.textAlign = "right";
  colb.style.verticalAlign = "top";
  obr.style.width = "42px";
  obr.style.height = "23px";
  obr.style.marginLeft = "10px";
  if (language == 1) {
    obr.title = "tisk";
  }
  if (language == 2) {
    obr.title = "tisk";
  }
  if (language == 3) {
    obr.title = "print";
  }

  obr.onmouseover = function() {
    this.src = "http://www.mhdspoje.cz/jrw20/png/printactive.png"; this.style.cursor = "pointer";
  }
  obr.onmouseout = function() {
    this.src = "http://www.mhdspoje.cz/jrw20/png/printinactive.png"; this.style.cursor = "auto";
  }

  J = this.JRt;
  P = this.pouzitePoznZastavky;
  PP = this.pouzitePozn;
  obr.idtarif = this.JRt.activeZastavka;
  obr.onclick = function() {
    printJR(this, J, P, PP);
  }
  colb.appendChild(obr);

  r = t.insertRow(1);
  r.style.height = "10px";
  r = t.insertRow(2);
  c = r.insertCell(0);
  c1 = r.insertCell(1);
  a1 = document.createElement("a");
  a1.style.verticalAlign = "middle";
  a1.style.paddingLeft = "10px";
  a1.style.fontSize = "12px";
  a1.style.fontWeight = "normal";
  if (language == 1) {
    a1.innerHTML = "směr : ";
  }
  if (language == 2) {
    a1.innerHTML = "smer : ";
  }
  if (language == 3) {
    a1.innerHTML = "direction : ";
  }
  c.appendChild(a1);
  a2 = document.createElement("a");
  a2.style.verticalAlign = "middle";
  a2.style.paddingLeft = "10px";
  a2.style.fontSize = "16px";
  a2.style.fontWeight = "bold";
//  a2.innerHTML = this.JRt.trasa[this.JRt.trasa.length - 1][2];
if (Linky.getLinkabyId(this.JRt.c_linky).smerA == '') {
  a2.innerHTML = this.JRt.trasa[this.JRt.trasa.length - 1][2];
} else {
  if (this.JRt.smer == 0) {
    a2.innerHTML =  Linky.getLinkabyId(this.JRt.c_linky).smerA;
  }
  if (this.JRt.smer == 1) {
    a2.innerHTML =  Linky.getLinkabyId(this.JRt.c_linky).smerB;
  }
}

  c.appendChild(a2);
  c.colSpan = 2;

  col1.appendChild(t);

  col1 = this.mainrow.insertCell(3);
  col1.className = "tableBorderRightMid";


  this.mainrow = this.maintab.insertRow(2);
  //    this.mainrow.style.background = "#d7d7d7";
  col1 = this.mainrow.insertCell(0);
  col1.className = "tableBorderLeftMid";
  col2 = this.mainrow.insertCell(1);
  col2.style.verticalAlign = "top";
  col3 = this.mainrow.insertCell(2);
  col3.style.verticalAlign = "top";
  /*    col7 = this.mainrow.insertCell(3);
    col7.style.verticalAlign = "top";*/

  this.col4 = this.mainrow.insertCell(3);
  this.col4.style.verticalAlign = "top";
  this.col4.colSpan = 2;
  //    col6 = this.mainrow.insertCell(4);
  col5 = this.mainrow.insertCell(4);
  col5.className = "tableBorderRightMid";

  this.odjezd = this.getNejblizsiOdjezd(this.hour, this.min);
  if (this.odjezd == null) {
    this.odjezd = this.getNejblizsiOdjezd(0, 0);
  }
  if (this.odjezd != null) {
    this.activerow = parseInt(this.odjezd / 1000);
    this.activecol = parseInt(this.odjezd - (parseInt(this.odjezd / 1000) * 1000));
  } else {
    this.activerow = null;
    this.activecol = null;
  }

  for(i = 0; i < 24; i++) {
    row = this.tab.insertRow(i);
    if (i % 2 == 0) {
      row.className = "sudaradka";
    } else {
      row.className = "licharadka";
    }
    c = row.insertCell(0);
    c.className = "hourJR";
    cas = i;
    if (i.toString(10).length == 1) {
      cas = '0' + cas;
    }
    c.innerHTML = cas;

    for(ii = 0; ii < this.JRt.numCol; ii++) {
      c = row.insertCell(ii + 1);
      a = document.createElement("a");
      a.className = "timeJR";
      this.nactiobr = false;
      if (this.JRt.JRtab[i] != null) {
        if (ii < this.JRt.JRtab[i].length) {
          a.over = true;
          a.style.background = "";
          if ((this.activerow != null) && (this.activecol != null)) {
            //                        document.write(this.activerow+","+this.activecol);
            if ((this.activerow == i) && (this.activecol == ii)) {
              if (this.JRt.JRtab[i][ii] != null) {
                //                                if ((parseInt(this.JRt.JRtab[i][ii].odjezd) == this.activecol)) {
                a.over = false;
                //                                a.style.background = "#ff8888";
                a.style.background = "#a6222a";
                a.style.color = "#ffffff";
              //                                }
              }
            }
          }
          a.id = "r"+i+"c"+ii;
          a.chrono = this.JRt.JRtab[i/*this.activerow*/][ii/*this.activecol*/].chrono;
          a.obj = this.self;
          a.row = i;
          a.col = ii;
          str = this.JRt.JRtab[i][ii].odjezd;// + "(" + this.JRt.JRtab[i][ii].kurz + ")";
          a.title = i+":"+str;
          if (this.JRt.JRtab[i][ii] != null) {
            if (this.JRt.JRtab[i][ii].poznamky != null)     {
                    
              for(iii = 0; iii < this.JRt.JRtab[i][ii].poznamky.length; iii++) {
                id = this.JRt.JRtab[i][ii].poznamky[iii];
                poz = Poznamky.getPoznamkaID(id);
                if (poz != null) {
                  poz1 = this.pouzitePozn.getPoznamkaID(id);
                  if (poz1 == null) {
                    this.pouzitePozn.addPoznamka(poz.c_kodu, poz.oznaceni, poz.popis, poz.obrazek);
                  }
                }
                this.nactiobr = true;
                if (poz/*.obrazek*/ == null) {
                //                            str = str + " " + poz.oznaceni;
                //                            this.nactiobr = true;
                } else {
                  this.nactiobr = true;
                //                            obr = document.createElement("img");
                //                            obr.src = poz.obrazek;
                //                            c.appendChild(obr);
                //                            str = str + " " + obr.src;
                }
              }
            }
          }
          a.innerHTML = str;
          a.onmouseover = function() {
            jrsover(this);
          };
          a.onmouseout = function() {
            jrsout(this);
          };
          a.onclick = function() {
            jrclick(this);
          }
        }
      }
      c.appendChild(a);

      if (this.JRt.JRtab[i] != null) {
        if (ii < this.JRt.JRtab[i].length) {
          if (zobrazitkurz == 1) {
            if (this.JRt.JRtab[i][ii].kurz != null) {
              a = document.createElement("a");
              a.className = "kurzJR";
              a.obj = this.self;
              a.innerHTML = "(" + this.JRt.JRtab[i][ii].kurz + ")";
              c.appendChild(a);
            }
          }
        }
      }
      if (this.nactiobr == true) {
        prvniA = true;
        prvniB = true;
        for(iii = 0; iii < this.JRt.JRtab[i][ii].poznamky.length; iii++) {
          id = this.JRt.JRtab[i][ii].poznamky[iii];
          poz = Poznamky.getPoznamkaID(id);
          //                        if (poz != null) {
          if ((poz.obrazek == null)) {
            if ((prvniA == false) || (prvniB == false)) {
              a = document.createElement("a");
              a.className = "poznamkaJR";
              a.innerHTML = ",";
              c.appendChild(a);
            }
            a = document.createElement("a");
            a.innerHTML = poz.oznaceni;
            a.className = "poznamkaJR";
            a.title = poz.popis;
            a.style.cursor = "Crosshair";
            c.appendChild(a);
            prvniA = false;
          } else {
            if ((prvniA == false) || (prvniB == false)) {
              a = document.createElement("a");
              a.className = "poznamkaJR";
              a.innerHTML = ",";
              c.appendChild(a);
            }
            obr = document.createElement("img");
            obr.src = "http://www.mhdspoje.cz/jrw20/png/" + poz.obrazek;
            obr.title = poz.popis;
            obr.style.cursor = "Crosshair";
            c.appendChild(obr);
            prvniB = false;
          }
        //                        }
        }
      }
    }
  }
  row = this.zasttab.insertRow(0);
  row.className = "headertrasa";
   
  c = row.insertCell(0);
  c = row.insertCell(1);

  //    c.style.paddingBottom = "5px";

  obsahujepasmo = false;
  for(i = 0; i < this.JRt.trasa.length; i++) {
    if (this.JRt.smer == 0) {
      if ((this.JRt.trasa[i][5] != '') || (this.JRt.trasa[i][6] != '')) {
        obsahujepasmo = true;
      }
    }
    if (this.JRt.smer == 1) {
      if ((this.JRt.trasa[i][7] != '') || (this.JRt.trasa[i][8] != '')) {
        obsahujepasmo = true;
      }
    }
  }

  a = document.createElement("a");
  if (obsahujepasmo == true) {
    if (language == 1) {
      a.innerHTML = "pásmo";
    }        
    if (language == 2) {
      a.innerHTML = "pásmo";
    }
    if (language == 3) {
      a.innerHTML = "zone";
    }
  } else {
    a.innerHTML = "";
  }
  c.appendChild(a);

  c = row.insertCell(2);
  c = row.insertCell(3);

  a = document.createElement("a");
    if (language == 1) {
      a.innerHTML = "zastávka";
    }
    if (language == 2) {
      a.innerHTML = "zastávka";
    }
    if (language == 3) {
      a.innerHTML = "* station";
    }
  c.appendChild(a);

  for(i = 0; i < this.JRt.trasa.length; i++) {
    row = this.zasttab.insertRow(i+1);
    c0 = row.insertCell(0);
    ctarif1 = row.insertCell(1);
    ctarif1.style.textAlign = "center";
    if (this.JRt.smer == 0) {
      if (this.JRt.trasa[i][5] != '') {
        a = document.createElement("a");
        a.innerHTML = this.JRt.trasa[i][5];
        ctarif1.appendChild(a);
      }
    } else {
      if (this.JRt.trasa[i][7] != '') {
        a = document.createElement("a");
        a.innerHTML = this.JRt.trasa[i][7];
        ctarif1.appendChild(a);
      }
    }
    ctarif2 = row.insertCell(2);
    ctarif2.style.textAlign = "center";
    if (this.JRt.smer == 0) {
      if (this.JRt.trasa[i][6] != '') {
        a = document.createElement("a");
        a.innerHTML = this.JRt.trasa[i][6];
        ctarif2.appendChild(a);
      }
    } else {
      if (this.JRt.trasa[i][8] != '') {
        a = document.createElement("a");
        a.innerHTML = this.JRt.trasa[i][8];
        ctarif2.appendChild(a);
      }
    }
    c = row.insertCell(3);
    if (this.JRt.activeZastavka == i) {
      c.style.fontWeight = "bold";
      c.style.color = "#ed131b";
      sipka = document.createElement("img");
      sipka.src = "http://www.mhdspoje.cz/jrw20/png/sipka.png";
      sipka.style.width = "auto";
      sipka.style.height = "auto";
      c0.appendChild(sipka);
      c0.style.width = "auto";
      row.width = "auto";
      c.name = "NO";
    } else {
      c.name = "YES";
    }
    c.onmouseover = function() {
      zastover(this);
    };
    c.onmouseout = function() {
      zastout(this);
    };
    a = document.createElement("a");
    a.id = i;
    if (this.JRt.trasa[i][3] == false) {
      a.className = "zastavkydisable";
    } else {
      a.className = "zastavkyenable";
    }
    if (this.JRt.activeZastavka == i) {
      a.style.fontWeight = "bold";
      a.style.color = "#ed131b";
    }
    J = this.JRt;
    a.onclick = function() {
      zastclick(this, J);
    };
    a.innerHTML = this.JRt.trasa[i][2];
    c.appendChild(a);
    if (this.JRt.trasa[i][4].poznamky != null) {
      for(ii = 0; ii < this.JRt.trasa[i][4].poznamky.size(); ii++) {
        poz = Poznamky.getPoznamkaID(this.JRt.trasa[i][4].poznamky.elementAt(ii).c_kodu);

        if (poz != null) {
          poz1 = this.pouzitePoznZastavky.getPoznamkaID(this.JRt.trasa[i][4].poznamky.elementAt(ii).c_kodu);
          if (poz1 == null) {
            this.pouzitePoznZastavky.addPoznamka(poz.c_kodu, poz.oznaceni, poz.popis, poz.obrazek);
          }
        }

        //                if (poz != null) {
        if (poz.obrazek != null) {
          if (ii > 0) {
            aa = document.createElement("a");
            aa.innerHTML = ",";
            c.appendChild(aa);
          }
          obr = document.createElement("img");
          obr.src = "http://www.mhdspoje.cz/jrw20/png/" + poz.obrazek;
          obr.title = poz.popis;
          obr.style.cursor = "Crosshair";
          c.appendChild(obr);
        } else {
          if (ii > 0) {
            aa = document.createElement("a");
            aa.innerHTML = ",";
            c.appendChild(aa);
          }
          aa = document.createElement("a");
          aa.innerHTML = poz.oznaceni;
          aa.title = poz.popis;
          aa.style.cursor = "Crosshair";
          c.appendChild(aa);
        }
      //              }
      }
    }
  //        c.innerHTML = this.JR.trasa[i][2];
  }

  if (this.JRt.JRtab[this.activerow] != null) {
    this.activechrono = this.JRt.JRtab[this.activerow][this.activecol].chrono;
    this.createDetail(this.activechrono, this.activerow, this.activecol);
  } else {
    this.createDetail(null, this.activerow, this.activecol);
  }
  /*    for(i = 0; i < this.JRt.trasa.length; i++) {
        row = this.detailtab.insertRow(i);
        col = row.insertCell(0);
        a = document.createElement("a");
        a.innerHTML = (parseInt(this.JRt.JRtab[this.activerow][this.activecol].pocatek_HH) + parseInt(parseInt(parseInt(this.JRt.JRtab[this.activerow][this.activecol].pocatek_MM) + parseInt(this.JRt.chrono[this.activechrono][i].doba_pocatek)) / 60 )) + ":" + parseInt((parseInt(this.JRt.JRtab[this.activerow][this.activecol].pocatek_MM) + parseInt(this.JRt.chrono[this.activechrono][i].doba_pocatek)) % 60);
        col.appendChild(a);
        if (this.JRt.chrono[this.activechrono][i].doba_jizdy == -1) {
            a.className = "detailtabletimedisable";
            a.innerHTML = "--:--";
        } else {
            a.className = "detailtabletimeenable";
        }

        col = row.insertCell(1);
        a = document.createElement("a");
        a.innerHTML = this.JRt.trasa[i][2];
        col.appendChild(a);

        if (this.JRt.chrono[this.activechrono][i].doba_jizdy == -1) {
            a.className = "detailtablezastavkydisable";
        } else {
            a.className = "detailtablezastavkyenable";
        }
    }*/
    
  col2.appendChild(this.zasttab);
  col3.appendChild(this.tab);
  this.col4.appendChild(this.detailtab);

  this.rowpoznamky = this.maintab.insertRow(3);
  col1 = this.rowpoznamky.insertCell(0);
  col1.className = "tableBorderLeftMid";
  this.colpoznamky = this.rowpoznamky.insertCell(1);
  //    this.colpoznamky.style.background = "#ffffff";
  //    this.colpoznamky.style.verticalAlign = "center";
  this.colpoznamky.style.textAlign = "right";
  this.colpoznamky.colSpan = 4;
  this.colpoznamky.style.mode = "auto";
  this.colpoznamky.style.whiteSpace = "pre";
  this.colpoznamky.style.borderTopStyle = "solid";
  this.colpoznamky.style.borderTopWidth = "1px";
  this.colpoznamky.style.borderColor = "#666666";
  a = document.createElement("a");
  a.className = "FS";
  a.innerHTML = "JRw ver. 2.0. - SKELETON &reg FS software s.r.o.";
  this.colpoznamky.appendChild(a);

  //POZNAMKY

  if (this.pouzitePozn.poznamky != null) {
    this.pozntable = document.createElement("table");
    this.pozntable.className = 'tableJR';
    this.pozntable.style.marginLeft = "15px";
    this.pozntable.style.marginRight = "15px";
//    this.pozntable.style.marginTop = "15px";
//    this.pozntable.style.marginBottom = "15px";
    this.prow = this.pozntable.insertRow(0);
    pcol1 = this.prow.insertCell(0);
    pcol1.className = "tableBorderLeftTop";
    pcol2 = this.prow.insertCell(1);
    pcol2.className = "tableBorderCenterTop";
    pcol3 = this.prow.insertCell(2);
    pcol3.className = "tableBorderCenterTop";
    pcol4 = this.prow.insertCell(3);
    pcol4.className = "tableBorderRightTop";

    this.pozntablerow = this.pozntable.insertRow(1);
    this.pozntablerow.className = "oddelovacpozn";
    col = this.pozntablerow.insertCell(0);
    a = document.createElement("a");
    if (language == 1) {
      a.innerHTML = 'Poznámky spojů : ';
    }
    if (language == 2) {
      a.innerHTML = 'Poznámky spojov : ';
    }
    if (language == 3) {
      a.innerHTML = 'Routing notes : ';
    }
    col.appendChild(a);
    col.colSpan = 4;


    for(i = 0; i < this.pouzitePozn.poznamky.size(); i++) {
      this.pozntablerow = this.pozntable.insertRow(i + 2);
      col = this.pozntablerow.insertCell(0);
      col.className = "tableBorderLeftMid";
      col = this.pozntablerow.insertCell(1);
      col.className = "poznamkaodsazeni";

      if (this.pouzitePozn.poznamky.elementAt(i).obrazek != null) {
        obr = document.createElement("img");
        obr.src = "http://www.mhdspoje.cz/jrw20/png/" + this.pouzitePozn.poznamky.elementAt(i).obrazek;
        col.appendChild(obr);
      } else {
        a = document.createElement("a");
        a.className = "poznamky";
        a.innerHTML = this.pouzitePozn.poznamky.elementAt(i).oznaceni;
        col.appendChild(a);
      }

      col = this.pozntablerow.insertCell(2);
      a = document.createElement("a");
      a.className = "poznamkypopis";
      a.innerHTML = this.pouzitePozn.poznamky.elementAt(i).popis;
      a.style.whiteSpace = "pre";
      col.appendChild(a);
      col = this.pozntablerow.insertCell(3);
      col.className = "tableBorderRightMid";
    }

    this.prow = this.pozntable.insertRow(i + 1);
    pcol1 = this.prow.insertCell(0);
    pcol1.className = "tableBorderLeftBottom";
    pcol2 = this.prow.insertCell(1);
    pcol2.className = "tableBorderCenterBottom";
    pcol3 = this.prow.insertCell(2);
    pcol3.className = "tableBorderCenterBottom";
    pcol4 = this.prow.insertCell(3);
    pcol4.className = "tableBorderRightBottom";
  }


  // END POZNAMKY

  // Poznamky     zastavek
  if (this.pouzitePoznZastavky.poznamky != null) {
    this.pozntable1 = document.createElement("table");
    this.pozntable1.className = 'tableJR';
    this.pozntable1.style.marginLeft = "15px";
    this.pozntable1.style.marginRight = "15px";
//    this.pozntable1.style.marginTop = "15px";
//    this.pozntable1.style.marginBottom = "15px";
    this.prow = this.pozntable1.insertRow(0);
    pcol1 = this.prow.insertCell(0);
    pcol1.className = "tableBorderLeftTop";
    pcol2 = this.prow.insertCell(1);
    pcol2.className = "tableBorderCenterTop";
    pcol3 = this.prow.insertCell(2);
    pcol3.className = "tableBorderCenterTop";
    pcol4 = this.prow.insertCell(3);
    pcol4.className = "tableBorderRightTop";

    this.pozntablerow = this.pozntable1.insertRow(1);
    this.pozntablerow.className = "oddelovacpozn";
    col = this.pozntablerow.insertCell(0);
    a = document.createElement("a");
    if (language == 1) {
      a.innerHTML = 'Poznámky zastávek : ';
    }
    if (language == 2) {
      a.innerHTML = 'Poznámky zastávok : ';
    }
    if (language == 3) {
      a.innerHTML = 'Station notes : ';
    }
    col.appendChild(a);
    col.colSpan = 4;

    for(i = 0; i < this.pouzitePoznZastavky.poznamky.size(); i++) {
      this.pozntablerow = this.pozntable1.insertRow(i + 2);
      col = this.pozntablerow.insertCell(0);
      col.className = "tableBorderLeftMid";
      col = this.pozntablerow.insertCell(1);
      col.className = "poznamkaodsazeni";

      if (this.pouzitePoznZastavky.poznamky.elementAt(i).obrazek != null) {
        obr = document.createElement("img");
        obr.src = "http://www.mhdspoje.cz/jrw20/png/" + this.pouzitePoznZastavky.poznamky.elementAt(i).obrazek;
        col.appendChild(obr);
      } else {
        a = document.createElement("a");
        a.className = "poznamky";
        a.innerHTML = this.pouzitePoznZastavky.poznamky.elementAt(i).oznaceni;
        col.appendChild(a);
      }

      col = this.pozntablerow.insertCell(2);
      a = document.createElement("a");
      a.className = "poznamkypopis";
      a.innerHTML = this.pouzitePoznZastavky.poznamky.elementAt(i).popis;
      a.style.whiteSpace = "pre";
      col.appendChild(a);
      col = this.pozntablerow.insertCell(3);
      col.className = "tableBorderRightMid";
    }

    this.prow = this.pozntable1.insertRow(i + 1);
    pcol1 = this.prow.insertCell(0);
    pcol1.className = "tableBorderLeftBottom";
    pcol2 = this.prow.insertCell(1);
    pcol2.className = "tableBorderCenterBottom";
    pcol3 = this.prow.insertCell(2);
    pcol3.className = "tableBorderCenterBottom";
    pcol4 = this.prow.insertCell(3);
    pcol4.className = "tableBorderRightBottom";
  }
  //END Poznamky zastavek



  /*this.colpoznamky.appendChild(this.pozntable);*/
  col1 = this.rowpoznamky.insertCell(2);
  col1.className = "tableBorderRightMid";

  this.mainrowbbottom = this.maintab.insertRow(4);
  col1 = this.mainrowbbottom.insertCell(0);
  col1.className = "tableBorderLeftBottom";
  col2 = this.mainrowbbottom.insertCell(1);
  col2.className = "tableBorderCenterBottom";
  col3 = this.mainrowbbottom.insertCell(2);
  col3.className = "tableBorderCenterBottom";
  this.col4 = this.mainrowbbottom.insertCell(3);
  this.col4.className = "tableBorderCenterBottom";
  col6 = this.mainrowbbottom.insertCell(4);
  col6.className = "tableBorderCenterBottom";
  col5 = this.mainrowbbottom.insertCell(5);
  col5.className = "tableBorderRightBottom";

  this.output.appendChild(this.maintab);
  if (this.pouzitePozn.poznamky != null) {
    this.output1.appendChild(this.pozntable);
  }
  if (this.pouzitePoznZastavky.poznamky != null) {
    this.output1.appendChild(this.pozntable1);
  }
}

JRTab.prototype.createDetail = function(achrono, arow, acol) {
  a = document.getElementById("r"+this.activerow+"c"+this.activecol);
  if (a != null) {
    a.over = true;
    a.style.background = "";
    a.style.color = "";
    a.style.cursor = "pointer";
  }

  numrows = this.detailtab.rows.length;
  for(i = 0; i < numrows; i++) {
    this.detailtab.deleteRow(0);
  }
  this.activechrono = achrono;
  this.activerow = arow;
  this.activecol = acol;
  row = this.detailtab.insertRow(0);
  row.className = "headertrasa";
  col = row.insertCell(0);
  a = document.createElement("a");
  if (language == 1) {
    a.innerHTML = "min.";
  }
  if (language == 2) {
    a.innerHTML = "min.";
  }
  if (language == 3) {
    a.innerHTML = "min.";
  }
  col.appendChild(a);

  col = row.insertCell(1);
  a = document.createElement("a");
  if (language == 1) {
    a.innerHTML = "čas";
  }
  if (language == 2) {
    a.innerHTML = "čas";
  }
  if (language == 3) {
    a.innerHTML = "time";
  }
  col.appendChild(a);

  col = row.insertCell(2);
  a = document.createElement("a");
  if (language == 1) {
    a.innerHTML = "zastávka";
  }
  if (language == 2) {
    a.innerHTML = "zastávka";
  }
  if (language == 3) {
    a.innerHTML = "* station";
  }
  col.appendChild(a);

  for(i = 0; i < this.JRt.trasa.length; i++) {
    row = this.detailtab.insertRow(i+1);
    col = row.insertCell(0);
    if (this.JRt.chrono[this.activechrono] != null) {
      if ((i >= this.JRt.activeZastavka) && (this.JRt.chrono[this.activechrono][i].doba_pocatek - this.JRt.chrono[this.activechrono][this.JRt.activeZastavka].doba_pocatek > 0)) {
        a = document.createElement("a");
        if (this.JRt.chrono[this.activechrono][i].doba_pocatek == 0) {
          a.className = "detailtabletimedisable";
        } else {
          a.className = "detailtabletimeenable";
        }
        a.innerHTML = this.JRt.chrono[this.activechrono][i].doba_pocatek - this.JRt.chrono[this.activechrono][this.JRt.activeZastavka].doba_pocatek;
        col.appendChild(a);
      }
    }

    col = row.insertCell(1);
    a = document.createElement("a");
    //        a.innerHTML = (parseInt(this.JRt.JRtab[this.activerow][this.activecol]./pocatek_HH) + parseInt(parseInt(parseInt(this.JRt.JRtab[this.activerow][this.activecol].pocatek_MM) + parseInt(this.JRt.chrono[this.activechrono][i].doba_pocatek)) / 60 )) + ":" + parseInt((parseInt(this.JRt.JRtab[this.activerow][this.activecol].pocatek_MM) + parseInt(this.JRt.chrono[this.activechrono][i].doba_pocatek)) % 60);
    if ((this.activechrono != null) && (this.JRt.chrono[this.activechrono][i] != null)) {
      a.innerHTML = formatHHMM((parseInt(this.JRt.JRtab[this.activerow][this.activecol].pocatek_HH) + parseInt(parseInt(parseInt(this.JRt.JRtab[this.activerow][this.activecol].pocatek_MM) + parseInt(this.JRt.chrono[this.activechrono][i].doba_pocatek)) / 60 )), parseInt((parseInt(this.JRt.JRtab[this.activerow][this.activecol].pocatek_MM) + parseInt(this.JRt.chrono[this.activechrono][i].doba_pocatek)) % 60));
    }
    if ((this.activechrono == null) || (this.JRt.chrono[this.activechrono][i] == null) || (this.JRt.chrono[this.activechrono][i].doba_jizdy == -1)) {
      a.className = "detailtabletimedisable";
      a.innerHTML = "--:--";
    } else {
      a.className = "detailtabletimeenable";
    }
    if (this.JRt.activeZastavka == i) {
      a.style.fontWeight = "bold";
      a.style.color = "#ed131b";
    }
    col.appendChild(a);

    col = row.insertCell(2);
    a = document.createElement("a");
    a.innerHTML = this.JRt.trasa[i][2];
    if ((this.activechrono == null) || (this.JRt.chrono[this.activechrono][i] == null) || (this.JRt.chrono[this.activechrono][i].doba_jizdy == -1)) {
      a.className = "detailtablezastavkydisable";
    } else {
      a.className = "detailtablezastavkyenable";
    }
    if (this.JRt.activeZastavka == i) {
      a.style.fontWeight = "bold";
      a.style.color = "#ed131b";
    }
    col.appendChild(a);
  }

  a = document.getElementById("r"+this.activerow+"c"+this.activecol);
  if (a != null) {
    a.over = false;
    //        a.style.background = "#ff8888";
    a.style.background = "#a6222a";
    a.style.color = "#ffffff";
    a.style.cursor = "";
    a.style.fontWeight = "";
  }

//    o = document.createElement("a");
//    o.innerHTML = "dhahgfhjgfhjdj";
//    this.col4.removeChild(this.detailtab);
//    document.write(this.detailtab.id);
//    o = document.getElementById("detail");
//    this.maintab.removeChild(this.detailtab);
//    document.body.removeChild(this.detailtab);
//    for(x = 0; document.body.childNodes[x]; x++) {
//        document.write(document.body.col4.id);
//    }
//
//    this.detailtab = document.createElement("table");
//	this.detailtab.className  = "detailtable";
}

JRTab.prototype.getNejblizsiOdjezd = function(H, M) {
  res = null;
  for(i1 = H; i1 < 24; i1++) {
    if (this.JRt.JRtab[i1] != null) {
      for(ii1 = 0; ii1 < this.JRt.JRtab[i1].length; ii1++) {
        if ((this.JRt.JRtab[i1][ii1].odjezd >= M) || (i1 != H)) {
          res = i1 * 1000 +  ii1;//parseInt(this.JRt.JRtab[i1][ii1].odjezd);
          return res;
        }
      }
    }
  }
  return res;
}

JRTab.prototype.getHeight = function() {
  return this.maintab.offsetHeight;
}

JRTab.prototype.show = function(tag) {
  ntag = document.getElementById(tag);

  //if (ntag == null) {
  for(x = 0; ntag.childNodes[x]; x++) {
    ntag.removeChild(ntag.childNodes[x]);
  }
  ntag = document.getElementById(tag);
  for(x = 0; ntag.childNodes[x]; x++) {
    ntag.removeChild(ntag.childNodes[x]);
  }

  this.pozaditab = document.createElement("table");
  this.pozaditab.className = "jrtable";
  this.pozadirow = this.pozaditab.insertRow(0);
  this.pozadicol = this.pozadirow.insertCell(0);

  this.pozadidiv = document.createElement("div");
  this.pozadidiv.className = "pozadi";
  if (this.movableJR == true) {
    this.pozadidiv.style.backgroundColor = '#ffffff';
  }

  this.pozadidiv.appendChild(this.output);
  if ((this.pouzitePozn.poznamky != null) || (this.pouzitePoznZastavky.poznamky != null)) {
    this.pozadidiv.appendChild(this.output1);
  }

  this.obloukdiv = document.createElement("div");
  this.obloukdiv.className = "pozadioblouk"
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_1";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_2";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_3";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_4";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_5";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_6";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_7";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_8";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_9";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_10";
  this.obloukdiv.appendChild(this.obloukelement);

  if (this.movableJR == true) {
    moving = false;

    this.obloukdiv.onmousedown = function mouseDown(ev) {
      this.moving = true;
      ev = ev || window.event;
      var mousePos = mouseCoords(ev);
      mx = mousePos.x;
      my = mousePos.y;
      moving = true;
      document.onselectstart = function(ev) {return false;};
    }

    this.obloukdiv.onmouseup = function() {
      this.moving = false;
      moving = false;
      document.onselectstart = null;
    }
    
    this.obloukdiv.style.height = '25px';
    this.obloukdiv.style.cursor = 'move';
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
    this.obloukelement = document.createElement("div");
    this.obloukelement.className = "pozadi1_10";
    this.obloukdiv.appendChild(this.obloukelement);
  //}

  closemoving = false;
  this.obrclose = document.createElement('img');
  this.obrclose.className = "close";
  this.obrclose.src = "http://www.mhdspoje.cz/jrw20/png/closeinactive.png";
  this.obrclose.onmouseover = function closeOver(ev) { this.src = "http://www.mhdspoje.cz/jrw20/png/closeactive.png"; };
  this.obrclose.onmouseout = function closeOut(ev) { this.src = "http://www.mhdspoje.cz/jrw20/png/closeinactive.png"; };
  this.obrclose.onmousedown = function closeDown(ev) { closemoving = true; };
  this.obrclose.onmouseup = function closeup(ev) { closemoving = false; };
  this.obrclose.onmousemove = null;//function closeDown(ev) { /*moving = false;*/ };
  this.obrclose.onclick = function closeclick(ev) {
    document.body.removeChild(document.getElementById('divJR'));
  }
  this.obloukdiv.appendChild(this.obrclose);
}

  this.pozadicol.appendChild(this.obloukdiv);
  this.pozadicol.appendChild(this.pozadidiv);
    
  this.obloukdiv = document.createElement("div");
  this.obloukdiv.className = "pozadioblouk"
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_10";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_9";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_8";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_7";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_6";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_5";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_4";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_3";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_2";
  this.obloukdiv.appendChild(this.obloukelement);
  this.obloukelement = document.createElement("div");
  this.obloukelement.className = "pozadi1_1";
  this.obloukdiv.appendChild(this.obloukelement);
    
  this.pozadicol.appendChild(this.obloukdiv);
    
  ntag.appendChild(this.pozaditab);

  //    document.getElementById("load").style.visibility = "hidden";
  document.getElementById('divJR').style.visibility = 'visible';
  if (this.movableJR == true) {
    document.onmousemove = function mouseMove(ev){
      if ((moving == true) && (closemoving == false)) {
        document.body.onselectstart = "return false";
        ev = ev || window.event;
        var mousePos = mouseCoords(ev);
        document.getElementById('divJR').style.left = document.getElementById('divJR').offsetLeft + (mousePos.x - mx) + 'px';
        document.getElementById('divJR').style.top = document.getElementById('divJR').offsetTop + (mousePos.y - my) + 'px';
        mx = mousePos.x;
        my = mousePos.y;
      }
    }
  }
//    this.pozntable.style.width = this.zasttab.offsetWidth + this.tab.offsetWidth + this.detailtab.offsetWidth;
}

JRTab.prototype.setWidth = function() {
  //    this.pozntable.style.width = "200px";//this.zasttab.offsetWidth + this.tab.offsetWidth + this.detailtab.offsetWidth;
  }

function mouseCoords(ev){
    if(ev.pageX || ev.pageY){
         return {x:ev.pageX, y:ev.pageY};
     }
     return {
         x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
         y:ev.clientY + document.body.scrollTop  - document.body.clientTop
     };
 }


function jrsover(obj) {
  //    try {
  if (obj.over != false) {
    obj.style.background = "#ffff00";
    obj.style.fontWeight = "bold";
    obj.style.cursor = "pointer";
  }
//    }
//    catch(chyba) {}
}

function jrsout(obj) {
  try {
    if (obj.over != false) {
      obj.style.background = "";
      obj.style.fontWeight = "";
      obj.style.cursor = "";
    }
  }
  catch(chyba) {}
}

function zastover(obj) {
  try {
    if (obj.name != "NO") {
      obj.style.color = "#FFFFFF";
    }
  }
  catch(chyba) {}
}

function zastout(obj) {
  try {
    if (obj.name != "NO") {
      //            obj.style.color = "#FFFFFF";
      obj.style.color = "";
    } else {

  }
  }
  catch(chyba) {}
}

function zastclick(obj, _J) {
  try {
    if ((obj.name != "NO") && (_J.trasa[obj.id][3] != false)) {
      //            document.getElementById("loadtext").innerHTML = "";
      //            document.getElementById("load").style.visibility = "visible";
      var t = _J.trasa[obj.id][1];
      var target = document.createElement("script");
      target.setAttribute("src", "http://www.mhdspoje.cz/jrw20/LoadJR.php?l="+_J.c_linky+"&t="+t+"&s="+_J.smer+"&jr=JR&j=j&i=0&ta=tabulka&po="+_J.kod+"&loc="+lokace+"&move="+movableJR);//document.getElementById("combolocation").value);
      document.body.appendChild(target);

      tarifindex = document.getElementById('combotrasa');
      for (i = 0; i < tarifindex.length; i++) {
        if (tarifindex.options[i].value == t) {
          tarifindex.selectedIndex = i;
          /*                    if (tarifindex.refresh != undefined) {
                        tarifindex.refresh();
                    }*/
          break;
        }
      }
    //            document.getElementById("load").style.visibility = "hidden";
    }
  }
  catch(chyba) {}
}

function otocSmer(obj, _J) {
  try {
    if (((_J.smer == 0) && (obj.idtarif != 0)) || ((_J.smer == 1) && (obj.idtarif != 0))) {
      //            document.getElementById("loadtext").innerHTML = "";
      //            document.getElementById("load").style.visibility = "visible";
      var t = _J.trasa[obj.idtarif][1];
      if (_J.smer == 0) {
        _J.smer = 1;
      } else {
        _J.smer = 0;
      }
      var target = document.createElement("script");
      target.setAttribute("src", "http://www.mhdspoje.cz/jrw20/LoadJR.php?l="+_J.c_linky+"&t="+t+"&s="+_J.smer+"&jr=JR&j=j&i=0&ta=tabulka&po="+_J.kod+"&loc="+lokace+"&move="+movableJR);//document.getElementById("combolocation").value);
      document.body.appendChild(target);

      smerindex = document.getElementById('combosmer');
      smerindex.selectedIndex = _J.smer;
    /*            if (smerindex.refresh != undefined) {
                smerindex.refresh();
            }*/
    }
  }
  catch(chyba) {}
}

function printJR(obj, _J, _pPoznZastavky, _pPozn) {
  w=window.open("","","toolbar=0, location = 0, menubar = 0, resizable = 1");
  w.document.open();
  pageContent = "";
  pageContent += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
  pageContent += '<html  xmlns="http://www.w3.org/1999/xhtml">';
  pageContent += '<head>';
  pageContent += '<title></title> ';
  pageContent += '<link rel="stylesheet" type="text/css" href="http://www.mhdspoje.cz/jrw20/ccs/main.css"></link>';
  pageContent += '<link rel="stylesheet" type="text/css" href="http://www.mhdspoje.cz/jrw20/ccs/tableJR.css"></link>';
  pageContent += '</head>';
  pageContent += '<body>';

  pageContent += '<table class = "printmaintable">';
  pageContent += '<tr>';
  pageContent += '<td>';

  pageContent += '<div style = "height: 10px;">';
  pageContent += '</div>';

  pageContent += '<div class = "printpozadioblouk">';
  pageContent += '<div class = "printpozadi1_1">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_2">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_3">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_4">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_5">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_6">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_7">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_8">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_9">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_10">';
  pageContent += '</div>';
  pageContent += '</div>';

  pageContent += '<div class = printpozadi>';

  pageContent += '<table class="printjrtable">';
  pageContent += '<tr>';
  pageContent += '<td colspan=3>';
  doprava = Linky.getLinkabyId(comboLinky.options[comboLinky.selectedIndex].value).doprava;
  if (doprava == 'A') {
    obrsrc = "http://www.mhdspoje.cz/jrw20/png/tra19.PNG";
  }
  if (doprava == 'T') {
    obrsrc = "http://www.mhdspoje.cz/jrw20/png/bus19.PNG";
  }
  if (doprava == 'O') {
    obrsrc = "http://www.mhdspoje.cz/jrw20/png/tro19.PNG";
  }
  pageContent += '<img src = "' + obrsrc  + '" style = "vertical-align: bottom;">';
  pageContent += '<a class = "printlinka">';
  pageContent += comboLinky.options[comboLinky.selectedIndex].text ;
  pageContent += '</a>';
  pageContent += '<a class = "printdatum">';
  pageContent += " (" + formatDDMMYYY(cCalendar.activeday, cCalendar.activemonth, cCalendar.activeyear) + ")";
  pageContent += '</a>';
  pageContent += '<a class = "printden">';
  pageContent += "-  " + cCalendar.getTypeDay();
  pageContent += '</a>';

  pageContent += '<tr>';
  pageContent += '<td style = "margin-bottom = 5px; border-bottom-style: solid; border-bottom-width: 1px;" colspan=3>';
  pageContent += '<a>';
  if (language == 1) {
    pageContent +=  'směr : ';
  }
  if (language == 2) {
    pageContent +=  'smer : ';
  }
  if (language == 3) {
    pageContent +=  'direction : ';
  }
  pageContent += '</a>';
  pageContent += '<a class = "printsmer">';
//    pageContent +=  _J.trasa[_J.trasa.length - 1][2];
  if (_J.smer == 0) {
    pageContent +=  Linky.getLinkabyId(_J.c_linky).smerA;
  }
  if (_J.smer == 1) {
    pageContent +=  Linky.getLinkabyId(_J.c_linky).smerB;
  }
  pageContent += '</a>';

  pageContent += '<tr>';
  pageContent += '<td style = "vertical-align: top;">';

  pageContent += '<table class="printzastavkytable">';
  pageContent += '<tr>';
  pageContent += '<td class="center">';
  if (language == 1) {
    pageContent += '<a >pásmo</a>';
  }
  if (language == 2) {
    pageContent += '<a >pásmo</a>';
  }
  if (language == 3) {
    pageContent += '<a >zone</a>';
  }
  pageContent += '<td class="center">';
  if (language == 1) {
    pageContent += '<a>zastávka</a>';
  }
  if (language == 2) {
    pageContent += '<a>zastávka</a>';
  }
  if (language == 3) {
    pageContent += '<a>*station</a>';
  }

  for(i = 0; i < _J.trasa.length; i++) {
    pageContent += '<tr>';
    pageContent += '<td>';

    if (_J.smer == 0) {
      if (_J.trasa[i][5] != '') {
        pageContent += '<a class="printpasmo">';
        pageContent += _J.trasa[i][5];
        pageContent += '</a>';
      }
    } else {
      if (_J.trasa[i][7] != '') {
        pageContent += '<a class="printpasmo">';
        pageContent += _J.trasa[i][7];
        pageContent += '</a>';
      }
    }

    if (_J.smer == 0) {
      if (_J.trasa[i][6] != '') {
        pageContent += '<a class="printpasmo">';
        pageContent += _J.trasa[i][6];
        pageContent += '</a>';
      }
    } else {
      if (_J.trasa[i][8] != '') {
        pageContent += '<a class="printpasmo">';
        pageContent += _J.trasa[i][8];
        pageContent += '</a>';
      }
    }


    pageContent += '<td>';
    if (_J.trasa[i][3] == false) {
      pageContentpom = '<a class="printzastavkydisable">';
    } else {
      if (_J.activeZastavka == i) {
        pageContentpom = '<a class="printzastavkyactual">';
      } else {
        pageContentpom = '<a class="printzastavkyenable">';
      }
    }
    pageContent += pageContentpom;
    pageContent += _J.trasa[i][2];
    pageContent += '</a>';

    if (_J.trasa[i][4].poznamky != null) {
      for(ii = 0; ii < _J.trasa[i][4].poznamky.size(); ii++) {
        poz = Poznamky.getPoznamkaID(_J.trasa[i][4].poznamky.elementAt(ii).c_kodu);

        if (poz != null) {
          poz1 = _pPoznZastavky.getPoznamkaID(_J.trasa[i][4].poznamky.elementAt(ii).c_kodu);
          if (poz1 == null) {
            _pPoznZastavky.addPoznamka(poz.c_kodu, poz.oznaceni, poz.popis, poz.obrazek);
          }
        }

        if (poz.obrazek != null) {
          if (ii > 0) {
            pageContent += pageContentpom;
            pageContent += ',';
            pageContent += '</a>';
          }
          pageContent += '<img src = ';
          obrsrc = "http://www.mhdspoje.cz/jrw20/png/" + poz.obrazek;
          obrtitle = poz.popis;
          pageContent += '"' + obrsrc + '" title = "' + obrtitle + '">';
        } else {
          if (ii > 0) {
            pageContent += pageContentpom;
            pageContent += ',';
            pageContent += '</a>';
          }
          pageContent += pageContentpom;
          pageContent += poz.oznaceni;
          pageContent += '</a>';
        }
      }
    }

  }

  pageContent += '</table>';

  pageContent += '<td style = "vertical-align: top;">';
  pageContent += '<table class = "printtableJR">';
  for(i = 0; i < 24; i++) {
    if (i % 2 == 0) {
      pageContent += '<tr class = "printsudaradka">';
    } else {
      pageContent += '<tr class = "printlicharadka">';
    }
    pageContent += '<td class = "printhourJR">';
    cas = i;
    if (i.toString(10).length == 1) {
      cas = '0' + cas;
    }
    pageContent += '<a>';
    pageContent += cas;
    pageContent += '</a>';

    for(ii = 0; ii < _J.numCol; ii++) {
      pageContent += '<td>';
      nactiobr = false;
      if (_J.JRtab[i] != null) {
        if (ii < _J.JRtab[i].length) {
          str = _J.JRtab[i][ii].odjezd;
          pageContent += '<a class = "printtimeJR" title = "' + i+":"+str +  '">';
          if (_J.JRtab[i][ii] != null) {
            if (_J.JRtab[i][ii].poznamky != null)     {

              for(iii = 0; iii < _J.JRtab[i][ii].poznamky.length; iii++) {
                id = _J.JRtab[i][ii].poznamky[iii];
                poz = Poznamky.getPoznamkaID(id);
                if (poz != null) {
                  poz1 = _pPozn.getPoznamkaID(id);
                  if (poz1 == null) {
                    _pPozn.addPoznamka(poz.c_kodu, poz.oznaceni, poz.popis, poz.obrazek);
                  }
                }
                this.nactiobr = true;
                if (poz == null) {
                } else {
                  this.nactiobr = true;
                }
              }
            }
          }
          pageContent += str;
          pageContent += '</a>';
        }
      }

      if (_J.JRtab[i] != null) {
        if (ii < _J.JRtab[i].length) {
          if (zobrazitkurz == 1) {
            if (_J.JRtab[i][ii].kurz != null) {
              pageContent += '<a class = "printkurzJR">';
              pageContent += "(" + _J.JRtab[i][ii].kurz + ")";
              pageContent += '</a>';
            }
          }
        }
      }
      if (this.nactiobr == true) {
        prvniA = true;
        prvniB = true;
        for(iii = 0; iii < _J.JRtab[i][ii].poznamky.length; iii++) {
          id = _J.JRtab[i][ii].poznamky[iii];
          poz = Poznamky.getPoznamkaID(id);
          if ((poz.obrazek == null)) {
            if ((prvniA == false) || (prvniB == false)) {
              pageContent += '<a>';
              pageContent += ",";
              pageContent += '</a>';
            }
            pageContent += '<a title = "' + poz.popis + '">';
            pageContent +=  poz.oznaceni;
            pageContent += '</a>';
            prvniA = false;
          } else {
            if ((prvniA == false) || (prvniB == false)) {
              pageContent += '<a>';
              pageContent += ",";
              pageContent += '</a>';
            }
            pageContent += '<img src = "' + "http://www.mhdspoje.cz/jrw20/png/" + poz.obrazek + '" title = "' + poz.popis + '">';
            prvniB = false;
          }
        }
      }
    }
  }
  pageContent += '</table>';

  pageContent += '<tr>';
  pageContent += '<td style = "margin-top = 5px; border-top-style: solid; border-top-width: 1px; text-align: right;" colspan=3>';
  pageContent += '<a class = "printFS">JRw ver. 2.0. - SKELETON &reg FS software s.r.o.</a>';

  if (_pPoznZastavky.poznamky != null) {
    pageContent += '<tr>';
    pageContent += '<td colspan=3>';
    pageContent += '<a class = "printpoznamkyheader">';
    if (language == 1) {
      pageContent += 'Poznámky zastávek : ';
    }
    if (language == 2) {
      pageContent += 'Poznámky zastávok : ';
    }
    if (language == 3) {
      pageContent += 'Station notes : ';
    }
    pageContent += '</a>';

    for(i = 0; i < _pPoznZastavky.poznamky.size(); i++) {
      pageContent += '<tr>';
      pageContent += '<td colspan=3>';

      if (_pPoznZastavky.poznamky.elementAt(i).obrazek != null) {
        pageContent += '<img style = "padding-right: 10px; padding-left: 10px;" src = "' + "http://www.mhdspoje.cz/jrw20/png/" + _pPoznZastavky.poznamky.elementAt(i).obrazek + '">';
      } else {
        pageContent += '<a class = "printpoznamkyoznaceni">';
        pageContent += _pPoznZastavky.poznamky.elementAt(i).oznaceni;
        pageContent += '</a>';
      }

      pageContent += '<a class = "printpoznamkypopis">';
      pageContent += _pPoznZastavky.poznamky.elementAt(i).popis;
      pageContent += '</a>';
    }
  }

  if (_pPozn.poznamky != null) {
    pageContent += '<tr>';
    pageContent += '<td colspan=3>';
    pageContent += '<a class = "printpoznamkyheader">';
    if (language == 1) {
      pageContent += 'Poznámky spojů : ';
    }
    if (language == 2) {
      pageContent += 'Poznámky spojov : ';
    }
    if (language == 3) {
      pageContent += 'Routing notes : ';
    }
    pageContent += '</a>';

    for(i = 0; i < _pPozn.poznamky.size(); i++) {
      pageContent += '<tr>';
      pageContent += '<td colspan=3>';

      if (_pPozn.poznamky.elementAt(i).obrazek != null) {
        pageContent += '<img style = "padding-right: 10px; padding-left: 10px;" src = "' + "http://www.mhdspoje.cz/jrw20/png/" + _pPozn.poznamky.elementAt(i).obrazek + '">';
      } else {
        pageContent += '<a class = "printpoznamkyoznaceni">';
        pageContent += _pPozn.poznamky.elementAt(i).oznaceni;
        pageContent += '</a>';
      }

      pageContent += '<a class = "printpoznamkypopis">';
      pageContent += _pPozn.poznamky.elementAt(i).popis;
      pageContent += '</a>';
    }
  }

  pageContent += '</table>';
  pageContent += '</div>';

  pageContent += '<div class = "printpozadioblouk">';
  pageContent += '<div class = "printpozadi1_10">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_9">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_8">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_7">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_6">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_5">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_4">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_3">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_2">';
  pageContent += '</div>';
  pageContent += '<div class = "printpozadi1_1">';
  pageContent += '</div>';
  pageContent += '</div>';

  pageContent += '<div style = "height: 10px;">';
  pageContent += '</div>';

  pageContent += '</table>';
  pageContent += '</body>';
  pageContent += '</html>';

  w.document.write(pageContent);
  w.document.close();
  w.print();
}

function jrclick(obj, i, ii) {
  //    document.write(obj.row+" "+obj.col);
  obj.obj.createDetail(obj.chrono, obj.row, obj.col);
}


