//OnMouseOver
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if(browser_name == "Netscape" && browser_version >= 3.0) {
  version = "ok";
}
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) {
  version = "ok";
}
else if (browser_name == "Opera" && browser_version >= 6.0) {
  version = "ok";
}
else {
  version = "bad";
}



//Create Flash
function createFlash(movie, wdth, hght, bgnd, idName, cel, fVars) {
       obj_setFlash = document.getElementById(cel);
       objTag = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' style='z-index:1' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+wdth+"' height='"+hght+"' id='"+idName+"'>";
       objTag2 = "<object data='"+movie+"' type='application/x-shockwave-flash' width='"+wdth+"' height='"+hght+"' id='"+idName+"'>";
       paramTag = "<param name='movie' value='"+movie+"' /><param name='bgcolor' value='"+bgnd+"' /><param name='quality' value='high' /><param name='menu' value='false' /><param name='FlashVars' value='"+fVars+"' /></object>";
       if (typeof HTMLElement != "undefined") {
              obj = document.createElement("object");
              obj.setAttribute("data", movie);
              obj.setAttribute("type", "application/x-shockwave-flash");
              obj.setAttribute("width", wdth);
              obj.setAttribute("height", hght);
              obj.setAttribute("id", idName);
              par = document.createElement("param");
              par.setAttribute("name", "quality");
              par.setAttribute("value", "high");
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "wmode");
              par.setAttribute("value", "transparent");
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "bgcolor");
              par.setAttribute("value", bgnd);
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "menu");
              par.setAttribute("value", "false");
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "FlashVars");
              par.setAttribute("value", fVars);
              obj.appendChild(par);
              par = document.createElement("param");
              par.setAttribute("name", "pluginspage");
              par.setAttribute("value", "http://www.macromedia.com/go/getflashplayer");
              obj.appendChild(par);
              obj_setFlash.appendChild(obj);
       } else {
              obj_setFlash.insertAdjacentHTML('beforeEnd',objTag+paramTag);
       }
}

//Otw�rz okno z flashem
function flash(URL,szer,wys) {
  nowe_okno=window.open("","_blank","toolbar=no,status=no,menu=no,scrollbars,resizable,width="+(szer+20)+",height="+wys+",top=30,left=30");
  nowe_okno.document.open();
  nowe_okno.document.writeln('<BODY topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>');
  nowe_okno.document.writeln('<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 height='+wys+' width='+szer+' classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>');
  nowe_okno.document.writeln('<PARAM NAME="Movie" VALUE="'+URL+'">');
  nowe_okno.document.writeln('<PARAM NAME="Src" VALUE="'+URL+'">');
  nowe_okno.document.writeln('<PARAM NAME="Play" VALUE="-1">');
  nowe_okno.document.writeln('<PARAM NAME="Loop" VALUE="-1">');
  nowe_okno.document.writeln('<PARAM NAME="Quality" VALUE="High">');
  nowe_okno.document.writeln('<embed src="'+URL+'" type="application/x-shockwave-flash" width="'+szer+'" height="'+wys+'" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" quality="best" play="true">');
  nowe_okno.document.writeln('</OBJECT>');
  nowe_okno.document.writeln('</BODY>');
  nowe_okno.document.close();
}

//Otw�rz okno ze zdjeciem
function zdjecie(URL,w,h) {
  obrazek = new Image();
  obrazek.src = URL;
  if(w>screen.width-50) w=screen.width-50;
  if(h>screen.height-50) h=screen.height-50;
  wo=screen.width-50;
  ho=screen.height-50;
  t=parseInt((screen.height-h)/2);
  l=parseInt((screen.width-w)/2);
  //P�tla op�naij�ca
  nowe_okno=window.open("","_blank","toolbar=no,status=no,menu=no,scrollbars,resizable,width="+w+",height="+h+",top="+t+",left="+l);
  nowe_okno.document.open();
  nowe_okno.document.writeln('<SCRIPT language=Javascript>');
  nowe_okno.document.writeln('function wymiary() { ');
  nowe_okno.document.writeln('wz=document.zdjecie.width+30; hz=document.zdjecie.height+30; if(wz>'+wo+') wz='+wo+'; if(hz>'+ho+') hz='+ho+';');
  nowe_okno.document.writeln('window.resizeTo(wz,hz);');
  nowe_okno.document.writeln('}');
  nowe_okno.document.writeln('</SCRIPT>');
  nowe_okno.document.writeln('<BODY topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 onLoad="wymiary()">');
  nowe_okno.document.writeln('<A href="javascript:window.close()"><IMG src='+URL+' alt="Kliknij aby zamkn��" border=0 name=zdjecie></A>');
  nowe_okno.document.writeln('</BODY>');
  nowe_okno.document.close();
}

