

<!--
function historyBack() {
 history.back()
}
function createCookie(name,value,days) {
 if (days) {
  var date = new Date();
  date.setTime(date.getTime()+(days*24*60*60*1000));
  var expires = "; expires="+date.toGMTString();
 }
 else var expires = "";
 document.cookie = name+"="+value+expires+"; path=/";
}
function readCookies(name) {
 var nameEQ = name + "=";
 var ca = document.cookie.split(';');
 for(var i=0;i < ca.length;i++) {
  var c = ca[i];
  while (c.charAt(0)==' ') c = c.substring(1,c.length);
  if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
 }
 return null;
}
function readCookie(name) {
 if (readCookies('lector') === null && $("#mainpage").length > 0) {
  createCookie('lector','false');
 }
 else if ((readCookies('lector') === null || readCookies('lector') === 'false') && $("#mainpage").length < 1) {
  createCookie('lector','male');
 }
 var ciacho = readCookies(name);
 return ciacho;
}
function refresh() {
 document.location = document.location;
}
$(document).ready(function() {

	if ($("#game").length > 0) {
		switch(readCookies('lang')){
			case 'cn':{
				if ($('.newGame').length > 0) {
					$('body').css('background-image','url(/_img/bg-body-cn-new.jpg)');
				}
				else {
					$('body').css('background-image','url(/_img/bg-body-cn.jpg)');
				}
				$('#header').addClass('headerCn').append('<a href="/" class="main" title="Strona główna">Strona główna</a><a href="http://www.mkidn.gov.pl/" class="mkidn" title="Mkidn" target="_blank">Mkidn</a><a href="http://www.msz.gov.pl/index.php?document=2" class="msz" title="Msz" target="_blank">Msz</a>');
                var footerHtml = '<ul id="footerLeft">' +
                    '<li><a class="friends" href="/friendsCn/" title="Friends">Friends</a></li>' +
                    '<li class="flags">' +
                        '<ul>' +
                            '<li><a href="#" class="switchLang" id="eng">wersja angielska</a></li>' +
                            '<li><a href="#" class="switchLang" id="cn">wersja chińska</a></li>' +
                            '<li><a href="#" class="switchLang" id="pl">wersja polska</a></li>' +
                        '</ul>' +
                    '</li>' +
                '</ul>';
                
				$('#footer').addClass('footerCn').append(footerHtml);
				//$('#footer').addClass('footerCn').append('<ul id="footerLeft"><li><a class="friends" href="/friendsCn/" title="Friends">Friends</a></li></ul><ul id="footerRight"><li><a class="forTeacherCn" href="/for-teachersCn/" title="For teachers">For teachers</a></li><li><a class="forParentsCn" href=/for-parentsCn/" title="For parents">For parents</a></li></ul>');
				break;
			}
			case 'eng':{
				if ($('.newGame').length > 0) {
					$('body').css('background-image','url(/_img/bg-body-en-new.jpg)');
				}
				else {
					$('body').css('background-image','url(/_img/bg-body-en.jpg)');
				}
				$('#header').addClass('headerEn').append('<a href="/" class="main" title="Strona główna">Strona główna</a><a href="http://www.mkidn.gov.pl/" class="mkidn" title="Mkidn" target="_blank">Mkidn</a><a href="http://www.msz.gov.pl/index.php?document=2" class="msz" title="Msz" target="_blank">Msz</a>');
                var footerHtml = '<ul id="footerLeft">' +
                    '<li><a class="friends" href="/friends/" title="Friends">Friends</a></li>' +
                    '<li class="flags">' +
                        '<ul>' +
                            '<li><a href="#" class="switchLang" id="eng">wersja angielska</a></li>' +
                            '<li><a href="#" class="switchLang" id="cn">wersja chińska</a></li>' +
                            '<li><a href="#" class="switchLang" id="pl">wersja polska</a></li>' +
                        '</ul>' +
                    '</li>' +
                '</ul>';
                
				$('#footer').addClass('footerCn').append(footerHtml);
				//$('#footer').addClass('footerEn').append('<ul id="footerLeft"><li><a class="friends" href="/friends/" title="Friends">Friends</a></li></ul><ul id="footerRight"><li><a class="forTeacher" href="/for-teachers/" title="For teachers">For teachers</a></li><li><a class="forParents" href="/for-parents/" title="For parents">For parents</a></li></ul>');
				break;
			}
			default :{
				if ($('.newGame').length > 0) {
					$('body').css('background-image','url(/_img/bg-body-pl-new.jpg)');
				}
				else {
					$('body').css('background-image','url(/_img/bg-body-pl.jpg)');
				}
				$('#header').addClass('headerPl').append('<a href="/" class="main" title="Strona główna">Strona główna</a><a href="http://www.mkidn.gov.pl/" class="mkidn" title="Mkidn" target="_blank">Mkidn</a>');
				var footerHtml = '<ul id="footerLeft">' +
                    '<li><a class="friends" href="/przyjaciele/" title="Friends">Friends</a></li>' +
                    '<li class="flags">' +
                        '<ul>' +
                            '<li><a href="#" class="switchLang" id="eng">wersja angielska</a></li>' +
                            '<li><a href="#" class="switchLang" id="cn">wersja chińska</a></li>' +
                            '<li><a href="#" class="switchLang" id="pl">wersja polska</a></li>' +
                        '</ul>' +
                    '</li>' +
                '</ul>' +
                '<ul id="footerRight"><li><a class="forTeacher" href="#" title="Dla nauczycieli">Dla nauczycieli</a></li><li><a class="forParents" href="#" title="Dla rodziców">Dla rodziców</a></li></ul>';
                
				$('#footer').addClass('footerPl').append(footerHtml);
                //$('#footer').addClass('footerPl').append('<ul id="footerLeft"><li><a class="friends" href="/przyjaciele/" title="Przyjaciele">Przyjaciele</a></li></ul><ul id="footerRight"><li><a class="forTeacher" href="#" title="Dla nauczycieli">Dla nauczycieli</a></li><li><a class="forParents" href="#" title="Dla rodziców">Dla rodziców</a></li></ul>');
			}
		}
        
        /* zmiana języka na stronach htmlowych */
        $('.flags li a').click(function() {
            var lang = $(this).attr('id');
            createCookie('lang', lang, 30);
            document.location = document.location;
            return false
        });
	}


/*chowanie stopki angielskiej*
	if(readCookies('lang')!='eng')$('#wrapper').append('<a href="/dla-rodzicow/polityka-prywatnosci.html" class="menu-polityka" title="Polityka prywatności">Polityka prywatności</a><a href="/dla-nauczycieli" class="menu-nauczyciel" title="Menu dla nauczycieli">Menu dla nauczycieli</a><a href="/dla-rodzicow" class="menu" title="Menu dla rodziców">Menu dla rodziców</a>');	
	if(readCookies('lang')=='eng'&&(
	(window.location.href.substring(window.location.href.length-6,window.location.href.length)!='szawa/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='nsk/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='kow/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='law/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='run/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='owa/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='ane/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='ice/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='tok/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='odz/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='zno/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='pin/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='ola/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='ria/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='iki/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='how/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='nin/'&&
	window.location.href.substring(window.location.href.length-4,window.location.href.length)!='.pl/'
	)
	|| window.location.href.search('miasto')>0
	))
	$('body').css('background-image','url(/_img/bg_body2.jpg)');
/*koniec chowania*/


 $("#forParents #wrap #topNav li.cross a").click(function(){
  historyBack();
  return false;
 });
 $('#submitForm').click(function(){
   $.each($('[class="error"]'), function(){
    $('#'+this.id).removeClass('error');
   });
   $.ajax({
    url: "/frontend.php/form",
    type: "POST",
    dataType: "json",
    data: {
     imie: $("input[name='imie']").val(),
     nazwisko: $("input[name='nazwisko']").val(),
     mail: $("input[name='mail']").val(),
     komentarz: $("textarea[name='komentarz']").val()
    },
    success: function(xml) {
     if(xml.result === true){
      $("#contactForm #msg").html('Dziękujemy za wypełnienie formularza.');
      $("#contactForm #msg").slideDown(); 
      setTimeout( '$("#contactForm #msg").slideUp();', 4000 ); 
     }
     else {
      $.each(xml.errors,function(k,field){
       $('#'+field).addClass('error');
      });
      $("#contactForm #msg").html('Nie wszystkie pola zostały poprawnie wypełnione. Prosimy sprawdzić czy wszystkie wymagane dane zostały wprowadzone i spróbować ponownie wysłać formularz.');
      $("#contactForm #msg").slideDown(); 
      setTimeout( '$("#contactForm #msg").slideUp();', 4000 ); 
     }
    } 
   });
   return false;
 });
 
});

$(window).load(function(){
   // AdBlock Plus remove
   $('#flashWrapper object').live('mouseover',function(){
    if($('[title*="Kliknij tutaj, aby zablokować ten obiekt"]').length > 0){
      $(this).next().wrap('<div class="adblock"></div>');
    }
   });
 
 
});
//-->

