// JavaScript Document document.documentElement.id='js'; var jLisena = jQuery.noConflict(); (function($) { b2bdecode = function(str) { if(typeof str !== 'string') { throw new Error('b2bdecode accepts only strings.'); return; } var strArr = str.split(''); var reversed = strArr.reverse(); return reversed.join(''); }; $(function(){ if($("input.datepicker").length){ var $date = new Date(); var $d = $date.getDate(); $d = $d<10?'0'+$d:$d; var $m = $date.getMonth()+1; $m = $m<10?'0'+$m:$m; var $y = $date.getFullYear(); if(!$('#period-from').val().length) $('#period-from').val('01.01.2000'); if(!$('#period-to').val().length) $('#period-to').val($d+'.'+$m+'.'+$y); $("input.datepicker").datepicker({ yearRange: '2000:+0', buttonImage:$('#ui-datepicker-trigger').attr('src'), buttonImageOnly: true, changeMonth: true, changeYear: true, closeText: 'X', dateFormat: 'dd.mm.yy', dayNames: ['', '', '', '', '', '', ''], dayNamesMin: ['', '', '', '', '', '', ''], dayNamesShort: ['', '', '', '', '', '', ''], firstDay: 1, monthNames: ['','','','','','','','','','','',''], monthNamesShort: ['','','','','','','','','','','',''], nextText: '', prevText: '', selectOtherMonths: true, showOtherMonths: true, showOn: "button", onChangeMonthYear: function(year, month, inst) { var day = inst.currentDay; var dayCount = new Date(year, month, 0).getDate(); if(day>dayCount){ day=dayCount } var d = new Date( year, (month-1), day ) $(this).datepicker( "setDate" , d ) } }); }; $('#period-from,#period-to').change(function(){ var $dateTo = $('#period-to').val().split('.') $dateTo = new Date($dateTo[2]+'/'+$dateTo[1]+'/'+$dateTo[0]); var $dateFrom = $('#period-from').val().split('.') $dateFrom = new Date($dateFrom[2]+'/'+$dateFrom[1]+'/'+$dateFrom[0]); if($dateTo<$dateFrom){ $('#period-to').val(''); alert(' ') } }) if($('a.dropper2').length){ function dropper2(){ $('a.dropper2').click(function(){ $(this).siblings('ul.s,div.more').toggleClass('hide'); return false; }) } dropper2(); } if($('div.popup').length){ $(window).click(function(event){ if($(event.target).parent('div.popup').length){ $(event.target).parent('div.popup').addClass('hide'); $(event.target).parent('div.popup').find('input[id$="id"]').attr('list-value', ''); $(event.target).parent('div.popup').find('div[id$="form"]').removeClass('hide'); $(event.target).parent('div.popup').find('div[id$="result"]').addClass('hide').html(''); } }) } if($('div.popup-question').length){ $(window).click(function(event){ if($(event.target).parent('div.popup-question').length){ $(event.target).parent('div.popup-question').addClass('hide'); $(event.target).parent('div.popup-question').find('div.in').html(''); } }) } if($('#question').length){ $(window).click(function(event){ if($(event.target).hasClass('question-content-bg')){ $('#question-bg').addClass('hide'); $('#question').addClass('hide'); } }) } if($('a.dropper').length){ function dropper(){ $('a.dropper').click(function(){ $(this).siblings('ul.s,div.more').toggleClass('hide'); return false; }) } dropper(); } $('div.jcarousel').each(function(){ var $obj = $(this); var $prev = $('a.prev',$obj); var $next = $('a.next',$obj); var $t = $('table.jc',$obj); var $td = $('td.item',$obj); var l = $td.length-1; var i = 0; var w = $td.width(); $prev.click(function(){ i>0?i--:''; $t.stop().animate({ 'marginLeft':'-'+i*w },500); i==0?$prev.addClass('disabled'):'' $next.removeClass('disabled'); return false; }) $next.click(function(){ i