var regemail = /^[+]*[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*\.)+[a-z]{2,3}$/i;
var wIndou52 = null;

function dummy(){}

function validatePosNumber (Ctrl){
        var flag = new Boolean ();
        flag = true;
        for (index = Ctrl.value.length-1; flag && index >= 0; index--) {
                ch = Ctrl.value.charAt(index);
                if (ch != "0" && ch != "1" && ch != "2" && ch != "3" && ch != "4" &&
                        ch != "5" && ch != "6" && ch != "7" && ch != "8" && ch != "9") flag = false;
        }
        return flag;
}

function IsLeapYear(y)
{
        if (0 == y%4 && ((y%100 != 0) || (y%400 == 0))) return true;
        else return false;
}

function DayEnd(mes, rok)
{
        pocet_dni = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
        pocet = pocet_dni[mes - 1];
        if ((IsLeapYear(rok)) && (mes == 2)) pocet = 29;
        return pocet;
}

function checkBirthday(year,month,day) {
  var retval=0;
  var today = new Date();

  var diff;
  if(year>=1000 && year<=9999 && month>=1 && month<=12 && day>=1 && day<=DayEnd(month,year)) {
    diff=today.getFullYear()-year;
    if(diff<3 || diff>100) {
      d=today.getDate();
      m=today.getMonth()+1;
      if (!(((diff == 2) && (month<=m) && (day<=d)) || ((diff == 101) && (month>=m) && (day>d)))) retval = 1;
    }
  } else retval=2;
  return(retval);
}

function FormControl(ctrl,FC){
 var Message,Field,value,i;
 var RetVal=true;

 for (i=0; i<FC.length && RetVal; i++){
  Field=eval("ctrl."+FC[i][0]);
  if (Field) {
   value=Field.value;
   checked=Field.checked;
   if(!eval(FC[i][1])){
    Message=FC[i][2];
    RetVal=false;
   }
  }
 }
 if(!RetVal){
  alert(Message);
  Field.focus();
  if (Field.type=="text" || Field.type=="password"){
   Field.select();
  }
 }
 return RetVal;
}

function WinOpenScroll(html,name,width,height) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   window.open(html,name,'scrollbars=yes,width='+width+',height='+height+',left='+Math.floor((screen.width-30-width)/2)+',top='+Math.floor((screen.height-30-height)/2));
  } else {
   window.open(html,name,'scrollbars=yes,width='+width+',height='+height);
  }
 }
}

function terminal(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(href,'terminal','scrollbars=no,width=700,height=500,left=10,top=10');
  } else {
   w=window.open(href,'terminal','scrollbars=no,width=700,height=500');
  }
  if(w) w.focus();
 }
}

function terminal2(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(href,'terminal','scrollbars=no,width=790,height=535,left=10,top=10');
  } else {
   w=window.open('href','terminal','scrollbars=no,width=790,height=535');
  }
  if(w) w.focus();
 }
}

function terminal_html(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(href,'terminal','scrollbars=no,width=630,height=420,left=10,top=10');
  } else {
   w=window.open(href,'terminal','scrollbars=no,width=630,height=420');
  }
  if(w) w.focus();
 }
}


function ShowCert(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(href, "opravneni", "resizable=yes,toolbar=yes,scrollbars=yes,width=640,height=480,left="+Math.floor((screen.width-640-12)/2)+",top="+Math.floor((screen.height-480-78)/2));
  } else {
   w=window.open(href, "opravneni", "resizable=yes,toolbar=yes,scrollbars=yes,width=640,height=480");
  }
  if(w) w.focus();
 }
}

function ShowOverview(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(href, "prehled", "resizable=no,toolbar=no,scrollbars=yes,width=645,height=300,left="+Math.floor((screen.width-645-12)/2)+",top="+Math.floor((screen.height-300-78)/2));
  } else {
   w=window.open(href, "prehled", "resizable=no,toolbar=no,scrollbars=yes,width=645,height=300");
  }
  if(w) w.focus();
 }
}

