dbgCount=0;
function debugWrite(what)
{
 if(!self.debug||self.debug.closed){
                 debug=window.open('','dbg', 'toolbar=no,menubar=no,scrollbars=yes, resizable=yes,status=no,location=no,directories=no,top=10, left=610,height=300,width=400');
                 debug.document.write("<HTML><HEAD><TITLE>[W-debugger]</TITLE></HEAD><BODY>")
                }
 dbg="";
 if(what=="[array]")dbg="Array("+what.join(",")+")"
 else if(what=="[object]")dbg="";
 else dbg=what;

 debug.document.write("<table><td><font color=red>msg number <b>"+dbgCount+"</b></font>: </td><td>"+dbg+"</td></table>")
 dbgCount++;
 debug.focus();

}

DayName= new Array(7);
DayName[0]="niedziela"
DayName[1]="poniedziałek"
DayName[2]="wtorek"
DayName[3]=pls+"roda"
DayName[4]="czwartek"
DayName[5]="pi"+pla+"tek"
DayName[6]="sobota"

MonthName=new Array(12)
MonthName[0]="stycznia"
MonthName[1]="lutego"
MonthName[2]="marca"
MonthName[3]="kwietnia"
MonthName[4]="maja"
MonthName[5]="czerwca"
MonthName[6]="lipca"
MonthName[7]="sierpnia"
MonthName[8]="wrze"+pls+"nia"
MonthName[9]="pa"+plz+"dziernika"
MonthName[10]="listopada"
MonthName[11]="grudnia"

function getDateStr()
{
 var Today=new Date()
 var WeekDay=Today.getDay()
 var Month=Today.getMonth()
 var Day = Today.getDate()
 var Year=Today.getFullYear()
 
 dateStr = DayName[WeekDay]+", "+Day+" "+MonthName[Month]+" "+Year+" r.";
 //alert(Year);
 return dateStr;
 
}

function right(e)
{
     var msg = "\nCopyright \ KR Public Relations\n\n";
     if (navigator.appName == 'Netscape' && e.which == 3)
     {
     alert(msg);
     return false;
     }

     else if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2)
     {
     alert(msg);
     return false;
     }

     return true;
}
//document.onmousedown = right;

//jezeli strona jest wieksza (dluzsza) niz 2 ekrany, to wypluwa podany kod
function ifHigher(mult,code)
{
 if(document.all){
                  if(document.offsetHeight>window.screen.height*mult)
                      document.write(code);
                  }
 if(document.layers){
                     if(document.height>window.screen.height*mult)
                                 document.write(code);

                     }
}

function doNetscape()
{
 document.ids.stopka.fontSize='10px';
 document.classes.linkiSmallRed.a.fontSize='10px';
 document.classes.linkiStopka.a.fontSize='10px';
}


function init()
{
 if(document.all)remove_linkdots()
 if(document.layers){
                     setTimeout('initWMenuNS()',500);
                     if(document.layers.formPrzelot){//jest wlaczona wyszukiwarka zaawansowana
                                                     document.layers.formPrzelot.moveTo(document.layers.FPlacer.pageX,document.layers.FPlacer.pageY)
                                                     document.layers.formWlasny.moveTo(document.layers.FPlacer.pageX,document.layers.FPlacer.pageY)
                                                     document.layers.formPrzelot.visibility='show'
                                                     tmpForm=document.layers.formPrzelot.document.formFind
                                                     document.layers.formWlasny.visibility='hide'
                                                    }
                     if(menuToOpen!="")onMenu(menuToOpen)
                     }
}

function remove_linkdots() {
                  for (a=0;a<document.links.length;)
                  document.links[a].onfocus=document.links[a++].blur;
                 }

f_type="";
f_kwatera_id='-1';
f_row_id='-1';

