if(parent.frames.length!=0)parent.location.replace(location.href)
function $(i){return document.getElementById(i);}
var misio = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
misio=true;
@end @*/

function addfav()
{
 var msg_netscape = "Ta funkcja nie działa z Twoją przeglądarką. Dodaj nas do ulubionych ręcznie.";
 var msg_opera    = "Ta funkcja nie działa z tą wersją Opery. Dodaj nas do ulubionych ręcznie.";
 var msg_other    = "Twoja przeglądarka nie wspiera automatycznego dodawania do ulubionych. Dodaj nas do ulubionych ręcznie.";
 var agt          = navigator.userAgent.toLowerCase();
 var title        = "Biuro turystyczne TOP";
 var url          = "http://www.top.turystyka.pl/";
 if (agt.indexOf("opera") != -1)
 {
  if (window.opera && window.print) { return true; }
   else { alert(msg_other); }
 }
  else if (agt.indexOf("firefox") != -1) window.sidebar.addPanel(title,url,"");
  else if ((agt.indexOf("msie") != -1) && (parseInt(navigator.appVersion) >=4)) window.external.AddFavorite(url,title);
  else if (agt.indexOf("netscape") != -1) window.sidebar.addPanel(title,url,"")
  else if (window.sidebar && window.sidebar.addPanel) window.sidebar.addPanel(title,url,"");
  else alert(msg_other);
 return;
}

function startowa()
{
 document.body.style.behavior='url(#default#homepage)';
 document.body.setHomePage('http://www.top.turystyka.pl/');
}

function nwin(page, x, y, scr)
{
 var sx = screen.availWidth;
 var sy = screen.availHeight;
 var px = (sx/2)-(x/2);
 var py = (sy/2)-(y/2);
 nwi = window.open(page, 'blank', 'dependent=yes,toolbar=no,top='+py+',left='+px+',width='+x+',height='+y+',resizable=no,scrollbars='+scr+',status=yes');
 nwi.focus();
 return;
}

function start_flashmovie()
{
 var fo = new FlashObject("loader.swf", "topmovie", "450", "159", "7", "#6F92D2");
 fo.addParam("movie", "loader.swf");
 fo.addParam("quality", "high");
 fo.addParam("bgcolor", "#6F92D2");
 fo.addParam("menu", "false");
 //fo.addParam("wmode", "transparent");
 fo.addParam("allowScriptAccess", "sameDomain");
 fo.write("flashcontent");
}

function start_ggstatus()
{
 var d = document;
 if(d.getElementById('stgg2'))
 {
  d.getElementById('stgg2').src = 'http://www.gadu-gadu.pl/users/status.asp?id=34937923';
  d.getElementById('stgg3').src = 'http://www.gadu-gadu.pl/users/status.asp?id=4169924';
 }
}

function start()
{
 function add_fokus(a)
 {
  var el = a;
  el.onfocus = function() { el.className += " fokus"; }
  el.onblur = function() { el.className = el.className.replace(/( ?fokus)/g,''); }
 }
 if(misio)
 {
  n = document.getElementsByTagName('a');
  for(var i=0; i<n.length; i++) add_fokus(n[i]);
 }
 start_flashmovie();
 start_ggstatus();
 return;
}

onload = function()
{
 for(var i = 0; i < document.links.length; i++){
  if (document.links[i].rel == 'external'){
   document.links[i].target = '_blank';
  }
 }
}

function shwszukaj()
{
 var d = document;
 if(d.getElementById('wyszukajof').style.display == 'block')
  { d.getElementById('wyszukajof').style.display = 'none'; }
   else { d.getElementById('wyszukajof').style.display = 'block'; }
}

function shwtermsz(val)
{
 var d = document;
 if(val == 0)
  { d.getElementById('tzobacz').style.display = 'none'; d.getElementById('szczegoly').innerHTML = ''; }
 else
  { d.getElementById('tzobacz').style.display = 'inline'; }
}

function rezerwuj()
{
 if(document.getElementById('termin').value > 0)
 {
  document.location.href = '?s=rezerwacja&rn=' + document.getElementById('termin').value;
 }
  else { alert('Wybierz termin rezerwacji.'); }
}

function chkrezer()
{
 var ret = true;
 d = document;

 if(d.getElementById('warunki').checked == false) { ret=false; alert('Aby dokonać rezerwacji musisz zaakceptować warunki'+"\n"+'uczestnictwa w imprezie.'); }
 if(d.getElementById('imienaz').value.length < 3 && ret) { ret=false; alert('Pole "Imię i nazwisko" jest wymagane.'); }
 if(isNaN(parseInt(d.getElementById('miejsc').value)) && ret) { ret=false; alert('Podaj ilość rezerwowanych miejsc.'); }
 if(d.getElementById('k1').checked && d.getElementById('email').value.length < 3 && ret)
  { ret=false; alert('Wybrałeś opcję potwierdzenia rezerwacji poprzez e-mail.'+"\n"+'Uzupełnij pole "E-mail".'); }

 return ret;
}