function airports(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   retezec="scrollbars=no,width=700,height=400,left="+Math.floor((screen.width-668)/2)+",top="+Math.floor((screen.height-408)/2);
   w=window.open(href,'airport',retezec);
  } else {
   retezec="scrollbars=no,width=700,height=400,left="+Math.floor((screen.width-668)/2)+",top="+Math.floor((screen.height-408)/2);
   w=window.open(href,'airport',retezec);
  }
  if(w) w.focus();
 }
}

function airports2(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   retezec="scrollbars=yes,width=700,height=400,left="+Math.floor((screen.width-668)/2)+",top="+Math.floor((screen.height-408)/2);
   w=window.open(href,'airport',retezec);
  } else {
   retezec="scrollbars=yes,width=700,height=400,left="+Math.floor((screen.width-668)/2)+",top="+Math.floor((screen.height-408)/2);
   w=window.open(href,'airport',retezec);
  }
  if(w) w.focus();
 }
}

function jazyk(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(href,'jazyk','width=500,height=350,left='+Math.floor((screen.width-30-500)/2)+',top='+Math.floor((screen.height-30-350)/2));
  } else {
   w=window.open(href,'jazyk','width=500,height=350');
  }
  if(w) w.focus();
 }
}

function Flotila(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(href, "flotila", "resizable=yes,toolbar=yes,scrollbars=yes,width=656,height=480,left="+Math.floor((screen.width-668)/2)+",top="+Math.floor((screen.height-558)/2));
  } else {
   w=window.open(href, "flotila", "resizable=yes,toolbar=yes,scrollbars=yes,width=656,height=480");
  }
  if(w) w.focus();
 }
}

function printCard(csano,ffidhash,actid) {
 var width=700;
 var height=500;
 var href="?csano="+csano+"&ffidhash="+ffidhash+"&actid="+actid+"&format=print&print=card";
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
    window.open(href, 'printpage'+Math.floor(Math.random()*1000), 'resizable=yes,toolbar=yes,scrollbars=yes,width='+width+',height='+height+',left='+Math.floor((screen.width-width-10)/2)+',top='+Math.floor((screen.height-height-76)/2));
  } else {
    window.open(href, 'printpage'+Math.floor(Math.random()*1000), 'resizable=yes,toolbar=yes,scrollbars=yes,width='+width+',height='+height);
  }
 }
}

function printPage(urimodif) {
 var width=700;
 var height=500;
 if(urimodif) {
  if (parseInt(navigator.appVersion) >= 2 ) {
   if (parseInt(navigator.appVersion) >= 4 ) {
    window.open(urimodif, 'printpage'+Math.floor(Math.random()*1000), 'resizable=yes,toolbar=yes,scrollbars=yes,width='+width+',height='+height+',left='+Math.floor((screen.width-width-10)/2)+',top='+Math.floor((screen.height-height-76)/2));
   } else {
    window.open(urimodif, 'printpage'+Math.floor(Math.random()*1000), 'resizable=yes,toolbar=yes,scrollbars=yes,width='+width+',height='+height);
   }
  }
 }
}

function ResOff(iata) {
 var x=550;
 var y=270;
 var w=null;
 var l=window.location.pathname.substr(0,4);
 if (l!="/cs/") l="/en/";
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(l+"zahranici/rez_kancelare.htm?resoff="+iata, "resoff","scrollbars=yes,width="+x+",height="+y+",left="+Math.floor((screen.width-10-x)/2)+",top="+Math.floor((screen.height-30-y)/2));
  } else {
   w=window.open(l+"zahranici/rez_kancelare.htm?resoff="+iata, "resoff","scrollbars=yes,width="+x+",height="+y);
  }
  if(w) w.focus();
 }
}

