
var formplate_el,formplate_pattern;function checkkey(elem,e,charpattern,valuepattern)
{if(window.Event)c=e.which;else c=e.keyCode;if(c!=13&&c!=0&&c!=8)
{c=String.fromCharCode(c);if(!c.match(charpattern))return false;}
formplate_el=elem;formplate_pattern=valuepattern;setTimeout("checkvalue(formplate_el, formplate_pattern)",50);return true;}
function checkvalue(elem,pattern)
{var err=0;if(!elem.value.match(pattern))err=1
if(!elem.value&&!elem.className.match(/isrequired/))
{elem.style.backgroundColor='';return;}}
var valid_login=/^[.a-z0-9_-]{3,7}$/i;var valid_login_chars=/^[.a-z0-9_-]/i;var valid_email=/^[a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,6}$/i;var valid_email_chars=/^[.@a-z0-9_-]/i;var valid_int=/^[-|+]?[0-9]+$/;var valid_int_chars=/[0-9+-]/;var valid_float=/^[+|-]?[0-9]+[,|.]?[0-9]*$/;var valid_float_chars=/[.,0-9+-]/;var valid_nip=/^[0-9]{3}-[0-9]{3}-[0-9]{2}-[0-9]{2}$/;var valid_nip_chars=/^[0-9-]/;var valid_pesel=/^[0-9]{11}$/;var valid_pesel_chars=/^[0-9]/;var valid_data=/^[0-9]{4}\.[0-9]{2}\.[0-9]{2}$/;var valid_data_chars=/^[.0-9]/;var valid_kod=/^[0-9]{2}-[0-9]{3}$/;var valid_kod_chars=/^[0-9-]/;$(function()
{$('form.form .desc').hide();$('form.form .desc').parent().mousemove(function(){showhint('',true,'Podpowiedz',$(this).find(".desc").html(),300);});$('form.form .desc').parent().mouseout(function(){showhint('',false);});$('form.form input[type=text]').click(function(){showhint('',false)});$('form.form input[type=text]').keypress(function(){showhint('',false)});$('form.form textarea').click(function(){showhint('',false)});$('form.form textarea').keypress(function(){showhint('',false)});$('form.form .isemail').keypress(function(e){return checkkey(this,e,valid_email_chars,valid_email)});$('form.form .islogin').keypress(function(e){return checkkey(this,e,valid_login_chars,valid_login)});$('form.form .isint').keypress(function(e){return checkkey(this,e,valid_int_chars,valid_int)});$('form.form .isfloat').keypress(function(e){return checkkey(this,e,valid_float_chars,valid_float)});$('form.form .isnip').keypress(function(e){return checkkey(this,e,valid_nip_chars,valid_nip)});$('form.form .ispesel').keypress(function(e){return checkkey(this,e,valid_pesel_chars,valid_pesel)});$('form.form .isdata').keypress(function(e){return checkkey(this,e,valid_data_chars,valid_data)});$('form.form .iskod').keypress(function(e){return checkkey(this,e,valid_kod_chars,valid_kod)});$('form.form .islogin').each(function(){checkvalue(this,valid_login)});$('form.form .isemail').each(function(){checkvalue(this,valid_email)});$('form.form .isint').each(function(){checkvalue(this,valid_int)});$('form.form .isfloat').each(function(){checkvalue(this,valid_float)});$('form.form .isnip').each(function(){checkvalue(this,valid_nip)});$('form.form .ispesel').each(function(){checkvalue(this,valid_pesel)});$('form.form .isdata').each(function(){checkvalue(this,valid_data)});$('form.form .iskod').each(function(){checkvalue(this,valid_kod)});$('.form').bind('submit',function(){$.blockUI("Przetwarzanie formularza");$(this).find('.err').remove();$(this).find('.formerr').html('');var query=$(this).serialize();$.post($(this).attr('action'),query,function(response){$.unblockUI();command=response.charAt(0);response=response.slice(2);if(command=='s')eval(response);else
if(command=='!')alert(response);else
if(command=='*')alert(response);});return false;});});﻿var wybranyjacht=0;var mintermin=0;var maxtermin=0;var min=0;var max=0;var $inputy;var scrollBarWidth=18;var rezerwacjaWeekendowa=false;$(function(){scrollBarWidth=scrollbarWidth();rezerwacjaWeekendowa=$('.rezerwacja-terminy .weekend').length?true:false;$('.delselection').bind('click',function(){clearselection();return false;});$('.wybortypu').bind('click',function(){$('.typjachtu').hide();$('.'+$(this).val()).show();$('#rezcontainer').width($('.rezerwacja-terminy:first').width()+scrollBarWidth+2);clearselection();});$('.rezerwuj input').bind('click',function(){ile=$inputy.filter(':checked').length;val=$(this).val().split(',');if(ile==0){wybranyjacht=0;mintermin=0;maxtermin=0;min=0;max=0;clearcena()
return true;}
if(ile==1){if(rezerwacjaWeekendowa&&!$inputy.filter(':checked').parents('tr.weekend').length){alert('Aby zarezerwować zwykły dzień, najpierw należy zarezerwować weekend.');return false;}
wybranyjacht=val[1];findminmaxtermin(this);}
if(ile>1){if(wybranyjacht!=val[1]){return false;}
if(rezerwacjaWeekendowa){if($inputy.filter(':checked').parents('tr.weekend').length==0&&$(this).hasClass('weekend')){alert('Ten typ rezerwacji wymaga, aby co najmniej jeden weekend był zarezerwowany.');return false;}}
if(min-1==val[4]||min==val[4]){findminmaxtermin(this);return true;}
if(max==val[4]-1||max==val[4]){findminmaxtermin(this);return true;}
return false;}});$('.typjachtu').not('.typ1').hide();$('.wybortypu:first').attr('checked','checked');clearselection();});$(window).load(function(){$('#rezcontainer').width($('.rezerwacja-terminy:first').width()+scrollBarWidth+2);});function findminmaxtermin(clickedinput){mintermin=$inputy.filter(':checked:first').val().split(',')[0];maxtermin=$inputy.filter(':checked:last').val().split(',')[0];min=$inputy.filter(':checked:first').val().split(',')[4];max=$inputy.filter(':checked:last').val().split(',')[4];$('.terminod, .termindo').css('backgroundColor','');var termod=$inputy.filter(':checked:first').parent().parent().find('.terminod').css('backgroundColor','#265889').html();var termdo=$inputy.filter(':checked:last').parent().parent().find('.termindo').css('backgroundColor','#265889').html();var termin=mintermin;var dni=0;$.each($inputy.filter(':checked'),function(){dni+=parseInt($(this).val().split(',')[3]);});var typjachtu=$('.wybortypu:checked').val().slice(3);var query='cena=1&typ='+typjachtu+'&termin='+termin+'&dni='+dni;$('#cena').html('&#160;');$.post('/rezerwacja-process.php',query,function(response){$('#cena').html(response+' ('+termod+'-'+termdo+')');});};function scrollbarWidth(){var div=$('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div></div>');$('body').append(div);var w1=$('div',div).innerWidth();div.css('overflow-y','scroll');var w2=$('div',div).innerWidth();$(div).remove();if(w1-w2==0)return scrollBarWidth;return(w1-w2);}
function clearcena(){$('#cena').html('&#160;');$('.terminod, .termindo').css('backgroundColor','');}
function clearselection(){$inputy=$('.rezerwuj input',document.getElementById('rezcontainer'));$inputy.filter(':checked').each(function(){$(this).get(0).checked=false;});clearcena();}
var IE=document.all?true:false;var xmouse=0,ymouse=0;var topoffset=0,lefoffset=0;var hint_visible=false;var hintheight=0,hintwidth=0;var hint,sh,sh2,sh3;function getxymouse(e)
{xmouse=e.pageX;ymouse=e.pageY;if(IE){topoffset=document.documentElement.scrollTop;leftoffset=document.documentElement.scrollLeft;}
else
{leftoffset=self.pageXOffset||document.body.scrollLeft;topoffset=self.pageYOffset||document.body.scrollTop;}}
function hintbox_init()
{d=document;$(d).mousemove(function(e){getxymouse(e);});$('body').append("<div id='hint'></div><div id='sh'></div><div id='sh2'></div><div id='sh3'></div>");hint=d.getElementById('hint');sh=d.getElementById('sh');sh2=d.getElementById('sh2');sh3=d.getElementById('sh3');}
function showhint(classname,show,title,description,width)
{if(description=='')return;if(show==false)
{sh.style.visibility='hidden';sh2.style.visibility='hidden';sh3.style.visibility='hidden';hint.style.visibility='hidden';hint_visible=false;return;}
if(show==true)
{x=xmouse;y=ymouse;if(!hint_visible)
{var content="<div id=hintbox"+classname+" style=\"width:"+width+"px\">";if(title!="")content+="<div id=hintheader"+classname+">"+title+"</div>";content+="<div id=hintbody"+classname+"><div style=\"padding:4px;\">"+description+"</div></div></div>";hint.innerHTML=content;hintheight=$(hint).height();hintwidth=$(hint).width();}
if(getWinWidth()-(hintwidth+x)<35)pleft=x-hintwidth-30;else pleft=x+30;if(y-topoffset<hintheight+25)ptop=y+25;else ptop=y-hintheight-25;hint.style.left=pleft+'px';hint.style.top=ptop+'px';sh.style.left=pleft+15+'px';sh.style.top=ptop+15+'px';sh2.style.left=pleft+15+1+'px';sh2.style.top=ptop+15+1+'px';sh3.style.left=pleft+15+2+'px';sh3.style.top=ptop+15+2+'px';if(hint_visible)return;sh.style.width=hintwidth+'px';sh2.style.width=hintwidth+'px';sh3.style.width=hintwidth+'px';sh.style.height=hintheight+'px';sh2.style.height=hintheight+'px';sh3.style.height=hintheight+'px';sh.style.visibility='visible';sh2.style.visibility='visible';sh3.style.visibility='visible';hint.style.visibility='visible';hint_visible=true;}}
function getWinWidth(){var width=0;if(document.documentElement&&document.documentElement.clientWidth)width=document.documentElement.clientWidth;else if(document.body&&document.body.clientWidth)width=document.body.clientWidth;else if(document.body&&document.body.offsetWidth)width=document.body.offsetWidth;else if(window.innerWidth)width=window.innerWidth-18;return width;}
$(function(){hintbox_init()});eval(function(p,a,c,k,e,d){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--)d[e(c)]=k[c]||e(c);k=[function(e){return d[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;}('(8($){$.1f=8(3,4){b(3&&R 3==\'1g\'&&!3.o&&!3.F){4=3;3=1h}3=3?(3.F?$(3):3):\'<C>1d q...</C>\';c.J(3,4||{})};$.1e=8(1i){b(c.g)c.d(0)};c={g:1m,y:0,g:0,m:0,U:$.N.1n&&R 1j==\'8\',Z:(I.L&&I.L.1k()<9)||($.N.1b&&/12/.13(14.10)),d:8(s){s?5.g.d():5.g.11();5.y=s},J:8(3,4){b(c.g){m.15().Y(3).4(4);b(3.o)3.d();M 5.d(1)}$(\'19,a\').4(\'A\',\'x%\');k h=8(){M!c.y};$().B(\'16\',h).B(\'17\',h).B(\'1H\',h);k f=$(\'<K e="z-n:1G;O-P:#E;D:1C"></K>\');k w=$(\'<j e="z-n:1E;S:q"></j>\');m=$(\'<j e="z-n:1D;S:q;1s:0;l:G;v:Q%;H:Q%;r:1t;1u:-1p 0 0 -1q;1r-1v:1z;O-P:#E;D:1x 1y #1B"></j>\');$([f[0],w[0]]).4({l:\'G\',r:\'x%\',A:\'x%\',v:\'0\',H:\'0\'});5.g=$([f[0],w[0],m[0]]).1a(\'a\');m.Y(3).4(4);b(3.o)3.d();5.Z?f.4(\'r\',\'0\'):f.4(\'1w\',\'0.6\');b(5.U){$.1A([f,w,m],8(i){k s=5[0].e;s.l=\'1F\';b(i<2)s.V(\'A\',\'7.a.T > 7.a.u ? 7.a.T : 7.a.u + "W"\');18{s.V(\'v\',\'(7.t.X || 7.a.X) / 2 - (5.u / 2) + (1l = 7.t.p ? 7.t.p : 7.a.p) + "W"\');s.1o=0}})}}}})(1c);',62,106,'|||msg|css|this||document|function||body|if|impl|show|style|||||div|var|position||index|jquery|scrollTop|wait|width||documentElement|offsetHeight|top||100|vis||height|bind|h1|border|fff|nodeType|fixed|left|window|init|iframe|opera|return|browser|background|color|50|typeof|cursor|scrollHeight|ie6|setExpression|px|clientHeight|append|noalpha|platform|hide|Linux|test|navigator|empty|keypress|keydown|else|html|appendTo|mozilla|jQuery|Please|unblockUI|blockUI|object|null|options|XMLHttpRequest|version|blah|false|msie|marginTop|50px|125px|text|padding|250px|margin|align|opacity|3px|solid|center|each|aaa|none|3000|2000|absolute|1000|mousedown'.split('|'),0,{}))
