/* jQuery Form Styler v1.4.7 | (c) Dimox | https://github.com/Dimox/jQueryFormStyler */
(function(c){c.fn.styler=function(h){h=c.extend({wrapper:"form",idSuffix:"-styler",filePlaceholder:"\u0424\u0430\u0439\u043b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d",fileBrowse:"\u041e\u0431\u0437\u043e\u0440...",selectSearch:!0,selectSearchLimit:10,selectSearchNotFound:"\u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e",selectSearchPlaceholder:"\u041f\u043e\u0438\u0441\u043a...",selectVisibleOptions:0,singleSelectzIndex:"100",
selectSmartPositioning:!0},h);return this.each(function(){function s(){var c="",q="",b="",u="";void 0!==a.attr("id")&&""!=a.attr("id")&&(c=' id="'+a.attr("id")+h.idSuffix+'"');void 0!==a.attr("title")&&""!=a.attr("title")&&(q=' title="'+a.attr("title")+'"');void 0!==a.attr("class")&&""!=a.attr("class")&&(b=" "+a.attr("class"));var s=a.data(),g;for(g in s)""!=s[g]&&(u+=" data-"+g+'="'+s[g]+'"');this.id=c+u;this.title=q;this.classes=b}var a=c(this);a.is(":checkbox")?a.each(function(){if(1>a.parent("div.jq-checkbox").length){var h=
function(){var h=new s,b=c("<div"+h.id+' class="jq-checkbox'+h.classes+'"'+h.title+'><div class="jq-checkbox__div"></div></div>');a.css({position:"absolute",zIndex:"-1",opacity:0,margin:0,padding:0}).after(b).prependTo(b);b.attr("unselectable","on").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none",display:"inline-block",position:"relative",overflow:"hidden"});a.is(":checked")&&b.addClass("checked");a.is(":disabled")&&
b.addClass("disabled");b.click(function(){b.is(".disabled")||(a.is(":checked")?(a.prop("checked",!1),b.removeClass("checked")):(a.prop("checked",!0),b.addClass("checked")),a.change());return!1});a.closest("label").add('label[for="'+a.attr("id")+'"]').click(function(a){b.click();a.preventDefault()});a.change(function(){a.is(":checked")?b.addClass("checked"):b.removeClass("checked")}).keydown(function(a){13!=a.which&&32!=a.which||b.click()}).focus(function(){b.is(".disabled")||b.addClass("focused")}).blur(function(){b.removeClass("focused")})};
h();a.on("refresh",function(){a.parent().before(a).remove();h()})}}):a.is(":radio")?a.each(function(){if(1>a.parent("div.jq-radio").length){var p=function(){var q=new s,b=c("<div"+q.id+' class="jq-radio'+q.classes+'"'+q.title+'><div class="jq-radio__div"></div></div>');a.css({position:"absolute",zIndex:"-1",opacity:0,margin:0,padding:0}).after(b).prependTo(b);b.attr("unselectable","on").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none",
display:"inline-block",position:"relative"});a.is(":checked")&&b.addClass("checked");a.is(":disabled")&&b.addClass("disabled");b.click(function(){b.is(".disabled")||(b.closest(h.wrapper).find('input[name="'+a.attr("name")+'"]').prop("checked",!1).parent().removeClass("checked"),a.prop("checked",!0).parent().addClass("checked"),a.change());return!1});a.closest("label").add('label[for="'+a.attr("id")+'"]').click(function(a){b.click();a.preventDefault()});a.change(function(){a.parent().addClass("checked")}).focus(function(){b.is(".disabled")||
b.addClass("focused")}).blur(function(){b.removeClass("focused")})};p();a.on("refresh",function(){a.parent().before(a).remove();p()})}}):a.is(":file")?a.css({position:"absolute",top:0,right:0,width:"100%",height:"100%",opacity:0,margin:0,padding:0}).each(function(){if(1>a.parent("div.jq-file").length){var p=function(){var q=new s,b=c("<div"+q.id+' class="jq-file'+q.classes+'"'+q.title+' style="display: inline-block; position: relative; overflow: hidden"></div>'),p=c('<div class="jq-file__name">'+
h.filePlaceholder+"</div>").appendTo(b);c('<div class="jq-file__browse">'+h.fileBrowse+"</div>").appendTo(b);a.after(b);b.append(a);a.is(":disabled")&&b.addClass("disabled");a.change(function(){p.text(a.val().replace(/.+[\\\/]/,""))}).focus(function(){b.addClass("focused")}).blur(function(){b.removeClass("focused")}).click(function(){b.removeClass("focused")})};p();a.on("refresh",function(){a.parent().before(a).remove();p()})}}):a.is("select")?a.each(function(){if(1>a.next("div.jqselect").length){var p=
function(){function q(a){a.unbind("mousewheel DOMMouseScroll").bind("mousewheel DOMMouseScroll",function(a){var b=null;"mousewheel"==a.type?b=-1*a.originalEvent.wheelDelta:"DOMMouseScroll"==a.type&&(b=40*a.originalEvent.detail);b&&(a.stopPropagation(),a.preventDefault(),c(this).scrollTop(b+c(this).scrollTop()))})}function b(){i=0;for(len=g.length;i<len;i++){var a="",c="",b=a="",h="",m="";g.eq(i).prop("selected")&&(c="selected sel");g.eq(i).is(":disabled")&&(c="disabled");g.eq(i).is(":selected:disabled")&&
(c="selected sel disabled");void 0!==g.eq(i).attr("class")&&(b=" "+g.eq(i).attr("class"),m=' data-jqfs-class="'+g.eq(i).attr("class")+'"');var e=g.eq(i).data(),n;for(n in e)""!=e[n]&&(a+=" data-"+n+'="'+e[n]+'"');a="<li"+m+a+' class="'+c+b+'"><span>'+g.eq(i).text()+"</span></li>";g.eq(i).parent().is("optgroup")&&(void 0!==g.eq(i).parent().attr("class")&&(h=" "+g.eq(i).parent().attr("class")),a="<li"+m+' class="'+c+b+" option"+h+'"><span>'+g.eq(i).text()+"<psan></li>",g.eq(i).is(":first-child")&&(a='<li class="optgroup'+h+
'">'+g.eq(i).parent().attr("label")+"</li>"+a));v+=a}}function p(){var k=new s,d=c("<div"+k.id+' class="jq-selectbox jqselect'+k.classes+'" style="display: inline-block; position: relative; z-index:'+h.singleSelectzIndex+'"><div class="jq-selectbox__select"'+k.title+'><div class="jq-selectbox__select-text"></div><div class="jq-selectbox__trigger"><div class="jq-selectbox__trigger-arrow"></div></div></div></div>');a.css({margin:0,padding:0}).wrap('<div class="jq-selectbox-wrapper" style="display: inline-block; position: relative;"></div>').after(d);
var k=a.clone().appendTo("body"),r=k.width();k.remove();r!=a.width()&&a.parent().css("display","block");var k=c("div.jq-selectbox__select",d),l=c("div.jq-selectbox__select-text",d),r=g.filter(":selected");r.length?l.text(r.text()):l.text(g.first().text());b();var m="";h.selectSearch&&(m='<div class="jq-selectbox__search"><input type="search" autocomplete="off" placeholder="'+h.selectSearchPlaceholder+'"></div><div class="jq-selectbox__not-found">'+h.selectSearchNotFound+"</div>");var e=c('<div class="jq-selectbox__dropdown" style="position: absolute">'+
m+'<ul style="position: relative; list-style: none; overflow: auto; overflow-x: hidden">'+v+"</ul></div>");d.append(e);var n=c("ul",e),f=c("li",e),t=c("input",e),w=c("div.jq-selectbox__not-found",e).hide();f.length<h.selectSearchLimit&&t.parent().hide();var x=0;f.each(function(){c(this).css({display:"inline-block","white-space":"nowrap"});c(this).width()>x&&(x=c(this).width());c(this).css({display:"block","white-space":"normal"})});d.width(a.outerWidth());x>e.width()&&e.width(x+e.width()-f.width());
a.css({position:"absolute",opacity:0,height:d.outerHeight()});var z=d.outerHeight(),u=t.outerHeight(),y=n.css("max-height"),m=f.filter(".selected");1>m.length&&f.first().addClass("selected sel");void 0===f.data("li-height")&&f.data("li-height",f.outerHeight());var A=e.css("top");"auto"==e.css("left")&&e.css({left:0});"auto"==e.css("top")&&e.css({top:z});e.hide();m.length&&(g.first().text()!=r.text()&&d.addClass("changed"),d.data("jqfs-class",m.data("jqfs-class")),d.addClass(m.data("jqfs-class")));
if(a.is(":disabled"))return d.addClass("disabled"),!1;k.click(function(){a.focus();if(!navigator.userAgent.match(/(iPad|iPhone|iPod)/g)){if(h.selectSmartPositioning){var b=c(window),g=d.offset().top,m=b.height()-z-(g-b.scrollTop()),k=h.selectVisibleOptions,l=f.data("li-height"),p=5*l,r=l*k;0<k&&6>k&&(p=r);0==k&&(r="auto");m>p+u+20?(e.height("auto").css({bottom:"auto",top:A}),k=function(){n.css("max-height",Math.floor((m-20-u)/l)*l)},k(),n.css("max-height",r),"none"!=y&&n.css("max-height",y),m<e.outerHeight()+
20&&k()):(e.height("auto").css({top:"auto",bottom:A}),k=function(){n.css("max-height",Math.floor((g-b.scrollTop()-20-u)/l)*l)},k(),n.css("max-height",r),"none"!=y&&n.css("max-height",y),g-b.scrollTop()-20<e.outerHeight()+20&&k())}c("div.jqselect").css({zIndex:h.singleSelectzIndex-1}).removeClass("opened focused");d.css({zIndex:h.singleSelectzIndex});e.is(":hidden")?(c("div.jq-selectbox__dropdown:visible").hide(),e.show(),d.addClass("opened")):(e.hide(),d.removeClass("opened"));f.filter(".selected").length&&
(0!=n.innerHeight()/l%2&&(l/=2),n.scrollTop(n.scrollTop()+f.filter(".selected").position().top-n.innerHeight()/2+l));t.length&&(t.val("").keyup(),w.hide(),t.focus().keyup(function(){var a=c(this).val();f.each(function(){c(this).html().match(RegExp(".*?"+a+".*?","i"))?c(this).show():c(this).hide()});1>f.filter(":visible").length?w.show():w.hide()}));q(n);return!1}});f.hover(function(){c(this).siblings().removeClass("selected")});var B=f.filter(".selected").text();f.filter(".selected").text();f.filter(":not(.disabled):not(.optgroup)").click(function(){var b=
c(this),n=b.text();if(B!=n){var f=b.index();b.is(".option")&&(f-=b.prevAll(".optgroup").length);b.addClass("selected sel").siblings().removeClass("selected sel");g.prop("selected",!1).eq(f).prop("selected",!0);B=n;l.text(n);g.first().text()!=n?d.addClass("changed"):d.removeClass("changed");d.data("jqfs-class")&&d.removeClass(d.data("jqfs-class"));d.data("jqfs-class",b.data("jqfs-class"));d.addClass(b.data("jqfs-class"));a.change()}t.length&&(t.val("").keyup(),w.hide());e.hide();d.removeClass("opened")});
e.mouseout(function(){c("li.sel",e).addClass("selected")});a.change(function(){l.text(g.filter(":selected").text());f.removeClass("selected sel").not(".optgroup").eq(a[0].selectedIndex).addClass("selected sel")}).focus(function(){d.addClass("focused")}).blur(function(){d.removeClass("focused")}).bind("keydown keyup",function(b){l.text(g.filter(":selected").text());f.removeClass("selected sel").not(".optgroup").eq(a[0].selectedIndex).addClass("selected sel");38!=b.which&&37!=b.which&&33!=b.which||
e.scrollTop(e.scrollTop()+f.filter(".selected").position().top);40!=b.which&&39!=b.which&&34!=b.which||e.scrollTop(e.scrollTop()+f.filter(".selected").position().top-e.innerHeight()+liHeight);13==b.which&&e.hide()});c(document).on("click",function(a){c(a.target).parents().hasClass("jq-selectbox")||"OPTION"==a.target.nodeName||(t.length&&t.val("").keyup(),e.hide().find("li.sel").addClass("selected"),d.removeClass("focused opened"))})}function C(){var k=new s,d=c("<div"+k.id+' class="jq-select-multiple jqselect'+
k.classes+'"'+k.title+' style="display: inline-block; position: relative"></div>');a.css({margin:0,padding:0}).wrap('<div class="jq-selectbox-wrapper" style="display: inline-block; position: relative;"></div>').after(d);var k=a.clone().appendTo("body"),h=k.width();k.remove();h!=a.width()&&a.parent().css("display","block");b();d.append("<ul>"+v+"</ul>");var l=c("ul",d).css({position:"relative","overflow-x":"hidden","-webkit-overflow-scrolling":"touch"}),m=c("li",d).attr("unselectable","on").css({"-webkit-user-select":"none",
"-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none","white-space":"nowrap"}),k=a.attr("size"),h=l.outerHeight(),e=m.outerHeight();void 0!==k&&0<k?l.css({height:e*k}):l.css({height:4*e});h>d.height()&&(l.css("overflowY","scroll"),q(l),m.filter(".selected").length&&l.scrollTop(l.scrollTop()+m.filter(".selected").position().top));a.is(":disabled")?(d.addClass("disabled"),g.each(function(){c(this).is(":selected")&&m.eq(c(this).index()).addClass("selected")}),
d.width(a.outerWidth()),d.width(d.width()-(d.outerWidth()-d.width())),a.css({position:"absolute",opacity:0,height:d.outerHeight()})):(d.width(a.outerWidth()),d.width(d.width()-(d.outerWidth()-d.width())),a.css({position:"absolute",opacity:0,height:d.outerHeight()}),m.filter(":not(.disabled):not(.optgroup)").click(function(b){a.focus();d.removeClass("focused");var f=c(this);b.ctrlKey||b.metaKey||f.addClass("selected");b.shiftKey||f.addClass("first");b.ctrlKey||(b.metaKey||b.shiftKey)||f.siblings().removeClass("selected first");
if(b.ctrlKey||b.metaKey)f.is(".selected")?f.removeClass("selected first"):f.addClass("selected first"),f.siblings().removeClass("first");if(b.shiftKey){var e=!1,h=!1;f.siblings().removeClass("selected").siblings(".first").addClass("selected");f.prevAll().each(function(){c(this).is(".first")&&(e=!0)});f.nextAll().each(function(){c(this).is(".first")&&(h=!0)});e&&f.prevAll().each(function(){if(c(this).is(".selected"))return!1;c(this).not(".disabled, .optgroup").addClass("selected")});h&&f.nextAll().each(function(){if(c(this).is(".selected"))return!1;
c(this).not(".disabled, .optgroup").addClass("selected")});1==m.filter(".selected").length&&f.addClass("first")}g.prop("selected",!1);m.filter(".selected").each(function(){var a=c(this),b=a.index();a.is(".option")&&(b-=a.prevAll(".optgroup").length);g.eq(b).prop("selected",!0)});a.change()}),g.each(function(a){c(this).data("optionIndex",a)}),a.change(function(){m.removeClass("selected");var a=[];g.filter(":selected").each(function(){a.push(c(this).data("optionIndex"))});m.not(".optgroup").filter(function(b){return-1<
c.inArray(b,a)}).addClass("selected")}).focus(function(){d.addClass("focused")}).blur(function(){d.removeClass("focused")}),h>d.height()&&a.keydown(function(a){38!=a.which&&37!=a.which&&33!=a.which||l.scrollTop(l.scrollTop()+m.filter(".selected").position().top-e);40!=a.which&&39!=a.which&&34!=a.which||l.scrollTop(l.scrollTop()+m.filter(".selected:last").position().top-l.innerHeight()+2*e)}))}var g=c("option",a),v="";a.is("[multiple]")?C():p()};p();a.on("refresh",function(){a.parent().before(a).remove();
p()});a.on("adaptiveWidth",function(){a.css({position:"static"});a.next().width(a.outerWidth());a.css({position:"absolute"})});c(window).on("resize",function(){a.trigger("adaptiveWidth")})}}):a.is(":reset")&&a.click(function(){setTimeout(function(){a.closest(h.wrapper).find("input, select").trigger("refresh")},1)})})}})(jQuery);