function ResOffCity(iata) {
 var x=550;
 var y=270;
 var w=null;
 var l=window.location.pathname.substr(0,4);
 if (l!="/cs/") l="/en/";
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(l+"zahranici/rez_kancelare.htm?resoff="+iata,"resoff","scrollbars=yes,width="+x+",height="+y+",left="+Math.floor((screen.width-10-x)/2)+",top="+Math.floor((screen.height-30-y)/2));
  } else {
   w=window.open(l+"zahranici/rez_kancelare.htm?resoff="+iata,"resoff","scrollbars=yes,width="+x+",height="+y);
  }
  if(w) w.focus();
 }
}

function ResOffCountry(iata) {
 var x=550;
 var y=270;
 var w=null;
 var l=window.location.pathname.substr(0,4);
 if (l!="/cs/") l="/en/";
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(l+"zahranici/rez_kancelare.htm?zeme="+iata,"resoff","scrollbars=yes,width="+x+",height="+y+",left="+Math.floor((screen.width-10-x)/2)+",top="+Math.floor((screen.height-30-y)/2));
  } else {
   w=window.open(l+"zahranici/rez_kancelare.htm?zeme="+iata,"resoff","scrollbars=yes,width="+x+",height="+y);
  }
  if(w) w.focus();
 }
}

function Demo(href) {
 var x=796;
 var y=570;
 var w=null;
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   w=window.open(href,'demo','resizable=yes,scrollbars=yes,width='+x+',height='+y+',left='+Math.floor((screen.width-x)/2)+',top='+Math.floor((screen.height-30-y)/2));
  } else {
   w=window.open(href,'demo','resizable=yes,scrollbars=yes,width='+x+',height='+y);
  }
  if(w) w.focus();
 }
}

function SitaCargo(href) {
 if (parseInt(navigator.appVersion) >= 2 ) {
  if (parseInt(navigator.appVersion) >= 4 ) {
   window.open(href, "SITA", "resizable=yes,toolbar=no,location=yes,scrollbars=yes,width=700,height=480,left="+Math.floor((screen.width-668)/2)+",top="+Math.floor((screen.height-558)/2));
  } else {
   window.open(href, "SITA", "resizable=yes,toolbar=no,location=yes,scrollbars=yes,width=700,height=480");
  }
 }
}

// funkce na otevreni noveho okna uprostred obrazovky (v zavorce jsou prenasene parametry)
function WinPopUp(href,width,height,left,top,name,scrollbars,resizable,toolbar,location) {
   if(!width) width=350;
   if(!height) height=260;
   if(!left) left=Math.floor((screen.width-10-width)/2);
   if(!top) top=Math.floor((screen.height-30-height)/2);
   if(!name) name='reklama';
   if(scrollbars) scrollbars='yes';
   else scrollbars='no'
   if(resizable) resizable='yes';
   else resizable='no'
   if(toolbar) toolbar='yes';
   else toolbar='no'
   if(location) location='yes';
   else location='no'
   w=window.open(href,name,"resizable="+resizable+",toolbar="+toolbar+",location="+location+",scrollbars="+scrollbars+",width="+width+",height="+height+",left="+left+",top="+top);
   if(w) w.focus();
}

function img_act(p) {
 if (document.images) {
  on =  eval (p + "_on.src"); document[p].src = on;
 }
}

function img_inact(p) {
 if (document.images) {
  off =  eval (p + "_off.src"); document[p].src = off;
 }
}