//Otw�rz okno ze zdjeciem
function zdjecie_blank(URL,w,h) {
  obrazek = new Image();
  obrazek.src = URL;
  if(w>screen.width-50) w=screen.width-50;
  if(h>screen.height-50) h=screen.height-50;
  wo=screen.width-50;
  ho=screen.height-50;
  t=parseInt((screen.height-h)/2);
  l=parseInt((screen.width-w)/2);
  //P�tla op�naij�ca
  nowe_okno=window.open("","_blank","toolbar=no,status=no,menu=no,scrollbars=no,resizable=no,width="+w+",height="+h+",top="+t+",left="+l);
  nowe_okno.document.open();
  nowe_okno.document.writeln('<SCRIPT language=Javascript>');
  nowe_okno.document.writeln('function wymiary() { ');
  nowe_okno.document.writeln('wz=document.zdjecie.width+30; hz=document.zdjecie.height+30; if(wz>'+wo+') wz='+wo+'; if(hz>'+ho+') hz='+ho+';');
  nowe_okno.document.writeln('window.resizeTo(wz,hz);');
  nowe_okno.document.writeln('}');
  nowe_okno.document.writeln('</SCRIPT>');
  nowe_okno.document.writeln('<BODY topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 onLoad="wymiary()">');
  nowe_okno.document.writeln('<A href="javascript:window.close()"><IMG src='+URL+' alt="Kliknij aby zamkn��" border=0 name=zdjecie></A>');
  nowe_okno.document.writeln('</BODY>');
  nowe_okno.document.close();
}

//Otw�rz okno z dokumentem (okre�l rozmiary)
function okno(URL,szer,wys) {
  nowe_okno=window.open(URL,"_blank","toolbar=no,status=no,menus=no,scrollbars,location=no,resizable,width="+szer+",height="+wys+",top=30,left=30");
  return;
}

//Otw�rz okno z dokumentem (zasymuluj target=_blank)
function url(URL) {
  nowe_okno=window.open(URL,"_blank","toolbar,location,status,menubar,scrollbars,resizable,top=30,left=30,width=675,height=450");
  return;
}

function okno_blank(URL,szer,wys) {
  nowe_okno=window.open(URL,"_blank","toolbar=no,status=no,menus=no,scrollbars=no,resizable,width="+szer+",height="+wys+",top=30,left=30");
  return;
}

function horz_scroll(div,speed) {
  //Pobierz warstw� i jej nazw�
  if(div.id) div=div.id;
  ob_div = document.getElementById(div);
  //Pobierz aktualne przesuni�cie
  i=0;
  if(document.all && ob_div.getAttribute("count"))
    i=ob_div.getAttribute("count");
  else if(arguments.length>=3)
    i=arguments[2];
  if(!document.all) eval('if(document.horzscroll_count_'+div+') i = document.horzscroll_count_'+div+';');
  //Oblicz nowe przesuni�cie
  i=i+speed;
  ob_div.scrollLeft=i;
  if(i>ob_div.scrollWidth) i=0;
  if(i>ob_div.scrollLeft) i=0;
  //Zapisz nowe przesuni�cie
  if(document.all)
    ob_div.setAttribute("count",i);
  else
    eval('document.horzscroll_count_'+div+'= i');
  //W��cz przetwarzanie w p�tli
  eval('horzscroll_t1_'+div+'=setTimeout("horz_scroll(\''+div+'\','+speed+','+i+')",25)');
}//function horz_scroll(div,speed) {

function vert_scroll(div,speed) {
  //Pobierz warstw� i jej nazw�
  if(div.id) div=div.id;
  ob_div = document.getElementById(div);
  //Pobierz aktualne przesuni�cie
  i=0;
  if(document.all && ob_div.getAttribute("count"))
    i=ob_div.getAttribute("count");
  else if(arguments.length>=3)
    i=arguments[2];
  if(!document.all) eval('if(document.vertscroll_count_'+div+') i = document.vertscroll_count_'+div+';');
  //Oblicz nowe przesuni�cie
  i=i+speed;
  ob_div.scrollTop=i;
  if(i>ob_div.scrollHeight) i=0;
  if(i>ob_div.scrollTop) i=0;
  //Zapisz nowe przesuni�cie
  if(document.all)
    ob_div.setAttribute("count",i);
  else
    eval('document.vertscroll_count_'+div+'= i');
  //W��cz przetwarzanie w p�tli
  eval('vertscroll_t1_'+div+'=setTimeout("vert_scroll(\''+div+'\','+speed+','+i+')",25)');
}//function vert_scroll(div,speed) {


function base64_encode(input) {
   var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);

   return output;
}

function base64_decode(input) {
   var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}


function ShowDowoz() {
    $("#Dowoz").toggle("slow");
}