function openAutomatedAsk()
{
 //alert('ju clicked: type:'+f_type+',kid:'+f_kwatera_id+',rid:'+f_row_id);
 var tmp;
 if(f_type=="")alert("Musisz wybrać kwaterę by wysłać zapytanie o wolne miejsca.");
 else
 {
  if(f_type=="wlasny")
  {
   tmp=eval('document.forms.priceBrowser_w.elements.WYZ'+f_row_id);
   f_wyzywienie=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser_w.elements.IL_O'+f_row_id);
   f_iloscosob=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser_w.elements.TDAY'+f_row_id);
   f_rozpoczecieD=tmp.options[tmp.selectedIndex].value-1
   tmp=eval('document.forms.priceBrowser_w.elements.TMONTH'+f_row_id);
   f_rozpoczecieM=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser_w.elements.CZAS_WLASNY'+f_row_id);
   f_dlugpob=tmp.options[tmp.selectedIndex].value

  }
  else if(f_type="przelot")
  {
   tmp=eval('document.forms.priceBrowser.elements.WYZ'+f_row_id);
   f_wyzywienie=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser.elements.IL_O'+f_row_id);
   f_iloscosob=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser.elements.TDAY'+f_row_id);
   f_rozpoczecieD=tmp.options[tmp.selectedIndex].value
      tmp=eval('document.forms.priceBrowser.elements.TMONTH'+f_row_id);
   f_rozpoczecieM=tmp.options[tmp.selectedIndex].value
   f_dlugpob='';

  }

  if(f_wyzywienie=='none' || f_iloscosob=='none'||f_rozpoczecieD=='none'||f_rozpoczecieM=='none')alert("Musisz wybrać kwaterę by wysłać zapytanie o wolne miejsca.");
  else{
       d=window.open('autoask.php?r='+f_type+'&KID='+f_kwatera_id+'&W='+f_wyzywienie+'&IO='+f_iloscosob+'&S='+f_rozpoczecieD+'.'+f_rozpoczecieM+'&D='+f_dlugpob,'aa', 'toolbar=no,menubar=no,scrollbars=no, resizable=no,status=no,location=no,directories=no,top=10, left=10,height=300,width=400');
       d.focus();
      }
 }
}
function check_email(txt)
{
 var i,ats_count;

 ats_count=0;
 for(i=0;i<txt.length;i++)
 {
  if(txt.charAt(i)=='@')ats_count++;
 }

 if(txt.indexOf('@')<2 || txt.indexOf('.')==-1 || txt=='' || ats_count>1) return false;
 else return true;
}

function openAutomatedForm()
{
 //alert('ju clicked: type:'+f_type+',kid:'+f_kwatera_id+',rid:'+f_row_id);
 var tmp;
 if(f_type=="")alert("Musisz wybrać kwaterę w celu wypełnienia formularza.");
 else
 {
  if(f_type=="wlasny")
  {
   tmp=eval('document.forms.priceBrowser_w.elements.WYZ'+f_row_id);
   f_wyzywienie=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser_w.elements.IL_O'+f_row_id);
   f_iloscosob=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser_w.elements.TDAY'+f_row_id);
   f_rozpoczecieD=tmp.options[tmp.selectedIndex].value-1
   tmp=eval('document.forms.priceBrowser_w.elements.TMONTH'+f_row_id);
   f_rozpoczecieM=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser_w.elements.CZAS_WLASNY'+f_row_id);
   f_dlugpob=tmp.options[tmp.selectedIndex].value

  }
  else if(f_type="przelot")
  {
   tmp=eval('document.forms.priceBrowser.elements.WYZ'+f_row_id);
   f_wyzywienie=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser.elements.IL_O'+f_row_id);
   f_iloscosob=tmp.options[tmp.selectedIndex].value
   tmp=eval('document.forms.priceBrowser.elements.TDAY'+f_row_id);
   f_rozpoczecieD=tmp.options[tmp.selectedIndex].value
      tmp=eval('document.forms.priceBrowser.elements.TMONTH'+f_row_id);
   f_rozpoczecieM=tmp.options[tmp.selectedIndex].value
   f_dlugpob='';

  }

  if(f_wyzywienie=='none' || f_iloscosob=='none'||f_rozpoczecieD=='none'||f_rozpoczecieM=='none')alert("Musisz wybrać kwaterę w celu wypełnienia formularza.");
  else{
       d=window.open('rezerwacja.html.php?r='+f_type+'&KID='+f_kwatera_id+'&W='+f_wyzywienie+'&IO='+f_iloscosob+'&S='+f_rozpoczecieD+'.'+f_rozpoczecieM+'&D='+f_dlugpob,'aa', 'toolbar=no,menubar=no,scrollbars=yes, resizable=yes,status=no,location=no,directories=no,top=10, left=10,height=400,width=720');
       d.focus();
      }
 }
}
function tymc_popup()
{
   tp=window.open('popup.html','aa', 'toolbar=no,menubar=no,scrollbars=yes, resizable=yes,status=no,location=no,directories=no,top=10, left=10,height=250,width=400');
   tp.focus();
	
 return false;
}