var openedCalendar = null;
var clndrSetDates = new Array();
//ti - titul okna
//mn - month names
//wd - week names
//hc,bc - barvy
//r1 - day field, r2 - month field, r3 - year field, f - formaty
//mi - cislo mesice od ktereho maji byt datumy aktivni (cislo je o jedno mensi)
//mx - cislo mesice do ktereho maji byt datumy aktivni (cislo je o jedno mensi)
//stm - mesic ktery se ma ukazat pri otevreni okna
//function clndr(stm,ti,mi,mx,mn,wd,ho,hc,bc,r1,f1,r2,f2,r3,f3) {
function clndr(ti,mi,mx,mn,wd,ho,hc,bc,r1,f1,r2,f2,r3,f3) {
    if(openedCalendar && !window.openedCalendar.closed) {
            window.openedCalendar.close();
            window.openedCalendar = null;
    }
    clndr_wi=window.open('about:blank','clndr_wi',"location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0,width=186,height=146,left="+Math.floor((screen.width-196)/2)+",top="+Math.floor((screen.height-175)/2));
    openedCalendar = clndr_wi;
    month = new Number();
    clndr_ho=new Array();
    clndr_mn=new Array();
    clndr_wd=new Array();
//    clndr_stm=new Array();
    clndr_ms=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    clndr_dd=new Date();
    clndr_td=new Date();
    clndr_hd=new Date();
    for(i=0;i<ho.length;i++) if(ho[i].charAt(ho[i].length-1)==".") clndr_ho[i]=ho[i].substring(0,ho[i].length-1);
            else clndr_ho[i]=ho[i];
    for(i=0;i<mn.length;i++) if(document.layers) clndr_mn[i]=clndr_as(mn[i]);
            else clndr_mn[i]=mn[i];
    for(i=0;i<7;i++) if(document.layers) clndr_wd[i]=clndr_as(wd[i]);
            else clndr_wd[i]=wd[i];
    clndr_mi=clndr_mm(mi);
    clndr_mx=clndr_mm(mx);
    clndr_mx.setHours(23);
    clndr_mx.setMinutes(59);
    if(document.layers) clndr_ti=clndr_as(ti);
    else clndr_ti=ti;
//    clndr_stm=stm;
    clndr_hc=hc;
    clndr_bc=bc;
    clndr_r1=r1;
    clndr_r2=r2;
    clndr_r3=r3;
    clndr_f1=f1;
    clndr_f2=f2;
    clndr_f3=f3;
    if(clndrSetDates[clndr_ti])
      clndr_td = clndr_mm(clndrSetDates[clndr_ti]);
    clndr_sh();
}

function clndr_sh() {
    var i,pd,bm,yr,ho,stm;
    var wd=clndr_wi.document;
    wd.open();
    wd.write("<html>\n<head>\n");

// tady se musi nejak osetrit aby pri listovani uz nebylo do clndr_td prirazeno pevne cislo
   // celej trik je v tom dole na radce 387 predat nejakou promennou podle ktery se pozna, ze         // nekdo chce listovat, kdyz se to povede tak je to doma
// v promene clndr_stm je schovana promenna stm predana z formulare
// jinak tim ze do clndr_td dam cislo tak to je cislo mesice-1 ktere se zobrazi jako vychozi
//       clndr_td.setMonth(clndr_stm-1); //
//     if (clndr_st) wd.write("stav="+clndr_st+"\n");
// tady je konec triku s vychozim mesicem

    if(document.all) wd.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset="+document.charset+"\">\n");
    wd.write("<title>"+clndr_ti+"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</title>");
    wd.write("<style>\ntd { background-color: "+clndr_bc+"; text-align: center; font-style: normal; font-size: 11px; font-family: Tahoma, Arial, Helvetica, sans-serif; } input, select { font-size: 11px; } .no { color: #cccccc; } .ce { color: #dd0000; } .mi { color: #555555; } a, a:link, a:visited { color: #000000; text-decoration: none; } a:hover { color: #990000; text-decoration: none; } .border { background-color: "+clndr_hc+"; } .head { background-color: "+clndr_hc+"; }");
    wd.write("</style>\n<scr"+"ipt language=javascript>\n");
    wd.write("\nfunction ff(v) { var id='"+clndr_ti+"'; window.opener.clndr_ff(v,id); }");
