var fce=1; var skinDir='http://www.ekopaliva.com/skin/biomac'; function myParseFloat(str){str=''+str+''; var value=str.match('[-]{0,1}(?:[1-9]+[0-9]*[,.]{0,1}[0-9]*)|(?:0[,.][0-9]*)'); if(value!=null && value.length>0){value[0]=value[0].replace(',','.'); value=parseFloat(value[0])*1; return value;}else{return 0;}} $(function(){ // regnovinky var enovForm=new formCheckClass(); var requiredEnov=[ {'selector':'input[name=enov]', 'test':'email', 'required':true, 'showIcon':true, 'showBubble':true, 'bubble':'Zadejte Váš email, kam budou zasílána obchodní sdělení.' } ]; enovForm.configure({'formId':'novinky','bubbleRound':4,'bubbleWidth':200,'errorAlert':'Email, který jste zadali v registračním políčku, je chybně, zkontruljte a akci, registrovat odběr, opakujte'}) .setData(requiredEnov) .run(); $('#inquiryForm').each(function(){ var obj=$(this); var form=new formCheckClass(); var reEmail=/^[^@]+@([a-z,A-Z,0-9,_,-]+[.]{1})+[a-z,A-Z,0-9]{2,5}$/i; var rePhone=/^([+][0-9]{1,4}){1}[0-9]{9}$/; var email=obj.find('input[name*=email]'); var phone=obj.find('input[name*=phone]'); var testEmailPhone=function(){ return email.val().match(reEmail) || phone.val().match(rePhone); }; var required=[ {'selector':'input[name*=email]', 'test':testEmailPhone, 'required':true, 'showIcon':true, 'showBubble':true, 'bubble':'Volitelně vyplňte váš email anebo telefon' }, {'selector':'input[name*=phone]', 'test':testEmailPhone, 'required':true, 'showIcon':true, 'showBubble':true, 'bubble':'Volitelně vyplňte váš email anebo telefon' }, {'selector':'input[name=\'inquiry[name]\']', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte vaše jméno, např. Jan' }, {'selector':'input[name*=surname]', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte vaše příjmení, např. Novák' }, {'selector':'input[name*=firm]', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte jméno firmy' }, {'selector':'input[name*=street]', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte ulici' }, {'selector':'input[name*=number]', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte číslo popísné' }, {'selector':'input[name*=city]', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte město' }, {'selector':'input[name*=country]', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte zemi' }, {'selector':'input[name*=zip]', 'test':'psc', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte PSČ' }, {'selector':'input[name*=productType]', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte typ poptávaného produktu' }, {'selector':'input[name*=amount]', 'test':'string', 'required':false, 'showIcon':false, 'showBubble':true, 'bubble':'Zadejte množství včetně jednotky, např. 50t ' } ]; form.configure({'formId':'inquiryFormMain','bubbleRound':4,'bubbleWidth':200,'errorAlert':'Vyplňte všechny požadované údaje ve formuláři'}) .setData(required) .run(); }); $('#hledani input[name=as_search]').one('click',function(){ this.value=''; }); $('.akce .scroll').css({position:'absolute',left:'100%',top:'0px'}).animate({left:'0%'},{easing:'easeInOutBack',duration:2000}); // tabs var setStateRe=/tab\d/; $('.tabs').each(function(){ var obj=$(this); var mis=obj.find('.menu .mi'); var tabs=obj.find('.tab'); var setMiState=function(mi,state) { var objs=mi.find('.left,.right,.text'); var setState=function(objs,state) { objs.each(function(){ this.className=this.className.replace(setStateRe,'tab'+state); }); } if (state) { setState(objs,1); mi.addClass('active'); } else { setState(objs,0); mi.removeClass('active'); } }; mis.each(function(i){ var mi=$(this); var open=mi.hasClass('active'); var tab=$(tabs[i]); mi.bind('open',function(){ tab.show(); setMiState(mi,1); }).bind('close',function(){ tab.hide(); setMiState(mi,0); }).click(function(){ mis.not(mi).trigger('close'); mi.trigger('open'); }); }); }); }); $(function(){ $('a[rel^=prettyPhoto]').prettyPhoto(); var ulozit=$('a.ulozit').hide(); $('td.pocet input').bind('click focus keyup keydown',function(){ $(this).parent().append(ulozit); ulozit.css('display','inline-block'); }); $('.toggle[data-toggle]').change(function(){ var obj=$(this); $(obj.attr('data-toggle')).toggle(); }); $('#message').each(function(){ var obj=$(this); var close=function(){ obj.fadeOut(); }; var ctout; var init=function(){ if (!ctout) { ctout=setTimeout(close,5000); } }; obj.mouseenter(function(){ clearTimeout(ctout); ctout=false; }); obj.mouseleave(function(){ init(); }); init(); obj.find('.close').click(function(){ close(); return false; }); }); });