$(function(){ function top_menu(){ var npos = $(window).scrollTop(); var hei = 0; if($('#wpadminbar').length > 0){ hei = parseInt($('#wpadminbar').height()); } var one = parseInt($('#menutopped').offset().top) - hei; var wid = $(window).width(); if(wid >= 1000){ if(npos > one){ $('#topmenu').css({'position': 'fixed', 'top': hei}); } else { $('#topmenu').css({'position':'absolute', 'top': '0px'}); } } } $(window).scroll(function(){ top_menu(); }); $(window).on('resize', function(){ top_menu(); }); top_menu(); $(window).scroll(function(){ var npos = $(window).scrollTop(); if(npos > 200){ $('#topped').show(); } else { $('#topped').hide(); } }); $('#topped').click(function(){ $('body,html').animate({scrollTop : 0},500); return false; }); $('.conform').live('click', function(){ $('#shadow, .shadowvn').show(); var hei = $(window).height(); var nhei = $('.shadowins').height(); nhei = Math.ceil((hei - nhei) / 2); $('.shadowvn').css({'top': nhei}); }); $('.shadowclose').live('click', function(){ $('#shadow, .shadowvn').hide(); }); $('.ajaxedsubmit').live('click', function(){ var txt = $(this).parents('form').attr('action').replace('.php','form.php'); $(this).parents('form').attr('action', txt); }); $('.ajaxedform').ajaxForm({ dataType: 'json', beforeSubmit: function(a,f,o) { thet = f; thet.find('input[type=submit]').attr('disabled',true); txt = thet.find('.ajaxedformtext').html(); var txt = thet.attr('action').replace('form.php','.php'); thet.attr('action', txt); }, success: function(ht) { if(ht['otv'] == 2){ alert(ht['txt']); thet.find('input[type=text], textarea').attr('value',''); } else if(ht['otv'] == 4){ alert(ht['txt']); } else if(ht['otv'] == 5){ alert(ht['txt']); $('#shadow, .shadowvn').hide(); } else if(ht['otv'] == 1) { alert(ht['txt']); } thet.find('input[type=submit]').attr('disabled',false); } }); $('.js_menu li:has(ul)').addClass('hasedul'); $('.js_menu a').each(function(){ var hre = $(this).attr('href'); if(hre == '#'){ $(this).addClass('nolink'); } }); $('a.nolink').live('click', function(){ return false; }); /* $('a.oneuslug').hover(function(){ $(this).find('.uslugsimgvn').animate({backgroundPosition: '0px -108px'}, 300); }, function(){ $(this).find('.uslugsimgvn').stop(true,true).animate({backgroundPosition: '0px 0px'}, 300); }); */ $('.js_menu li').hover(function(){ $(this).find('ul:first').slideDown(300); }, function(){ $(this).find('ul:first').stop(true,true).slideUp(100); }); $('.onevacancititle').live('click', function(){ var par = $(this).parents('.onevacanci'); $(this).toggleClass('act'); par.find('.onevacancicont').slideToggle(300); return false; }); $('.onepreim').hover(function(){ $(this).find('.onepreimcifr').animate({'font-size': '52px'}, 100); $(this).find('.onepreimsm').animate({'font-size': '12px'}, 100); }, function(){ $(this).find('.onepreimcifr').stop(true,true).animate({'font-size': '48px'}, 100); $(this).find('.onepreimsm').stop(true,true).animate({'font-size': '14px'}, 100); }); $('.homemap').hover(function(){ $('.themaped').stop(true,true).animate({'left': '160px'}, 100, function(){ $('.themaped').stop(true,true).animate({'left': '180px'}, 100, function(){ $('.themaped').stop(true,true).animate({'left': '170px'}, 200); }); }); }, function(){ }); /* home slider */ $('.hgnavone:first').addClass('act'); $('.hgone:first').addClass('act').show(); function go_slide(ind){ $('.hgnavone').removeClass('act'); $('.hgnavone').eq(ind).addClass('act'); $('.hgone').fadeOut(500); $('.hgone').eq(ind).stop(true,true).fadeIn(500); //$('.hgone').hide('drop'); //$('.hgone').eq(ind).show('drop'); } function go_slider(){ var cc = $('.hgnavone').length - 1; var ind = $('.hgnavone.act').index(); var nind = ind+1; if(nind > cc){ nind = 0; } go_slide(nind); } var interval = ''; var idslide = ''; var cc = $('.hgone').length; if(cc > 1){ idslide = setInterval( go_slider , 5000); } $('.hgnavone').live('click', function(){ if(!$(this).hasClass('act')){ var ind = $(this).index(); go_slide(ind); } return false; }); $('.homeslidediv').live('mouseenter',function(){ clearInterval(idslide); }); $('.homeslidediv').live('mouseleave',function(){ clearInterval(idslide); idslide = setInterval(go_slider, 5000); }); /* end home slider */ /* home prich */ var left = 0; var top = 0; $('#prich').mousemove(function(e){ var thet = $('#prich'); left = e.pageX - thet.offset().left - 480; top = e.pageY - thet.offset().top; var l1 = left / 80; var t1 = top / 160; var l2 = left / 160 - 10; var t2 = top / 200; $('.oneprichico').css({'left': l1, 'top': t1}); $('.oneprichcifr').css({'left': l2, 'bottom': t2}); }).mouseleave(function(){ }); /* end home prich */ $('.theshadow').each(function(){ $(this).find('img').before('
'); }); $('.theshadow').live('mouseenter',function(){ $(this).find('.shad').fadeIn(300); var wid = $(this).find('.shad').width(); var hei = $(this).find('.shad').height(); var nwid = (wid / 2) - 5; var nhei = (hei / 2) - 5; var nhei2 = (wid / 2) - 21; var nwid2 = (hei / 2) - 21; var nhei3 = (wid / 2) - 26; var nwid3 = (hei / 2) - 26; $(this).find('.shadvnlup').css({'left': nwid, 'top': nhei}).show(); $(this).find('.shadvnlup').animate({'top': nwid3, 'left': nhei3, 'height': '52px','width': '52px'}, 200, function(){ $(this).animate({'top': nwid2, 'left': nhei2, 'height': '42px','width': '42px'}, 100); }); $(this).find('.cat-img-list').stop(true).fadeIn(300); }); $('.theshadow').live('mouseleave',function(){ $(this).find('.shad').stop(true,true).fadeOut(300); $(this).find('.shadvnlup').stop(true,true).hide().css({'left': '0', 'top': '0','height': '10px', 'width': '10px'}); $(this).find('.cat-img-list').fadeOut(300); }); $('a.onealbum').hover(function(){ $(this).find('.onealbumexcr').slideDown(300); }, function(){ $(this).find('.onealbumexcr').slideUp(300); }); $('#domlink').hover(function(){ $(this).animate({'opacity':'1'}, 300); $('.domlback').slideDown(300); }, function(){ $(this).stop(true,true).animate({'opacity':'0.7'}, 100); $('.domlback').stop(true,true).slideUp(300); }); }); (function($) { $.extend($.fx.step,{ backgroundPosition: function(fx) { if (fx.pos === 0 && typeof fx.end == 'string') { var start = $.css(fx.elem,'backgroundPosition'); start = toArray(start); fx.start = [start[0],start[2]]; var end = toArray(fx.end); fx.end = [end[0],end[2]]; fx.unit = [end[1],end[3]]; } var nowPosX = []; nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0]; nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1]; fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1]; function toArray(strg){ strg = strg.replace(/left|top/g,'0px'); strg = strg.replace(/right|bottom/g,'100%'); strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2"); var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/); return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]]; } } }); })(jQuery);