// tady se musi nejak poslat promenna, ktera vypne prirazovani mesice do clndr_td vyse
    wd.write("\nfunction sm(v) { window.opener.clndr_td.setMonth(v); window.opener.clndr_sh(); }");
    wd.write("\nfunction sy(v) { window.opener.clndr_td.setFullYear(v); window.opener.clndr_sh(); }");
    wd.write("</scr"+"ipt>\n");
    wd.write("</head>\n<body topmargin=3 leftmargin=3 marginheight=3 marginwidth=3>");
    wd.write("<table width=180 cellpadding=1 cellspacing=0 border=0><tr><td class=border>\n<table width=100% cellpadding=0 cellspacing=0 border=0><tr><td width=20 class=head>");
    if((clndr_td.getFullYear()>clndr_mi.getFullYear())||((clndr_td.getMonth()!=0)&&(clndr_td.getFullYear()==clndr_mi.getFullYear()))) wd.write("<a href=\"javascript:sm("+(clndr_td.getMonth()-1)+")\"><b>&lt;</b></a>");
    else wd.write("<b>&lt;</b>");
        wd.write("</td><td class=head><form><select name=m onchange=\"sm(this[this.selectedIndex].value);\">");

// tady se vypisuje pull down mesicu
        for(i=0;i<12;i++) {
            wd.write("<option value="+i);
// tady se urci ktery mesic ma byt na vypisu jako oznaceny
            if(i==(clndr_td.getMonth())) { wd.write(" selected "); }
            wd.write(">"+clndr_mn[i]+"</option>\n");
        }
        wd.write("</select><select name=r onchange=\"sy(this[this.selectedIndex].value);\">");
        for(i=clndr_mi.getFullYear();i<(clndr_mx.getFullYear()+1);i++) {
            wd.write("<option value="+i);
            if(i==clndr_td.getFullYear()) wd.write(" selected ");
            wd.write(">"+i+"</option>\n");
        }
        wd.write("</select></td></form><td class=head width=20>");
    if((clndr_td.getFullYear()<clndr_mx.getFullYear())||((clndr_td.getMonth()!=11)&&(clndr_td.getFullYear()==clndr_mx.getFullYear()))) wd.write("<a href=\"javascript:sm("+(clndr_td.getMonth()+1)+")\"><b>&gt;</b></a>");
    else wd.write("<b>&gt;</b>");
    wd.write("</td></tr></table><table width=100% cellpadding=2 cellspacing=0 border=0><tr>");
    for(i=0;i<6;i++) wd.write("<td width=20><b>"+clndr_wd[i]+"</b></td>");
    wd.write("<td width=20><span class=ce><b>"+clndr_wd[6]+"</b></span></td></tr>\n");
    clndr_td.setDate(1);
    pd=clndr_td.getDay()-1;
    clndr_rc=0;
    if(pd==-1) pd=6;
        bm=clndr_td.getMonth();
        yr=clndr_td.getFullYear();
        if(bm==0) {
            clndr_td.setMonth(11);
            clndr_td.setFullYear(yr-1);
            clndr_ol();
        } else clndr_td.setMonth(bm-1);
        for(i=clndr_ms[clndr_td.getMonth()]-pd+1;i<=clndr_ms[clndr_td.getMonth()];i++) {
            clndr_td.setDate(i);
             if(clndr_td.getDay()==0) ho="class=ce";
            else ho="";
            wd.write("<td>&nbsp</td>");
        }
        clndr_td.setDate(1);
        clndr_td.setMonth(bm);
        clndr_td.setFullYear(yr);
        clndr_ol();
        for(i=0;i<clndr_ms[(clndr_td.getMonth())];i++) {
            clndr_td.setDate(i+1);
            if((clndr_td.getDay()==1)&&(clndr_td.getDate()!=1)) {
                     wd.write("</tr>\n<tr>");
                     clndr_rc++;
            } else if((clndr_td.getDay()==1)&&(clndr_td.getDate()==1)) wd.write("<tr>");
            if(clndr_td.getDay()==0) ho="class=ce";
            else ho="";
             for(j=0;j<clndr_ho.length;j++) if((clndr_ho[j].substring(0,clndr_ho[j].indexOf("."))==clndr_td.getDate())&&(clndr_ho[j].substring(clndr_ho[j].indexOf(".")+1,clndr_ho[j].length)==(clndr_td.getMonth()+1))) ho="class=ce";
            if((clndr_td.getTime()>clndr_mx.getTime())||(clndr_td.getTime()<clndr_mi.getTime())) wd.write("<td "+ho+"><span class=no>"+clndr_td.getDate()+"</span></td>");
            else if(ho=="") wd.write("<td><a href=\"javascript:ff('"+clndr_td.getDate()+"."+(clndr_td.getMonth()+1)+"."+clndr_td.getFullYear()+"')\">"+clndr_td.getDate()+"</a></td>");
            else wd.write("<td><a href=\"javascript:ff('"+clndr_td.getDate()+"."+(clndr_td.getMonth()+1)+"."+clndr_td.getFullYear()+"')\"><span class=ce>"+clndr_td.getDate()+"</span></a></td>");
        }
        clndr_td.setDate(1);
        clndr_td.setMonth(bm+1);
        pd=clndr_td.getDay()-1;
        if(pd==0) pd=20;
        if(pd==-1) pd=6;
        for(i=1;i<=(7-pd);i++) {
            wd.write("<td>&nbsp</td>");
            clndr_td.setDate(i);
            if(clndr_td.getDay()==0) ho="class=ce";
            else ho="";
        }
        clndr_td.setDate(1);
        clndr_td.setMonth(bm);
        clndr_td.setFullYear(yr);
        clndr_ol();
    if(clndr_rc<5) wd.write("</tr><tr><td colspan=7>&nbsp;</td>");
    wd.write("</tr></table></td></tr></table></body></html>");
    wd.close();
    window.clndr_wi.focus();
}
// zde se urcuje ktery data maji byt aktivni pro prenos do formulare
function clndr_mm(ta) {
    var td=new Date();
    ta=ta.split(".");
    td.setDate(ta[0]);
    td.setMonth(ta[1]-1);
    td.setFullYear(ta[2]);
    td.setHours(0);
    td.setMinutes(0);
    return(td);
}
function clndr_ol() {
    var y=clndr_td.getFullYear();
        if (0 == y%4 && ((y%100 != 0) || (y%400 == 0))) clndr_ms[1]=29;
        else  clndr_ms[1]=28;
}
function clndr_ff(dt,id) {
    var f,r,fr,d,dd,m,mm,mmm,yy,yyyy;
        clndrSetDates[id] = dt;
    var msn=Array('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC');
        dt=dt.split(".");
        d=dt[0];
        if(d<10) dd="0"+d;
        else dd=d;
        m=dt[1];
        if(m<10) mm="0"+m;
        else mm=m;
        mmm = msn[m-1];
        yyyy=dt[2];
        yy=yyyy.substring(2,4);
        for(i=1;i<=3;i++) {
            r=eval("clndr_r"+i);
            f=eval("clndr_f"+i);
            if((r)&&(f!="undefined")) {
                    fr=f.replace("dd",dd);
                    fr=fr.replace("d",d);
                    fr=fr.replace("mmm",mmm);
                    fr=fr.replace("mm",mm);
                    fr=fr.replace("m",m);
                    fr=fr.replace("yyyy",yyyy);
                    fr=fr.replace("yy",yy);
                r.value=fr;
            }
    }
    window.clndr_wi.close();
    openedWindow = false;
}
function clndr_as(co) {
 var k;
 var n="aAaAcCdDeEeEeEiIlLlLnNoOoOoOrRrRsStTuUuUuUyYzZ";
 var o="áÁäÄèÈïÏéÉëËìÌíÍåÅ¾¼òÒóÓôÔöÖàÀøØšŠúÚùÙüÜýÝžŽ";
 for(k=0;k<n.length;k++) co=co.replace(o[k],n[k]);
 return(co);
}

