(function(b,a){if(!a){a=window.Lego={}}a.messages=a.messages||{};a.message=function(d,c){return a.params.locale=="ru"?c:(a.messages[d]||c)}})(jQuery,window.Lego);(function(b,a){a.block["b-dropdown"]=function(){var f=b(this),h=b('<div class="b-dropdown-popup"><iframe frameborder="0" src="javascript:\'<body style=\\\'background:none;overflow:hidden\\\'>\'"></iframe></div>'),g=f.clone(true).removeClass("g-js").hide(),e=true,c=(function(){if(e){return}h.css("visibility","hidden").before(f).hide();g.hide();e=true}),d;f.before(h);h.after(g);b(document).keydown(function(i){if(i.keyCode==27&&!(i.metaKey||i.ctrlKey||i.altKey||i.shiftKey)){c()}}).click(function(i){if(!b(i.target).is(".b-dropdown *")){c()}}).bind("popupsClose.lego",c);h.mouseout(function(){d=setTimeout(c,1000)}).mouseover(function(){clearTimeout(d)});b(this).find(".or").click(function(i){i.preventDefault();if(e){b(document).trigger("popupsClose.lego");var j=b.Event("popupOpen.lego");f.trigger(j);if(!j.isDefaultPrevented()){g.css("display","");h.append(f).css("visibility","").css("display","");e=false}}else{c()}})}})(jQuery,window.Lego);(function(b,a){a.block["b-head-userinfo.user"]=function(){var c=b(this);if(a.params.login!=""){b.getJSON("//pass.yandex.ru/services?callback=?",{locale:a.params.locale,login:"yes"},function(f){if(!f||!f.services){return}var d=f.login||a.params.login;var e='<div class="g-js b-dropdown" onclick="return {name:\'b-dropdown\'}"><ul><li class="visible"><a href="http://i.yandex.ru" class="or"><span class="b-pseudo-link"><span><b class="b-user"><b>'+d.substring(0,1)+"</b>"+d.substring(1)+'</b></span></span><i class="arrow"><i class="b-icon"><i></i></i></i></a></li>';b.each(f.services,function(){e+="<li>";if(a.params.id==this.id){e+="<strong>"+this.title+"</strong>"}else{e+='<a href="'+this.url+'"onmousedown="Lego.ch(\''+a.params.id+".login.myservices."+this.id+"',this)\">"+this.title+"</a>"}e+="</li>"});e+='<li class="line"><a href="//passport.yandex.ru/">'+a.message("b-head-userinfo.user:passport","Паспорт")+"</a></li>";e+='<li><a href="//passport.yandex.ru/passport?mode=changepass&retpath=http://i.yandex.ru/">'+a.message("b-head-userinfo.user:change-password","Сменить пароль")+"</a></li>";e+="</ul></div>";c.find(".b-user").replaceWith(e);a.blockInit(c,".b-dropdown")})}}})(jQuery,window.Lego);(function(b,a){a.block["b-hint-input"]=function(){var g=b(this),d=b("#"+g.attr("for")),f=function(){g.hide()},c=function(){if(!d.attr("value")){g.show()}};d.focus(f).blur(c).bind("change mouseover",function(){if(d.attr("value")){f()}});g.click(function(){d.focus()});d.change();var e=d.attr("value");(function(){if(d.attr("value")!=e){b(d).trigger("change");e=d.attr("value")}setTimeout(arguments.callee,200)})()}})(jQuery,window.Lego);function toggleMenu(a){var b=document.getElementById(a);if(b.className.indexOf("b-menu-on")==-1){b.className=b.className.replace(/b-menu-off/,"b-menu-on")}else{b.className=b.className.replace(/b-menu-on/,"b-menu-off")}return false};



function check_form(f) {
    if(f.Email.value == '' && f['FileResume'].value != '' && f.FIO.value != ''){
        return true;
    }else if(f.FIO.value == ''){
        alert('Пожалуйста, укажите Ваши Имя и Фамилию');
        return false;
    }else if(validate_email(f.Email.value) && f.FIO.value != ''){
        return true;

    }else if(!validate_email(f.Email.value) && f.FIO.value != '') {
        alert('Пожалуйста, укажите Ваш действительный адрес E-mail');
        return false;
    }else if(f.FIO.value == '' && !validate_email(f.Email.value)) {
        alert('Пожалуйста, укажите Ваши Имя, Фамилию и действительный адрес E-mail');
        return false;
    }else{
        return false;
    }
}

function validate_email (email) {
    return /[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-z]{2,7}/i.test(email);
}

function check_example(f) {
        if(f['resume[]'].value == '' && f.code.value == '') {
                alert('Пожалуйста, приведите пример кода или загрузите файл с резюме');
                return false;
        }
        else return true;
}

function tab(a) {
    a.parentNode.parentNode.parentNode.className =
    a.parentNode.parentNode.parentNode.className.replace(/(.*)-(.*)/, "$1-" + a.parentNode.className);
    a.blur();
    return false;
}