1/* Author: 2 3 */ 4 5$(function() { 6 if ($.browser.msie && $.browser.version < 8) { 7 fixOldIe(); 8 } 9 createTabs(); // поиÑÐµÑ Ð±Ð»Ð¾ÐºÐ¸ .tabs и ÑÐ´ÐµÐ»Ð°ÐµÑ Ð¸Ð· Ð½Ð¸Ñ Ð±Ð»Ð¾ÐºÐ¸ Ñ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ°Ð¼Ð¸ 10 authFormPopup(); // ÑоÑма авÑоÑизаÑии в Ñапке 11 calendFormPopup(); // календаÑÑ 12 regionSelectionPopup(); // вÑÐ±Ð¾Ñ Ñегиона 13 newsBand(); // новоÑÑÐ½Ð°Ñ Ð»ÐµÐ½Ñа на главной 14 $("#searchBlock").inputoverlabel(); // ÑоÑма, в коÑоÑой label=Ñон input, ÑокÑÑ Ð² input пÑÑÑÐµÑ label 15 $('.ngears').brandImg(); 16 initShare(); // блок ÑоÑиалÑнÑÑ ÐºÐ½Ð¾Ð¿Ð¾Ðº 17 //initVideoExpander(); // ÑазвеÑнÑÑÑ Ð²Ð¸Ð´ÐµÐ¾Ð»ÐµÐ½ÑÑ 18 19 $('#Russiamap').each(function(){ 20 $(this).find('area').hover(function(){ 21 $('a'+$(this).attr('rel')).addClass('hover'); 22 }, function(){ 23 $('a'+$(this).attr('rel')).removeClass('hover'); 24 }); 25 }); 26 initVideoitems(); // ÑÑÑаниÑа Ñо ÑпиÑком видео 27 $('.js-anonscroll').notacarousel({wrap:null, width: 980}); 28 29 30}); // DOM loaded 31 32 33function fixOldIe(){ 34 $('.block +.block').css('margin-left','20px'); 35 $('.slide +.slide').css('margin-left','0px'); 36} 37 38 39//enter ÑоÑма авÑоÑизаÑии в Ñапке 40function authFormPopup() { 41 var enterBl = $('#loginBlock'); 42 enterBl.find('.doorEnter').click(function(){ 43 enterBl.find('.enterForm').toggle(); 44 return false; 45 }); 46} //authFormPopup() 47// end enter 48 49 50function initShare() { // ÑаÑекнопки 51 52// $('.shareBlock').bind('mouseleave', function(){ $(this).hide(); }); 53 $('.share').click(function(){ 54 var s = $(this), par = s.parents('.anonce:eq(0)'); 55 var shareBlock = $('#shareBlock_'+((s.data('idButton'))?s.data('idButton'):s.data('idbutton'))).clone(true); 56 var pos = s.offset(); 57 shareBlock.appendTo('body'); 58 59 shareBlock.css({left:pos.left-40, top:pos.top+16}).show(0,function(){ 60 shareBlock.bind('mouseleave', function(){ $(this).remove();par.off('mouseleave'); }); 61 par.on('mouseleave',function(e){ 62 window.setTimeout(function(){ 63 $(document).one('mousemove', function(e){ 64 var targ = $(e.target); 65 if(!targ.hasClass('shareBlock') && targ.parents('.shareBlock').length<1) { 66 shareBlock.remove(); 67 par.off('mouseleave'); 68 } 69 }) 70 },100); 71 }); 72 }); 73 74 75 //shareBlock.show(); 76 }); 77} //initShare() 78 79 80function addShare(id, type, button) { 81 82 if (button > 0) 83 { 84 var shareCounter = $('#shareCounter_'+button+' > span'); 85 var countShare = shareCounter.text(); 86 console.log(countShare); 87 shareCounter.text((countShare*1)+1); 88 } 89 90 $.get("/ajax/ajax_handler.php", {'ID': id, 'TYPE': type, 'action': 'addShare'} ); 91} 92 93function newsBand(){ // новоÑÑÐ½Ð°Ñ Ð»ÐµÐ½Ñа на главной 94 var mainpage = $('#mainpage'); if (mainpage.length<1) return false; 95 var news = mainpage.find('section.news'); if (news.length<1) return false; 96 var newsPos = news.position(); 97 // еÑÑÑ Ð±Ð»Ð¾Ðº новоÑÑей и ÑÑдом еÑÑÑ Ð±Ð»Ð¾Ðº, коÑоÑÑй Ñ Ð½Ð¸Ð¼ на одной линии по-гоÑизонÑали 98 // пÑедположим, ÑÑо ÑодеÑжимого блока новоÑÑей Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð±Ð¾Ð»ÑÑе, Ñем Ñ ÑоÑеда 99 // по вÑÑоÑе ÑоÑеда и бÑдем его ÑовнÑÑÑ 100 var newslist = news.find('dl'); 101 newslist.wrap('<div class="scrollblock"/>'); 102 newslist.after('<a href="#" class="scrollup"></a><a href="#" class="scrolldown"></a>'); 103 newslist.wrap('<div class="scrollwrapper"/>'); 104 var scrollblock = newslist.parents('.scrollblock:eq(0)'); 105 var scrollwrapper = scrollblock.find('.scrollwrapper'); 106 $(window).load(function(){ 107// scrollwrapper.height(nearby.height()-125); 108 scrollblock.hide(1,function(){scrollblock.show();});}); 109 var nav = scrollblock.find('.scrollup, .scrolldown'); 110 // scroll setup 111 var speed = 15, scroll = 3, scrolling; 112 nav.mouseenter(function(){ 113 /*if ($(this).hasClass('scrolldown')) { // Scroll the element up 114 scrolling = window.setInterval(function() { 115 scrollwrapper.scrollTop(scrollwrapper.scrollTop() - scroll); 116 }, speed); 117 } else { // Scroll the element down 118 scrolling = window.setInterval(function() { 119 scrollwrapper.scrollTop(scrollwrapper.scrollTop() + scroll); 120 }, speed); 121 }*/ 122 }).bind({ 123 click: function(e) { 124 // Prevent the default click action 125 e.preventDefault(); 126 }, 127 mouseleave: function() { 128 if (scrolling) { 129 window.clearInterval(scrolling); 130 scrolling = false;
131 } 132 } 133 }); 134 135} // newsBand 136 137function createTabs(container){ // поиÑÐµÑ Ð±Ð»Ð¾ÐºÐ¸ .tabs и ÑÐ´ÐµÐ»Ð°ÐµÑ Ð¸Ð· Ð½Ð¸Ñ Ð±Ð»Ð¾ÐºÐ¸ Ñ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ°Ð¼Ð¸ 138 if (!container || container.length<1) container = $('body'); 139 var strAll = "ÐÑе маÑеÑÐ¸Ð°Ð»Ñ Ñаздела"; 140 141 container.find('.tabs').each(function(){ 142 var tabs = $(this); 143 var tabsnav = $('<ul></ul>').prependTo(tabs); 144 tabs.find('section').each(function(i){ 145 var sect = $(this); 146 147 var input = $("input#all_materials",sect); 148 if(input.length > 0) 149 strAll = input.val(); 150 151 var d = new Date(); 152// var id = 'sect'+ d.getTime()+i; 153 var id = sect.attr('id'); 154 var newid = 'sect'+ d.getTime()+i; 155 sect.attr('id', newid); 156 var h2a = sect.find('.stitle a'); 157 var href = h2a.attr('href'); 158 $('<li><h2 class="stitle" id="'+((id)? id : newid+'_')+'"><a href="#'+newid+'">'+h2a.text()+'</a></h2></li>').appendTo(tabsnav); 159 sect.find('.tabpanel').prepend('<p class="small"><a href="'+href+'">'+strAll+'</a></p>'); 160 }); 161 tabs.tabs(); 162 }); 163} // createTabs() 164 165 166(function($) { //create closure 167 $.fn.minislideshow = function(options){ 168 /* 169 <div id="slideshow"> 170 <div class="slide"></div> 171 ... 172 <div class="slide"></div> 173 </div><!-- /slideshow --> 174 <script>$(function(){$("#slideshow").minislideshow({frame:520,selector:'.slide'});});</script> 175 */ 176 177 var defaults = { 178 frame: 520, // ÑиÑина 179 selector: '.slide', // ÑелекÑÐ¾Ñ Ñлайдов-конÑейнеÑов, opts.container.children(".slide"); 180 toLeftTmpl: '<span>впеÑед</span>', // Ñаблон ÑÑÑли "влево" 181 toRightTmpl: '<span>назад</span>', // Ñаблон ÑÑÑли "впÑаво" 182 preview: false, // добавлÑÑÑ Ð»Ð¸ каÑÑÐ¸Ð½ÐºÑ Ð¿ÑедпÑоÑмоÑÑа ÑледÑÑÑего по напÑÐ°Ð²Ð»ÐµÐ½Ð¸Ñ Ñлайда [false|ÑелекÑоÑ-пÑÑÑ Ðº каÑÑинке внÑÑÑи Ñлайда] 183 secondNav: 'count' // [count|mark|false] 184 }; 185 var errors = 0; var msg=''; 186 var opts = $.extend(defaults, options); 187 188 opts.container = $(this); 189 opts.child = opts.container.children(); 190 opts.par = opts.container.parent(); // must be div with position: relative; 191 opts.locker = false; // Ð»Ð¾ÐºÐµÑ 192 opts.I = opts.child.length; 193 opts.Curr = 1; 194 if (opts.I>1) { 195 initminislideshow(); 196 } 197 function initminislideshow(){ 198 opts.child.wrapAll('<div />'); 199 opts.div = $('div:first',opts.container); 200// opts.nav.hide(); 201 opts.slide = opts.div.children(opts.selector); opts.slide.addClass('block'); 202 cleanUpWhiteSpaces(opts.container); // ÑбÑаÑÑ ÑекÑÑовÑе ÑÐ·Ð»Ñ (пÑобелÑ) Ð¼ÐµÐ¶Ð´Ñ ÐºÐ°ÑÑинками 203 opts.container.css({overflow:'hidden', position: 'relative'}); 204 opts.div.css({position:'absolute', 'white-space':'nowrap', width: '9999em', height:opts.container.height()}); 205 opts.W = opts.div.width(); 206 207 createNav(); 208 prepareFrames(); 209 opts.toLeft.bind('click', function(){ 210 /**/ 211 if (opts.locker) return false; // еÑли Ñже двигаеÑÑÑ - клик не заÑÑиÑÑваем 212 opts.locker = true; 213 // Ñлева-напÑаво 214 // пÑибиваем поÑледний ÐºÐ°Ð´Ñ (его клон в наÑале ленÑÑ) 215 opts.child.last().remove(); 216 opts.child = opts.div.children(); 217 // клониÑÑем оÑÑавÑийÑÑ Ð¿Ð¾Ñледний ÐºÐ°Ð´Ñ Ð¸ запоминаем его ÑиÑÐ¸Ð½Ñ 218 var last = opts.child.last(); var W = last.width(); 219 last = last.clone(true); 220 // обнÑлÑем ÑиÑÐ¸Ð½Ñ ÐºÐ»Ð¾Ð½Ñ Ð¸ помеÑаем его в наÑало ленÑÑ 221 last.width(0).prependTo(opts.div); 222 opts.child = opts.div.children(); 223 // а ÑепеÑÑ, возвÑаÑаем ÐµÐ¼Ñ ÑиÑÐ¸Ð½Ñ Ð¸ ленÑа ÑдвигаеÑÑÑ Ð½Ð° 1 ÐºÐ°Ð´Ñ Ñлева напÑаво 224 last.animate({width: W}, function(){ 225 opts.Curr = (opts.Curr-1 < 1) ? opts.I : opts.Curr-1; 226 if (opts.secondNav) { 227 if (opts.secondNav == 'count') { opts.nav.find('.current').text(opts.Curr); } 228 if (opts.secondNav == 'mark') { $('.current',opts.nav).removeClass('current'); $('.mark a',opts.nav).eq(opts.Curr-1).addClass('current'); } 229 } 230 addNavImg(); 231 opts.locker = false;
232 }); 233 234// leftToRight(3); 235 $(this).blur(); 236 return false; 237 }); 238 opts.toRight.bind('click', function(){ 239 /* */ 240 if (opts.locker) return false; // еÑли Ñже двигаеÑÑÑ - клик не заÑÑиÑÑваем 241 opts.locker = true; 242 // беÑем пеÑвÑй ÐºÐ°Ð´Ñ (он вообÑе-Ñо поÑле иниÑиализаÑии - клон поÑледнего кадÑа) 243 var first = opts.child.first(); 244 // ÑменÑÑаем его ÑиÑÐ¸Ð½Ñ Ð´Ð¾ 0 - ленÑа ÑдвигаеÑÑÑ ÑпÑава налево 245 first.animate({width: 0}, function(){ 246 $(this).remove(); // Ñбиваем его 247 opts.child = opts.div.children(); 248 // клониÑÑем новÑй пеÑвÑй ÑÑейм и кладем клона в ÐºÐ¾Ð½ÐµÑ Ð»ÐµÐ½ÑÑ 249 opts.child.first().clone(true).appendTo(opts.div); 250 opts.child = opts.div.children(); 251 opts.Curr = (opts.Curr+1 > opts.I) ? 1 : opts.Curr+1; 252 if (opts.secondNav) { 253 if (opts.secondNav == 'count') { opts.nav.find('.current').text(opts.Curr); } 254 if (opts.secondNav == 'mark') { $('.current',opts.nav).removeClass('current'); $('.mark a',opts.nav).eq(opts.Curr-1).addClass('current'); } 255 } 256 addNavImg(); 257 // и ÑазлоÑиваем 258 opts.locker = false; 259 }); 260 261// rightToLeft(1); 262 $(this).blur(); 263 return false; 264 }); 265 opts.par.mouseenter(function(){ 266// opts.nav.show(); 267 }).mouseleave(function(){ 268// opts.nav.hide(); 269 }); 270 } 271 272 function leftToRight(step){ 273 if (opts.locker) return false; // еÑли Ñже двигаеÑÑÑ - клик не заÑÑиÑÑваем 274 opts.locker = true; 275 // Ñлева-напÑаво 276 // пÑибиваем поÑледний ÐºÐ°Ð´Ñ (его клон в наÑале ленÑÑ) 277 opts.child.last().remove(); 278 opts.child = opts.div.children(); 279 // клониÑÑем оÑÑавÑийÑÑ Ð¿Ð¾Ñледний ÐºÐ°Ð´Ñ Ð¸ запоминаем его ÑиÑÐ¸Ð½Ñ 280 var last = (step==1)? opts.child.slice(opts.I-1) : opts.child.slice(opts.I-step,opts.I); 281 last = last.clone(true); 282 // обнÑлÑем ÑиÑÐ¸Ð½Ñ ÐºÐ»Ð¾Ð½Ñ Ð¸ помеÑаем его в наÑало ленÑÑ 283 last.width(0).prependTo(opts.div); 284 opts.child = opts.div.children(); 285 // а ÑепеÑÑ, возвÑаÑаем ÐµÐ¼Ñ ÑиÑÐ¸Ð½Ñ Ð¸ ленÑа ÑдвигаеÑÑÑ Ð½Ð° 1 ÐºÐ°Ð´Ñ Ñлева напÑаво 286 last.animate({width: opts.frame}, function(){ 287 opts.Curr = (opts.Curr-step < 1) ? opts.I : opts.Curr-step; 288 if (opts.secondNav) { 289 if (opts.secondNav == 'count') { opts.nav.find('.current').text(opts.Curr); } 290 if (opts.secondNav == 'mark') { $('.current',opts.nav).removeClass('current'); $('.mark a',opts.nav).eq(opts.Curr-1).addClass('current'); } 291 } 292 addNavImg(); 293 opts.locker = false; 294 }); 295 } 296 297 function rightToLeft(step){ 298 if (opts.locker) return false; // еÑли Ñже двигаеÑÑÑ - клик не заÑÑиÑÑваем 299 opts.locker = true; 300 // беÑем пеÑвÑй ÐºÐ°Ð´Ñ (он вообÑе-Ñо поÑле иниÑиализаÑии - клон поÑледнего кадÑа) 301 var first = opts.child.first(); 302 // ÑменÑÑаем его ÑиÑÐ¸Ð½Ñ Ð´Ð¾ 0 - ленÑа ÑдвигаеÑÑÑ ÑпÑава налево 303 first.animate({width: 0}, function(){ 304 $(this).remove(); // Ñбиваем его 305 opts.child = opts.div.children(); 306 // клониÑÑем новÑй пеÑвÑй ÑÑейм и кладем клона в ÐºÐ¾Ð½ÐµÑ Ð»ÐµÐ½ÑÑ 307 opts.child.first().clone(true).appendTo(opts.div); 308 opts.child = opts.div.children(); 309 opts.Curr = (opts.Curr+1 > opts.I) ? 1 : opts.Curr+1; 310 if (opts.secondNav) { 311 if (opts.secondNav == 'count') { opts.nav.find('.current').text(opts.Curr); } 312 if (opts.secondNav == 'mark') { $('.current',opts.nav).removeClass('current'); $('.mark a',opts.nav).eq(opts.Curr-1).addClass('current'); } 313 } 314 addNavImg(); 315 // и ÑазлоÑиваем 316 opts.locker = false;
317 }); 318 } 319 320 function prepareFrames() { // поÑледний ÑÑейм клониÑÑем в наÑало ленÑÑ Ð¸ Ñдвигаем влево 321 // визÑалÑно: "пеÑвÑй" ÐºÐ°Ð´Ñ Ð¾ÑÑаеÑÑÑ Ð½Ð° меÑÑе 322 // а в-наÑÑÑе: пеÑвÑй и поÑледний кадÑÑ Ð²Ñегда ÐºÐ»Ð¾Ð½Ñ - колÑÑо замкнÑÑо 323 var last = opts.child.last(); 324 last.clone(true).prependTo(opts.div); 325 opts.child = opts.div.children(); 326 opts.div.css({left:'-'+opts.frame+'px'}); 327 addNavImg(); 328 } 329 330 function addNavImg() { 331 opts.child.removeClass('current'); 332 opts.child.eq(1).addClass('current'); 333 if (opts.preview) { 334 opts.toLeft.html(opts.toLeftTmpl+'<img src="'+opts.child.eq(0).find(opts.preview).attr('src')+'" alt="" />'); 335 opts.toRight.html(opts.toRightTmpl+'<img src="'+opts.child.eq(2).find(opts.preview).attr('src')+'" alt="" />'); 336 } 337 } 338 339 function createNav(){
340 opts.nav = $('<div class="slidenav"><a href="#" class="nav toleft">'+opts.toLeftTmpl+'</a><a href="#" class="nav toright">'+opts.toRightTmpl+'</a></div>'); 341 opts.div.before(opts.nav); 342 opts.toLeft = $('a.toleft', opts.nav); 343 opts.toRight = $('a.toright', opts.nav); 344 345 if (opts.secondNav) { 346 if (opts.secondNav == 'count') { 347 opts.nav.append('<div class="count"><span class="current">'+opts.Curr+'</span>/<span class="total">'+opts.I+'</span></div>'); 348 } 349 350 if (opts.secondNav == 'mark') { 351 var mark = $('<div class="mark"></div>'); opts.nav.append(mark); 352 for (var i=0; i<opts.I; i++) { 353 mark.append('<a href="#" class="block'+((i==0)?' current':'')+'"></a>'); 354 } 355 mark.find('a').click(function(){ 356// if (opts.locker) return false; // еÑли Ñже двигаеÑÑÑ - клик не заÑÑиÑÑваем 357// opts.locker = true; 358// var a = $(this); 359// if (a.hasClass('current')) return false; 360// var curr = mark.find('a.current').index(); 361// var ind = a.index(); 362// if (curr > ind) { // кÑÑÑим Ñлева-напÑаво 363// leftToRight(curr-ind); 364// } else { // кÑÑÑим ÑпÑава-налево 365// rightToLeft(ind,curr); 366 367// } 368 $(this).blur(); 369 return false; 370 }); 371 } 372 } 373 } 374 } 375//end of closure 376})(jQuery); 377 378function cleanUpWhiteSpaces(container){ // ÑбÑаÑÑ ÑекÑÑовÑе ÑÐ·Ð»Ñ Ð¼ÐµÐ¶Ð´Ñ ÑлеменÑами внÑÑÑи конÑейнеÑа 379 var nodes = container.get(0).childNodes; 380 var i = nodes.length-1; 381 while (i>-1) { 382 if (nodes[i].nodeType == 3 || nodes[i].nodeType == 8) { 383 container.get(0).removeChild(nodes[i]); 384 } 385 i--; 386 } 387} 388 389 390(function($) { //create closure 391 $.fn.inputoverlabel = function(options){ 392 var defaults = { 393 }; 394 var errors = 0; var msg=''; 395 var opts = $.extend(defaults, options); 396 397 var form = $(this); 398 $('input[type=text],input[type=password],textarea', form).each(function(){ 399 var input = $(this); 400 var label = $('label[for='+input.attr('id')+']'); 401 if (input.val()!='') label.addClass('hide'); 402 input.unbind('focus.hidelabel').bind('focus.hidelabel', function(){ 403 label.addClass('hide'); 404 input.parent().removeClass('error'); 405 }); 406 input.unbind('blur.showlabel').bind('blur.showlabel', function(){ 407 input.val($.trim(input.val())); 408 if (input.val()=='') label.removeClass('hide'); 409 }); 410 }); 411 // ÑледÑÑÑий код Ð¿Ð¾Ð»Ð½Ð°Ñ Ñ ÐµÑнÑ, а не код, заÑем веÑаÑÑ Ð½Ð° вÑе кнопки ÑÑÐ°Ð·Ñ Ð´Ð»Ñ Ð²Ñе ÑÑÑаниÑÑ, нелÑÐ·Ñ Ð±Ñло ÑоÑÐ¼Ñ Ð´Ð¾Ð¿Ð¸ÑаÑÑ (Ñам допиÑал) 412 $('a.button',form).unbind('click').bind('click', function(){ 413 form.submit(); 414 return false; 415 }); 416 } 417//end of closure 418})(jQuery); 419 420/* ----- freiserg ----- */ 421$(function() { 422 $('#reg-tel, textarea.add-ta').unbind().focusin(function () { 423 var _this = $(this); 424 var value = $.trim(_this.val()); 425 if (value.length == 0) 426 _this.prev('label').hide(); 427 }).focusout(function() { 428 var _this = $(this); 429 var value = $.trim(_this.val()); 430 if (value.length == 0) 431 _this.prev('label').show(); 432 }); 433 434 $('span.button-form input').mouseover(function () 435 { 436 var _this = $(this); 437 _this.prev().addClass('rollover').children('span').addClass('rollover'); 438 }).mouseout(function() 439 { 440 var _this = $(this); 441 _this.prev('span').removeClass('rollover').children('span').removeClass('rollover'); 442 }); 443}); 444function SetWidthTextArea() 445{ 446 $('div.add-comm').each(function() 447 { 448 var _width = $(this).width() - 14; 449 $(this).find('textarea').width(_width); 450 }); 451} 452/* ------------ */ 453 454function initVideoExpander() { 455 var expbutt = $('#videoribbonexpand');
456 var videoribbon = $('#videoribbon'); 457 if (expbutt.length < 1 || videoribbon.length < 1) return false; 458 videoribbon.ambcarousel({posLeft:15}); 459 videoribbon.css('display','none'); 460 expbutt.click(function(){ 461 var videoprev = expbutt.parents('section.video'); 462 var pos = videoprev.offset(), h = videoprev.outerHeight(true); 463 videoribbon.css({display:'block',opacity:0}); 464 var ul = videoribbon.find('ul'), ulh = ul.height(); ul.width('9999em'); 465 videoribbon.css({top: pos.top, paddingTop: (h-ulh)/2+3, paddingBottom: (h-ulh)/2, height: ulh}).animate({opacity:1}); 466 return false; 467 }); 468 videoribbon.find('.rollup').click(function(){ 469 videoribbon.animate({opacity:0}, function(){ $(this).css('display','none'); }); 470 return false; 471 }); 472} 473 474(function($) { //create closure 475 $.fn.ambcarousel = function(options){ 476 /* 477 <div class="carousel"> 478 <ul> 479 <li></li> 480 ... 481 <li></li> 482 </ul> 483 </div><!-- /carousel --> 484 <script>$(function(){$(".carousel").ambcarousel();});</script> 485 */ 486 487 var defaults = { 488 T: 400, // ÑкоÑоÑÑÑ 489 posLeft : 0, // ÑмеÑение ÑенÑÑалÑной каÑÑинки оÑноÑиÑелÑно ÑенÑÑа 490 toLeftTmpl: '<span>впеÑед</span>', // Ñаблон ÑÑÑли "влево" 491 toRightTmpl: '<span>назад</span>' // Ñаблон ÑÑÑли "впÑаво" 492 }; 493 var errors = 0; var msg=''; 494 var opts = $.extend(defaults, options); 495 496 opts.locker = false; // Ð»Ð¾ÐºÐµÑ 497 opts.root = $(this); 498 499 opts.root.each(function(){ 500 var rootcont = $(this); 501 var container = rootcont.children('ul'); 502 var items = container.children('li'); 503 cleanUpWhiteSpaces(container); // ÑбÑаÑÑ ÑекÑÑовÑе ÑÐ·Ð»Ñ (пÑобелÑ) Ð¼ÐµÐ¶Ð´Ñ ÐºÐ°ÑÑинками 504 var nav = createNav(rootcont); 505 var toLeft = nav.toleft, toRight = nav.toright; 506 var W = rootcont.width(), C = Math.round(W/2); 507 var cW = preparePosition(C, container, items); // ÑенÑÑиÑÑÐµÑ ÐºÐ°ÑÑÑÐµÐ»Ñ Ð¾ÑноÑиÑелÑно ÑÑÑаниÑÑ Ð¸ 508 // возвÑаÑÐ°ÐµÑ ÑÑÐ¼Ð¼Ñ ÑиÑин Ñлайдов 509 var ind = Math.round(items.length/2 - 1); 510 var item = items.eq(ind), pos = item.offset(); 511 citem = {item:item, i:ind, left:pos.left}; 512 513 // и двигаем ее на меÑÑо (впÑаво) center-opts.posLeft 514 var D = C - Math.round(citem.left) + opts.posLeft; citem.item.addClass('current'); 515 //container.css('margin-left', parseInt(container.css('margin-left')) + D); 516 toRight.click(function() { 517 if (opts.locker) return false; 518 opts.locker = true; 519 var current = container.find('.current'); 520 var around = setPrevNext(current, items); 521 var D = current.data('oWidth'); 522 var cLeft = parseInt(container.css('left'),10); 523 // найÑи вÑе item, коÑоÑÑе Ñже за ÑкÑаном Ñлева 524 items.each(function() { // и ÑпозиÑиониÑоваÑÑ Ð¸Ñ Ð²Ð¿Ñаво 525 var item = $(this); 526 var pos = item.offset(); 527 if (pos.left < 0 && pos.left+item.data('oWidth') < 0) { 528 pos = item.position(); 529 var maxPos = 0; 530 item.nextAll().andSelf().each(function(){ 531 maxPos += $(this).data('oWidth'); 532 }); 533 item.css('left', pos.left+maxPos); 534 } 535 }); 536 container.animate({left: cLeft-D}, opts.T, function(){ // двигаем за Ð¾Ð´Ð½Ñ Ð°Ð½Ð¸Ð¼Ð°ÑÐ¸Ñ Ð²ÐµÑÑ ÐºÐ¾Ð½ÑÐµÐ¹Ð½ÐµÑ 537 current.removeClass('current'); 538 around.next.addClass('current'); 539 items.each(function(){ 540 var item = $(this); 541 var l = parseInt(item.css('left'),10); 542 l = (!l)?0:l; 543 item.css('left', l-D); 544 }); 545 container.css('left', cLeft); 546 opts.locker = false;
547 }); 548 return false; 549 }); 550 toLeft.click(function() { 551 if (opts.locker) return false; 552 opts.locker = true; 553 var current = container.find('.current'); 554 var around = setPrevNext(current, items); 555 var D = around.prev.data('oWidth'); 556 var cLeft = parseInt(container.css('left'),10); 557 // найÑи вÑе item, коÑоÑÑе Ñже за ÑкÑаном ÑпÑава 558 items.each(function() { // и ÑпозиÑиониÑоваÑÑ Ð¸Ñ Ð²Ð»ÐµÐ²Ð¾ 559 var item = $(this); 560 var pos = item.offset(); 561 if (pos.left > W) { 562 pos = item.position(); 563 var minPos = 0; 564 item.prevAll().andSelf().each(function(){ //.andSelf() 565 minPos += $(this).data('oWidth'); 566 }); 567 item.css('left', parseInt(item.css('left'),10)-cW);//+minPos); 568 } 569 }); 570 container.animate({left: cLeft+D}, opts.T, function(){ // двигаем за Ð¾Ð´Ð½Ñ Ð°Ð½Ð¸Ð¼Ð°ÑÐ¸Ñ Ð²ÐµÑÑ ÐºÐ¾Ð½ÑÐµÐ¹Ð½ÐµÑ 571 current.removeClass('current'); 572 around.prev.addClass('current'); 573 items.each(function(){ 574 var item = $(this); 575 var l = parseInt(item.css('left'),10); 576 l = (!l)?0:l; 577 item.css('left',l+D); 578 }); 579 container.css('left', cLeft); 580 opts.locker = false; 581 }); 582 return false; 583 }); 584 585 586 }); 587 588 589 590 function preparePosition(C, container, items) { 591 var W = 0; 592 items.each(function(){ 593 $(this).data('oWidth',$(this).outerWidth(true)) 594 W += $(this).data('oWidth'); 595 }); 596 var ml = C-W/2; 597 container.css('margin-left',ml); 598 return W; 599 } 600 601 function findCenterImage(C, container, items) { 602 var ind = 0; 603 for (var i=0; i<items.length; i++) { 604 var item = items.eq(i); 605 var pos = item.offset(); 606 if (pos.left < C && pos.left+item.data('oWidth') > C) { 607 ind = {item:item, i:i, left:pos.left}; 608 break; 609 } 610 } 611 return ind; 612 } 613 614 function createNav(rootcont){ 615 rootcont.append('<div class="carouselnav"><a href="#" class="nav toleft">'+opts.toLeftTmpl+'</a><a href="#" class="nav toright">'+opts.toRightTmpl+'</a></div>'); 616 return {toleft:$('a.toleft', rootcont), toright:$('a.toright', rootcont)}; 617 } 618 619 620 function setPrevNext(curritem, items) { 621 var prev = curritem.prev(); 622 if (prev.length < 1) prev = items.last(); 623 var next = curritem.next(); 624 if (next.length < 1) next = items.first(); 625 return {"prev":prev,"next":next}; 626 } 627 628 629 } 630//end of closure 631})(jQuery); 632 633 634 635 636 637 638//calendBlock 639function calendFormPopup() { 640 var $sortBl = $('#sortNewsList'); 641 if ($sortBl.length > 0) { 642 var calendar = $sortBl.find('.calendar'); 643 $sortBl.find('.time').click(function(){ 644 $(this).toggleClass('show'); 645 calendar.toggle(); // заÑем? 646 if (calendar.length > 0) runCalendar(); // иниÑиализаÑÐ¸Ñ ÐºÐ°Ð»ÐµÐ½Ð´Ð°ÑÑ ÑолÑко, еÑли он должен бÑÑÑ Ð½Ð° ÑÑÑаниÑе 647 return false; 648 }); 649 $sortBl.find('.clearCalendar').click(function(){ runCalendar(true); return false; }); // ÑÑÑлка "оÑиÑÑиÑÑ" 650 } 651} //calendFormPopup() 652// end calendBlock 653 654//region_selection 655function regionSelectionPopup() { 656 var $sortBl = $('#sortNewsList'); 657 if ($sortBl.length > 0) { 658 var region_selection = $sortBl.find('.region_selection'); 659 $sortBl.find('.region').click(function(){ 660 $(this).toggleClass('show'); 661 region_selection.toggle(); // заÑем? 662 //if (calendar.length >
662 0) runCalendar(); // иниÑиализаÑÐ¸Ñ ÐºÐ°Ð»ÐµÐ½Ð´Ð°ÑÑ ÑолÑко, еÑли он должен бÑÑÑ Ð½Ð° ÑÑÑаниÑе 663 return false; 664 }); 665 //$sortBl.find('.clearCalendar').click(function(){ runCalendar(); return false; }); // ÑÑÑлка "оÑиÑÑиÑÑ" 666 } 667} //regionSelectionPopup() 668// end region_selection 669 670(function(b){var a=function(){var c={},k={wrapper:'<div class="cpicker"><div class="cpickerContainer"><table cellspacing="0" cellpadding="0"><tbody><tr class="cpicker-months"></tr></tbody></table></div></div>', 671 head:["<td>",'<table cellspacing="0" cellpadding="0">',"<thead>","<tr>",'<th class="cpickerGoPrev"><a href="#"><span><%=prev%></span></a></th>','<th colspan="5" class="cpickerMonth"><span></span></th>','<th class="cpickerGoNext"><a href="#"><span><%=next%></span></a></th>',"</tr>",'<tr class="cpickerDoW">',"<th><span><%=day1%></span></th>","<th><span><%=day2%></span></th>","<th><span><%=day3%></span></th>","<th><span><%=day4%></span></th>","<th><span><%=day5%></span></th>","<th><span><%=day6%></span></th>",'<th class="sunday"><span><%=day7%></span></th>',"</tr>","</thead>","</table></td>"], 672 head1:["<td>",'<table cellspacing="0" cellpadding="0">',"<thead>","<tr>",'<th class="cpickerGoPrev"><a href="#"><span><%=prev%></span></a></th>','<th colspan="5" class="cpickerMonth"><span></span></th>','<th class="cpickerGoNext"><a href="#"><span><%=next%></span></a></th>',"</tr>",'<tr class="cpickerDoW">',"<th><span><%=day1%></span></th>","<th><span><%=day2%></span></th>","<th><span><%=day3%></span></th>","<th><span><%=day4%></span></th>","<th><span><%=day5%></span></th>","<th><span><%=day6%></span></th>",'<th class="sunday"><span><%=day7%></span></th>',"</tr>","</thead>",'</table></td><td class="cpickerSpace"><div></div></td>'], 673 space:'<td class="cpickerSpace" />',days:function(){var t=['<tbody class="cpickerDays">'];for(var s=0;s<6;s++){if(s==0){t.push('<tr class="firstrow">')}else{t.push("<tr>")}for(var v=0;v<7;v++){var u="<%=weeks["+s+"].days["+v+"].classname%>";if(v==6){u+=" sunday"}t.push('<td class="'+u+'"><a href="#<%=weeks['+s+"].days["+v+'].date%>"><span><%=weeks['+s+"].days["+v+"].text%></span></a></td>")}t.push("</tr>")}t.push("</tbody>");return t}(), 674 months:['<tbody class="<%=className%>">',"<tr>",'<td colspan="2"><a href="#"><span><%=data[0]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[1]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[2]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[3]%></span></a></td>',"</tr>","<tr>",'<td colspan="2"><a href="#"><span><%=data[4]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[5]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[6]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[7]%></span></a></td>',"</tr>","<tr>",'<td colspan="2"><a href="#"><span><%=data[8]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[9]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[10]%></span></a></td>','<td colspan="2"><a href="#"><span><%=data[11]%></span></a></td>',"</tr>","</tbody>"]}, 675 g={flat:false,starts:1,prev:" ",next:" ",lastSel:false,mode:"single",calendars:1,format:"Y-m-d",position:"top",eventName:"click",onRender:function(){return{}},onChange:function(){return true},onShow:function(){return true},onBeforeShow:function(){return true},onHide:function(){return true},onMonthRender:function(){},locale:{ 676 days:["ÐоÑкÑеÑенÑе","ÐонеделÑник","ÐÑоÑник","СÑеда","ЧеÑвеÑг","ÐÑÑниÑа","СÑббоÑа","ÐоÑкÑеÑенÑе"], 677 daysShort:["ÐÑ","Ðн","ÐÑ","СÑ","ЧÑ","ÐÑ","Сб","ÐÑ"], 678 daysMin:["ÐÑ","Ðн","ÐÑ","СÑ","ЧÑ","ÐÑ","Сб","ÐÑ"], 679 months1:["ЯнваÑÑ","ФевÑалÑ","ÐаÑÑ","ÐпÑелÑ","Ðай","ÐÑнÑ","ÐÑлÑ","ÐвгÑÑÑ","СенÑÑбÑÑ","ÐкÑÑбÑÑ","ÐоÑбÑÑ","ÐекабÑÑ"], 680 months:["ÑнваÑÑ","ÑевÑалÑ","маÑÑа","апÑелÑ","маÑ","иÑнÑ","иÑлÑ","авгÑÑÑа","ÑенÑÑбÑÑ","окÑÑбÑÑ","ноÑбÑÑ","декабÑÑ"], 681 monthsShort:["Янв","Фев","ÐаÑÑ","ÐпÑ","Ðай","ÐÑнÑ","ÐÑлÑ","Ðвг","Сен","ÐкÑ","ÐоÑ","Ðек"], 682 weekMin:"wk"},datesCheckUrl:null},r={},l=function(s,u){var t=r[u.calendar]; 683 if(!t){b.ajax({async:false,url:s,data:u,dataType:"json",success:function(w,v){t=w},error:function(){t=null}});r[u.calendar]=t}return t},p=function(t){var w=b(t).data("cpicker");var B=b(t);var u=Math.floor(w.calendars/2),J,L,C,K,H=0,F,x,v,y,z,D;for(var I=0;I<3;I++){J=new Date(w.current);J.addMonths(-u+I);if(w.datesCheckUrl){var s=l(w.datesCheckUrl,{calendar:(J.getFullYear()+"-"+(J.getMonth()+1))})}jj=I+I;D=B.find("div>table>tbody>tr>td").eq(jj);theadi=D.find("thead").html();D.find("table").remove();C=q(J,"b");D.find("thead tr:first th:eq(1) span").text(C);C=J.getFullYear()-6;L={data:[],className:"cpickerYears"};for(var G=0;G<12;G++){L.data.push(C+G)}z="";J.setDate(1);L={weeks:[],test:10};K=J.getMonth();var C=(J.getDay()-w.starts)%7;J.addDays(-(C+(C<0?7:0)));F=-1;H=0;while(H<42){v=parseInt(H/7,10);y=H%7;if(!L.weeks[v]){F=J.getWeekNumber();L.weeks[v]={week:F,days:[]}}L.weeks[v].days[y]={text:J.getDate(),date:((J.getDate()<10)?("0"+J.getDate()):J.getDate())+"-"+((J.getMonth()<9)?("0"+(J.getMonth()+1)):(J.getMonth()+1))+"-"+J.getFullYear(),classname:[]};if(K!=J.getMonth()){L.weeks[v].days[y].classname.push("cpickerNotInMonth")}if(J.getDay()==0){L.weeks[v].days[y].classname.push("cpickerSunday")}if(J.getDay()==6){L.weeks[v].days[y].classname.push("cpickerSaturday")}var E=w.onRender(J);var M=J.valueOf();if(E.selected||w.date==M||b.inArray(M,w.date)>-1||(w.mode=="range"&&M>=w.date[0]&&M<=w.date[1])){L.weeks[v].days[y].classname.push("cpickerSelected")}if(w.datesCheckUrl&&s!=null){if(s[L.weeks[v].days[y].date]!=true){L.weeks[v].days[y].classname.push("cpickerDisabled")}}if(E.disabled){L.weeks[v].days[y].classname.push("cpickerDisabled")}if(E.className){L.weeks[v].days[y].classname.push(E.className)}L.weeks[v].days[y].classname=L.weeks[v].days[y].classname.join(" ");H++;J.addDays(1)}z=tmpl(k.days.join(""),L)+z;z="<table><thead>"+theadi+"</thead>"+z+"</table>";D.append(z);var A=L.weeks[1].days[0].date;A=A.substr(A.length-4);D.find(".cpickerMonth span").html(w.locale.months1[K]+" "+A);w.onMonthRender(L)}},e=function(t,D){if(t.constructor==Date){return new Date(t)}var x=t.split(/\W+/);var u=D.split(/\W+/),B,v,C,A,w,s=new Date();for(var z=0;z<x.length;z++){switch(u[z]){case"d":case"e":B=parseInt(x[z],10);break;case"m":v=parseInt(x[z],10)-1;break;case"Y":case"y":C=parseInt(x[z],10);C+=C>100?0:(C<29?2000:1900);break;case"H":case"I":case"k":case"l":A=parseInt(x[z],10);break;case"P":case"p":if(/pm/i.test(x[z])&&A<12){A+=12}else{if(/am/i.test(x[z])&&A>=12){A-=12}}break;case"M":w=parseInt(x[z],10);break}}return new Date(C||s.getFullYear(),v||s.getMonth(),B||s.getDate(),A||s.getHours(),w||s.getMinutes(),0)},q=function(u,G){var v=u.getMonth();var E=u.getDate();var F=u.getFullYear();var H=u.getWeekNumber();var I=u.getDay();var L={};var J=u.getHours();var x=(J>=12);var C=(x)?(J-12):J;var K=u.getDayOfYear();if(C==0){C=12}var A=u.getMinutes();var D=u.getSeconds();var z=G.split(""),t;for(var B=0;B<z.length;B++){t=z[B];switch(z[B]){case"a":t=u.getDayName();break;case"A":t=u.getDayName(true);break;case"b":t=u.getMonthName();break;case"B":t=u.getMonthName(true);break;case"C":t=1+Math.floor(F/100);break;case"d":t=(E<10)?("0"+E):E;break;case"e":t=E;break;case"H":t=(J<10)?("0"+J):J;break;case"I":t=(C<10)?("0"+C):C;break;case"j":t=(K<100)?((K<10)?("00"+K):("0"+K)):K;break;case"k":t=J;break;case"l":t=C;break;case"m":t=(v<9)?("0"+(1+v)):(1+v);break;case"M":t=(A<10)?("0"+A):A;break;case"p":case"P":t=x?"PM":"AM";break;case"s":t=Math.floor(u.getTime()/1000);break;
683case"S":t=(D<10)?("0"+D):D;break;case"u":t=I+1;break;case"w":t=I;break;case"y":t=(""+F).substr(2,2);break;case"Y":t=F;break}z[B]=t}return z.join("")},f=function(s){if(Date.prototype.tempDate){return}Date.prototype.tempDate=null;Date.prototype.months=s.months;Date.prototype.months1=s.months1;Date.prototype.monthsShort=s.monthsShort;Date.prototype.days=s.days;Date.prototype.daysShort=s.daysShort;Date.prototype.getMonthName=function(t){return this[t?"months":"months1"][this.getMonth()]};Date.prototype.getDayName=function(t){return this[t?"days":"daysShort"][this.getDay()]};Date.prototype.addDays=function(t){this.setDate(this.getDate()+t);this.tempDate=this.getDate()};Date.prototype.addMonths=function(t){if(this.tempDate==null){this.tempDate=this.getDate()}this.setDate(1);this.setMonth(this.getMonth()+t);this.setDate(Math.min(this.tempDate,this.getMaxDays()))};Date.prototype.addYears=function(t){if(this.tempDate==null){this.tempDate=this.getDate()}this.setDate(1);this.setFullYear(this.getFullYear()+t);this.setDate(Math.min(this.tempDate,this.getMaxDays()))};Date.prototype.getMaxDays=function(){var u=new Date(Date.parse(this)),v=28,t;t=u.getMonth();v=28;while(u.getMonth()==t){v++;u.setDate(v)}return v-1};Date.prototype.getFirstDay=function(){var t=new Date(Date.parse(this));t.setDate(1);return t.getDay()};Date.prototype.getWeekNumber=function(){var t=new Date(this);t.setDate(t.getDate()-(t.getDay()+6)%7+3);var u=t.valueOf();t.setMonth(0);t.setDate(4);return Math.round((u-t.valueOf())/(604800000))+1};Date.prototype.getDayOfYear=function(){var t=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var v=new Date(this.getFullYear(),0,0,0,0,0);var u=t-v;return Math.floor(u/24*60*60*1000)}},i=function(v){var t=b(v).data("cpicker");var x=b("#"+t.id);var w=x.find("table:first").get(0);var u=w.offsetWidth;var s=w.offsetHeight;x.css({width:u+"px",height:s+"px"}).find("div.cpickerContainer").css({width:u-2+"px",height:s+5+"px"})},o=function(z){if(b(z.target).is("span")){z.target=z.target.parentNode}var u=b(z.target);if(u.is("a")){z.target.blur();if(u.hasClass("cpickerDisabled")){return false}var B=b(this).data("cpicker");var y=u.parent();var t=y.parent().parent().parent();var A=b("table",this).index(t.get(0))-1;var x=new Date(B.current);var w=false;var s=false;if(y.is("th")){if(y.hasClass("cpickerWeek")&&B.mode=="range"&&!y.next().hasClass("cpickerDisabled")){var v=parseInt(y.next().text(),10);x.addMonths(A-Math.floor(B.calendars/2));if(y.next().hasClass("cpickerNotInMonth")){x.addMonths(v>15?-1:1)}x.setDate(v);B.date[0]=(x.setHours(0,0,0,0)).valueOf();x.setHours(23,59,59,0);x.addDays(6);B.date[1]=x.valueOf();s=true;w=true;B.lastSel=false}else{if(y.hasClass("cpickerMonth")){x.addMonths(A-Math.floor(B.calendars/2));switch(t.get(0).className){case"cpickerViewDays":t.get(0).className="cpickerViewMonths";u.find("span").text(x.getFullYear());break;case"cpickerViewMonths":t.get(0).className="cpickerViewYears";u.find("span").text((x.getFullYear()-6)+" - "+(x.getFullYear()+5));break;case"cpickerViewYears":t.get(0).className="cpickerViewDays";u.find("span").text(q(x,"b, Y"));break}}else{if(y.parent().parent().is("thead")){B.current.addMonths(y.hasClass("cpickerGoPrev")?-1:1);s=true}}}}else{if(y.is("td")&&!y.hasClass("cpickerDisabled")){switch(t.get(0).className){case"cpickerViewMonths":B.current.setMonth(t.find("tbody.cpickerMonths td").index(y));B.current.setFullYear(parseInt(t.find("thead th.cpickerMonth span").text(),10));B.current.addMonths(Math.floor(B.calendars/2)-A);t.get(0).className="cpickerViewDays";break;case"cpickerViewYears":B.current.setFullYear(parseInt(u.text(),10));t.get(0).className="cpickerViewMonths";break;default:var v=parseInt(u.text(),10);x.addMonths(A-Math.floor(B.calendars/2));if(y.hasClass("cpickerNotInMonth")){x.addMonths(v>15?-1:1)}x.setDate(v);switch(B.mode){case"multiple":v=(x.setHours(0,0,0,0)).valueOf();if(b.inArray(v,B.date)>-1){b.each(B.date,function(C,D){if(D==v){delete B.date[C];return false}})}else{B.date.push(v)}break;case"range":if(!B.lastSel){B.date[0]=(x.setHours(0,0,0,0)).valueOf()}v=(x.setHours(23,59,59,0)).valueOf();if(v<B.date[0]){B.date[1]=B.date[0]+86399000;B.date[0]=v-86399000}else{B.date[1]=v}B.lastSel=!B.lastSel;break;default:B.date=x.valueOf();break}break}s=true;w=true}}if(s){p(this)}if(w){B.onChange.apply(this,j(B))}}return false},j=function(s){var t;if(s.mode=="single"){t=new Date(s.date);return[q(t,s.format),t]}else{t=[[],[]];b.each(s.date,function(v,w){var u=new Date(w);t[0].push(q(u,s.format));t[1].push(u)});return t}},d=function(){var s=document.compatMode=="CSS1Compat";return{l:window.pageXOffset||(s?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(s?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(s?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(s?document.documentElement.clientHeight:document.body.clientHeight)}},m=function(u,t,s){if(u==t){return true}if(u.contains){return u.contains(t)}if(u.compareDocumentPosition){return !!(u.compareDocumentPosition(t)&16)}var v=t.parentNode;while(v&&v!=s){if(v==u){return true}v=v.parentNode}return false},n=function(x){var s=b("#"+b(this).data("cpickerId"));if(!s.is(":visible")){var y=s.get(0);var A=s.data("cpicker");A.onBeforeShow.apply(this,[s.get(0)]);var v=b(this).offset();var z=d();var w=v.top;var t=v.left;var u=b.curCSS(y,"display");s.css({visibility:"hidden",display:"block"});i(y);switch(A.position){case"top":w-=y.offsetHeight;break;case"left":t-=y.offsetWidth;break;case"right":t+=this.offsetWidth;break;case"bottom":w+=this.offsetHeight;break}if(w+y.offsetHeight>z.t+z.h){w=v.top-y.offsetHeight}if(w<z.t){w=v.top+this.offsetHeight+y.offsetHeight}if(t+y.offsetWidth>z.l+z.w){t=v.left-y.offsetWidth}if(t<z.l){t=v.left+this.offsetWidth}s.css({visibility:"visible",display:"block",top:w+"px",left:t+"px"});if(A.onShow.apply(this,[s.get(0)])!=false){s.show()}b(document).bind("mousedown",{cal:s,trigger:this},h)}return false},h=function(s){if(s.target!=s.data.trigger&&!m(s.data.cal.get(0),s.target,s.data.cal.get(0))){if(s.data.cal.data("cpicker").onHide.apply(this,[s.data.cal.get(0)])!=false){s.data.cal.hide()}b(document).unbind("mousedown",h)}};return{init:function(s){s=b.extend({},g,s||{});f(s.locale);s.calendars=Math.max(1,parseInt(s.calendars,10)||1);s.mode=/single|multiple|range/.test(s.mode)?s.mode:"single";return this.each(function(){if(b(this).data("cpickerId")){return}if(!b(this).data("cpicker")){if(s.date.constructor==String){s.date=e(s.date,s.format);s.date.setHours(0,0,0,0)}if(s.mode!="single"){if(s.date.constructor!=Array){s.date=[s.date.valueOf()];if(s.mode=="range"){s.date.push(((new Date(s.date[0])).setHours(23,59,59,0)).valueOf())}}else{for(var u=0;u<s.date.length;u++){s.date[u]=(e(s.date[u],s.format).setHours(0,0,0,0)).valueOf()}if(s.mode=="range"){s.date[1]=((new Date(s.date[1])).setHours(23,59,59,0)).valueOf()}}}else{s.date=s.date.valueOf()}
683if(!s.current){s.current=new Date()}else{s.current=e(s.current,s.format)}s.current.setDate(1);s.current.setHours(0,0,0,0);var w="cpicker_"+parseInt(Math.random()*1000),t;s.id=w;b(this).data("cpickerId",s.id);var v=b(k.wrapper).attr("id",w).bind("click",o).data("cpicker",s);if(s.className){v.addClass(s.className)}for(var u=0;u<s.calendars;u++){t=s.starts;headd=k.head;if(u!=2){headd=k.head1}v.find("tr.cpicker-months:first").append(tmpl(headd.join(""),{week:s.locale.weekMin,prev:s.prev,next:s.next,day1:s.locale.daysMin[(t++)%7],day2:s.locale.daysMin[(t++)%7],day3:s.locale.daysMin[(t++)%7],day4:s.locale.daysMin[(t++)%7],day5:s.locale.daysMin[(t++)%7],day6:s.locale.daysMin[(t++)%7],day7:s.locale.daysMin[(t++)%7]}))}v.find("tr.cpicker-months:first table").addClass("cpickerViewDays");if(s.flat){v.appendTo(this).show().css("position","relative");i(v.get(0))}else{v.appendTo(document.body);b(this).bind(s.eventName,n)}}})},preparePicker:function(){p(this.find(".cpicker"));return this},showPicker:function(){return this.each(function(){if(b(this).data("cpickerId")){n.apply(this)}})},hidePicker:function(){return this.each(function(){if(b(this).data("cpickerId")){b("#"+b(this).data("cpickerId")).hide()}})},setDate:function(s,t){return this.each(function(){if(b(this).data("cpickerId")){var w=b("#"+b(this).data("cpickerId"));var u=w.data("cpicker");u.date=s;if(u.date.constructor==String){u.date=e(u.date,u.format);u.date.setHours(0,0,0,0)}if(u.mode!="single"){if(u.date.constructor!=Array){u.date=[u.date.valueOf()];if(u.mode=="range"){u.date.push(((new Date(u.date[0])).setHours(23,59,59,0)).valueOf())}}else{for(var v=0;v<u.date.length;v++){u.date[v]=(e(u.date[v],u.format).setHours(0,0,0,0)).valueOf()}if(u.mode=="range"){u.date[1]=((new Date(u.date[1])).setHours(23,59,59,0)).valueOf()}}}else{u.date=u.date.valueOf()}if(t){u.current=new Date(u.mode!="single"?u.date[0]:u.date)}p(w.get(0))}})},getDate:function(s){if(this.size()>0){return j(b("#"+b(this).data("cpickerId")).data("cpicker"))[s?0:1]}}}}();b.fn.extend({CPicker:a.init,CPickerHide:a.hide,CPickerShow:a.show,CPickerSetDate:a.setDate,CPickerPrepare:a.preparePicker,CPickerGetDate:a.getDate})})(jQuery);(function(){var b={};this.tmpl=function a(e,d){var c=!/\W/.test(e)?b[e]=b[e]||a(document.getElementById(e).innerHTML):new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return d?c(d):c}})(); 684/* 685 $(function() { 686 runCalendar(); 687 }); 688 */ 689function runCalendar(monf) { 690 monf = monf || false; 691 var k = new Date(); 692 if (k.getMonth() == 0) { k.setMonth(11); k.setFullYear(k.getFullYear() - 1); } else { k.setMonth(k.getMonth() - 1); } 693 $('#cpicker').html('<div id="dp"></div>'); 694 $('#since,#till').val(''); 695 if (monf) 696 $('#calendarperiod').html(' за поÑледние 3 меÑÑÑа '); 697 $('#dp').CPicker({flat: true,format: 'd.m.Y',date: [],current: k,calendars: 3,mode: 'range',starts: 1,onChange: function (s) { 698 $('#calendarperiod').html(' Ñ <strong>' + s.join('</strong> по <strong>') + '</strong>'); 699 $('#since').val(s.shift()); 700 $('#till').val(s.shift()); 701 } 702 }); 703 if ($.browser.msie && $.browser.version < 8) {$('#dp').CPickerSetDate(1);} else {$('#dp').CPickerPrepare();} 704 $('#dp').find('.cpickerGoPrev:eq(0)').addClass('prevM'); 705 $('#dp').find('.cpickerGoNext:eq(2)').addClass('nextM'); 706} 707 708(function($) { //create closure 709 $.fn.notacarousel = function(options){ 710 var defaults = { 711 toLeftTmpl: '<a href="javascript:void(0);"><span></span></a>', 712 toRightTmpl: '<a href="javascript:void(0);"><span></span></a>', 713 wrap: 'circular', 714 start: 1, 715 width: 520, // ÑиÑина конÑейнеÑа 716 selector: '.slide', 717 scroll: 1, 718 easing: 'easeInQuad', 719 animation: 300, 720 preview: false // true - галеÑÐµÑ Ð¿ÑевÑÑÑек Ñ ÑвелиÑением; false - обÑÐºÐ½Ð¾Ð²ÐµÐ½Ð½Ð°Ñ ÐºÐ°ÑÑÑÐµÐ»Ñ 721 }; 722 var errors = 0; var msg=''; 723 var o = $.extend(defaults, options); 724 var ul = $(this); 725 726 ul.jcarousel({ 727 buttonNextHTML: o.toRightTmpl, 728 buttonPrevHTML: o.toLeftTmpl, 729 wrap: o.wrap, 730 start: o.start, 731 easing: o.easing, 732 scroll: o.scroll, 733 animation: o.animation, 734 initCallback: carouselPrepare, 735 animationStepCallback: carouselNextStep, 736 itemFallbackDimension: 60, 737 itemVisibleInCallback: { 738 onBeforeAnimation: onBeforeAnimationStep, 739 onAfterAnimation: onAfterAnimationStep 740 } 741 }); 742 743 function carouselPrepare(carousel) {
744 var id = carousel.container.context.id, txt = ''; 745 carousel.container.find(o.selector).each(function(i){ 746 txt += '<li><a href="#">'+(i+1)+'</a></li>'; 747 }); 748 carousel.container.append('<ul id="'+id+'control" class="carouselcontrol">'+txt+'</ul>'); 749 $('#'+id+'control a').bind('click', function() { 750 $('#'+id+'control').find('.current').removeClass('current'); 751 carousel.scroll($.jcarousel.intval($(this).text())); 752 $(this).parent().addClass('current'); 753 return false; 754 }); 755 carousel.container.css({ width: o.width, overflow: 'hidden' }); 756 if (o.preview) { 757 carousel.container.prepend('<div class="enlargefoto" id="'+id+'enlarge"></div><div class="slidenav"><a href="javascript:void(0)" class="nav toleft"><span>«</span></a><a href="javascript:void(0)" class="nav toright"><span>»</span></a></div>'); 758 var li = carousel.container.find(o.selector); 759 var cnt = li.length; 760 $(document).on('click', o.selector, function(){ 761 var enlargefoto = $('#'+id+'enlarge'); 762 var olds = enlargefoto.find('.enlslide'); 763 var news = $('<div class="enlslide">'+$(this).html()+'</div>'); 764 olds.css('zIndex',0).animate({opacity:0}
764, 600, function(){ olds.detach(); }); 765 news.css({opacity:0,'zIndex':1}).appendTo(enlargefoto).animate({opacity:1}, 600, function(){}); 766 carousel.container.find('.current').removeClass('current'); 767 $(this).addClass('current'); 768 }); 769 var startslide = (o.start > 0 && o.start < li.length) ? o.start - 1 : 1; 770 li.each(function(i){ 771 var cont = $(this); 772 cont.find('.slideinfo>span').append('<strong>'+(i+1)+' / '+(cnt)+'</strong>'); 773 if (i== startslide) cont.click(); 774 }); 775 carousel.container.find('.slidenav a').click(function(){ 776 var curr = carousel.container.find(o.selector+'.current'); 777 var ind = curr.attr('jcarouselindex'); 778 if ($(this).hasClass('toright')) { 779 if (ind >= carousel.last) { 780 carousel.container.find('.jcarousel-next').click(); 781 } 782 var next = curr.next(), moveA = next.find('.move'); 783 if (moveA.length > 0) window.location = moveA.attr('href'); 784 next.click(); next.find('.move').click(); 785 } else { 786 if ((ind-1) <= carousel.first) { 787 carousel.container.find('.jcarousel-prev').click(); 788 } 789 var prev = curr.prev(), moveA = prev.find('.move'); 790 if (moveA.length > 0) window.location = moveA.attr('href'); 791 prev.click(); 792 } 793 return false; 794 }); 795 } 796 } 797 function carouselNextStep() { 798 } 799 function onBeforeAnimationStep(){ 800 } 801 function onAfterAnimationStep(carousel){ 802 var n = carousel.first % carousel.options.size, id = carousel.container.context.id; 803 n = (n <= 0)? carousel.options.size + n : n; 804 $('#'+id+'control').find('.current').removeClass('current'); 805 $('#'+id+'control').find('li:eq('+(n-1)+')').addClass('current'); 806 var nextimg = carousel.container.find('.jcarousel-next .preview'); 807 var previmg = carousel.container.find('.jcarousel-prev .preview'); 808 if (nextimg.length > 0 && previmg.length > 0) { // каÑÑинки пÑевÑÑÑки около ÑÑÑелок навигаÑии 809 previmg.attr('src',carousel.container.find('.jcarousel-item-'+(((n-1)<1) ? carousel.options.size : (n-1))+' img').attr('src')); 810 nextimg.attr('src',carousel.container.find('.jcarousel-item-'+(((n+1)>carousel.options.size) ? 1 : (n+1))+' img').attr('src')); 811 } 812 } 813 } 814//end of closure 815})(jQuery); 816 817function setDays() 818{ 819 var month = $("#calendar_month").val(); 820 var year = $("#calendar_year").val(); 821 if(year.length <= 0) 822 { 823 var date = new Date(); 824 year = date.getFullYear().toString(); 825 } 826 827 if(month.length > 0 && year.length > 0) 828 { 829 var dayCount = new Date(year, month, 0).getDate(); 830 var optCount = $("#calendar_day > option").length - 1; 831 832 if (optCount > dayCount) 833 $("#calendar_day > option:gt("+(dayCount)+")").remove(); 834 else 835 { 836 var strHtml = ""; 837 var cnt = dayCount - optCount; 838 var d = 0; 839 for (var i = 1; i <= cnt; i++) 840 { 841 d = optCount + i 842 strHtml += "<option value=\""+d+"\">"+d+"</option>"; 843 } 844 845 $("#calendar_day").append(strHtml); 846 } 847 848 } 849} 850 851function initFavorites(url,backurl) 852{ 853 url = url || window.location.href; 854 backurl = backurl || ''; 855 if(typeof(window.arFavorites) != "undefined" && window.arFavorites.length > 0) 856 { 857 var params = new Object(); 858 params['sessid'] = BX.bitrix_sessid(); 859 params['data'] = window.arFavorites; 860 params['action'] = 'init_favorite'; 861 params['url'] = url; 862 params['backurl'] = backurl; 863 $.post( 864 url, 865 params, 866 function(data) { 867 if(typeof(data) != "undefined") 868 if(data.success == 'y') { 869 $.each(data.html,function(container,inner_html) { 870 $("#"+container).html(inner_html); 871 872 }); 873 } 874 }, 875 'json' 876 ); 877 } 878 return false;
879} 880 881function initFavorite(url,container,type,id) { 882 883 url = url || window.location.href; 884 885 var params = new Object(); 886 params['sessid'] = BX.bitrix_sessid(); 887 params['container'] = container; 888 params['type'] = type; 889 params['id'] = id; 890 params['action'] = 'init_favorite'; 891 params['url'] = url; 892 //params['backurl'] = window.location.href; 893 $.post( 894 url, 895 params, 896 function(data) { 897 if(data.success == 'y') 898 $("#"+container).html(data.html); 899 }, 900 'json' 901 ); 902 903 return false; 904} 905 906window.arFavorites = []; 907var busy_ajax = false; 908 909function _addToFavorite(url,data) { 910 911 if(busy_ajax) 912 return; 913 914 if(typeof(data) == 'undefined') 915 return; 916 917 url = url || window.location.href; 918 919 busy_ajax = true; 920 var params = new Object(); 921 var container = data['container']; 922 923 params['sessid'] = BX.bitrix_sessid(); 924 params['url'] = url; 925 params['container'] = container; 926 927 params['type'] = data['type']; 928 params['id'] = data['id']; 929 params['param1'] = data['param1']; 930 params['param2'] = data['param2']; 931 932 params['action'] = 'add_to_favorite'; 933 934 $.post( 935 url, 936 params, 937 function(data) { 938 if(data.success == 'y') { 939 $("#"+container).html(data.html[container]); 940 } 941 busy_ajax = false; 942 }, 943 'json' 944 ); 945} 946 947function addToFavorite(url,container,type,id) { 948 949 if(busy_ajax) 950 return; 951 952 url = url || window.location.href; 953 954 busy_ajax = true; 955 956 var params = new Object(); 957 params['sessid'] = BX.bitrix_sessid(); 958 params['container'] = container; 959 params['type'] = type; 960 params['id'] = id; 961 params['url'] = url; 962 //params['backurl'] = window.location.href; 963 params['action'] = 'add_to_favorite'; 964 $.post( 965 url, 966 params, 967 function(data) { 968 if(data.success == 'y') { 969 $("#"+container).html(data.html[container]); 970 busy_ajax = false; 971 } 972 }, 973 'json' 974 ); 975} 976 977function showProgressBar(elem, id, start_width) 978{ 979 var progressBarId = "progress-bar-" + id; 980 981 if (typeof(elem) == 'undefined') 982 return; 983 if(typeof(start_width) == 'undefined') 984 start_width = 0; 985 if ($('#'+progressBarId).length) 986 return; 987 988 var progressDiv = $("<div></div>", {'class': 'brogress-bar', 'id': progressBarId}); 989 var width = $(elem).outerWidth(true); 990 var height = $(elem).outerHeight(true); 991 var left = $(elem).offset().left - parseInt($(elem).css('marginLeft'), 10); 992 var top = $(elem).offset().top - parseInt($(elem).css('marginTop'), 10); 993 994 $(progressDiv).css({ 995 'left': left, 996 'top': top, 997 'width': width, 998 'height': height 999 });/*.append('<div class="progress-border" ><div class="progress" style="width: '+start_width+'%;"></div></div>');*/ 1000 1001 if (width > 70) { 1002 left = 10; 1003 width = width - 20; 1004 } 1005 else { 1006 left = 2; 1007 width = width - 4; 1008 } 1009 1010 top = parseInt(height / 2 - $('div.progress-border', progressDiv).outerHeight() / 2, 10); 1011 1012 $('div.progress-border', progressDiv).css({ 1013 'left': left, 1014 'top': top, 1015 'width': width 1016 }); 1017 1018 $('body').append(progressDiv); 1019} 1020function hideProgressBar(id) 1021{ 1022 $('#progress-bar-' + id).remove(); 1023} 1024 1025function initVideoitems(){ // видеолиÑÑ 1026 var H = 0; 1027 $('.videoitems .anonce').each(function(){ 1028 var anonce = $(this); 1029 H = Math.max(H,anonce.height()); 1030 anonce.hover(function(){ 1031 $(this).addClass('hover'); 1032 },function(){ 1033 $(this).removeClass('hover'); 1034 }); 1035 }); 1036 $('.videoitems .anonce').height(H); 1037} 1038 1039function declination(a, b, c, s) { 1040 var words = [a, b, c]; 1041 var index = s % 100; 1042 if (index >=11 && index <= 14) { index = 0; } 1043 else { index = (index %= 10) < 5 ? (index > 2 ? 2 : index): 0; } 1044 return(words[index]); 1045} 1046 1047function ShowShareDialog(counter) 1048{ 1049 var div = document.getElementById("share-dialog"+counter); 1050 if (!div) 1051 return; 1052 1053 if (div.style.display == "block") 1054 { 1055 div.style.display = "none"; 1056 } 1057 else 1058 { 1059 div.style.display = "block"; 1060 } 1061 return false;
1062} 1063 1064function CloseShareDialog(counter) 1065{ 1066 var div = document.getElementById("share-dialog"+counter); 1067 1068 if (!div) 1069 return; 1070 1071 div.style.display = "none"; 1072 return false; 1073} 1074 1075function incSocnetCounter(id, type, socnet, button) { 1076 $.get("/ajax/ajax_handler.php", { 1077 "ELEMENT_ID": id, 1078 "ELEMENT_TYPE": type, 1079 "SOCNET_CODE": socnet, 1080 "action": "incSocnetCounter" 1081 }).done(function(msg){ 1082 msg = parseInt(jQuery.trim(msg)); 1083 if (!isNaN(msg) && msg > 0 && button > 0) { 1084 $('#shareCounter_' + button + ' > span').empty().text(msg); 1085 } 1086 }); 1087} 1088 1089 1090function __function_exists(function_name) 1091{ 1092 if (typeof function_name == 'string') 1093 { 1094 return (typeof window[function_name] == 'function'); 1095 } 1096 else 1097 { 1098 return (function_name instanceof Function); 1099 } 1100} 1101 1102 1103 1104 1105(function(cash) { //create closure 1106 $.fn.brandImg = function(){ 1107 this.each(function(){ 1108 var cont = $(this), inner = cont.find('.f'), h = $('.header .top').height(); 1109 1110 $( window ).scroll(function() { 1111 //console.log( $( window ).scrollTop() ); 1112 if ( $( window ).scrollTop() > h ) { 1113 inner.css({ 1114 'top': '0', 1115 'position': 'fixed' 1116 }); 1117 1118 } else { 1119 inner.css({ 1120 'top': h, 1121 'position': 'absolute' 1122 }); 1123 } 1124 }); 1125 1126 1127 }); 1128 1129 } 1130 //end of closure 1131})(jQuery); 1132 1133Share = { 1134 facebook: function(purl, ptitle, text) { 1135 url = 'http://www.facebook.com/sharer.php?'; 1136 url += '&u=' + encodeURIComponent(purl); 1137 Share.popup(url); 1138 }, 1139 telegram: function (pUrl, pTitle) { 1140 this.popup( 1141 'https://t.me/share/url?' 1142 + 'url=' + encodeURIComponent(pUrl) 1143 + '&text=' + encodeURIComponent(pTitle) 1144 ) 1145 }, 1146 twitter: function(purl, ptitle) { 1147 url = 'http://twitter.com/share?'; 1148 url += 'text=' + encodeURIComponent(ptitle); 1149 url += '&url=' + encodeURIComponent(purl); 1150 url += '&counturl=' + encodeURIComponent(purl); 1151 Share.popup(url); 1152 }, 1153 vkontakte: function(purl, ptitle, pimg, text) { 1154 url = 'http://vk.com/share.php?'; 1155 url += 'url=' + encodeURIComponent(purl); 1156 url += '&title=' + encodeURIComponent(ptitle); 1157 url += '&description=' + encodeURIComponent(text); 1158 url += '&image=' + encodeURIComponent(pimg); 1159 url += '&noparse=true'; 1160 Share.popup(url); 1161 }, 1162 popup: function(url) { 1163 window.open(url,'','toolbar=0,status=0,width=626,height=436'); 1164 } 1165}; 1166 1167 1168/* 1169 * Ðопап 1170 */ 1171$(document).ready(function(){ 1172 $(document).on('click', '.js-popup-link', function(event) { 1173 var _this = $(this); 1174 event.preventDefault(); 1175 1176 if(_this.hasClass('disabled')) { 1177 return; 1178 } 1179 1180 _this.addClass('disabled'); 1181 1182 var id = $(this).data("id"); 1183 var section = $(this).data("section"); 1184 $.ajax({ 1185 type: "GET", 1186 url: "add2basket.php", 1187 data: {add2basket: id, OTHER_SECTION: section}, 1188 context: document.body, 1189 success: function(html) { 1190 _this.removeClass('disabled'); 1191 $('.js-popup').remove(); 1192 $('body').append(html); 1193 $('.js-popup').bPopup({ 1194 closeClass: 'js-close-popup', 1195 opacity: 0.5 1196 }); 1197 $('#button-buy_'+id+'').text("РкоÑзине").css("color","#cf1838"); 1198 _this.removeClass("js-popup-link"); 1199 _this.css("cursor", "pointer"); 1200 _this.attr("onclick", "document.location.href='/profile/basket/?scroll_to=Y'") 1201 }, 1202 error: function(err) { 1203 _this.removeClass('disabled'); 1204 } 1205 }); 1206 }); 1207});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.