//univerzal funkce pro otevreni formulare do noveho okna
function goLocation(href,formular,width,height,scroll,left,top) {
    var x
    var para = "";
    if(wIndou52 && ! wIndou52.closed) wIndou52.close();

    if(!width) width=640;
    if(!height) height=480;
    if(!scroll) scroll='no';
    else scroll='yes';
    if(!left) left=Math.floor((screen.width-10-width)/2);
    if(!top) top=Math.floor((screen.height-30-height)/2);
    if (formular != "") {
        x = eval("document."+formular+".length");
        for(i=0;i<x;i++) {
            para = para + eval("document."+formular+".elements["+i+"].name") + "=" + eval("document."+formular+".elements["+i+"].value") + "&";
        }
        href = href + "?" + para;
    }
    wIndou52 = window.open(href, "wIndou"+Math.floor(Math.random()*1000), "resizable=yes,toolbar=no,location=no,scrollbars="+scroll+",width="+width+",height="+height+",left="+left+",top="+top);
    if(wIndou52) wIndou52.focus();
}


// letovy rad
function DateValid(den,mesic,rok) {
        if (isNaN(rok)||(rok<1999)||(rok>2099)) return false;
        if (isNaN(mesic)||(mesic<1)||(mesic>12)) return false;
        if (isNaN(den)||(den<1)||(den>31)) return false;
        if (mesic == 2)        {
                if (rok % 4 == 0) {
                        if (den>29) return false;
                } else {
                        if (den>28) return false;
                }
        }
        if ((mesic == 4 || mesic == 6 || mesic == 9 || mesic == 11) && (den>30))  return false;
        return true;
}

