jQuery.countWC=function(options){var options=options||{};var arrPeoples=new Array(250,500,1000,2000,3000,4000,5000,6000,7000,8000,10000,12500,15000,17500,20000,25000,30000,40000,50000,75000,100000);var arrTime=new Array(1,2,3,4,5,6,7,8,9,10);var arrWCs=new Array();var strOptPeoples='';var strOptTime='';for(i=0;i<arrPeoples.length;i++)strOptPeoples+='<option value="'+i+'">'+$.numberFormat(arrPeoples[i],0,""," ")+'</option>';for(i=0;i<arrTime.length;i++)strOptTime+='<option value="'+i+'">'+arrTime[i]+'</option>';var nWC=0;arrWCs[nWC++]=new Array(2,2,2,2,2,3,3,3,3,3);arrWCs[nWC++]=new Array(2,3,3,4,4,4,4,4,4,5);arrWCs[nWC++]=new Array(3,4,5,6,6,7,7,7,7,7);arrWCs[nWC++]=new Array(5,8,10,11,12,13,13,14,14,14);arrWCs[nWC++]=new Array(7,12,15,16,18,18,19,20,20,21);arrWCs[nWC++]=new Array(10,16,19,22,24,25,25,27,27,28);arrWCs[nWC++]=new Array(12,20,24,27,29,31,32,33,33,34);arrWCs[nWC++]=new Array(14,24,28,33,35,37,37,39,41,41);arrWCs[nWC++]=new Array(17,27,34,38,41,42,46,46,47,48);arrWCs[nWC++]=new Array(20,32,38,44,48,49,50,51,53,54);arrWCs[nWC++]=new Array(24,39,47,54,58,62,64,66,67,68);arrWCs[nWC++]=new Array(30,48,61,68,73,78,80,81,82,85);arrWCs[nWC++]=new Array(37,57,70,81,87,92,94,99,102,104);arrWCs[nWC++]=new Array(42,68,84,95,100,110,111,113,116,118);arrWCs[nWC++]=new Array(48,77,95,107,115,120,127,131,133,136);arrWCs[nWC++]=new Array(60,96,122,133,146,156,159,162,165,171);arrWCs[nWC++]=new Array(73,114,141,163,174,184,188,194,197,201);arrWCs[nWC++]=new Array(95,156,188,217,231,243,249,257,266,271);arrWCs[nWC++]=new Array(120,192,238,267,290,305,312,322,330,337);arrWCs[nWC++]=new Array(177,292,357,403,432,455,470,485,491,508);arrWCs[nWC++]=new Array(239,378,475,515,542,562,583,593,620,633);$('#wc-kultura select[name=peoples]').empty();$('#wc-kultura select[name=peoples]').append(strOptPeoples);$('#wc-kultura select[name=time]').empty();$('#wc-kultura select[name=time]').append(strOptTime);$('#wc-kultura a').bind('click',function(){var nPeopleIndex=$('#wc-kultura select[name=peoples] option:selected').val();var nTimeIndex=$('#wc-kultura select[name=time] option:selected').val();$('#wc-kultura span[class=wc-count]').text(arrWCs[nPeopleIndex][nTimeIndex])});var arrPeoplesStavba=new Array('1 – 10','11 – 20','21 – 30','31 – 40','41 – 50','51 – 60','61 – 70','71 – 80','81 – 90','přes 91');var arrWCsStavba=new Array('1','2','3','4','5','6','7','8','9','1 navíc/10 pracovníků');var strOptPeoplesStavba='';for(i=0;i<arrPeoplesStavba.length;i++)strOptPeoplesStavba+='<option value="'+i+'">'+arrPeoplesStavba[i]+'</option>';$('#wc-stavba select[name=peoples]').empty();$('#wc-stavba select[name=peoples]').append(strOptPeoplesStavba);$('#wc-stavba a').bind('click',function(){var nPeopleIndex=$('#wc-stavba select[name=peoples] option:selected').val();$('#wc-stavba span[class=wc-count]').text(arrWCsStavba[nPeopleIndex])})};jQuery.numberFormat=function(fNumber,nDecimalPlaces,strDecimalSeparator,strThousandSeparator){var fBufNumber,nDelitel,strBuf,strBuf2,arrNumbers=new Array(),nNasobitel,nExist;nDelitel=10;fBufNumber='';strBuf='';strBuf2='';for(var i=1;i<nDecimalPlaces;i++)nDelitel=nDelitel*10;fNumber=Math.round(fNumber*nDelitel)/nDelitel;strBuf=String(fNumber);if(String(fNumber).indexOf(".")>-1){strBuf=String(fNumber).slice(0,String(fNumber).indexOf("."));strBuf2=String(fNumber).slice((String(fNumber).indexOf(".")+1),String(fNumber).length)}nExist=strBuf.length%3;if(nExist==2)strBuf='0'+strBuf;else if(nExist==1)strBuf='00'+strBuf;nNasobitel=strBuf.length/3;if(strBuf.length>3){for(var i=strBuf.length;i>=0;i-=3){if(i>3)arrNumbers[(nNasobitel-1)]=strBuf.slice((--nNasobitel)*3,i);else arrNumbers[(nNasobitel-1)]=Number(strBuf.slice((--nNasobitel)*3,i))}}else arrNumbers[0]=Number(strBuf);for(var i=0;i<arrNumbers.length;i++)fBufNumber=fBufNumber+(i<(arrNumbers.length-1)?arrNumbers[i]+strThousandSeparator:arrNumbers[i]);if(String(strBuf2).length<nDecimalPlaces){for(var i=String(strBuf2).length;i<nDecimalPlaces;i++)strBuf2=strBuf2+'0'}else if(String(strBuf2).length==0){for(var i=0;i<nDecimalPlaces;i++)strBuf2=strBuf2+'0'}fBufNumber=fBufNumber+strDecimalSeparator+strBuf2;return String(fBufNumber)};jQuery.orderSend=function(options){var options=options||{};$('#orderForm a').bind('click',function(){var bError=false;$(this).parent().find('input, textarea').each(function(index){if($(this).val()==""&&!bError){alert('Musí být vyplňena všechna pole.');bError=true;$(this).focus()}else if($(this).attr('name')=='email'&&!bError){var pattern=new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);if(!pattern.test($(this).val())){alert('Vyplňte email ve správném formátu.');bError=true;$(this).val('@');$(this).focus()}}});if(!bError){$(this).parent().submit()}})};$(document).ready(function(){$.countWC();$.orderSend()});
