var ERROR_GETTING_DATA='<div class="errormsg">'+'Wystąpił błąd przy pobieraniu danych z serwera. Naciśnij CTRL+F5, aby odświeżyć stronę.';var ERROR_NO_ITEMS='<br /><div class="infomsg">'+'Brak elementów do wyświetlenia na wybranym poziomie. Wybierz inny poziom.'+'</div>';var ERROR_USER_LIMIT_EXCEEDED='<br /><span class="red"><b>'+'Przekroczono limit szybkości wykonywania ćwiczeń.'+'</b> '+'Prosimy zrobić sobie chwilę przerwy :).'+'</span>';var ERROR_USER_LIMIT_EXCEEDED_REPETITIONS='<span class="red"><b>'+'Przekroczono limit szybkości wykonywania powtórek.'+'</b> '+'Prosimy zrobić sobie chwilę przerwy :).'+'</span>';var AJAX_LOADER_IMG='<img src="/images/ajax-loader.gif" width="16" height="16" alt="'+'Proszę czekać...'+'" class="absmiddle" />';var isIE=navigator.userAgent.indexOf("IE")!=-1;var isMozilla=navigator.userAgent.indexOf("Gecko")!=-1;var isOpera=navigator.userAgent.indexOf("Opera")!=-1;function GetElement(e){return document.getElementById(e)}function ElementExists(e){return GetElement(e)}function SetDisplay(e,v){GetElement(e).style.display=v}function SetVisibility(e,v){GetElement(e).style.visibility=v}function SetEnabled(e,v){GetElement(e).disabled=!v}function SetInnerHTML(e,html){GetElement(e).innerHTML=html}function SetColor(e,color){GetElement(e).style.color=color}function SetBackground(e,color){GetElement(e).style.background=color}function SetBorderColor(e,color){GetElement(e).style.borderColor=color}function SetTextFieldBorderColor(e,color){SetBorderColor(e,color);GetElement(e).style.borderStyle='solid';GetElement(e).style.borderWidth='2'}function ResetBorderStyle(e){GetElement(e).style.borderStyle='';GetElement(e).style.borderWidth='';GetElement(e).style.borderColor=''}function SetWidth(e,width){GetElement(e).style.width=width+"px"}function SetHeight(e,height){GetElement(e).style.height=height+"px"}function SetTop(e,top){GetElement(e).style.top=top+"px"}function SetLeft(e,left){GetElement(e).style.left=left+"px"}function GetValue(e){return GetElement(e).value}function SetValue(e,value){GetElement(e).value=value}function IsChecked(c){return GetElement(c).checked}function SetChecked(c,checked){GetElement(c).checked=checked}function IsSelected(c){return GetElement(c).selected}function SetSelected(c,selected){GetElement(c).selected=selected}function SelectItem(i){GetElement(i).checked=true}function SubmitForm(f){GetElement(f).submit()}function FocusElement(e){GetElement(e).focus()}function GetDocumentTitle(){return document.title}function SetDocumentTitle(title){document.title=title}function Trim(str){return(""+str).replace(/^\s*|\s*$/g,"")}function SingleSpaces(str){return Trim(str).replace(/\s+/g," ")}function SplitIntoLines(str){return Trim(str).replace(/\r\n/g,"\n").split("\n")}function SplitIntoWords(str){str=Trim(str);if(str=='')return new Array();return str.replace(/\s+/g,' ').split(' ')}function Htmlspecialchars(str){if(str==undefined||str==null){return''}str=(''+str);str=str.replace(/&/g,'&amp;');str=str.replace(/'/g,'&#039;');str=str.replace(/"/g,'&quot;');str=str.replace(/</g,'&lt;');str=str.replace(/>/g,'&gt;');str=str.replace(/\//g,'&#x2F;');return str}function Htmlspecialchars_decode(str){if(str==undefined||str==null){return''}str=(''+str);str=str.replace(/&#x2F;/g,'/');str=str.replace(/&gt;/g,'>');str=str.replace(/&lt;/g,'<');str=str.replace(/&quot;/g,'"');str=str.replace(/&#0*39;/g,"'");str=str.replace(/&#x27;/g,"'");str=str.replace(/&amp;/g,'&');return str}function UrlEscape(str){if(encodeURIComponent){return encodeURIComponent(str)}else{return escape(str)}}function LoadPage(url){window.location.assign(url)}function ReloadPage(){LoadPage(window.location.href)}function RandomString(){var chars="0123456789abcdefghijklmnopqrstuvwxyz";var result="";for(var i=1;i<=6;i++){result+=chars.charAt(Math.floor(Math.random()*chars.length))}return result}function ArrayRandom(a){return a[Math.floor(Math.random()*a.length)]}function InArray(arr,obj){var len=arr.length;for(var x=0;x<=len;x++){if(arr[x]==obj)return true}return false}function preloadImage(url){var img=new Image();img.src=url}function _t(text){return text}function KeyboardApi(){this.startCapture=function(){document.onkeydown=function(evt){return KeyboardApiInstance.handlekeydown(evt)};document.onkeypress=function(evt){return KeyboardApiInstance.handlekeypress(evt)};document.onkeyup=function(evt){return KeyboardApiInstance.handlekeyup(evt)};this.captureEnabled=true};this.setCaptureEnabled=function(a){this.captureEnabled=a};this.setFocusInLockCaptureField=function(a){this.focusInLockCaptureField=a};this.setCtrlCaptureEnabled=function(a){this.ctrlCaptureEnabled=a};this.addKeyDownListener=function(a){this.onkeydown=a};this.addKeyUpListener=function(a){this.onkeyup=a};this.isCtrlPressed=function(){return this.ctrlPressed};this.isShiftPressed=function(){return this.shiftPressed};this.isAltPressed=function(){return this.altPressed};this.resetLockKeyPressesCounter=function(){if(isOpera){this.lockKeyPressesCounter=0}else{this.lockKeyPressesCounter=-1}};this.captureEnabled=false;this.focusInLockCaptureField=false;this.ctrlCaptureEnabled=false;this.ctrlPressed=false;this.shiftPressed=false;this.altPressed=false;this.lockKeyPressesCounter=0;function getEvent(evt){return(evt?evt:window.event)};this.handlekeydown=function(evt){evt=getEvent(evt);var keyCode=evt.keyCode;this.ctrlPressed=(keyCode==Keys.CTRL||(evt.ctrlKey&&!evt.altKey));this.shiftPressed=(keyCode==Keys.SHIFT||evt.shiftKey);this.altPressed=(keyCode==Keys.ALT||evt.altKey);if(keyCode==Keys.CTRL){return true}if(this.onkeydown!=null&&(!this.ctrlPressed||this.ctrlCaptureEnabled)&&this.captureEnabled&&!this.focusInLockCaptureField){var result=this.onkeydown(keyCode);if(!result){this.lockKeyPressesCounter++}return result}else{return true}};this.handlekeypress=function(evt){if(this.lockKeyPressesCounter>0&&(!this.ctrlPressed||this.ctrlCaptureEnabled)){this.lockKeyPressesCounter--;return false}else{return true}};this.handlekeyup=function(evt){KeyboardApiInstance.handlekeypress(evt);evt=getEvent(evt);var keyCode=evt.keyCode;this.ctrlPressed=(keyCode!=Keys.CTRL&&(evt.ctrlKey&&!evt.altKey));this.shiftPressed=(keyCode!=Keys.SHIFT&&evt.shiftKey);this.altPressed=(keyCode!=Keys.ALT&&evt.altKey);if(keyCode==Keys.CTRL){return true}if(this.onkeyup!=null&&(!this.ctrlPressed||this.ctrlCaptureEnabled)&&this.captureEnabled&&!this.focusInLockCaptureField){return this.onkeyup(keyCode)}else{return true}};this.onkeydown=null;this.onkeyup=null}if(typeof jQuery!='undefined'){$(document).ready(function(){$('.disableKeyboardCaptureOnFocus').live('focus',function(){KeyboardApiInstance.setFocusInLockCaptureField(true)});$('.disableKeyboardCaptureOnFocus').live('blur',function(){KeyboardApiInstance.setFocusInLockCaptureField(false)})})}function Keys(){}Keys.ENTER=13;Keys.ESC=27;Keys.SPACE=32;Keys.BACKSPACE=8;Keys.TAB=9;Keys.CTRL=17;Keys.ALT_LEFT=18;Keys.LEFT=37;Keys.UP=38;Keys.RIGHT=39;Keys.DOWN=40;Keys.INSERT=45;Keys.DELETE=46;Keys.HOME=36;Keys.END=35;Keys.PAGEUP=33;Keys.PAGEDOWN=34;Keys.A=65;Keys.B=66;Keys.C=67;Keys.D=68;Keys.E=69;Keys.F=70;Keys.G=71;Keys.H=72;Keys.I=73;Keys.J=74;Keys.K=75;Keys.L=76;Keys.M=77;Keys.N=78;Keys.O=79;Keys.P=80;Keys.Q=81;Keys.R=82;Keys.S=83;Keys.T=84;Keys.U=85;Keys.V=86;Keys.W=87;Keys.X=88;Keys.Y=89;Keys.Z=90;Keys.N0=48;Keys.N1=49;Keys.N2=50;Keys.N3=51;Keys.N4=52;Keys.N5=53;Keys.N6=54;Keys.N7=55;Keys.N8=56;Keys.N9=57;Keys.NUMPAD0=96;Keys.NUMPAD1=97;Keys.NUMPAD2=98;Keys.NUMPAD3=99;Keys.NUMPAD4=100;Keys.NUMPAD5=101;Keys.NUMPAD6=102;Keys.NUMPAD7=103;Keys.NUMPAD8=104;Keys.NUMPAD9=105;Keys.DASH=109;Keys.LEFTBRACE=219;Keys.RIGHTBRACE=221;Keys.SEMICOLON=59;Keys.APOSTROPHE=222;Keys.COMMA=188;Keys.FULLSTOP=190;Keys.SHIFT=16;Keys.CTRL=17;Keys.ALT=18;var KeyboardApiInstance=new KeyboardApi();function LockManager(){}LockManager.locks=new Array();LockManager.setLock=function(token,timeValidMs){LockManager.locks[token]=new Date().getTime()+timeValidMs};LockManager.isLockSet=function(token){return(LockManager.locks[token]&&LockManager.locks[token]>new Date().getTime())};
function getDocumentSelection(){var selection=null;if(window.getSelection){selection=window.getSelection()}else if(document.getSelection){selection=document.getSelection()}else if(document.selection){selection=document.selection.createRange().text}if(selection==undefined){selection=null}if(selection!=null){selection=new String(selection);if(selection.length>0){selection=selection.valueOf()}else{selection=null}}return selection}function Dictionary(){}Dictionary.jqueryEventsNamespace='DIKI';Dictionary.searchUrlPrefix='/slownik-angielskiego/';Dictionary.tabsEnabled=false;Dictionary.iMaxTabsCount=8;Dictionary.tabsMinCaptionLength=6;Dictionary.tabsMaxCaptionLength=30;Dictionary.nextTabId=1;Dictionary.popupOnDoubleClick=true;if(window.location.href.match(/\?q\=/)||window.location.href=='http://www.diki.pl/'||window.location.href=='http://www.live.diki.pl/'){Dictionary.popupOnDoubleClick=false}Dictionary.popupOnDoubleClickLocked=false;Dictionary.dictionarySelectorMode=false;Dictionary.dictionarySelectorModePos=undefined;Dictionary.doubleClickSearch=function(){var selection=getDocumentSelection();if(selection!=null&&$.trim(selection)!=''&&!window.location.href.match(/\/edytuj\//)){if(Dictionary.popupOnDoubleClick){NyroManager.showNyro(Dictionary.searchUrlPrefix+'?q='+$.trim(UrlEscape(selection))+'&popupmode=1'+(Dictionary.dictionarySelectorMode?'&dictionaryselectormode=1':''),750,550)}else if(Dictionary.hasNecessaryTabsElements()){if(selection.length>0){Dictionary.openInTab(selection)}}else{LoadPage(Dictionary.searchUrlPrefix+'?q='+$.trim(UrlEscape(selection)))}}};Dictionary.selectorModeSearch=function(search,pos){Dictionary.dictionarySelectorModePos=pos;NyroManager.showNyro(Dictionary.searchUrlPrefix+'?'+(search!=undefined&&search!=''?'q='+UrlEscape(search)+'&':'')+'popupmode=1&dictionaryselectormode=1',750,550)};Dictionary.selectorModeCallback=function(event,el){var shiftWasPressed=(event&&event.shiftKey==1);el.isActiveInRepetitions=true;ElementsEditor.addElement(el,Dictionary.dictionarySelectorModePos);if(!shiftWasPressed){NyroManager.hideNyro()}return false};Dictionary.doBugReport=function(e){if($('#diki-js-panels li.selected').length>0&&$('#diki-js-panels li.selected').data('diki.searchQuery')){LoadPage('/o-slowniku/kontakt/wiadomosc/?t=bugreport&q='+UrlEscape($('#diki-js-panels li.selected').data('diki.searchQuery')));e.preventDefault()}};Dictionary.getSuggestions=function(key,cont){$.get('/autocomplete.php',{'q':key},function(obj){var res=[];for(var i=0;i<obj.length;i++){res.push({id:i,value:obj[i]})}cont(res)},'json')};Dictionary.getTranslation=function(searchQuery,foreignLanguageCode,callback){$.getJSON('/translate.php',{'q':searchQuery,'lang':foreignLanguageCode},function(result){if(result!=null&&!result.error){if(result.translatedText){callback(result.translatedText,false);if(result.translatedText.length<=100&&result.targetLanguage=='en'){SoundApi.playRecording('http://translate.google.com/translate_tts?tl=en&q='+UrlEscape(result.translatedText))}}else if(result.messageHtml){callback(result.messageHtml,true)}}})};Dictionary.hasNecessaryTabsElements=function(){return $('.panel-content').length>0&&Dictionary.tabsEnabled};Dictionary.clickAndOpenTabs=function(event,linkObj){if($(linkObj).hasClass('notablink')||!Dictionary.hasNecessaryTabsElements()){return true}var sSearch='';var href=$(linkObj).attr('href');var hrefQueryPos=href.indexOf('q=')+2;if(hrefQueryPos>=2&&href.indexOf('/profil/')<0&&href.indexOf('/kontakt/wiadomosc/')<0&&href.indexOf('site=')<0){var sLen=href.length-hrefQueryPos;if(href.indexOf('&',hrefQueryPos)>0){sLen=href.indexOf('&',hrefQueryPos)-hrefQueryPos}if(href.indexOf('#',hrefQueryPos)>0){sLen=href.indexOf('#',hrefQueryPos)-hrefQueryPos}sSearch=decodeURIComponent(href.substr(hrefQueryPos,sLen));sSearch=(sSearch.replace(/\+/g,' '))}else{return true}event.preventDefault();Dictionary.openInTab(sSearch)};Dictionary.hasTabFor=function(searchQuery){var alreadyFoundTabForThisSearchQuery=false;$.each($('#diki-js-panels li'),function(){if($(this).data('diki.searchQuery')==searchQuery){$(this).children('a').first().click();alreadyFoundTabForThisSearchQuery=true;return false}});return alreadyFoundTabForThisSearchQuery};Dictionary.fixTabCaptionsLengths=function(){var maxCaptionLengthChars=Math.max(Math.round($(document).width()*0.6/9.5/$('#diki-js-panels li').length),Dictionary.tabsMinCaptionLength);var extraCharsForTabs=0;var tabsNeedingExtraChars=0;$.each($('#diki-js-panels li'),function(){if($(this).data('diki.searchQuery').length<maxCaptionLengthChars){extraCharsForTabs+=(maxCaptionLengthChars-$(this).data('diki.searchQuery').length)}else{tabsNeedingExtraChars++}});maxCaptionLengthChars+=Math.round(extraCharsForTabs/tabsNeedingExtraChars);maxCaptionLengthChars=Math.min(maxCaptionLengthChars,Dictionary.tabsMaxCaptionLength);$.each($('#diki-js-panels li'),function(){$(this).find('a span.tabCaption').first().text(Dictionary.getStringPart($(this).data('diki.searchQuery'),maxCaptionLengthChars))})};Dictionary.getStringPart=function(string,lengthLimit){if(string.length>lengthLimit){string=$.trim(string.substr(0,lengthLimit))+'...'}return string};Dictionary.openInTab=function(searchQuery){searchQuery=$.trim(searchQuery);if(searchQuery.length<1){return}if(Dictionary.hasTabFor(searchQuery)){return}$('span.tabsSpinner').show();$.getJSON(Dictionary.searchUrlPrefix,{'q':searchQuery,'tabsmode':1},function(json){$('span.tabsSpinner').hide();if(Dictionary.hasTabFor(searchQuery)){return}Dictionary.nextTabId++;if($('#diki-js-panels li').length>=Dictionary.iMaxTabsCount){Dictionary.closeTab($('#diki-js-panels li:first-child'),true)}var tabCaption=Dictionary.getStringPart(searchQuery,Dictionary.tabsMaxCaptionLength);var tabLiHtml='<li id="li-q-'+Htmlspecialchars(Dictionary.nextTabId)+'" class="selected"><a href="#q-'+Htmlspecialchars(Dictionary.nextTabId)+'" id="tab-a-'+Htmlspecialchars(Dictionary.nextTabId)+'" onclick="return false" title="'+Htmlspecialchars(searchQuery)+'"><span class="tabCaption">'+Htmlspecialchars(tabCaption)+'</span><img src="/images/diki/tabs/remove.gif" alt="" id="tab-img-'+Htmlspecialchars(Dictionary.nextTabId)+'"/></a></li>';var tabContentsHtml='<div class="panel-content" id="q-'+Htmlspecialchars(Dictionary.nextTabId)+'">'+json.searchResultsHtml+'</div>';$('#diki-js-panels').append(tabLiHtml);$('#panels-content').append(tabContentsHtml);$tabLi=$('#li-q-'+Dictionary.nextTabId);$('#q-'+(Dictionary.nextTabId)+' .nyroModal').nyroModal();$tabLi.data('diki.searchQuery',searchQuery);$tabLi.data('diki.pageTitle',json.pageTitle);$tabLi.data('diki.autoplayRecordingUrl',json.autoplayRecordingUrl);Dictionary.fixTabCaptionsLengths();if($('#diki-js-panels li').length>1){$('.js-panels-wrapper').show();$('.langinfomain').hide()}$tabLi.children('a').first().click();if(window._gaq){try{_gaq.push(['_trackPageview',Dictionary.searchUrlPrefix+'?q='+searchQuery])}catch(ex){}}})};Dictionary.closeTab=function($tabLi,skipTabSwitching){var tabLiId=$tabLi.attr('id');var $nextTabLi=($tabLi.next('li').length>0?$tabLi.next('li'):$tabLi.prev('li'));$tabLi.remove();$('#q-'+(tabLiId.slice(tabLiId.indexOf('li-q-')+5))).remove();if(!skipTabSwitching){if($('#diki-js-panels li.selected').length==0&&$nextTabLi.length>0){$nextTabLi.children('a').first().click()}if($('#diki-js-panels li').length<=1){$('.js-panels-wrapper').hide();$('.langinfomain').show()}Dictionary.fixTabCaptionsLengths()}};Dictionary.setTabsEnabled=function(enabled){$.get('/?tabs'+(enabled?'on':'off'),function(){window.location.assign(window.location.href.replace('#','&x='+Math.floor(Math.random()*1000)+'#'))})};function hideAdsAndSocialButtons(json){if(json==undefined||json.state==undefined||json.state=="on"){$('.fb-container').hide();$('.google-container').hide();var exdate=new Date();exdate.setDate(exdate.getDate()+90);document.cookie='likesdiki=1;expires='+exdate.toUTCString()+';path=/'}};$(document).ready(function(){if($('input.dsearch').length>0){$('input.dsearch').autocomplete({ajax_get:Dictionary.getSuggestions,cache:false,callback:function(v,cont){$('form#dsearchform').submit()},noresults:'Brak sugestii'})}$('.dictpict').live('mouseenter',function(){$('li.'+$(this).attr('id').substring(0,$(this).attr('id').indexOf('p'))).addClass('hl')});$('.dictpict').live('mouseleave',function(){$('li.'+$(this).attr('id').substring(0,$(this).attr('id').indexOf('p'))).removeClass('hl')});if(document.getElementById('searchfield')&&!document.getElementById('wyroznienia')){$('#searchfield').focus();$('#searchfield').select();$('#searchfield').dblclick(function(){return false})}if($('.fb-container').length>0&&window.FB){FB.Event.subscribe('edge.create',function(href,widget){FB.api('/me',function(response){hideAdsAndSocialButtons()})})}if(Dictionary.tabsEnabled){$('#dsearchform').submit(function(event){if(Dictionary.hasNecessaryTabsElements()){Dictionary.openInTab($('#searchfield').val());$('#searchfield').select();event.preventDefault()}});$('#diki-js-panels li a').live('click',function(event){$('#diki-js-panels li').removeClass('selected');$('.panel-content').hide();var tabId=this.href.slice(this.href.indexOf('#')+1);$('#li-'+tabId).addClass('selected');$('#'+tabId).show();var searchQuery=$('#li-'+tabId).data('diki.searchQuery');if(searchQuery){$('#searchfield').val(searchQuery);$.bbq.pushState({'q':searchQuery})}if($('#li-'+tabId).data('diki.pageTitle')){document.title=$('#li-'+tabId).data('diki.pageTitle')}if($('#li-'+tabId).data('diki.autoplayRecordingUrl')){SoundApi.playRecording($('#li-'+tabId).data('diki.autoplayRecordingUrl'))}return false});$('#diki-js-panels li a img').live('click',function(event){Dictionary.closeTab($(this).closest('li'),false);return false});$('body .dikibody a').live('click',function(event){return Dictionary.clickAndOpenTabs(event,this)});$(window).bind('hashchange',function(event){if($.bbq.getState('q')!=undefined){Dictionary.openInTab($.bbq.getState('q'))}});if($.bbq.getState('q')!=undefined){$currentTabLi=$('#diki-js-panels li').eq(0);if($currentTabLi.data('diki.searchQuery')!=$.bbq.getState('q')){Dictionary.closeTab($currentTabLi);Dictionary.openInTab($.bbq.getState('q'))}}$(window).resize(Dictionary.fixTabCaptionsLengths);$('.bugreportlink').click(Dictionary.doBugReport)}if(window.top==window.self){$('body').bind('dblclick.'+Dictionary.jqueryEventsNamespace,Dictionary.doubleClickSearch)}$('.nyroModal').nyroModal()});