function DateControl(datum) {
    var regdate = /^[0-9.]*$/i;
    if(datum.search(regdate) == -1) return false;
        dateArr=datum.split(".",3);
        den=parseInt(dateArr[0],10);
        mesic=parseInt(dateArr[1],10);
        rok=parseInt(dateArr[2],10);
        if(rok<100){
                if(rok>90) rok+=1900;
                else rok+=2000;
        }
         return DateValid(den,mesic,rok);
}

function makeDate(arr) {
    var day = parseInt(arr[0], 10);
    var month = parseInt(arr[1], 10);
    var year = parseInt(arr[2], 10);
    return new Date(year, month-1, day, 0, 0, 0);
}

function goToBooking(href) {
    Ctrl = document.forms["LetRad"];

    var status = LRFormControl();
    if(status) {
        //param = "depiata=CDG&retiata=PRG&depdate=1.3.2002";

        var depiata = Ctrl.flight_from.options[Ctrl.flight_from.selectedIndex].value;
        var retiata = Ctrl.flight_to.options[Ctrl.flight_to.selectedIndex].value;

        var depdate = Ctrl.date1.value;
        var retdate = Ctrl.date2.value;

        var param = 'depiata='+depiata+'&retiata='+retiata+'&depdate='+depdate;
        if(retdate.length) param += '&retdate='+retdate;
        var p = escape(href+"?"+param);
        window.open("/go.php3?url="+p);
    }
}

//letovy rad konec

function verisign(url) {
    var w=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=720,height=440');
}

function moneyConvertor(src) {
    var pos,href,width,height,left,top,win;
    pos = src.search(/\/[a-z]{2}\//);
    if(pos != -1) {
        href = src.substring(0,pos+3)+"/info/mena_convert.htm";
        width = 350;
        height = 315;
        left = Math.floor((screen.width-10-width)/2);
        top = Math.floor((screen.height-30-height)/2);
        win = window.open(href, "moneyConvertor"+Math.floor(Math.random()*1000), "resizable=yes,toolbar=no,location=no,scrollbars=no,width="+width+",height="+height+",left="+left+",top="+top);
        if(win) win.focus();
    }
}