(function(e){function t(){var e=document.createElement("input"),t="onpaste";return e.setAttribute(t,""),"function"==typeof e[t]?"paste":"input"}var n,a=t()+".mask",r=navigator.userAgent,i=/iphone/i.test(r),o=/android/i.test(r);e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn",placeholder:"_"},e.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&(n=this.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,r){var c,l,s,u,f,h;return!t&&this.length>0?(c=e(this[0]),c.data(e.mask.dataName)()):(r=e.extend({placeholder:e.mask.placeholder,completed:null},r),l=e.mask.definitions,s=[],u=h=t.length,f=null,e.each(t.split(""),function(e,t){"?"==t?(h--,u=e):l[t]?(s.push(RegExp(l[t])),null===f&&(f=s.length-1)):s.push(null)}),this.trigger("unmask").each(function(){function c(e){for(;h>++e&&!s[e];);return e}function d(e){for(;--e>=0&&!s[e];);return e}function m(e,t){var n,a;if(!(0>e)){for(n=e,a=c(t);h>n;n++)if(s[n]){if(!(h>a&&s[n].test(R[a])))break;R[n]=R[a],R[a]=r.placeholder,a=c(a)}b(),x.caret(Math.max(f,e))}}function p(e){var t,n,a,i;for(t=e,n=r.placeholder;h>t;t++)if(s[t]){if(a=c(t),i=R[t],R[t]=n,!(h>a&&s[a].test(i)))break;n=i}}function g(e){var t,n,a,r=e.which;8===r||46===r||i&&127===r?(t=x.caret(),n=t.begin,a=t.end,0===a-n&&(n=46!==r?d(n):a=c(n-1),a=46===r?c(a):a),k(n,a),m(n,a-1),e.preventDefault()):27==r&&(x.val(S),x.caret(0,y()),e.preventDefault())}function v(t){var n,a,i,l=t.which,u=x.caret();t.ctrlKey||t.altKey||t.metaKey||32>l||l&&(0!==u.end-u.begin&&(k(u.begin,u.end),m(u.begin,u.end-1)),n=c(u.begin-1),h>n&&(a=String.fromCharCode(l),s[n].test(a)&&(p(n),R[n]=a,b(),i=c(n),o?setTimeout(e.proxy(e.fn.caret,x,i),0):x.caret(i),r.completed&&i>=h&&r.completed.call(x))),t.preventDefault())}function k(e,t){var n;for(n=e;t>n&&h>n;n++)s[n]&&(R[n]=r.placeholder)}function b(){x.val(R.join(""))}function y(e){var t,n,a=x.val(),i=-1;for(t=0,pos=0;h>t;t++)if(s[t]){for(R[t]=r.placeholder;pos++<a.length;)if(n=a.charAt(pos-1),s[t].test(n)){R[t]=n,i=t;break}if(pos>a.length)break}else R[t]===a.charAt(pos)&&t!==u&&(pos++,i=t);return e?b():u>i+1?(x.val(""),k(0,h)):(b(),x.val(x.val().substring(0,i+1))),u?t:f}var x=e(this),R=e.map(t.split(""),function(e){return"?"!=e?l[e]?r.placeholder:e:void 0}),S=x.val();x.data(e.mask.dataName,function(){return e.map(R,function(e,t){return s[t]&&e!=r.placeholder?e:null}).join("")}),x.attr("readonly")||x.one("unmask",function(){x.unbind(".mask").removeData(e.mask.dataName)}).bind("focus.mask",function(){clearTimeout(n);var e;S=x.val(),e=y(),n=setTimeout(function(){b(),e==t.length?x.caret(0,e):x.caret(e)},10)}).bind("blur.mask",function(){y(),x.val()!=S&&x.change()}).bind("keydown.mask",g).bind("keypress.mask",v).bind(a,function(){setTimeout(function(){var e=y(!0);x.caret(e),r.completed&&e==x.val().length&&r.completed.call(x)},0)}),y()}))}})})(jQuery);
$(document).ready(function (e) {

    $(".fancybox").fancybox({
        padding: [47, 26, 26, 26],
        helpers: {
            overlay: {
                locked: false
            }
        }
    });


    $("#creditformlink").fancybox({
        padding: [40, 40, 40, 40],
        helpers: {
            overlay: {
                locked: false
            }
        }
    });

    windowwidth = $(window).width();
    if (windowwidth < 620) {
        $('#topmenu').click(function (e) {
            if ($(this).hasClass('show')) {
                $(this).removeClass('show')
            } else {
                $(this).addClass('show');
            }
        });


        $('#topmenu>ul .current a').click(function () {
            if (!($('#topmenu').hasClass('show'))) {
                $('#topmenu').addClass('show');
                return false;
            }
        });


    }


});

function clicksearch() {
    $('.search-page .shadowblock > form .redbtn2').click(function () {
        if ($('.search-page .shadowblock > form input[type="text"]').val() == '') {
            $(this).addClass('disabled');
            return false;
        } else {
            $(this).removeClass('disabled')
        }
    });
};


$(document).ready(function (e) {
    windowwidth = $(window).width();
    if (!$('#topmenu li').hasClass('current')) {
        $('#topmenu').addClass('mainpage');
    }


    $(document).click(function (event) {
        if ($(event.target).closest("#consultation, #connectblock .topbtn").length) return;
        $("#consultation").fadeOut({
            duration: 300
        });
        event.stopPropagation();
    });

    $("#connectblock .topbtn").click(function () {

        if ($('#consultation').is(':visible')) {
            $("#consultation").fadeOut({
                duration: 300
            }, 'ease-out');
        } else {
            $("#consultation").fadeIn({
                duration: 300
            }, 'ease-out');
        }
		return false;

    });
    $("#consultation .closebtn").click(function () {
        $("#consultation").fadeOut({
            duration: 300
        }, 'ease-out');
    });


    $('footer .button').click(function () {
        if ($('footer .searchbox').val() == '') {
            return false;
        }
    });


    clicksearch();

});




var fullwidth = 0;
var myScroll;

function menuscroller() {
    $('#adaptivemenu > ul > li').each(function () {
        fullwidth = fullwidth + $(this).outerWidth();
        $('#adaptivemenu > ul').width(fullwidth + 10);
        myScroll = new IScroll('#adaptivemenu', {
            scrollX: true,
            scrollY: false,
            mouseWheel: true,
            click: true
        });
        if (document.querySelector('#adaptivemenu > ul .current')) {
            myScroll.scrollToElement(document.querySelector('#adaptivemenu > ul .current'), true, true, true);
        }
    });
}



$(window).load(function (e) {
    if (!($('html').hasClass('lt-ie8'))) {
        menuscroller();
    }

});




$(window).resize(function (e) {
    windowwidth = $(window).width();

    $('#adaptivemenu > ul > li').each(function () {
        fullwidth = fullwidth + $(this).outerWidth();
    });
    $('#adaptivemenu > ul').width(fullwidth + 10);
    if (windowwidth < 620) {
        $('#topmenu').click(function (e) {
            if ($(this).hasClass('show')) {
                $(this).removeClass('show')
            } else {
                $(this).addClass('show');
            }
        });


        $('#topmenu>ul .current a').click(function () {
            if (!($('#topmenu').hasClass('show'))) {
                $('#topmenu').addClass('show');
                return false;
            }
        });


    }



    if (windowwidth < 620) {
        $('#topmenu').click(function (e) {
            if ($(this).hasClass('show')) {
                $(this).removeClass('show')
            } else {
                $(this).addClass('show');
            }
        });


        $('#topmenu>ul .current a').click(function () {
            if (!($('#topmenu').hasClass('show'))) {
                $('#topmenu').addClass('show');
                return false;
            }
        });
    }
    fullwidth = 0;

    if (!($('html').hasClass('lt-ie8'))) {
        menuscroller();
    }




});




function isLocalStorageAvailable() {
    try {
        return 'localStorage' in window && window['localStorage'] !== null;
    } catch (e) {
        return false;
    }
}


$(document).ready(function (e) {
    isLocalStorageAvailable();

    var cityvalue = "";
    var currentcity;
    $('#cityselect select').change(function () {
        var str = "";
        var phone;
        $("#cityselect option:selected").each(function () {
            str = $(this).text();
            phone = $(this).attr('data-phone');
            localStorage.setItem('city', str);
        });

        $('header #connectblock .phone').animate({
            'opacity': 0
        }, 400, function () {
            $(this).text(phone);
        }).animate({
            'opacity': 1
        }, 400);

    });

    cityvalue = localStorage.getItem("city");

    if (cityvalue) {
        $("#cityselect select :contains('" + cityvalue + "')").attr("selected", "selected");
        currentcity = $('#cityselect select option[selected="selected"]');
        phone = $(currentcity).attr('data-phone');
        $('header #connectblock .phone').text(phone);
    }

    $('#cityselect select').styler();
});



$.fn.rowSlideUp = function (duration, callback) {
    if (!duration) duration = 500;
    if (!callback) callback = function () {};
    return $(this).find('td,th').wrapInner('<div/>').parent().find('td > div, th > div')
        .slideUp(duration, function () {
            $(this).parent().parent().hide(0, function () {
                $(this).find('td > div, th > div').each(function () {
                    $(this).children().unwrap();
                });
                if (callback && typeof (callback) === "function") callback.call(this);
            });
        });
};
$.fn.rowSlideDown = function (duration, callback) {
    if (!duration) duration = 500;
    if (!callback) callback = function () {};
    return $(this).find('td,th').wrapInner('<div style="display:none;"/>').parent().show(0).find('td > div, th > div')
        .slideDown(duration, function () {
            $(this).children().unwrap();
            if (callback && typeof (callback) === "function") callback.call(this);
        });
};




function number_format(str) {
    return str.replace(/(\s)+/g, '').replace(/(\d{1,3})(?=(?:\d{3})+$)/g, '$1 ');
}