﻿
(function(c){function p(d,b,a){var e=this,l=d.add(this),h=d.find(a.tabs),i=b.jquery?b:d.children(b),j;h.length||(h=d.children());i.length||(i=d.parent().find(b));i.length||(i=c(b));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(a.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(j>=0)return e;f=a.initialIndex;k=h.eq(f)}if(f===j)return e;g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[a.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});j=f;h.removeClass(a.current);k.addClass(a.current);return e}},getConf:function(){return a},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return e.click(j+1)},prev:function(){return e.click(j-1)},destroy:function(){h.unbind(a.event).removeClass(a.current);i.find("a[href^=#]").unbind("click.T");return e}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(a[g])&&c(e).bind(g,a[g]);e[g]=function(k){k&&c(e).bind(g,k);return e}});if(a.history&&c.fn.history){c.tools.history.init(h);a.event="history"}h.each(function(f){c(this).bind(a.event,function(g){e.click(f,g);return g.preventDefault()})});i.find("a[href^=#]").bind("click.T",function(f){e.click(c(this).attr("href"),f)});if(location.hash&&a.tabs=="a"&&d.find("[href="+location.hash+"]").length)e.click(location.hash);else if(a.initialIndex===0||a.initialIndex>0)e.click(a.initialIndex)}c.tools=c.tools||{version:"1.2.5"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,b){o[d]=b}};var o={"default":function(d,b){this.getPanes().hide().eq(d).show();b.call()},fade:function(d,b){var a=this.getConf(),e=a.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(a.fadeInSpeed,b)},slide:function(d,b){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,b)},ajax:function(d,b){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),b)}},m;c.tools.tabs.addEffect("horizontal",function(d,b){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();b.call()})});c.fn.tabs=function(d,b){var a=this.data("tabs");if(a){a.destroy();this.removeData("tabs")}if(c.isFunction(b))b={onBeforeClick:b};b=c.extend({},c.tools.tabs.conf,b);this.each(function(){a=new p(c(this),d,b);c(this).data("tabs",a)});return b.api?a:this}})(jQuery);(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,d=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];d+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))h-=f(window).scrollTop();var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")d-=a/2;if(i=="left")d-=a;return{top:h,left:d}}function u(a,b){var c=this,h=a.add(c),d,i=0,j=0,m=a.attr("title"),q=a.attr("data-tooltip"),r=o[b.effect],l,s=a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(e){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(e)},b.predelay);else c.show(e)}).bind(k[1],function(e){clearTimeout(j);if(b.delay)i=setTimeout(function(){c.hide(e)},b.delay);else c.hide(e)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(e){if(!d){if(q)d=f(q);else if(b.tip)d=f(b.tip).eq(0);else if(m)d=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{d=a.next();d.length||(d=a.parent().next())}if(!d.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;d.stop(true,true);var g=p(a,d,b);b.tip&&d.html(a.data("title"));e=e||f.Event();e.type="onBeforeShow";h.trigger(e,[g]);if(e.isDefaultPrevented())return c;g=p(a,d,b);d.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(c,function(){e.type="onShow";l="full";h.trigger(e)});g=b.events.tooltip.split(/,\s*/);if(!d.data("__set")){d.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&d.bind(g[1],function(n){n.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});d.data("__set",true)}return c},hide:function(e){if(!d||!c.isShown())return c;e=e||f.Event();e.type="onBeforeHide";h.trigger(e);if(!e.isDefaultPrevented()){l=false;o[b.effect][1].call(c,function(){e.type="onHide";h.trigger(e)});return c}},isShown:function(e){return e?l=="full":l},getConf:function(){return b},getTip:function(){return d},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(e,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(n){n&&f(c).bind(g,n);return c}})}f.tools=f.tools||{version:"1.2.5"};f.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){o[a]=[b,c]}};var o={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);(function(e){function p(f,c){var b=e(c);return b.length<2?b:f.parent().find(c)}function u(f,c){var b=this,n=f.add(b),g=f.children(),l=0,j=c.vertical;k||(k=b);if(g.length>1)g=e(c.items,f);e.extend(b,{getConf:function(){return c},getIndex:function(){return l},getSize:function(){return b.getItems().size()},getNaviButtons:function(){return o.add(q)},getRoot:function(){return f},getItemWrap:function(){return g},getItems:function(){return g.children(c.item).not("."+c.clonedClass)},move:function(a,d){return b.seekTo(l+
a,d)},next:function(a){return b.move(1,a)},prev:function(a){return b.move(-1,a)},begin:function(a){return b.seekTo(0,a)},end:function(a){return b.seekTo(b.getSize()-1,a)},focus:function(){return k=b},addItem:function(a){a=e(a);if(c.circular){g.children("."+c.clonedClass+":last").before(a);g.children("."+c.clonedClass+":first").replaceWith(a.clone().addClass(c.clonedClass))}else g.append(a);n.trigger("onAddItem",[a]);return b},seekTo:function(a,d,h){a.jquery||(a*=1);if(c.circular&&a===0&&l==-1&&d!==0)return b;if(!c.circular&&a<0||a>b.getSize()||a<-1)return b;var i=a;if(a.jquery)a=b.getItems().index(a);else i=b.getItems().eq(a);var r=e.Event("onBeforeSeek");if(!h){n.trigger(r,[a,d]);if(r.isDefaultPrevented()||!i.length)return b}i=j?{top:-i.position().top}:{left:-i.position().left};l=a;k=b;if(d===undefined)d=c.speed;g.animate(i,d,c.easing,h||function(){n.trigger("onSeek",[a])});return b}});e.each(["onBeforeSeek","onSeek","onAddItem"],function(a,d){e.isFunction(c[d])&&e(b).bind(d,c[d]);b[d]=function(h){h&&e(b).bind(d,h);return b}});if(c.circular){var s=b.getItems().slice(-1).clone().prependTo(g),t=b.getItems().eq(1).clone().appendTo(g);s.add(t).addClass(c.clonedClass);b.onBeforeSeek(function(a,d,h){if(!a.isDefaultPrevented())if(d==-1){b.seekTo(s,h,function(){b.end(0)});return a.preventDefault()}else d==b.getSize()&&b.seekTo(t,h,function(){b.begin(0)})});b.seekTo(0,0,function(){})}var o=p(f,c.prev).click(function(){b.prev()}),q=p(f,c.next).click(function(){b.next()});if(!c.circular&&b.getSize()>1){b.onBeforeSeek(function(a,d){setTimeout(function(){if(!a.isDefaultPrevented()){o.toggleClass(c.disabledClass,d<=0);q.toggleClass(c.disabledClass,d>=b.getSize()-1)}},1)});c.initialIndex||o.addClass(c.disabledClass)}c.mousewheel&&e.fn.mousewheel&&f.mousewheel(function(a,d){if(c.mousewheel){b.move(d<0?1:-1,c.wheelSpeed||50);return false}});if(c.touch){var m={};g[0].ontouchstart=function(a){a=a.touches[0];m.x=a.clientX;m.y=a.clientY};g[0].ontouchmove=function(a){if(a.touches.length==1&&!g.is(":animated")){var d=a.touches[0],h=m.x-d.clientX;d=m.y-d.clientY;b[j&&d>0||!j&&h>0?"next":"prev"]();a.preventDefault()}}}c.keyboard&&e(document).bind("keydown.scrollable",function(a){if(!(!c.keyboard||a.altKey||a.ctrlKey||e(a.target).is(":input")))if(!(c.keyboard!="static"&&k!=b)){var d=a.keyCode;if(j&&(d==38||d==40)){b.move(d==38?-1:1);return a.preventDefault()}if(!j&&(d==37||d==39)){b.move(d==37?-1:1);return a.preventDefault()}}});c.initialIndex&&b.seekTo(c.initialIndex,0,function(){})}e.tools=e.tools||{version:"1.2.5"};e.tools.scrollable={conf:{activeClass:"active",circular:false,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:true,mousewheel:false,next:".next",prev:".prev",speed:400,vertical:false,touch:true,wheelSpeed:0}};var k;e.fn.scrollable=function(f){var c=this.data("scrollable");if(c)return c;f=e.extend({},e.tools.scrollable.conf,f);this.each(function(){c=new u(e(this),f);e(this).data("scrollable",c)});return f.api?c:this}})(jQuery);(function(b){var f=b.tools.scrollable;f.autoscroll={conf:{autoplay:true,interval:3E3,autopause:true}};b.fn.autoscroll=function(c){if(typeof c=="number")c={interval:c};var d=b.extend({},f.autoscroll.conf,c),g;this.each(function(){var a=b(this).data("scrollable");if(a)g=a;var e,h=true;a.play=function(){if(!e){h=false;e=setInterval(function(){a.next()},d.interval)}};a.pause=function(){e=clearInterval(e)};a.stop=function(){a.pause();h=true};d.autopause&&a.getRoot().add(a.getNaviButtons()).hover(a.pause,a.play);d.autoplay&&a.play()});return d.api?g:this}})(jQuery);(function(a){function t(d,b){var c=this,j=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+'"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";j.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var i=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof i=="string")i=i=="center"?Math.max((o.height()-v)/2,0):parseInt(i,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:i,left:r},function(){if(m){e.type="onLoad";j.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";j.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";j.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(i){i&&a(c).bind(h,i);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<a class="close"></a>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.5"};a.tools.overlay={addEffect:function(d,b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),j=a(window);if(!c.fixed){d.top+=j.scrollTop();d.left+=j.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})(jQuery);function initMenu(i){$('ul.menu-top a').each(function(index){if(index==i){$(this).addClass('menu-top-active');}
else{$(this).removeClass('menu-top-active');}});}
function initHomeTabs()
{$('div.box-search-tabs a').each(function(index){$(this).click(function(event){$('div.box-search-tabs a').removeClass('box-search-tab-a');$('div.box-search-content-entry').css('display','none');$(this).addClass('box-search-tab-a');$('div#box-search-content-entry-'+index).css('display','');});});}
function initTabs(tabClass,contentClass,init,icon)
{var tabs=$(tabClass);var contents=$(contentClass);$(tabs).each(function(i){if(init!=i+1){1}
else{enableTabsElement(tabClass,contentClass,i,icon);}
$(this).bind('mousedown',function(e){enableTabsElement(tabClass,contentClass,i,icon);});});}
function enableTabsElement(tabClass,contentClass,i,icon){var tabs=$(tabClass);var contents=$(contentClass);$(tabs).each(function(j){if(i==j){var className='active';if(icon)className=className+' icon_'+(j+1)+'a';$(this).attr('class',className);}
else{var className='';if(icon)className=className+' icon_'+(j+1)+'i';$(this).attr('class',className);}});$(contents).each(function(j){if(i==j)this.style.display='block';else this.style.display='none';});}
function initScroll()
{$('div.box-recommended-scroll').scrollable({'items':'.box-recommended-scroll-content','next':'.scroll-right','prev':'.scroll-left','disabledClass':'scroll-disabled'});}
var msgTimeoutID;function showMsgBox(text,type)
{msgBoxDelete();if(!type)type='ok';$('body').append('<div class="message-box message-box-'+type+' set-middle"><span onclick="msgBoxDelete();" class="icon set-middle set-right"><img src="http://byway.pl/new_img/arrow_close.gif" /></span>'+text+'</div>');if(type='error'){msgTimeoutID=window.setTimeout(msgBoxDelete,60000);}else{msgTimeoutID=window.setTimeout(msgBoxDelete,6000);}}
function showErrorMsgBox(text){showMsgBox(text,'error')}
function showInfoMsgBox(text){showMsgBox(text,'info')}
function msgBoxDelete()
{window.clearTimeout(msgTimeoutID);$('div.message-box-ok').remove();$('div.message-box-error').remove();$('div.message-box-info').remove();}
function AddObject(){window.location=baseUrl+"moje-wycieczki/addPoi.aspx?op=add";}
function IsUserLogged(nextUrl){if(isloged==undefined||!isloged){if(nextUrl!=undefined){var answer=confirm('Aby wykonać tą operację musisz być zalogowany. Czy chcesz się zalogować?');if(answer){window.location=baseUrl+"UserManager/Login.aspx?ReturnUrl="+baseUrl+nextUrl;}}
return false;}
else{if(nextUrl!=undefined){window.location=baseUrl+nextUrl;}
return true;}}
function ConfirmDelete(txt,url){if(confirm('Czy chesz usunąć: '+txt)){window.location=url;}
else{void(0);}}
function showImage(id){$(".imagesList").hide();$("img#"+id).show();$("div#"+id).show();}
function getNextImage(){var list=$("img.imagesList");var count=list.length;var visibleElement=$("img.imagesList:visible");var index=list.index(visibleElement);if(index+1==count){$(".imagesList").hide();$("img.imagesList:first").show();$("div.imagesList:first").show();}
else{index=index+1;$(".imagesList").hide();$("img.imagesList:eq("+index+")").show();$("div.imagesList:eq("+index+")").show();}}
function getPrevImage(){var list=$("img.imagesList");var count=list.length;var visibleElement=$("img.imagesList:visible");var index=list.index(visibleElement);if(index==0){$(".imagesList").hide();$("img.imagesList:last").show();$("div.imagesList:last").show();}
else{index=index-1;$(".imagesList").hide();$("img.imagesList:eq("+index+")").show();$("div.imagesList:eq("+index+")").show();}}
function CheckFieldLength(fieldID,errorfieldID,maxchars){$('#'+errorfieldID).show();var len=document.getElementById(fieldID).value.length;if(len>maxchars){document.getElementById(fieldID).value=document.getElementById(fieldID).value.substring(0,maxchars);len=maxchars;document.getElementById(errorfieldID).innerHTML="Długość pola nie może przekroczyć "+maxchars+" znaków";}
else if(len<=maxchars){document.getElementById(errorfieldID).innerHTML="Pozostało: "+(maxchars-len)+" znaków";}}
function RemoveEnters(input){var output="";for(var i=0;i<input.length;i++){if((input.charCodeAt(i)==13)&&(input.charCodeAt(i+1)==10)){i++;}else{output+=input.charAt(i);}}
return output;}
function UrlEncode(txt){return encodeURI(txt);}
function EncodeJsString(input){var output="";for(var i=0;i<input.length;i++){switch(input.charCodeAt(i)){case'\'':output+="\\\'";break;case'\"':output+="\\\"";break;case'\\':output+="\\\\";break;case'\b':output+="\\b";break;case'\f':output+="\\f";break;case'\n':output+="\\n";break;case'\r':output+="\\r";break;case'\t':output+="\\t";break;default:output+=input.charCodeAt(i);break;}}
return output;}
function openIframe(_url,formTitle,width,height){if(typeof(width)=='undefined'){width=1140;}
if(typeof(height)=='undefined'){height=468;}
if(typeof(formTitle)=='undefined'){formTitle='test';}
$(document).ready(function(){$.nyroModalManual({bgColor:'#000000',windowResize:true,resizable:true,autoSizable:true,width:width,height:height,url:_url,type:'iframe',forceType:'iframe',closeButton:'<a href="#" class="nyroModalClose" id="closeBut" style="right:-12px; top: -12px;" title="close">Close</a>',title:formTitle});return false;});}
function replaceCharacters(text,inChar,outChar){var newString=text.split(inChar);newString=newString.join(outChar);return newString;}
function openPopUp(_url){window.open(_url);}
function add2Trip(guid,nazwa,community){var _url=baseUrl+'planowanie/tripbox.aspx'
$('#TripBoxDiv').html(loading);$.ajax({url:_url,data:({g2a:guid,oname:nazwa}),success:function(_html){$('#TripBoxDiv').html(_html);if(community=='true'){showMsgBox('Zapisano w schowku');}
else{showMsgBox('Obiekt dodany do wycieczki. <a href="'+baseUrl+'moje-wycieczki/wycieczka-program.aspx" >Zobacz wycieczkę</a>.');}}});}
function showTrip(){var _url=baseUrl+'planowanie/tripbox.aspx'
$('#TripBoxDiv').html(loading);$.ajax({url:_url,success:function(_html){$('#TripBoxDiv').html(_html);}});}
function delFTrip(guid,community){var _url=baseUrl+'planowanie/tripbox.aspx'
$('#TripBoxDiv').html(loading);$.ajax({url:_url,data:({g2d:guid}),success:function(_html){$('#TripBoxDiv').html(_html);if(tripMarkersByGuid[guid]!=undefined){map.removeOverlay(tripMarkersByGuid[guid]);if(gmarkersbyGuid[guid]!=undefined){map.addOverlay(gmarkersbyGuid[guid]);}}
if(community=='true'){showMsgBox('Obiekt usunięty ze schowka');}
else{showMsgBox('Obiekt usuniety z wycieczki.');}}});}
function CopyTrip(tripguid){IsUserLogged("Moje-wycieczki/wycieczka-program.aspx?copy="+tripguid);}
var gmarkersbyGuid=[];var tripMarkersByGuid=[];var markersDataByGuid=[];var bigMainPoiMarker;var htmlByGuid=[];var map;var points=[];if(typeof GetPoiListUrl=='undefined'){var GetPoiListUrl='xhr/mapa.asmx/GetPoiList';}else{}
function contains(a,obj){var i=a.length;while(i-->0){if(a[i].lat()===obj.lat()&&a[i].lng()===obj.lng()){return true;}}
return false;}
function getPoint(lat,lng){var temp=new GLatLng(lat,lng);while(contains(points,temp)){temp=new GLatLng(temp.lat()+0.001,temp.lng()+0.001);}
return temp;}
function LoadMap(){LoadMapS(850,450);}
function ClearMap(){map.clearOverlays();}
function LoadMapS(width,height,scrolling){allowedBounds=new GLatLngBounds(new GLatLng(49,14),new GLatLng(55,24.2));map=new google.maps.Map2(document.getElementById("map"));var mt=map.getMapTypes();for(var i=0;i<mt.length;i++){mt[i].getMinimumResolution=function(){return 6;}
mt[i].getMaximumResolution=function(){return 17;}}
if(scrolling!='false'&!scrolling){map.enableScrollWheelZoom();}
map.addControl(new GLargeMapControl3D());map.setCenter(new GLatLng(52.17393169256846,18.8525390625));map.setZoom(6);GEvent.addListener(map,"move",function(){checkBounds();});GEvent.addListener(map,"movestart",function(){closeTooltip();});GEvent.addListener(map,"zoomend",function(){closeTooltip();});}
var doRemap=true;function reMap(){if(typeof map!==undefined&&doRemap){if(typeof(map.checkResize)=='function'){var poiListnerIsEnable=false;if(MapMoveEndEvent!=undefined)
poiListnerIsEnable=true;removePoiListener()
map.checkResize();fitMap(map,points);if(poiListnerIsEnable)
addPoiListener();}}
doRemap=false;}
function createMarker(point,name,guid,urlzdjecia,urlguidobj,opis,address,phone,poitype,addscript,showbutton,ico_type,ico_url,ico_width,ico_height,community,linktosalessystem){if(isNaN(point.lat())||isNaN(point.lat()))
alert('Błędne współrzędne punktu. Marker: '+name+', Lat: '+point.lat()+',  Lng'+point.lng());switch(ico_type){case'trip':var marker=new GMarker(point,tripIco);break;case'url':var ico=new GIcon();ico.image=ico_url;ico.iconSize=new GSize(ico_width,ico_height);var x=1;var y=1;if(ico_height==ico_width){x=Math.round(ico_width/2);y=Math.round(ico_height/2);}
else{x=Math.round(ico_width/2);y=Math.round(ico_height);}
ico.iconAnchor=new GPoint(x,y);ico.infoWindowAnchor=new GPoint(x,y);var marker=new GMarker(point,ico);break;default:var marker=new GMarker(point);}
if(phone!=''&&phone!=undefined){phone='<b>telefon:<\/b> '+phone+'<br \/>';}
var descriptionLenght=75;var descriptionMoreVisible='inline';if(opis.length>descriptionLenght){opis=opis.substring(0,descriptionLenght)+'...';}
if((urlguidobj+'').length<2)
descriptionMoreVisible='none';var button='';if(showbutton=='true'){if(typeof(linktosalessystem)!='undefined'&&linktosalessystem!=''){button=button+''+linktosalessystem+'';}
if(community=='true'){button=button+'<a href="javascript:;" class="button-small" onclick="'+addscript+'">Zapisz do schowka<\/a>';}
else{button=button+'<a href="javascript:;" class="button-small" onclick="'+addscript+'">Dodaj do wycieczki<\/a>';}}
else{button='<b>To miejsce jest już w twojej wycieczce</b>';}
marker.tooltip='<div id="gmaptip'+guid+'" class="gmap-tip close noprint">'+'<div class="gmap-tip-top">'+'<div class="gmap-tip-top-title">'+'<div class="name" style="float:left;">'+'<a href="javascript: showTooltip(currentmarker, true);">'+name+'<\/a>'+'<\/div>'+'<div class="gmap-tip-top-close" style="float:left;position:static;padding-left:5px;">'+'<a class="text" href="javascript: showTooltip(currentmarker, true);">więcej<\/a>'+'<\/div>'+'<div class="gmap-tip-top-open" style="float:left;padding-left:10px;">'+'<a href="javascript: showTooltip(currentmarker, true);"><\/a>'+'<\/div>'+'<div style="clear:both;"></div>'+'<\/div>'+'<\/div>'+'<div class="gmap-tip-bottom-folded">'+'<div><\/div>'+'<\/div>'+'<\/div>';marker.tooltipExtend='<div id="gmaptip'+guid+'" class="gmap-tip close noprint" style="width:400px">'+'<div class="gmap-tip-top">'+'<div class="gmap-tip-top-title">'+'<div class="name">'+'<a href="javascript: closeTooltip();">'+name+'<\/a>'+'<\/div>'+'<\/div>'+'<div class="gmap-tip-top-close">'+'<a class="text" href="javascript: closeTooltip();">zamknij<\/a>'+'<\/div>'+'<div class="gmap-tip-top-hide">'+'<a href="javascript: closeTooltip();"><\/a>'+'<\/div>'+'<\/div>'+'<div class="gmap-tip-content">'+'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+'<tr>'+'<td width="75px">'+'<a href="#">'+'<img src="'+urlzdjecia+'" width="75" \/>'+'<\/a>'+'<\/td>'+'<td>'+'<div class="gmap-tip-content-text">'+
opis+' <a style="color:#4D4D4D; display:'+descriptionMoreVisible+';" href="javascript:openPopUp(\'http://byway.pl/'+urlguidobj+'\');">(<font style="text-decoration:underline;">więcej informacji</font>)</a>'+'<br /><span style="font-size:8px;">&nbsp;<br /></span>'+
address+'<br \/>'+'<b>typ miejsca:<\/b> '+poitype+'<\/div>'+'<div class="gmap-tip-content-buttons set-right">'+
button+'<\/div>'+'<\/td>'+'<\/tr>'+'<\/table>'+'<\/div>'+'<div class="gmap-tip-bottom-folded">'+'<div><\/div>'+'<\/div>'+'<\/div>';GEvent.addListener(marker,"click",function(){showTooltip(marker,true);});GEvent.addListener(marker,"mouseover",function(){showTooltip(marker,false);});map.addOverlay(marker);return marker;}
function showTooltip(marker,extend){closeTooltip();if(extend){tooltip.innerHTML=marker.tooltipExtend;}
else{tooltip.innerHTML=marker.tooltip;currentmarker=marker;}
var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(),map.getZoom());var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());var anchor=marker.getIcon().iconAnchor;var width=marker.getIcon().iconSize.width;var pos=new GControlPosition(G_ANCHOR_BOTTOM_LEFT,new GSize(offset.x-point.x-anchor.x+width/2-12,-offset.y+point.y+anchor.y-20));pos.apply(tooltip);tooltip.style.visibility="visible";}
function closeTooltip(){$('.gmap-tip').hide();}
function mymouseover(guid){var marker1=tripMarkersByGuid[guid];if(tripMarkersByGuid[guid]!=undefined)
showTooltip(tripMarkersByGuid[guid])
else{if(gmarkersbyGuid[guid]!=undefined)
showTooltip(gmarkersbyGuid[guid])
else{}}}
function mymouseout(){closeTooltip();}
function addObjToMap(urlguidobj,guid,urlzdjecia,nazwa,opis,lat1,lng1,address,phone,poitype,groupid,ico_width,ico_height,type,hightlighted,linktosalessystem,community){tooltip=document.createElement("div");document.getElementById("map").appendChild(tooltip);tooltip.style.visibility="hidden";var lat=(lat1+'').replace(',','.');var lng=(lng1+'').replace(',','.');var point=getPoint(lat,lng);points.push(point);var nameJS=replaceCharacters(nazwa,'"','\\\'');var opisJS=replaceCharacters(opis,'"','\\\'');var addscript;if(community=='true'){addscript='javascript: add2Trip(\''+guid+'\', \'\', \'true\'); ';}
else{addscript='javascript: add2Trip(\''+guid+'\'); ';}
addscript+='addTripObjToMap(\''+urlguidobj+'\',\''+guid+'\',\''+urlzdjecia+'\',\''+nameJS+'\',\''+opisJS+'\',\''+lat+'\',\''+lng+'\',\''+address+'\',\''+phone+'\',\''+poitype+'\', \''+groupid+'\', \'19\', \'23\', \'trip\', \'0\', \''+community+'\');';addscript+='closeTooltip(); ';addscript+='return false;';if(groupid>0){if(typeof(ico_width)=='undefined'){ico_width=22;}
if(typeof(ico_height)=='undefined'){ico_height=27;}
switch(type){case'object':var markerIcoUrl=GetObjectMapIcoType(groupid,hightlighted);if(hightlighted!=''&&hightlighted!=undefined&&hightlighted!='undefined'){ico_width=33;ico_height=33;}
break;default:var markerIcoUrl='';break;}
gmarkersbyGuid[guid]=createMarker(point,nazwa,guid,urlzdjecia,urlguidobj,opis,address,phone,poitype,addscript,'true','url',markerIcoUrl,ico_width,ico_height,community,linktosalessystem);}
else{gmarkersbyGuid[guid]=createMarker(point,nazwa,guid,urlzdjecia,urlguidobj,opis,address,phone,poitype,addscript,'true','','','','',community,linktosalessystem);}}
function addTripObjToMap(urlguidobj,guid,urlzdjecia,nazwa,opis,lat1,lng1,address,phone,poitype,groupid,ico_width,ico_height,type,count,community){tooltip=document.createElement("div");document.getElementById("map").appendChild(tooltip);tooltip.style.visibility="hidden";var descriptionLenght=75;var descriptionMoreVisible='none';if(opis.length>descriptionLenght){opis=opis.substring(0,descriptionLenght);descriptionMoreVisible='inline';}
var lat=(lat1+'').replace(',','.');var lng=(lng1+'').replace(',','.');var point=getPoint(lat,lng);points.push(point);if(gmarkersbyGuid[guid]!=undefined){map.removeOverlay(gmarkersbyGuid[guid]);}
if(groupid>0){if(typeof(ico_width)=='undefined'){ico_width=19;}
if(typeof(ico_height)=='undefined'){ico_height=25;}
switch(type){case'print':var markerIcoUrl=GetObjectPrintMapIcoType(groupid,count);break;case'trip':var markerIcoUrl=GetTripObjectMapIcoType(groupid);break;case'object':var markerIcoUrl=GetObjectMapIcoType(groupid);break;case'bigpoi':var markerIcoUrl=GetObjectMapIcoType(groupid,'big');ico_width=35;ico_height=45;break;default:var markerIcoUrl='';break;}
tripMarkersByGuid[guid]=createMarker(point,nazwa,guid,urlzdjecia,urlguidobj,opis,address,phone,poitype,'','false','url',markerIcoUrl,ico_width,ico_height,community);}
else{tripMarkersByGuid[guid]=createMarker(point,nazwa,guid,urlzdjecia,urlguidobj,opis,address,phone,poitype,'','false','trip','','','',community);}
return tripMarkersByGuid[guid];}
function fitMap(map,points){var poiListnerIsEnable=false;if(MapMoveEndEvent!=undefined)
poiListnerIsEnable=true;removePoiListener()
var bounds=new GLatLngBounds();if(points.lenght==0||points==undefined||points==''){var point=new GLatLng(53.47497,16.325684);points.push(point);point=new GLatLng(51.275662,16.853027);points.push(point);point=new GLatLng(53.343993,21.577148);points.push(point);point=new GLatLng(50.792047,22.148438);points.push(point);}
for(var i=0;i<points.length;i++){bounds.extend(points[i]);}
map.setZoom(map.getBoundsZoomLevel(bounds)-1);map.setCenter(bounds.getCenter());if(poiListnerIsEnable)
addPoiListener()}
function GetObjectPrintIcoType(groupID){return baseUrl+'new_img/print/cloud'+groupID+'.gif';}
function GetObjectPrintMapIcoType(groupID,count){var url='';switch(groupID){case'1':url=baseUrl+'new_img/markers/markers_blue/marker_'+count+'.png';break;case'2':url=baseUrl+'new_img/markers/markers_red/marker_'+count+'.png';break;case'3':url=baseUrl+'new_img/markers/markers_yellow/marker_'+count+'.png';break;case'4':url=baseUrl+'new_img/markers/markers_violet/marker_'+count+'.png';break;default:url='';break;}
return hostUrl+url;}
function GetObjectMapIcoType(groupID,hightlightedOrBig){var url='';switch(groupID){case'1':url=baseUrl+'new_img/markers/map/marker_noclegi.png';break;case'2':url=baseUrl+'new_img/markers/map/marker_atrakcje.png';break;case'3':url=baseUrl+'new_img/markers/map/marker_gastronomia.png';break;case'4':url=baseUrl+'new_img/markers/map/marker_wydarzenia.png';break;case 1:url=baseUrl+'new_img/markers/map/marker_noclegi.png';break;case 2:url=baseUrl+'new_img/markers/map/marker_atrakcje.png';break;case 3:url=baseUrl+'new_img/markers/map/marker_gastronomia.png';break;case 4:url=baseUrl+'new_img/markers/map/marker_wydarzenia.png';break;default:url='';break;}
if(hightlightedOrBig=='big'){url=url.replace('.png','_big.png');}
else if(hightlightedOrBig!=''&&hightlightedOrBig!=undefined&&hightlightedOrBig!='undefined'){url=url.replace('.png','_h.gif');}
return hostUrl+url;}
function GetTripObjectMapIcoType(groupID){return hostUrl+baseUrl+'new_img/markers/icon_map'+groupID+'.gif';}
var MapMoveEndEvent;function getPoiByMap(){bounds=map.getBounds();ne=bounds.getNorthEast();sw=bounds.getSouthWest();var _newurl="?";if(typeof($('form').attr('action'))!=='undefined'){_newurl=$('form').attr('action');}
_newurl+="&gl="+Math.max(sw.x.toFixed(5),14).toString()+'&gb='+Math.max(sw.y.toFixed(5),49).toString()+'&gr='+Math.min(ne.x.toFixed(5),24.2)+'&gt='+Math.min(ne.y.toFixed(5),55);var valuesLayers=new Array();$.each($("input[name='poilayer']:checked"),function(){valuesLayers.push($(this).val());});if(valuesLayers.length>0){layers=valuesLayers.toString();_newurl+='&lay='+layers;}
if(typeof(GetPoiList)=='function'){GetPoiList(_newurl,false);}}
function addPoiListener(){MapMoveEndEvent=GEvent.addListener(map,"moveend",function(){if(checkBounds())
getPoiByMap();});}
function removePoiListener(){if(MapMoveEndEvent!=undefined){MapMoveEndEvent.remove();}
MapMoveEndEvent=undefined;}
var allowedBounds;function checkBounds(){if(allowedBounds.contains(map.getCenter())){return true;}
var C=map.getCenter();var X=C.lng();var Y=C.lat();var AmaxX=allowedBounds.getNorthEast().lng();var AmaxY=allowedBounds.getNorthEast().lat();var AminX=allowedBounds.getSouthWest().lng();var AminY=allowedBounds.getSouthWest().lat();if(X<AminX){X=AminX;}
if(X>AmaxX){X=AmaxX;}
if(Y<AminY){Y=AminY;}
if(Y>AmaxY){Y=AmaxY;}
map.setCenter(new GLatLng(Y,X));return false;}
function AjaxSucceeded(result,fitMap2poi){ClearMap();if(fitMap2poi==undefined){fitMap2poi=true;}
if(result.d.pois.length>0){if(result.d.pois!=null){addPoiMap2Map(result.d.pois,'normal');}
if(fitMap2poi){fitMap(map,points);}
if(result.d.trips!=null){addPoiMap2Map(result.d.trips,'trip');}}
else{}
$('#mainLoader').hide();$("#mapLoader").html('');$("#mapLoader").hide();}
function addPoiMap2Map(trips,type){$.each(trips,function(i,poi){var desc=poi.Abs;if(desc==null){desc='';}
if(poi.ReservationButton==null){poi.ReservationButton='';}
if(poi.Lat!=null&&poi.Lon!=null&&poi.Lat!=0&&poi.Lon!=0){if(type=='mytrip'){addTripObjToMap('details.aspx?guid='+poi.GuidObject,poi.GuidObject,poi.PhotoThUri,poi.Name,desc,poi.Lat,poi.Lon,poi.fAddress,poi.Tel,poi.fGroupName,poi.GroupID,19,23,'trip');}else{addObjToMap('details.aspx?guid='+poi.GuidObject,poi.GuidObject,poi.PhotoThUri,poi.Name,desc,poi.Lat,poi.Lon,poi.fAddress,poi.Tel,poi.fGroupName,poi.GroupID,22,27,'object',poi.HighLighted,poi.ReservationButton+'');}}});}
function AjaxFailed(result){ClearMap();}
var xhr;function GetPoiList(query,fitMap2poi,sort){if(xhr!=null&xhr!=undefined){xhr.abort();}
if(sort==undefined||sort==null)
sort=0;if(fitMap2poi==undefined){fitMap2poi=true;}
points=[];gmarkers=[];htmls=[];i=0;$("#mapLoader").html(loading);$("#mapLoader").show();var _url=baseUrl+GetPoiListUrl;xhr=$.ajax({type:"POST",url:_url,data:"{'query': '"+replaceCharacters(query,'%u','\\u')+"', 'order': '"+sort+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){AjaxSucceeded(msg,fitMap2poi);},error:AjaxFailed,cache:true});}
function zoomStaticMap(id,zoomchange){var _zoom=parseInt($(id).attr('zoom'));var old_zoom="zoom="+_zoom;var new_zoom="zoom="+(_zoom+zoomchange);if((zoomchange==-1&_zoom>0)||(zoomchange==1&_zoom<18)){$(id).attr('src',$(id).attr('src').replace(old_zoom,new_zoom));$(id).attr('zoom',(_zoom+zoomchange));}}
var oldmapStyle;var oldtripStyle;function makeFullScrean(mapid){oldmapStyle=$(mapid).attr('style');oldtripStyle=$('#box-trip box-shadow').attr('style');$(mapid).attr('style','top: 0pt; left: 0pt; width: 100%; height: 100%; z-index: 1;  position: absolute; background-color:white;');$('.box-trip').attr('style','position:fixed; top:10px; right:4px; z-index:1000; width:200px;');$('ul#TripBoxDiv').height('80px');window.location="#";$('#fullscrBtn').hide();reMap();$("body").css("overflow","hidden");_gaq.push(['_trackEvent','map','fullscrenclick','strona',window.location.href]);}
(function(a){var k="function",i="password",c="maxLength",e="type",b=true,d=false,s="watermark",t,m=s,h="watermarkClass",p="watermarkFocus",j="watermarkSubmit",l="watermarkMaxLength",g="watermarkPassword",f="watermarkText",r=":data("+m+")",n=":text,:password,:search,textarea",o=["Page_ClientValidate"],q=d;a.extend(a.expr[":"],{search:function(a){return"search"===a.type},data:function(f,h,g){var e,c=/^((?:[^=!^$*]|[!^$*](?!=))+)(?:([!^$*]?=)(.*))?$/.exec(g[3]);if(c){e=a(f).data(c[1]);if(e!==t){if(c[2]){e=""+e;switch(c[2]){case"=":return e==c[3];case"!=":return e!=c[3];case"^=":return e.slice(0,c[3].length)==c[3];case"$=":return e.slice(-c[3].length)==c[3];case"*=":return e.indexOf(c[3])!==-1}}return b}}return d}});a.watermark={version:"3.0.4",options:{className:s,useNative:b},hide:function(b){a(b).filter(r).each(function(){a.watermark._hide(a(this))})},_hide:function(a,i){if(a.val()==a.data(f)){a.val("");if(a.data(g))if(a.attr(e)==="text"){var d=a.data(g),b=a.parent();b[0].removeChild(a[0]);b[0].appendChild(d[0]);a=d}if(a.data(l)){a.attr(c,a.data(l));a.removeData(l)}if(i){a.attr("autocomplete","off");window.setTimeout(function(){a.select()},0)}}a.removeClass(a.data(h))},show:function(b){a(b).filter(r).each(function(){a.watermark._show(a(this))})},_show:function(d){var r=d.val(),j=d.data(f),m=d.attr(e);if((r.length==0||r==j)&&!d.data(p)){q=b;if(d.data(g))if(m===i){var o=d.data(g),n=d.parent();n[0].removeChild(d[0]);n[0].appendChild(o[0]);d=o;d.attr(c,j.length)}if(m==="text"||m==="search"){var k=d.attr(c);if(k>0&&j.length>k){d.data(l,k);d.attr(c,j.length)}}d.addClass(d.data(h));d.val(j)}else a.watermark._hide(d)},hideAll:function(){if(q){a.watermark.hide(n);q=d}},showAll:function(){a.watermark.show(n)}};a.fn.watermark=function(q,l){var o="string",s=typeof q===o,r;if(typeof l==="object"){r=typeof l.className===o;l=a.extend({},a.watermark.options,l)}else if(typeof l===o){r=b;l=a.extend({},a.watermark.options,{className:l})}else l=a.watermark.options;if(typeof l.useNative!==k)l.useNative=l.useNative?function(){return b}:function(){return d};return this.each(function(){var u="dragleave",t="dragenter",w=this,d=a(w);if(!d.is(n))return;if(d.data(m)){if(s||r){a.watermark._hide(d);s&&d.data(f,q);r&&d.data(h,l.className)}}else{if(l.useNative.call(w,d))if((""+d.css("-webkit-appearance")).replace("undefined","")!==""&&d.attr("tagName")!=="TEXTAREA"){s&&d.attr("placeholder",q);return}d.data(f,s?q:"");d.data(h,l.className);d.data(m,1);if(d.attr(e)===i){var x=d.wrap("<span>").parent(),k=a(x.html().replace(/type=["']?password["']?/i,'type="text"'));k.data(f,d.data(f));k.data(h,d.data(h));k.data(m,1);k.attr(c,q.length);k.focus(function(){a.watermark._hide(k,b)}).bind(t,function(){a.watermark._hide(k)}).bind("dragend",function(){window.setTimeout(function(){k.blur()},1)});d.blur(function(){a.watermark._show(d)}).bind(u,function(){a.watermark._show(d)});k.data(g,d);d.data(g,k)}else d.focus(function(){d.data(p,1);a.watermark._hide(d,b)}).blur(function(){d.data(p,0);a.watermark._show(d)}).bind(t,function(){a.watermark._hide(d)}).bind(u,function(){a.watermark._show(d)}).bind("dragend",function(){window.setTimeout(function(){a.watermark._show(d)},1)}).bind("drop",function(b){var a=b.originalEvent.dataTransfer.getData("Text");d.val().replace(a,"")===d.data(f)&&d.val(a);d.focus()});if(w.form){var o=w.form,v=a(o);if(!v.data(j)){v.submit(a.watermark.hideAll);if(o.submit){v.data(j,o.submit);o.submit=function(c,b){return function(){var d=b.data(j);a.watermark.hideAll();if(d.apply)d.apply(c,Array.prototype.slice.call(arguments));else d()}}(o,v)}else{v.data(j,1);o.submit=function(b){return function(){a.watermark.hideAll();delete b.submit;b.submit()}}(o)}}}}a.watermark._show(d)}).end()};o.length&&a(function(){for(var b,c,d=o.length-1;d>=0;d--){b=o[d];c=window[b];if(typeof c===k)window[b]=function(b){return function(){a.watermark.hideAll();b.apply(null,Array.prototype.slice.call(arguments))}}(c)}})})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};function validlength(obj){var minChar=$(obj).attr("MinChar");var maxChar=$(obj).attr("MaxChar");var id=$(obj).attr("id");var lengthid='';var val=$(obj).val();if(id.lastIndexOf('_')!=-1){lengthid='#'+id.substring(id.lastIndexOf('_')+1)+'length';}
else{lengthid='#'+id+'length';}
if((typeof(minChar)!="undefined"||typeof(maxChar)!="undefined")&&typeof($(lengthid).attr("id"))!="undefined"){if(typeof(maxChar)!="undefined"){$(lengthid).show();if(val.length>maxChar){$(lengthid).html("Wpisałeś za dużo o "+(val.length-maxChar)+" znaków.");$(obj).val(val.substring(0,maxChar));}
else{$(lengthid).html("Możesz jeszcze wpisać "+(maxChar-val.length)+" znaków.");}}
if(typeof(minChar)!="undefined"){if(val.length<minChar){$(lengthid).show();$(lengthid).html("Musisz jeszcze wpisać "+(minChar-val.length)+" znaków.");}}}}
function setvalidlength(){$('.validlength').change(function(){validlength(this);}).keypress(function(){validlength(this);}).keyup(function(){validlength(this);}).keydown(function(){validlength(this);}).blur(function(){var id=$(this).attr("id");var lengthid='';if(id.lastIndexOf('_')!=-1){lengthid='#'+id.substring(id.lastIndexOf('_')+1)+'length';}
else{lengthid='#'+id+'length';}});}
function initializevalidation(){$('.error').hide();}
function required(source,arguments){var id=source.id;var imgid='';var ctrlid='';if(id.lastIndexOf('_')!=-1){imgid='#'+id.substring(id.lastIndexOf('_')+3)+'errorimg';ctrlid='#'+id.substring(0,id.lastIndexOf('_')+1)+id.substring(id.lastIndexOf('_')+3);}
else{imgid='#'+id+'errorimg';ctrlid='#'+id;}
var init=$(ctrlid).attr("InitialValue");var regularexpression=$(ctrlid).attr("RegEx");var minChar=$(ctrlid).attr("MinChar");var maxChar=$(ctrlid).attr("MaxChar");var fun=$(ctrlid).attr("ValidationFunction");var len=arguments.Value.length;if(len>0&&((typeof(minChar)!='undefined'&&len>=minChar)||typeof(minChar)=='undefined')&&((typeof(maxChar)!='undefined'&&len<=maxChar)||typeof(maxChar)=='undefined')&&((typeof(fun)!='undefined'&&eval(fun+'(source, arguments)')==true)||typeof(fun)=='undefined')&&(((typeof(init)!='undefined')&&arguments.Value!=init)||(typeof(init)=='undefined'))&&(((typeof(regularexpression)!='undefined')&&arguments.Value.match(regularexpression))||(typeof(regularexpression)=='undefined'))){$(imgid).hide();$(ctrlid).removeClass('red');arguments.IsValid=true;}
else{$(imgid).show();$(ctrlid).addClass('red');arguments.IsValid=false;}}
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}('a(31.9&&!31.9.3c){(8(){6 G=8(s,x,f){5.1L=[];5.1p={};5.29=C;5.1K={};5.1a={};5.f=9.1y({2z:18,37:2u,2r:18,2Z:18,2T:2u,2S:2u},f);5.2Q(s,x);a(s){5.1n(5.1a[\'1V\'],x,5.f)}5.1a=C};G.m.2G=\'0.7.0\';G.m.2Q=8(s,x){6 2E=/\\{#3i *(\\w*?)( .*)*\\}/g;6 20,1x,H;6 1v=C;6 2x=[];2v((20=2E.3U(s))!=C){1v=2E.1v;1x=20[1];H=s.2s(\'{#/3i \'+1x+\'}\',1v);a(H==-1){Y c 12(\'14: G "\'+1x+\'" 2n 1Q 3H.\');}5.1a[1x]=s.2h(1v,H);2x[1x]=L.2c(20[2])}a(1v===C){5.1a[\'1V\']=s;b}F(6 i 1N 5.1a){a(i!=\'1V\'){5.1K[i]=c G()}}F(6 i 1N 5.1a){a(i!=\'1V\'){5.1K[i].1n(5.1a[i],9.1y({},x||{},5.1K||{}),9.1y({},5.f,2x[i]));5.1a[i]=C}}};G.m.1n=8(s,x,f){a(s==15){5.1L.A(c 1d(\'\',1));b}s=s.W(/[\\n\\r]/g,\'\');s=s.W(/\\{\\*.*?\\*\\}/g,\'\');5.29=9.1y({},5.1K||{},x||{});5.f=c 25(f);6 j=5.1L;6 J=s.1c(/\\{#.*?\\}/g);6 Z=0,H=0;6 e;6 1b=0;6 21=0;F(6 i=0,l=(J)?(J.O):(0);i<l;++i){a(1b){H=s.2s(\'{#/1z}\');a(H==-1){Y c 12("14: 3f 1G 3e 1z.");}a(H>Z){j.A(c 1d(s.2h(Z,H),1))}Z=H+11;1b=0;i=9.3Z(\'{#/1z}\',J);3b}H=s.2s(J[i],Z);a(H>Z){j.A(c 1d(s.2h(Z,H),1b))}6 3X=J[i].1c(/\\{#([\\w\\/]+).*?\\}/);6 2w=E.$1;36(2w){q\'3T\':++21;j.1U();q\'a\':e=c 1t(J[i],j);j.A(e);j=e;M;q\'U\':j.1U();M;q\'/a\':2v(21){j=j.1T();--21}q\'/F\':q\'/1S\':j=j.1T();M;q\'1S\':e=c 1j(J[i],j);j.A(e);j=e;M;q\'F\':e=1R(J[i],j);j.A(e);j=e;M;q\'2q\':j.A(c 2I(J[i],5.29));M;q\'h\':j.A(c 2p(J[i]));M;q\'2o\':j.A(c 2m(J[i]));M;q\'3M\':j.A(c 1d(\'{\'));M;q\'3K\':j.A(c 1d(\'}\'));M;q\'1z\':1b=1;M;q\'/1z\':Y c 12("14: 3f 2k 3e 1z.");2R:Y c 12(\'14: 3G 3E \'+2w+\'.\');}Z=H+J[i].O}a(s.O>Z){j.A(c 1d(s.3D(Z),1b))}};G.m.I=8(d,h,z,B){++B;6 $T=d,22,1Y;a(5.f.2T){$T=L.1m(d,{1W:(5.f.37&&B==1),1F:5.f.2z})}a(!5.f.2S){22=5.1p;1Y=h}U{22=L.1m(5.1p,{1W:(5.f.2r),1F:18});1Y=L.1m(h,{1W:(5.f.2r&&B==1),1F:18})}6 $P=9.1y({},22,1Y);6 $Q=z;$Q.2G=5.2G;6 13=\'\';F(6 i=0,l=5.1L.O;i<l;++i){13+=5.1L[i].I($T,$P,$Q,B)}--B;b 13};G.m.28=8(1J,1M){5.1p[1J]=1M};L=8(){};L.3q=8(3p){b 3p.W(/&/g,\'&4b;\').W(/>/g,\'&3o;\').W(/</g,\'&3n;\').W(/"/g,\'&48;\').W(/\'/g,\'&#39;\')};L.1m=8(d,1A){a(d==C){b d}36(d.3m){q 25:6 o={};F(6 i 1N d){o[i]=L.1m(d[i],1A)}a(!1A.1F){o.3k=d.3k}b o;q 47:6 o=[];F(6 i=0,l=d.O;i<l;++i){o[i]=L.1m(d[i],1A)}b o;q 3j:b(1A.1W)?(L.3q(d)):(d);q 46:a(1A.1F){Y c 12("14: 45 44 1Q 43.");}2R:b d}};L.2c=8(24){a(24===C||24===15){b{}}6 o=24.42(/[= ]/);a(o[0]===\'\'){o.41()}6 2B={};F(6 i=0,l=o.O;i<l;i+=2){2B[o[i]]=o[i+1]}b 2B};6 1d=8(2A,1b){5.23=2A;5.3h=1b};1d.m.I=8(d,h,z,B){6 t=5.23;a(!5.3h){6 $T=d;6 $P=h;6 $Q=z;t=t.W(/\\{(.*?)\\}/g,8(40,3g){6 19=V(3g);a(1I 19==\'8\'){6 f=9.K(z,\'1i\').f;a(f.2z||!f.2Z){b\'\'}U{19=19($T,$P,$Q)}}b(19===15)?(""):(3j(19))})}b t};6 1t=8(D,1r){5.1Z=1r;D.1c(/\\{#(?:U)*a (.*?)\\}/);5.3d=E.$1;5.1g=[];5.1f=[];5.1w=5.1g};1t.m.A=8(e){5.1w.A(e)};1t.m.1T=8(){b 5.1Z};1t.m.1U=8(){5.1w=5.1f};1t.m.I=8(d,h,z,B){6 $T=d;6 $P=h;6 $Q=z;6 2y=(V(5.3d))?(5.1g):(5.1f);6 13=\'\';F(6 i=0,l=2y.O;i<l;++i){13+=2y[i].I(d,h,z,B)}b 13};1R=8(D,1r){a(D.1c(/\\{#F (\\w+?) *= *(\\S+?) +3Y +(\\S+?) *(?:R=(\\S+?))*\\}/)){D=\'{#1S 1R.3a 38 \'+E.$1+\' 2k=\'+(E.$2||0)+\' 1G=\'+(E.$3||-1)+\' R=\'+(E.$4||1)+\' 1E=$T}\';b c 1j(D,1r)}U{Y c 12(\'14: 3W 3V "35": \'+D);}};1R.3a=8(i){b i};6 1j=8(D,1r){5.1Z=1r;D.1c(/\\{#1S (.+?) 38 (\\w+?)( .+)*\\}/);5.34=E.$1;5.y=E.$2;5.N=E.$3||C;5.N=L.2c(5.N);5.1g=[];5.1f=[];5.1w=5.1g};1j.m.A=8(e){5.1w.A(e)};1j.m.1T=8(){b 5.1Z};1j.m.1U=8(){5.1w=5.1f};1j.m.I=8(d,h,z,B){6 $T=d;6 $P=h;6 $Q=z;6 1h=V(5.34);6 1D=[];6 1u=1I 1h;a(1u==\'33\'){6 2t=[];9.17(1h,8(k,v){1D.A(k);2t.A(v)});1h=2t}6 1E=(5.N.1E!==15)?(V(5.N.1E)):{};6 s=1H(V(5.N.2k)||0),e;6 R=1H(V(5.N.R)||1);a(1u!=\'8\'){e=1h.O}U{a(5.N.1G===15||5.N.1G===C){e=1H.3S}U{e=1H(V(5.N.1G))+((R>0)?(1):(-1))}}6 13=\'\';6 i,l;a(5.N.1C){6 19=s+1H(V(5.N.1C));e=(19>e)?(e):(19)}a((e>s&&R>0)||(e<s&&R<0)){6 1q=0;6 30=(1u!=\'8\')?(3R.3Q((e-s)/R)):15;6 1s,1k;F(;((R>0)?(s<e):(s>e));s+=R,++1q){1s=1D[s];a(1u!=\'8\'){1k=1h[s]}U{1k=1h(s);a(1k===15||1k===C){M}}a((1u==\'33\')&&(1s 1N 25)&&(25[1s]===$T[1s])){3b}$T=1E;6 p=$T[5.y]=1k;$T[5.y+\'$2Y\']=s;$T[5.y+\'$1q\']=1q;$T[5.y+\'$2X\']=(1q==0);$T[5.y+\'$3l\']=(s+R>=e);$T[5.y+\'$2V\']=30;$T[5.y+\'$1D\']=1s;$T[5.y+\'$1I\']=1I 1k;F(i=0,l=5.1g.O;i<l;++i){13+=5.1g[i].I($T,h,z,B)}1e $T[5.y+\'$2Y\'];1e $T[5.y+\'$1q\'];1e $T[5.y+\'$2X\'];1e $T[5.y+\'$3l\'];1e $T[5.y+\'$2V\'];1e $T[5.y+\'$1D\'];1e $T[5.y+\'$1I\'];1e $T[5.y]}}U{F(i=0,l=5.1f.O;i<l;++i){13+=5.1f[i].I($T,h,z,B)}}b 13};6 2I=8(D,x){D.1c(/\\{#2q (.*?)(?: 3P=(.*?))?\\}/);5.2H=x[E.$1];a(5.2H==15){Y c 12(\'14: 3O 35 2q: \'+E.$1);}5.2U=E.$2};2I.m.I=8(d,h,z,B){6 $T=d;b 5.2H.I(V(5.2U),h,z,B)};6 2p=8(D){D.1c(/\\{#h 1J=(\\w*?) 1M=(.*?)\\}/);5.y=E.$1;5.23=E.$2};2p.m.I=8(d,h,z,B){6 $T=d;6 $P=h;6 $Q=z;h[5.y]=V(5.23);b\'\'};6 2m=8(D){D.1c(/\\{#2o 3N=(.*?)\\}/);5.2d=V(E.$1);5.2l=5.2d.O;a(5.2l<=0){Y c 12(\'14: 2o 3L 3J 3I\');}5.2f=0;5.2b=-1};2m.m.I=8(d,h,z,B){6 2j=9.K(z,\'1B\');a(2j!=5.2b){5.2b=2j;5.2f=0}6 i=5.2f++%5.2l;b 5.2d[i]};9.X.1n=8(s,x,f){a(s.3m===G){b 9(5).17(8(){9.K(5,\'1i\',s);9.K(5,\'1B\',0)})}U{b 9(5).17(8(){9.K(5,\'1i\',c G(s,x,f));9.K(5,\'1B\',0)})}};9.X.3F=8(1o,x,f){6 s=9.2g({1l:1o,2e:18}).2P;b 9(5).1n(s,x,f)};9.X.3C=8(2i,x,f){6 s=$(\'#\'+2i).2A();a(s==C){s=$(\'#\'+2i).2O();s=s.W(/&3n;/g,"<").W(/&3o;/g,">")}s=9.3B(s);s=s.W(/^<\\!\\[3A\\[([\\s\\S]*)\\]\\]>$/3z,\'$1\');b 9(5).1n(s,x,f)};9.X.3y=8(){6 1C=0;9(5).17(8(){a(9.K(5,\'1i\')){++1C}});b 1C};9.X.3x=8(){9(5).32();b 9(5).17(8(){9.2N(5,\'1i\')})};9.X.28=8(1J,1M){b 9(5).17(8(){6 t=9.K(5,\'1i\');a(t===15){Y c 12(\'14: G 2n 1Q 2W.\');}t.28(1J,1M)})};9.X.2a=8(d,h){b 9(5).17(8(){6 t=9.K(5,\'1i\');a(t===15){Y c 12(\'14: G 2n 1Q 2W.\');}9.K(5,\'1B\',9.K(5,\'1B\')+1);9(5).2O(t.I(d,h,5,0))})};9.X.3w=8(1o,h){6 10=5;6 s=9.2g({1l:1o,2e:18,3v:18,3u:\'3t\',3s:8(d){9(10).2a(d,h)}});b 5};6 1P=8(1l,h,1O,1X,16){5.2M=1l;5.1p=h;5.2L=1O;5.2K=1X;5.16=16;5.2C=C;6 10=5;9(16).17(8(){9.K(5,\'2D\',10)});5.27()};1P.m.27=8(){5.2J();a(5.16.O==0){b}6 10=5;9.4f(5.2M,5.2K,8(d){9(10.16).2a(d,10.1p)});5.2C=4e(8(){10.27()},5.2L)};1P.m.2J=8(){5.16=9.3r(5.16,8(o){a(9.4d.4c){6 n=o.2F;2v(n&&n!=4a){n=n.2F}b n!=C}U{b o.2F!=C}})};9.X.49=8(1l,h,1O,1X){6 u=c 1P(1l,h,1O,1X,5);b u.2C};9.X.32=8(){b 9(5).17(8(){6 26=9.K(5,\'2D\');a(26==C){b}6 10=5;26.16=9.3r(26.16,8(o){b o!=10});9.2N(5,\'2D\')})};9.1y({3c:8(s,x,f){b c G(s,x,f)},4g:8(1o,x,f){6 s=9.2g({1l:1o,2e:18}).2P;b c G(s,x,f)}})})(9)}',62,265,'|||||this|var||function|jQuery|if|return|new|||settings||param||node|||prototype||||case|||||||includes|_name|element|push|deep|null|oper|RegExp|for|Template|se|get|op|data|TemplateUtils|break|_option|length|||step|||else|eval|replace|fn|throw|ss|that||Error|ret|jTemplates|undefined|objs|each|false|tmp|_templates_code|literalMode|match|TextNode|delete|_onFalse|_onTrue|fcount|jTemplate|opFOREACH|cval|url|cloneData|setTemplate|url_|_param|iteration|par|ckey|opIF|mode|lastIndex|_currentState|tname|extend|literal|filter|jTemplateSID|count|key|extData|noFunc|end|Number|typeof|name|_templates|_tree|value|in|interval|Updater|not|opFORFactory|foreach|getParent|switchToElse|MAIN|escapeData|args|_param2|_parent|iter|elseif_level|_param1|_value|optionText|Object|updater|run|setParam|_includes|processTemplate|_lastSessionID|optionToObject|_values|async|_index|ajax|substring|elementName|sid|begin|_length|Cycle|is|cycle|UserParam|include|filter_params|indexOf|arr|true|while|op_|_template_settings|tab|disallow_functions|val|obj|timer|jTemplateUpdater|reg|parentNode|version|_template|Include|detectDeletedNodes|_args|_interval|_url|removeData|html|responseText|splitTemplates|default|clone_params|clone_data|_root|total|defined|first|index|runnable_functions|_total|window|processTemplateStop|object|_arg|find|switch|filter_data|as||funcIterator|continue|createTemplate|_cond|of|No|__a1|_literalMode|template|String|toString|last|constructor|lt|gt|txt|escapeHTML|grep|success|json|dataType|cache|processTemplateURL|removeTemplate|hasTemplate|im|CDATA|trim|setTemplateElement|substr|tag|setTemplateURL|unknown|closed|elements|no|rdelim|has|ldelim|values|Cannot|root|ceil|Math|MAX_VALUE|elseif|exec|failed|Operator|ppp|to|inArray|__a0|shift|split|allowed|are|Functions|Function|Array|quot|processTemplateStart|document|amp|msie|browser|setTimeout|getJSON|createTemplateURL'.split('|'),0,{}));if(window.jQuery)(function($){if($.browser.msie)try{document.execCommand("BackgroundImageCache",false,true)}catch(e){};$.fn.rating=function(options){if(this.length==0)return this;if(typeof arguments[0]=='string'){if(this.length>1){var args=arguments;return this.each(function(){$.fn.rating.apply($(this),args);});};$.fn.rating[arguments[0]].apply(this,$.makeArray(arguments).slice(1)||[]);return this;};var options=$.extend({},$.fn.rating.options,options||{});$.fn.rating.calls++;this.not('.star-rating-applied').addClass('star-rating-applied').each(function(){var control,input=$(this);var eid=(this.name||'unnamed-rating').replace(/\[|\]/g,'_').replace(/^\_+|\_+$/g,'');var context=$(this.form||document.body);var raters=context.data('rating');if(!raters||raters.call!=$.fn.rating.calls)raters={count:0,call:$.fn.rating.calls};var rater=raters[eid];if(rater)control=rater.data('rating');if(rater&&control)
control.count++;else{control=$.extend({},options||{},($.metadata?input.metadata():($.meta?input.data():null))||{},{count:0,stars:[],inputs:[]});control.serial=raters.count++;rater=$('<span class="star-rating-control"/>');input.before(rater);rater.addClass('rating-to-be-drawn');if(input.attr('disabled'))control.readOnly=true;rater.append(control.cancel=$('<div class="rating-cancel"><a title="'+control.cancel+'">'+control.cancelValue+'</a></div>').mouseover(function(){$(this).rating('drain');$(this).addClass('star-rating-hover');}).mouseout(function(){$(this).rating('draw');$(this).removeClass('star-rating-hover');}).click(function(){$(this).rating('select');}).data('rating',control));};var star=$('<div class="star-rating rater-'+control.serial+'"><a title="'+(this.title||this.value)+'">'+this.value+'</a></div>');rater.append(star);if(this.id)star.attr('id',this.id);if(this.className)star.addClass(this.className);if(control.half)control.split=2;if(typeof control.split=='number'&&control.split>0){var stw=($.fn.width?star.width():0)||control.starWidth;var spi=(control.count%control.split),spw=Math.floor(stw/control.split);star.width(spw).find('a').css({'margin-left':'-'+(spi*spw)+'px'})};if(control.readOnly)
star.addClass('star-rating-readonly');else
star.addClass('star-rating-live').mouseover(function(){$(this).rating('fill');$(this).rating('focus');}).mouseout(function(){$(this).rating('draw');$(this).rating('blur');}).click(function(){$(this).rating('select');});if(this.checked)control.current=star;input.hide();input.change(function(){$(this).rating('select');});star.data('rating.input',input.data('rating.star',star));control.stars[control.stars.length]=star[0];control.inputs[control.inputs.length]=input[0];control.rater=raters[eid]=rater;control.context=context;input.data('rating',control);rater.data('rating',control);star.data('rating',control);context.data('rating',raters);});$('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');return this;};$.extend($.fn.rating,{calls:0,focus:function(){var control=this.data('rating');if(!control)return this;if(!control.focus)return this;var input=$(this).data('rating.input')||$(this.tagName=='INPUT'?this:null);if(control.focus)control.focus.apply(input[0],[input.val(),$('a',input.data('rating.star'))[0]]);},blur:function(){var control=this.data('rating');if(!control)return this;if(!control.blur)return this;var input=$(this).data('rating.input')||$(this.tagName=='INPUT'?this:null);if(control.blur)control.blur.apply(input[0],[input.val(),$('a',input.data('rating.star'))[0]]);},fill:function(){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;this.rating('drain');this.prevAll().andSelf().filter('.rater-'+control.serial).addClass('star-rating-hover');},drain:function(){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;control.rater.children().filter('.rater-'+control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');},draw:function(){var control=this.data('rating');if(!control)return this;this.rating('drain');if(control.current){control.current.data('rating.input').attr('checked','checked');control.current.prevAll().andSelf().filter('.rater-'+control.serial).addClass('star-rating-on');}
else
$(control.inputs).removeAttr('checked');control.cancel[control.readOnly||control.required?'hide':'show']();this.siblings()[control.readOnly?'addClass':'removeClass']('star-rating-readonly');},select:function(value){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;control.current=null;if(typeof value!='undefined'){if(typeof value=='number')
return $(control.stars[value]).rating('select');if(typeof value=='string')
$.each(control.stars,function(){if($(this).data('rating.input').val()==value)$(this).rating('select');});}
else
control.current=this[0].tagName=='INPUT'?this.data('rating.star'):(this.is('.rater-'+control.serial)?this:null);this.data('rating',control);this.rating('draw');var input=$(control.current?control.current.data('rating.input'):null);if(control.callback)control.callback.apply(input[0],[input.val(),$('a',control.current)[0]]);},readOnly:function(toggle,disable){var control=this.data('rating');if(!control)return this;control.readOnly=toggle||toggle==undefined?true:false;if(disable)$(control.inputs).attr("disabled","disabled");else $(control.inputs).removeAttr("disabled");this.data('rating',control);this.rating('draw');},disable:function(){this.rating('readOnly',true,true);},enable:function(){this.rating('readOnly',false,false);}});$.fn.rating.options={cancel:'Cancel Rating',cancelValue:'',split:0,starWidth:16};$(function(){$('input[type=radio].star').rating();});})(jQuery);
