﻿//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 play()
{
	bodyContent = $.ajax({
		url: "include/wai.php",
		type: "POST",
		data: ({can : true}),
		dataType: "text/html",
		success: function(msg){
			$("#contactFormCaptcha").append(msg);
		}
	}).responseText;
}
function playToken()
{
	$("#contactFormCaptcha").append("<a href=\"javascript: play();\" name=\"czytajKod\" id=\"czytajKod\" title=\"Wprowadź usłyszane numery\"><img src=\"images/shared/accessibility.gif\" alt=\"Wprowadź usłyszane numery\" align=\"absmiddle\" /></a>");
}
$(document).ready(function() {
     if($("#contactFormCaptcha")) playToken();
});

//Easing
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'V\']=h.i[\'y\'];h.M(h.i,{B:\'C\',y:9(x,t,b,c,d){6 h.i[h.i.B](x,t,b,c,d)},14:9(x,t,b,c,d){6 c*(t/=d)*t+b},C:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},12:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},Q:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},O:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},P:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},L:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},S:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},F:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},K:9(x,t,b,c,d){e((t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*(2*8.g)/p)*.5+c+b},W:9(x,t,b,c,d,s){e(s==w)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},Y:9(x,t,b,c,d,s){e(s==w)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},Z:9(x,t,b,c,d,s){e(s==w)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.D))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.D))+1)*t+s)+2)+b},z:9(x,t,b,c,d){6 c-h.i.r(x,d-t,0,c,d)+b},r:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.o*t*t)+b}m e(t<(2/2.k)){6 c*(7.o*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.o*(t-=(2.17/2.k))*t+.18)+b}m{6 c*(7.o*(t-=(2.19/2.k))*t+.1a)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.z(x,t*2,0,c,d)*.5+b;6 h.i.r(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|5625||sqrt|easeOutBounce|||abs|asin|undefined||swing|easeInBounce|cos|def|easeOutQuad|525|easeInCirc|easeInQuint|easeOutCirc|easeInOutCirc|easeInElastic|easeOutQuint|easeInOutQuint|easeOutQuart|extend|easeInSine|easeInOutCubic|easeInQuart|easeOutCubic|easeOutSine|easeInOutQuart|easeOutElastic|easeInOutElastic|jswing|easeInBack|easeInOutSine|easeOutBack|easeInOutBack||easeInExpo|easeInCubic|easeInOutQuad|easeInQuad|easeOutExpo|easeInOutExpo|25|9375|625|984375|easeInOutBounce'.split('|'),0,{}))
	
	function bubblesJump() {
		setTimeout("bubbleJump(1)", 0);
		setTimeout("bubbleJump(2)", 300);
		setTimeout("bubbleJump(3)", 600);
	}
	
	function bubbleJump(bubble) {
		$("#chmurka"+bubble+" img").animate({width: "95%", height: "95%"}, 150, "easeOutExpo");
		$("#chmurka"+bubble+" img").animate({width: "75%", height: "75%"}, 600, "easeOutElastic");
	}
	
	setInterval("bubblesJump()", 5000);

$(function() {
	//Klasa "active" do aktywnego elementu menu
	var url = String(window.location).split("/");
	url = url[url.length-1];
	
	$("#menu a, nav a, .mnu-show li a").each(function() {
		if($(this).attr("href") == url)
			$(this).addClass("active");
	});
	
	$("#chmurki img").hover(function() {
		$(this).stop().animate({width: "95%", height: "95%"}, 750, "easeOutElastic");
	}, function() {
		$(this).stop().animate({width: "75%", height: "75%"}, 750, "easeOutElastic");
	});
	
	setTimeout('bubblesJump();', 500);
	
	$("#icons-index li a").hover(function() {
		var pos = $(this).position();
		var margin = $(this).css("margin-top");
		$("#icons-index").parent().append('<div class="ico-dymek"></div>');
		if($(".ramka").length)
			$(".ico-dymek").text($(this).attr("title")).css({left: pos.left+178, top: pos.top}).fadeIn(175);
		else
			$(".ico-dymek").text($(this).attr("title")).css({left: pos.left+7, top: pos.top-85+parseInt(margin)}).fadeIn(175);
	}, function() {
		$(".ico-dymek").stop().fadeOut(300).remove();
	});
});

//Rozwijane menu boczne

	$(document).ready(function(){

	//Hide (Collapse) the toggle containers on load
	$(".mn-show").hide(); 

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h2.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle(600, "easeOutBounce");
		return false; //Prevent the browser jump to the link anchor
	});

});
