
  function OpenDetailWin(url) {
w = window.open (url?url:'', 'detail','resizable=0,top=0,left=0,menubar=0,scrollbars=1,width=800,height=630');
  }

  function Opener2Hp() {
    if (window.opener)
      window.opener.document.location.replace('http://www.travel.cz/hp_en.html');
    else
      window.open('http://www.travel.cz/hp_en.html', '_blank')

    window.close();
  } 
  
  function FocusOpener() {
    if (window.opener)
      window.opener.focus();
    window.close();
  }

  function OpenLargeView(type, typeID, photoID) {
var wsize = WindowSize();
window.open ('http://www.travel.cz/largeview_en.html?'+type+"="+typeID+"&photoID="+photoID+"&res="+wsize, '_blank','resizable=0,top=0,left=0,menubar=0,scrollbars=1,width='+(wsize+30)+',height='+(wsize+70));
  }

  function OpenLargeViewIndex(type, typeID, index) {
var wsize = WindowSize();
window.open ('http://www.travel.cz/largeview_en.html?'+type+"="+typeID+"&index="+index+"&res="+wsize, '_blank','resizable=0,top=0,left=0,menubar=0,scrollbars=1,width='+(wsize+30)+',height='+(wsize+70));
  }

 function WindowSize() {
   if (!document.body.offsetWidth) //pro NS natvrdo 300
     return 300;
  else {
       if (document.body.offsetWidth) {
         if (document.body.offsetWidth<=620)
           return 300;
         if (document.body.offsetWidth<=780)
           return photo_size=450;
         return photo_size=600;
       }
       else
         return 300;
  }
}

function Valid_date(d,m,y) {
  month_length = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

  if ( ((y % 4)==0) && ((y % 100)!=0) || ((y % 400)==0) )
    month_length[1] = 29; //prestupny rok

  if (isNaN(y))
    return false;

  if ( (m<1) || (m>12) || isNaN(m) )
    return false;

  if ( (d>month_length[m-1]) || (d<1) || isNaN(d) )
    return false;

  dt = new Date(y, m-1, d, 23, 59, 59);
  today = new Date();

  if (dt.getTime()<today.getTime())
    return false;

  return true;
}

function OpenCal(form) {
  var my = document.forms[form]["ch_my"].options[document.forms[form]["ch_my"].selectedIndex].value;
  var d = document.forms[form]["ch_d"].options[document.forms[form]["ch_d"].selectedIndex].value
  var pos = my.indexOf('#1');
  var date = my.substring(0,pos)+d+my.substring(pos+2);

window.open ('http://www.travel.cz/others/calendar.html?date='+date+'&form='+form, '_blank','resizable=0,top=0,left=0,menubar=0,scrollbars=0,width=200,height=300');
  }

function OpenRatesOverView(id, checkin, checkout) {
window.open ('http://www.travel.cz/others/rates_overview_en.html?detailID='+id+'&checkin='+checkin+'&checkout='+checkout, '_blank','resizable=0,top=0,left=0,menubar=0,scrollbars=yes,width=300,height=400');
}

