var _SPINNER_STYLE={position:"absolute",opacity:0.8,zIndex:9999,background:"#FFF",textAlign:"center"};
function setPositionsForAbsElements(){if($chk($("welcome-str"))){if($chk($("header"))){$("welcome-str").setStyles({top:20,left:$("header").getPosition().x,width:940})
}}}window.addEvent("domready",function(){$$("noscript").each(function(b,a){b.destroy()});$("pagewrapper").setStyle("display","block");
setPositionsForAbsElements();if($chk($("rr-getmoney-help"))){$("rr-getmoney-help").addEvent("click",(function(a){a.stop();
new B2BTooltip({anchor:"rr-getmoney-help",text:"Скоро здесь будут электронные валюты.<br/>Сейчас, на начальном этапе,<br/>денежные средства можно получить,<br/>позвонив нам +7 (495) 517-45-20"}).show()
}))}});window.addEvent("resize",function(){setPositionsForAbsElements()});function getObjectBounds(a){var d=a.offsetLeft,c=a.offsetTop;
for(var b=a.offsetParent;b;b=b.offsetParent){d+=b.offsetLeft-(b.offsetParent?b.scrollLeft:0);c+=b.offsetTop-(b.offsetParent?b.scrollTop:0)
}return{left:d,top:c,width:a.offsetWidth,height:a.offsetHeight}}function getObjectParent(a,c){var d=a;
for(var b=0;b<c;b++){d=$(d).getParent()}return d}function $chkURL(a){return a.test(/^((ht|f)tp(s?)\:\/\/|\~\/|\/)?(\w+:\w+@)?(([-\w]+\.)+(com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(:[\d]{1,5})?(((\/([\~\w!$+|.,=\-]|%[a-f\d]{2})+)+|\/)+|\?|#)?((\?([-\w~!$+|.,*:]|%[a-f\d{2}])+=([-\w~!$+|.,*:=]|%[a-f\d]{2})*)(&([-\w~!$+|.,*:]|%[a-f\d{2}])+=([-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(#([-\w~!$+|.,*:=]|%[a-f\d]{2})*)?$/i)?true:false
}function $cleanString(b){var a=b.clean();return a.replace(/[^\s\d\wА-Яа-яЁё,."'+_-]/gi,"")}function $multiSelectToArray(a){var b=new Array();
$$($(a).getChildren()).each(function(d,c){if(d.selected){b.push($cleanString(d.value))}});return b}function $radioButtonSelected(a){var b=null;
$$(document.getElementsByName(a)).each(function(d,c){if(d.checked){b=d.value}});return b}function $radioButtonSetSelect(a,b){$$(document.getElementsByName(a)).each(function(d,c){d.checked=false;
if(d.value==b){d.checked=true}})}function $parseFloat(b){var a=b.replace(/[^\d\,\.\-]+/gi,"");a=a.replace(/[\-]{2,}/gi,"-");
a=a.replace(/,/gi,".");return a.toFloat()}function $float2str2(b){var a=Math.floor(b*1000)/1000;return a.toFixed(2)
}function $parseInt(b){var a=b.replace(/[^\d\-]+/gi,"");a=a.replace(/[\-]{2,}/gi,"-");return a.toInt()
}function _on_body_mouse_down(a){$$(".b2bpopup").each(function(b){_hide_popup(b)})}function _on_popup_mouse_down(b){var a=new Event(b);
a.stopPropagation();(function(){}).delay(300)}var _is_popup_vis=false;function _show_popup(c){var b=$(c.popup);
if(b!=null){if($(c.anchor)){var a=getObjectBounds($(c.anchor));b.setStyles({top:a.top+(c.top!=null?c.top.toInt():0),left:a.left+(c.left!=null?c.left.toInt():0)})
}if(!_is_popup_vis){b.setStyle("visibility","visible")}b.addClass("b2bpopup");(function(){$(document.body).addEvent("mousedown",_on_body_mouse_down);
b.addEvent("mousedown",_on_popup_mouse_down)}).delay(300);_is_popup_vis=true}}function _hide_popup(a){$(a).setStyles({visibility:"hidden",left:-2000,top:-4000});
_is_popup_vis=false;$(document.body).removeEvent("mousedown",_on_body_mouse_down);$(a).removeEvent("mousedown",_on_popup_mouse_down)
}function _show_loading_text(b){var a='<div style="display: block; position: relative;';if(b.marginLeft!=null){a+="margin-left:"+b.marginLeft+"px;"
}if(b.marginTop!=null){a+="margin-top:"+b.marginTop+"px;"}a+='"><img src="images/preload-1.gif" alt="" style="position:relative;display:block;"/>'+(b.loadText!=null?b.loadText:"Загрузка...")+"</div>";
if(b.targetWidth!=null){$(b.target).setStyle("width",b.targetWidth)}if(b.targetHeight!=null){$(b.target).setStyle("width",b.targetHeight)
}$(b.target).set("html",a)}function profile_form_legal_change(a){var c=$("profile[legal_type]").value;
for(var b=0;b<3;b++){if(a){if(!Browser.Engine.trident){$("profile-form-legal-type").set("tween",{property:"opacity",duration:"long"})
}}if(!Browser.Engine.trident){$("profile-form-legal-type").get("tween").set(0)}$$("div .profile-form-legal-type-"+b).each(function(d){d.setStyle("display","none")
})}$$("div .profile-form-legal-type-"+c).each(function(d){d.setStyle("display","block")});if(a){if(!Browser.Engine.trident){$("profile-form-legal-type").get("tween").set(1)
}}else{if(!Browser.Engine.trident){$("profile-form-legal-type").get("tween").start(1)}}}function InitGMaps2(){if(GBrowserIsCompatible()){var c=new GMap2($("gmaps-container"));
c.removeMapType(G_SATELLITE_MAP);c.enableScrollWheelZoom();c.enableDoubleClickZoom();c.setCenter(new GLatLng(55.66529,37.479),16);
c.addControl(new GSmallMapControl());c.addControl(new GMapTypeControl());var a=new GIcon();a.image="images/red-pushpin.png";
a.iconSize=new GSize(32,32);a.iconAnchor=new GPoint(9,32);a.shadow="images/pushpin_shadow.png";a.shadowSize=new GSize(59,32);
a.infoWindowAnchor=new GPoint(9,32);var b=new GLatLng(55.665229,37.478426);var d=new GMarker(b);c.addOverlay(d)
}}function _cleantagsstr(b){var a=b.clean();return a.toLowerCase().replace(/[^\wа-яА-ЯЁё\s_-]/gi,"")}var Base=new Class({root_url:null,initialize:function(){var a=document.getElementsByTagName("base")[0];
this.root_url=$(a).getProperty("href")}}),base=new Base();Element.implement({fixPNG:function(){if(Browser.Engine.trident4){var b=new RegExp("url\\(([.a-zA-Z0-9_/:-]+.png)\\)");
var a=this.getStyle("backgroundImage").replace(b,"$1");this.setStyle("backgroundImage","none");this.setStyle("filter",'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled="true", sizingMethod="scale", src="'+base.root_url+""+a+'")')
}return this}});B2BTooltip=new Class({Implements:[Options],options:{anchor:null,text:null,offsetTop:null,offsetLeft:null,anchorBorder:null,delay:null,width:null,height:null,scroll:null,autoClose:true,allowFade:true,showOnMouseOver:false,onClose:$empty,contentElement:null},initialize:function(a){this.setOptions(a);
this.options.anchor=$(this.options.anchor);this.onBrowserResizeBound=this.onBrowserResize.bind(this);
this.onDocClickBound=this.onDocClick.bind(this);if(this.options.showOnMouseOver&&$chk(this.options.anchor)){this.onAnchorMouseEnterBound=this.onAnchorMouseEnter.bind(this);
this.onAnchorMouseOutBound=this.onAnchorMouseOut.bind(this);this.options.anchor.addEvents({mouseenter:this.onAnchorMouseEnterBound,mouseout:this.onAnchorMouseOutBound})
}return this},reinitialize:function(){window.removeEvent("resize",this.onBrowserResizeBound);document.removeEvent("click",this.onDocClickBound);
this.tooltip.dispose();this.tooltip=null},setText:function(a){this.options.text=a;return this},getContentElement:function(){return this.options.contentElement
},drawTip:function(){var c=new Element("table");c.cellPadding="0";c.cellSpacing="0";c.border="0";var b=new Element("tbody").inject(c);
var a=new Element("tr").inject(b);new Element("td",{styles:{width:10,height:10,backgroundImage:"url(images/tt-lt-bg.png)"}}).fixPNG().inject(a);
new Element("td",{styles:{height:10,backgroundImage:"url(images/tt-tt-bg.png)"}}).fixPNG().inject(a);
new Element("td",{styles:{width:10,height:10,backgroundImage:"url(images/tt-rt-bg.png)"}}).fixPNG().inject(a);
var e=new Element("tr").inject(b);new Element("td",{styles:{paddingLeft:10,backgroundImage:"url(images/tt-ll-bg.png)"}}).fixPNG().inject(e);
this.options.contentElement=new Element("td",{styles:{backgroundColor:"#FFF",padding:"0 2px 5px 2px"}}).inject(e);
if($chk(this.options.text)){if(typeof this.options.text=="string"){this.options.contentElement.set("html",this.options.text)
}else{this.options.contentElement.grab(this.options.text)}}new Element("td",{styles:{paddingRight:10,backgroundImage:"url(images/tt-rr-bg.png)"}}).fixPNG().inject(e);
var d=new Element("tr").inject(b);new Element("td",{styles:{width:10,height:10,backgroundImage:"url(images/tt-lb-bg.png)"}}).fixPNG().inject(d);
new Element("td",{styles:{height:10,backgroundImage:"url(images/tt-bb-bg.png)"}}).fixPNG().inject(d);
new Element("td",{styles:{width:10,height:10,backgroundImage:"url(images/tt-rb-bg.png)"}}).fixPNG().inject(d);
return c},focusOnElement:function(){if(this.options.scroll&&!this.alreadyFocused&&!this.isScrolling){var a=this.options.anchor.getCoordinates().top-30;
this.isScrolling=true;if(window.getScroll().y!=a){new Fx.Scroll(window,{onComplete:function(){this.isScrolling=false;
this.options.anchor.focus()}.bind(this)}).start(0,a)}else{this.isScrolling=false;this.options.anchor.focus()
}this.alreadyFocused=true}},bindEventsForHiding:function(){window.addEvent("resize",this.onBrowserResizeBound);
if(!$chk(this.options.delay)&&this.options.autoClose){document.addEvent("click",this.onDocClickBound)
}},show:function(){var b=$(this.options.anchor).getPosition(),a=$(this.options.anchor).getSize();this.tooltip=new Element("div",{styles:{display:"block",position:"absolute",zIndex:30,overflow:"visible",width:$chk(this.options.width)?this.options.width:"auto",height:$chk(this.options.height)?this.options.height:"auto",top:b.y+($chk(this.options.offsetTop)?this.options.offsetTop:0),left:b.x+a.x+($chk(this.options.offsetLeft)?this.options.offsetLeft:0)}});
this.tooltip.grab(this.drawTip());$(document.body).grab(this.tooltip);if($chk(this.options.delay)){(function(){this.hide()
}).delay(this.options.delay,this)}this.focusOnElement();if(!Browser.Engine.trident&&this.options.allowFade){new Fx.Tween(this.tooltip,{duration:500,property:"opacity",ignore:true,onStart:function(){},onComplete:function(){this.bindEventsForHiding()
}.bind(this)}).set(0).start(1)}else{this.bindEventsForHiding()}return this},hide:function(){if(!Browser.Engine.trident&&this.options.allowFade){new Fx.Tween(this.tooltip,{duration:500,property:"opacity",ignore:true,onStart:function(){},onComplete:function(){this.options.onClose();
this.reinitialize()}.bind(this)}).set(1).start(0)}else{this.options.onClose();this.reinitialize()}return null
},hideOut:function(){this.tooltip.setStyle("display","none");return this},showIn:function(){this.tooltip.setStyle("display","block");
return this},onAnchorMouseEnter:function(a){if(!$chk(this.tooltip)){this.show()}},onAnchorMouseOut:function(a){if($chk(this.tooltip)){this.hide()
}},onDocClick:function(a){var b=$(a.target);if(!this.tooltip.hasChild(b)){this.hide()}},onBrowserResize:function(b){if($chk(this.tooltip)){var c=$(this.options.anchor).getPosition(),a=$(this.options.anchor).getSize();
this.tooltip.setStyles({top:c.y+($chk(this.options.offsetTop)?this.options.offsetTop:0),left:c.x+a.x+($chk(this.options.offsetLeft)?this.options.offsetLeft:0)})
}}});B2BForm=new Class({initialize:function(){this.formCheck=new formCheck()},validate:function(){},onSubmit:function(a){}});
B2BButtonLoad=new Class({Implements:[Options],options:{id:null,anchor:null,waitImg:"/images/preload-1.gif",buttonHeight:18,text:null,styles:{},onClick:$empty,onMake:$empty},initialize:function(a){this.setOptions(a);
window.addEvent("domready",(function(){this.options.anchor=$(this.options.anchor);this.make();this.onButtonClickBound=this.onButtonClick.bind(this);
this.buttonElement.addEvent("click",this.onButtonClickBound)}).bind(this));return this},onButtonClick:function(a){a.stop();
this.options.onClick(a)},reinitialize:function(){this.setOptions({id:null,anchor:null,waitImg:null,buttonHeight:null,text:null,styles:null,onClick:$empty,onMake:$empty})
},make:function(){if($chk(this.options.anchor)){var c=this.options.anchor}else{var c=new Element("span",{id:this.options.id})
}c.setStyles($merge({display:"inline-block",position:"relative",overflow:"hidden",paddingLeft:5,textAlign:"left",height:this.options.buttonHeight},this.options.styles));
var a=new Element("div",{"class":"button",styles:{display:"block",position:"relative",overflow:"visible"}}).inject(c);
var b=new Element("a",{href:"#"}).inject(a);new Element("span",{}).set("html",this.options.text).inject(b);
this.imgElement=new Element("img",{src:this.options.waitImg,width:this.options.buttonHeight,height:this.options.buttonHeight,styles:{display:"block",position:"relative"}}).inject(c);
this.wrapElement=c;this.buttonElement=a;this.options.onMake();return this},getButton:function(){return this.wrapElement
},wait:function(){this.wrapElement.setStyle("width",this.buttonElement.getSize().x);this.imgElement.setStyles({marginLeft:Math.floor(this.buttonElement.getSize().x/2-this.options.buttonHeight/2)});
this.buttonElement.setStyles({display:"none"});return this},normal:function(){this.buttonElement.setStyles({display:"block"});
return this},destroy:function(){this.buttonElement.removeEvent("click",this.onButtonClickBound);this.wrapElement.destroy();
this.buttonElement=null;this.imgElement=null;this.wrapElement=null;this.reinitialize();return null}});
B2BWindow=new Class({Implements:[Options],options:{debug:false,anchor:null,closeButton:null,windowId:null,shadowImg:null,width:0,height:0,top:0,left:0,offsetTop:0,offsetLeft:0,contentPadding:"0"},onMake:$empty,onAnchorClick:$empty,initialize:function(a){this.setOptions(a);
window.addEvent("domready",(function(){this.make();this.winElement.addEvent("click",(function(b){b.stopPropagation()
}).bindWithEvent(this));if($chk(this.options.anchor)){$(this.options.anchor).addEvent("click",(function(b){b.stop();
this.show();this.onAnchorClick()}).bindWithEvent(this));window.addEvent("resize",this.onBrowserResize.bindWithEvent(this))
}$(document.body).addEvent("click",(function(b){this.hide()}).bindWithEvent(this))}).bind(this));return this
},reinitialize:function(){this.options={windowId:null,shadowImg:null,width:0,height:0,top:0,left:0,contentPadding:null}
},make:function(){var a=new Element("div",{id:this.options.windowId,styles:{position:"absolute",display:"block",top:-3000,left:-3000,zIndex:10,visibility:"hidden",padding:0,border:($chk(this.options.debug)?"1px solid red":"none")}});
new Element("div",{"class":"shadow",styles:{position:"absolute",display:"block",background:"transparent url("+this.options.shadowImg+") no-repeat scroll 0 0",width:this.options.width,height:this.options.height,zIndex:10,border:($chk(this.options.debug)?"1px solid blue":"none")}}).fixPNG().inject(a);
if($chk(this.options.closeButton)){new Element("a",{href:"#","class":"close",styles:{position:"absolute",display:"block",width:this.options.closeButton.width,height:this.options.closeButton.height,top:this.options.closeButton.top,left:this.options.closeButton.left,zIndex:12,border:($chk(this.options.debug)?"1px solid red":"none")}}).inject(a).addEvent("click",(function(b){b.stop();
this.hide()}).bindWithEvent(this))}this.content=new Element("div",{"class":"content",styles:{position:"relative",display:"block",padding:this.options.contentPadding,zIndex:11}}).inject(a);
this.winElement=a;this.onMake();$(document.body).grab(a);return this},show:function(){if(!$chk(this.winElement)){window.addEvent("domready",(function(){this.show()
}).bind(this));return this}if($chk(this.options.anchor)){var b=$(this.options.anchor).getPosition(),a=$(this.options.anchor).getSize()
}this.winElement.setStyles({top:($chk(this.options.anchor)?(b.y+this.options.offsetTop):this.options.top),left:($chk(this.options.anchor)?(b.x+this.options.offsetLeft):this.options.left),visibility:"visible"});
return this},hide:function(){this.winElement.setStyles({top:-3000,left:-3000,visibility:"hidden"});return this
},onBrowserResize:function(b){if(this.winElement.getStyle("visibility")=="visible"){var c=$(this.options.anchor).getPosition(),a=$(this.options.anchor).getSize();
this.winElement.setStyles({top:c.y+this.options.offsetTop,left:c.x+this.options.offsetLeft,visibility:"visible"})
}},setHTML:function(a){this.content.set("html",a);return this},insertElement:function(a){this.content.adopt($(a));
return this},destroy:function(){if($chk(this.winElement)){this.winElement.destroy()}this.reinitialize()
}});function login_form_forgot_pass_check(b){var c=$("forgot[pass]").value.clean();var a=$("forgot[pass2]").value.clean();
if(!$chk(c)){new B2BTooltip({anchor:"forgot[pass]",text:"Введите новый пароль",delay:3000}).show();return false
}if(!$chk(a)){new B2BTooltip({anchor:"forgot[pass2]",text:"Повторите новый пароль",delay:3000}).show();
return false}if(c!=a){new B2BTooltip({anchor:"forgot[pass2]",text:"Проверьте правильность ввода",delay:3000}).show();
return false}return true}B2BLoginWindow=new Class({Extends:B2BWindow,errorsText:{email_not_exist:"Данный e-mail<br/>не зарегистрирован",user_blocked:"Пользователь заблокирован",user_not_found:"Пользователь не найден <br/> проверьте email и пароль"},initialize:function(a){this.parent($merge({windowId:"login-form-window",shadowImg:"/images/signin-bg.png",width:232,height:186,contentPadding:"40px 0 0 20px",offsetLeft:-150,offsetTop:20,closeButton:{width:18,height:18,top:27,left:206}},a))
},onMake:function(){if(Browser.Engine.trident){$("loginname").addEvent("keydown",this.onKeyDownInput.bindWithEvent(this));
$("loginpass").addEvent("keydown",this.onKeyDownInput.bindWithEvent(this))}this.submitBtn=new B2BButtonLoad({anchor:"login-form-submit",text:"Войти",styles:{marginTop:15},onClick:this.onClickSubmit.bindWithEvent(this)});
this.forgotBtn=new B2BButtonLoad({anchor:"forgot-password-submit",text:"Забыли пароль?",styles:{marginTop:15,marginLeft:2},onClick:this.onClickForgot.bindWithEvent(this)});
this.formElement=$("login-form");this.content.grab(this.formElement);this.formElement.addEvent("submit",this.submit.bindWithEvent(this))
},onAnchorClick:function(){$("loginname").focus()},onKeyDownInput:function(a){if(a.key=="enter"){a.stop();
this.submit()}},onClickSubmit:function(a){a.stop();this.submit()},onClickForgot:function(b){b.stop();
if(!$chk($("loginname").value)){new B2BTooltip({anchor:"loginname",text:"Введите e-mail",delay:2000}).show();
return false}var a=new Request.JSON({method:"post",url:"js/requester.php",data:{remote_class:"FEUsers",remote_method:"ajaxForgotPassword",loginname:escape($("loginname").value)},onRequest:(function(){this.forgotBtn.wait()
}).bind(this),onSuccess:(function(c){if($chk(c.send_ok)){new B2BTooltip({anchor:"forgot-password-submit",text:"На введёный Вами e-mail<br/>отправлено письмо с инструкциями",delay:5000,offsetLeft:-20}).show()
}else{if($chk(c.no_email)){new B2BTooltip({anchor:"forgot-password-submit",text:"Введёный e-mail не зарегистрирован",delay:3000,offsetLeft:-20}).show()
}}this.forgotBtn.normal()}).bind(this)}).send()},submit:function(){if(!$chk($("loginname").value)){new B2BTooltip({anchor:"loginname",text:"Введите e-mail",delay:2000}).show();
return false}if(!$chk($("loginpass").value)){new B2BTooltip({anchor:"loginpass",text:"Введите пароль",delay:2000}).show();
return false}var a=new Request.JSON({method:"post",url:"js/requester.php",data:{remote_class:"FEUsers",remote_method:"ajaxLoginUser",loginname:escape($("loginname").value),loginpass:escape($("loginpass").value)},onRequest:(function(){this.submitBtn.wait()
}).bind(this),onFailure:(function(b){new B2BTooltip({anchor:"deposit-form-submit",text:"Произошла ошибка соединения<br/>попробуйте позже",delay:3000,offsetLeft:40}).show();
this.submitBtn.normal()}).bind(this),onSuccess:(function(b){if($chk(b.user_ok)){this.formElement.submit();
return true}else{if($chk(b.email_not_exist)){var c=this.errorsText.email_not_exist}else{if($chk(b.user_blocked)){var c=this.errorsText.user_blocked
}else{if($chk(b.user_not_found)){var c=this.errorsText.user_not_found}}}}if($chk(c)){new B2BTooltip({anchor:"login-form-submit",text:c,delay:3000,offsetLeft:20}).show()
}this.submitBtn.normal()}).bind(this)}).send()}});B2BContactWindow=new Class({Extends:B2BWindow,initialize:function(a){this.parent($merge(a,{windowId:"contact-form-window",shadowImg:"/images/send-mail-bg.png",width:435,height:457,contentPadding:"20px 0 0 16px",offsetLeft:-150,offsetTop:-50,closeButton:{width:18,height:18,top:3,left:408}}))
},clearForm:function(){$each($("fmail-send-form").getElements("input,textarea"),function(a){a.value=""
})},onMake:function(){this.submitBtn=new B2BButtonLoad({anchor:"fmail-send-form-submit",text:"Отправить",onClick:this.onSubmitClick.bindWithEvent(this),styles:{marginTop:10}});
this.insertElement("fmail-send-form")},show:function(){this.clearForm();this.parent()},hide:function(){this.clearForm();
this.parent()},checkForm:function(){var a={name:$("send[name]").value.clean(),phone:$("send[phone]").value.clean(),email:$("send[email]").value.clean(),subj:$("send[subj]").value.clean(),info:$("send[info]").value.clean(),captcha:$("send[captcha]").value.clean()};
var b=null;if(!$chk(a.subj)){b="Введите тему"}else{if(!$chk(a.email)){b="Введите e-mail"}else{if(!$chk(a.info)){b="Введите сообщение"
}else{if(!$chk(a.captcha)){b="Введите символы показаные<br/>на изображении"}}}}if($chk(b)){new B2BTooltip({anchor:"fmail-send-form-submit",text:b,delay:3000,offsetLeft:0}).show();
return false}return a},onSubmitClick:function(c){c.stop();var b=this.checkForm();if(!b){return false}var a=new Request.JSON({method:"post",url:"js/requester.php",data:{remote_class:"MailingList",remote_method:"ajaxWriteMailToB2B",name:escape(b.name),phone:escape(b.phone),email:escape(b.email),subj:escape(b.subj),info:escape(b.info),captcha:escape(b.captcha)},onRequest:(function(){this.submitBtn.wait()
}).bind(this),onFailure:(function(d){new B2BTooltip({anchor:"fmail-send-form-submit",text:"Произошла ошибка соединения<br/>попробуйте позже",delay:3000,offsetLeft:0}).show();
this.submitBtn.normal();this.hide}).bind(this),onSuccess:(function(d){this.submitBtn.normal();if($chk(d.no_captcha)){new B2BTooltip({anchor:"send[captcha]",text:"Не правильно",delay:3000,offsetTop:0,offsetLeft:0}).show()
}else{if($chk(d.mail_not_valid)){new B2BTooltip({anchor:"send[email]",text:"Проверьте правильность ввода",delay:3000,offsetTop:0,offsetLeft:0}).show()
}else{if($chk(d.mail_ok)){this.hide();var e=$("fmail-send-form-captcha-wrap").getChildren()[0];e.destroy();
new Element("img",{src:"./captcha.php?"+d.sn+"="+d.si,alt:""}).inject($("fmail-send-form-captcha-wrap"));
new B2BTooltip({anchor:"form-send-mail-activate",text:"Ваше письмо отправлено.<br/>Спасибо!",delay:4000,offsetTop:20,offsetLeft:-300}).show()
}}}}).bind(this)}).send()}});B2BMailingForm=new Class({Implements:[Options],DEFAULT_EMAIL_MSG:"Ваш e-mail",MAIL_EXISTS:"Данный e-mail уже<br/>используется для рассылки",MAIL_NOT_EXISTS:"Данный e-mail не<br/>используется для рассылки",MAIL_NOT_VALID:"Проверьте правильность<br/>введёного вами e-mail'а",MAIL_OK:"На введёный Вами e-mail было <br/>отправлено письмо с подтвеждением",MAIL_DELETED_OK:"Введёный e-mail удалён из рассылки",AJAX_ERROR:"Произошла ошибка соединения<br/>попробуйте позже",initialize:function(a){this.setOptions(a);
this.submitBtn=new B2BButtonLoad({anchor:"mailing-list-submit-btn",text:"Подписаться",onClick:this.onSubmitClick.bindWithEvent(this)});
this.unSubmitBtn=new B2BButtonLoad({anchor:"mailing-list-unsubmit-btn",text:"Отписаться",onClick:this.onUnSubmitClick.bindWithEvent(this)});
$("mailing-list-email").value=this.DEFAULT_EMAIL_MSG;$("mailing-list-email").addEvent("blur",(function(b){var c=$("mailing-list-email");
if(!$chk(c.value)||c.value==this.DEFAULT_EMAIL_MSG){c.value=this.DEFAULT_EMAIL_MSG;c.setStyle("color","#AAA")
}}).bind(this));$("mailing-list-email").addEvent("focus",(function(b){var c=$("mailing-list-email");if(!$chk(c.value)||c.value==this.DEFAULT_EMAIL_MSG){c.value="";
c.setStyle("color","#191C1E")}}).bind(this))},onSubmitClick:function(c){c.stop();var a=$("mailing-list-email").value.clean();
if(!$chk(a)||a==this.DEFAULT_EMAIL_MSG){new B2BTooltip({anchor:"mailing-list-email",text:"Введите e-mail",delay:3000,offsetLeft:-80,offsetTop:-20}).show();
return false}var b=new Request.JSON({method:"post",url:"js/requester.php",data:{remote_class:"MailingList",remote_method:"ajaxSubmitMailing",email:escape(a)},onRequest:(function(){this.submitBtn.wait()
}).bind(this),onFailure:(function(d){new B2BTooltip({anchor:"mailing-list-email",text:"Произошла ошибка соединения<br/>попробуйте позже",delay:3000,offsetLeft:-80}).show();
this.submitBtn.normal()}).bind(this),onSuccess:(function(d){var e=null;if($chk(d.mail_exists)){e=this.MAIL_EXISTS
}else{if($chk(d.mail_ok)){e=this.MAIL_OK}else{if($chk(d.mail_not_valid)){e=this.MAIL_NOT_VALID}else{if($chk(d.ajax_error)){e=this.AJAX_ERROR
}}}}new B2BTooltip({anchor:"mailing-list-email",text:e,delay:4000,offsetLeft:-80,offsetTop:-20}).show();
this.submitBtn.normal()}).bind(this)}).send()},onUnSubmitClick:function(c){c.stop();var a=$("mailing-list-email").value.clean();
if(!$chk(a)||a==this.DEFAULT_EMAIL_MSG){new B2BTooltip({anchor:"mailing-list-email",text:"Введите e-mail",delay:3000,offsetLeft:-80,offsetTop:-20}).show();
return false}var b=new Request.JSON({method:"post",url:"js/requester.php",data:{remote_class:"MailingList",remote_method:"ajaxUnSubmitMailing",email:escape(a)},onRequest:(function(){this.unSubmitBtn.wait()
}).bind(this),onFailure:(function(d){new B2BTooltip({anchor:"mailing-list-email",text:"Произошла ошибка соединения<br/>попробуйте позже",delay:3000,offsetLeft:-80}).show();
this.unSubmitBtn.normal()}).bind(this),onSuccess:(function(d){var e=null;if($chk(d.mail_not_exists)){e=this.MAIL_NOT_EXISTS
}else{if($chk(d.mail_deleted_ok)){e=this.MAIL_DELETED_OK}else{if($chk(d.mail_not_valid)){e=this.MAIL_NOT_VALID
}else{if($chk(d.ajax_error)){e=this.AJAX_ERROR}}}}new B2BTooltip({anchor:"mailing-list-email",text:e,delay:4000,offsetLeft:-80,offsetTop:-20}).show();
this.unSubmitBtn.normal()}).bind(this)}).send()}});B2BRegistrationFormMini=new Class({Implements:[Options],initialize:function(a){this.setOptions(a);
this.ofertaLinks=new Array();this.ofertaLinks[0]="#";this.ofertaLinks[2]="/docs/b2b_rd_oferta.pdf";this.ofertaLinks[3]="/docs/b2b_rr_oferta.pdf";
this.ofertaLinks[5]="/docs/b2b_ra_oferta.pdf";this.rulesLinks=new Array();this.rulesLinks[0]="#";this.rulesLinks[2]="/docs/b2b_rd_rules.pdf";
this.rulesLinks[3]="/docs/b2b_rr_rules.pdf";this.rulesLinks[5]="#";this.options.form=$(this.options.form);
window.addEvent("domready",(function(){this.make();this.onRoleChange(null)}).bind(this));return this},make:function(){this.submitBtn=new B2BButtonLoad({anchor:"registration-form-submit",text:"зарегистрироваться",onClick:this.onSubmitClick.bindWithEvent(this)});
if($chk(this.options.role)){switch(this.options.role){case 2:$("reg[role]1").checked=true;break;case 3:$("reg[role]2").checked=true;
break;case 5:$("reg[role]3").checked=true;break}$("reg[role]").value=this.options.role}$("reg[role]").addEvent("change",this.onRoleChange.bind(this));
$("reg[role]1").addEvent("change",this.onRole1Change.bind(this));$("reg[role]2").addEvent("change",this.onRole2Change.bind(this));
$("reg[role]3").addEvent("change",this.onRole3Change.bind(this));this.onRoleChange(null)},onRole1Change:function(a){$("reg[role]").value=2;
this.onRoleChange(null)},onRole2Change:function(a){$("reg[role]").value=3;this.onRoleChange(null)},onRole3Change:function(a){$("reg[role]").value=5;
this.onRoleChange(null)},onRoleChange:function(a){var b=parseInt($("reg[role]").value);switch(b){case 2:case 5:$("reg_company_label").set("html","Компания");
break;case 3:$("reg_company_label").set("html","Сайт");break}},onSubmitClick:function(f){f.stop();var d=$("reg[email]").value.clean();
if(!$chk(d)){new B2BTooltip({anchor:"reg[email]",text:"Введите e-mail",delay:3000}).show();return false
}var b=$("reg[name]").value.clean();if(!$chk(b)){new B2BTooltip({anchor:"reg[name]",text:"Введите имя",delay:3000}).show();
return false}var a=$("reg[company]").value.clean();if(!$chk(a)){new B2BTooltip({anchor:"reg[company]",text:"Введите название компании",delay:3000}).show();
return false}var g=$("reg[role]").value.clean();if(!$chk(g)){new B2BTooltip({anchor:"reg[role]",text:"Выберите роль",delay:3000}).show();
return false}var c=$("reg[captcha]").value.clean();if(!$chk(c)){new B2BTooltip({anchor:"reg[captcha]",text:"Введите символы",delay:3000}).show();
return false}var e=new Request.JSON({method:"post",url:"js/requester.php",data:{remote_class:"FEUsers",remote_method:"regUserPopup",captcha:escape(c),email:escape(d),uname:escape(b),company:escape(a),role:g},onRequest:(function(){this.submitBtn.wait()
}).bind(this),onFailure:(function(h){new B2BTooltip({anchor:"mailing-list-email",text:"Произошла ошибка соединения<br/>попробуйте позже",delay:3000,offsetLeft:-80}).show();
this.submitBtn.normal()}).bind(this),onSuccess:(function(h){this.submitBtn.normal();if($chk(h.reg_ok)){var i=null;
i="Регистрация прошла успешно!<br/>Вы сможете начать работу после активации<br/>аккаунта нашими менеджерами!<br/>Спасибо!";
new B2BTooltip({anchor:"registration-form-submit",text:i,offsetLeft:-180,offsetTop:-20}).show();return true
}else{if($chk(h.email_exists)){i="Данный e-mail уже зарегистрирован"}else{if($chk(h.no_captcha)){i="Неправильно введены символы<br/>показанные на изображении"
}else{if($chk(h.email_not_valid)){i="Проверьте правильность ввода e-mail'a"}else{if($chk(h.ajax_error)){i="Произошла ошибка соединения<br/>попробуйте позже"
}}}}}new B2BTooltip({anchor:"registration-form-submit",text:i,delay:4000,offsetLeft:-80,offsetTop:-20}).show()
}).bind(this)}).send()}});