var $rExp={any:/^.*$/,email:/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9][-a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)$/,link:/^(http\:\/\/|https\:\/\/|www\.)[0-9a-zA-Z]{2,}\.[0-9a-zA-Z\:\_\+\=\?\-\&\.\/]{2,}$/,link_inline:/(ftp:\/\/|http:\/\/|https:\/\/|www\.)(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/,icq:/^[0-9\-\s]{5,}$/,captcha:/^[0-9a-zA-Z\.\,\-\$\(\)]{1,}\s[0-9a-zA-Z\.\,\-\$\(\)]{1,}$/,username:/^[a-zA-Z]{1}[a-zA-Z0-9\-\_\.]{4,18}[a-zA-Z0-9]{1}$/,password:/^[a-zA-Z]{1}[a-zA-Z0-9\-\_\.]{4,18}[a-zA-Z0-9]{1}$/,phone:/^[0-9\-\s\(\)\+\-]{5,20}$/,empty:/.*/};var regExpPassword=$rExp.password;var regExpUsername=$rExp.username;var regExpEmail=$rExp.email;var regExpPhone=$rExp.phone;var currentPage=document.location.href;var InstantMessangerWindow=null;var AuthorizedUser=false;Prototype.Browser=(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{version:(b.match(/.+(?:me|ox|on|rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b),IE6:(!this.opera&&/msie 6/i.test(b)),IE7:(!this.opera&&/msie 7/i.test(b)),IE8:(!this.opera&&/msie 8/i.test(b)),Mozilla:/firefox/i.test(b),Chrome:/chrome/i.test(b),Safari:(!(/chrome/i.test(b))&&/webkit|safari|khtml/i.test(b)),Iphone:/iphone/i.test(b),Ipod:/ipod/i.test(b),Iphone4:/iphone.*OS 4/i.test(b),Ipod4:/ipod.*OS 4/i.test(b),Ipad:/ipad/i.test(b),Mobile:/iphone|ipod|ipad|opera mini|opera mobi/i.test(b)}})();Ajax.Request.prototype.abort=function(){this.transport.onreadystatechange=Prototype.emptyFunction();this.transport.abort();Ajax.activeRequestCount--};String.prototype.replaceAll=function(b,a){return $A(this.split(b)).each(function(c){c.replace(b,a)}).join(a)};function isEnter(b){var a;if(window.event){a=window.event.keyCode}else{if(b){a=b.which}else{return false}}if(a==13){return true}else{return false}}function change_language(a){new Ajax.Request("/users/changelanguage/"+a,{method:"post",onComplete:function(b){window.location.reload()}})}function checkRegForm(b){var a=true;if($F("UserDetail0Trademark").length==0){new Effect.Highlight("UserDetail0Trademark_t",{duration:2,restorecolor:"#fff"});new Effect.Highlight("UserDetail0Trademark",{duration:2,restorecolor:"#fff"});$("UserDetail0Trademark_e").show();a=false}else{$("UserDetail0Trademark_e").hide()}if($("UserDetail1Trademark")&&$F("UserDetail1Trademark").length==0){new Effect.Highlight("UserDetail1Trademark_t",{duration:2,restorecolor:"#fff"});new Effect.Highlight("UserDetail1Trademark",{duration:2,restorecolor:"#fff"});$("UserDetail1Trademark_e").show();a=false}else{if($("UserDetail1Trademark")){$("UserDetail1Trademark_e").hide()}}if($F("UserDetail0Address").length==0){new Effect.Highlight("UserDetail0Address_t",{duration:2,restorecolor:"#fff"});new Effect.Highlight("UserDetail0Address",{duration:2,restorecolor:"#fff"});$("UserDetail0Address_e").show();a=false}else{$("UserDetail0Address_e").hide()}if($("UserDetail1Address")&&$F("UserDetail1Address").length==0){new Effect.Highlight("UserDetail1Address_t",{duration:2,restorecolor:"#fff"});new Effect.Highlight("UserDetail1Address",{duration:2,restorecolor:"#fff"});$("UserDetail1Address_e").show();a=false}else{if($("UserDetail1Address")){$("UserDetail1Address_e").hide()}}if($F("User.city_id").length==0){new Effect.Highlight("User.city_id_t",{duration:2,restorecolor:"#fff"});new Effect.Highlight("User.city_id",{duration:2,restorecolor:"#fff"});$("User.city_id_e").show();a=false}else{$("User.city_id_e").hide()}if($F("Contact0Value").length==0){new Effect.Highlight("Contact0Value_t",{duration:2,restorecolor:"#fff"});new Effect.Highlight("Contact0Value",{duration:2,restorecolor:"#fff"});$("Contact0Value_e").show();a=false}else{$("Contact0Value_e").hide()}if($F("UserPicture")!=1){new Effect.Highlight("logo_table",{duration:2,restorecolor:"#fff"});$("UserPicture_e").show();a=false}else{$("UserPicture_e").hide()}if((!$("new_product_groups"))||($F("new_product_groups").length==0&&!$("subsubgroups_list_td").select("input[type=checkbox]").find(function(c){if(c.checked){return true}}))){new Effect.Highlight("groups_table",{duration:2,restorecolor:"#fff"});$("groups_e").show();a=false}else{$("groups_e").hide()}if(a){return true}return false}function checkFirstRegForm(){if(!regExpPassword.test($F("UserPassword1"))){new Effect.Highlight("UserPassword1",{duration:2,restorecolor:"#fff"});$("password_notice").update($L.ERROR0005);return false}else{$("password_notice").update($L.GEN0068)}if(!regExpPassword.test($F("UserPasswordConfirmation"))||$F("UserPasswordConfirmation")!=$F("UserPassword1")){new Effect.Highlight("UserPasswordConfirmation",{duration:2,restorecolor:"#fff"});$("password_confirmation_notice").update($L.ERROR0006);return false}else{$("password_confirmation_notice").update($L.GEN0069)}if(!regExpUsername.test($F("UserUsername"))){$("user_notice").update($L.ERROR0002);new Effect.Highlight("UserUsername",{duration:2,restorecolor:"#fff"});return false}else{$("user_notice").update($L.GEN0066)}if(!regExpEmail.test($F("UserEmail"))){new Effect.Highlight("UserEmail",{duration:2,restorecolor:"#fff"});$("email_notice").update($L.ERROR0004);return false}else{$("email_notice").update($L.GEN0067)}if($F("recaptcha_response_field")==""){new Effect.Highlight("recaptcha_response_field",{duration:2,restorecolor:"#fff"});return false}if($("agree_check").checked==false){new Effect.Highlight("agree_check_td",{duration:2,restorecolor:"#fff"});return false}return true}function addslashes(a){return a.split("").join("\\")}function FormatNumberLength(a,c){var b=""+a;while(b.length<c){b="0"+b}return b}function randomNumber(a,b){a=parseInt(a);b=parseInt(b);return Math.floor(Math.random()*(b-a+1))+a}var Base64={keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(c){var a="";var k,h,f="";var j,g,e,d="";var b=0;do{k=c.charCodeAt(b++);h=c.charCodeAt(b++);f=c.charCodeAt(b++);j=k>>2;g=((k&3)<<4)|(h>>4);e=((h&15)<<2)|(f>>6);d=f&63;if(isNaN(h)){e=d=64}else{if(isNaN(f)){d=64}}a=a+this.keyStr.charAt(j)+this.keyStr.charAt(g)+this.keyStr.charAt(e)+this.keyStr.charAt(d);k=h=f="";j=g=e=d=""}while(b<c.length);return a},decode:function(d){var b="";var l,j,g="";var k,h,f,e="";var c=0;var a=/[^A-Za-z0-9\+\/\=]/g;if(a.exec(d)){alert("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, �+�, �/�, and �=�\nExpect errors in decoding.")}d=d.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{k=this.keyStr.indexOf(d.charAt(c++));h=this.keyStr.indexOf(d.charAt(c++));f=this.keyStr.indexOf(d.charAt(c++));e=this.keyStr.indexOf(d.charAt(c++));l=(k<<2)|(h>>4);j=((h&15)<<4)|(f>>2);g=((f&3)<<6)|e;b=b+String.fromCharCode(l);if(f!=64){b=b+String.fromCharCode(j)}if(e!=64){b=b+String.fromCharCode(g)}l=j=g="";k=h=f=e=""}while(c<d.length);return b}};function composeMultipartPostBody(a){var d="";var c=$(a);var f=Math.random();var b=c.getInputs("file");var e=c.serialize(true);$H(e).each(function(g){if(g.value.length<200){d+="--"+f+'\r\nContent-Disposition: form-data;name="'+g.key+'"\r\n\r\n'+g.value+"\r\n"}else{d+="--"+f+'\r\nContent-Disposition: form-data;name="'+g.key+'";'+g.value+"\r\n"}});d+="--"+f+"--\r\n";return{content:d,boundary:f}}function composeMultipartPostBody2(a){var c="";var b=$(a);var e=Math.random();var d=b.serialize(true);$H(d).each(function(f){c+="--"+e+'\r\nContent-Disposition: form-data;name="'+f.key+'"\r\n\r\n'+f.value+"\r\n"});c+="--"+e+"--\r\n";return{content:c,boundary:e}}function storeImageData(a,b){$(a).value=b}function initTextareaMaxlength(){$$("textarea").each(function(a){if(!a.readAttribute("maxlength")){return}a.stopObserving("keydown",textareaMaxlengthKeyDown);a.observe("keydown",textareaMaxlengthKeyDown);a.stopObserving("blur",textareaMaxlengthBlur);a.observe("blur",textareaMaxlengthBlur)})}function textareaMaxlengthKeyDown(b){var a=b.target;key=b.charCode||b.keyCode;if((key==32)||(key==13)||(key>47)&&!(b.altKey||b.ctrlKey)){if(a.value.length>=a.readAttribute("maxlength")){b.stop()}}}function textareaMaxlengthBlur(b){var a=b.target;if(a.value.length>=a.readAttribute("maxlength")){a.value=a.value.substr(0,a.readAttribute("maxlength"))}}var Cookie={set:function(c,e,a,h,d,g){var b=new Date();b.setTime(b.getTime());if(a){a=a*1000*60*60*24}var f=new Date(b.getTime()+(a));document.cookie=c+"="+escape(e)+((a)?";expires="+f.toGMTString():"")+((h)?";path="+h:"")+((d)?";domain="+d:"")+((g)?";secure":"")},get:function(a){var f=document.cookie.split(";");var b="";var d="";var e="";var c=false;for(i=0;i<f.length;i++){b=f[i].split("=");d=b[0].replace(/^\s+|\s+$/g,"");if(d==a){c=true;if(b.length>1){e=unescape(b[1].replace(/^\s+|\s+$/g,""))}return e;break}b=null;d=""}if(!c){return null}}};function setCookie(b,d,a,f,c,e){return Cookie.set(b,d,a,f,c,e)}function getCookie(a){return Cookie.get(a)}var AccountMenus=new Array();var AccountMenu=Class.create({initialize:function(b){this.account=b.account;this.menu=$("menu"+this.account);this.triggers=$$("img.logo"+this.account);var a=this.triggers.find(function(c){if(c.id==""){return true}});a.identify();this.trigger=a;this.timeout=null;this.trigger.observe("mouseover",this.show.bind(this));this.trigger.observe("mouseout",this.hide.bind(this));this.menu.observe("mouseover",this._hold.bind(this));this.menu.observe("mouseout",this.hide.bind(this));this.menu.observe("click",this.hide.bind(this));AccountMenus.push(this)},show:function(a){a.stop();this._calcCoordinates();clearTimeout(this.timeout);this.timeout=setTimeout(function(){this.menu.setStyle({left:this.x+"px",top:this.y+"px"}).show()}.bind(this),200)},hide:function(a){this.event=a;clearTimeout(this.timeout);this.timeout=setTimeout(function(){this.menu.hide()}.bind(this),200)},_calcCoordinates:function(){this.x=this.trigger.cumulativeOffset().left+this.trigger.getWidth()-20;this.y=this.trigger.cumulativeOffset().top+this.trigger.getHeight()-20},_hold:function(a){clearTimeout(this.timeout)}});function sendGuestMessage(a){new Ajax.Request("/profile/add_to_im_contacts/"+a,{method:"post",onSuccess:function(c){var b=c.responseJSON;if(b.code==1){openIM(this.user_id)}}.bind({user_id:a})})}function openIM(a){if((InstantMessangerWindow&&!InstantMessangerWindow.closed)){InstantMessangerWindow.focus();if(a){InstantMessangerWindow.InstantMessanger.selectContact(null,"contact"+a)}}else{if(!a){a=""}InstantMessangerWindow=window.open("/im/index/"+a,"instantmessanger","menubar=no,width=970,height=500,toolbar=no,scrollbars=no,status=no,resizable=no,location=no",true)}}function addAccountTo(a,c,b){new Ajax.Request("/profile/add_to_"+c+"/"+a,{method:"post",onSuccess:function(e){var d=e.responseJSON;if(d.code==1){is_profile=document.location.href.indexOf("/profile");is_search=document.location.href.indexOf("/search");if(is_profile==-1){reloadAccountMenu(a)}else{updateContent(currentPage,true)}}}.bind(({user_id:a}))})}function removeAccountFrom(a,b){new Ajax.Request("/profile/remove_from_"+b+"/"+a,{method:"post",onSuccess:function(d){var c=d.responseJSON;if(c.code==1){is_profile=document.location.href.indexOf("/profile");if(is_profile==-1){reloadAccountMenu(a)}else{updateContent(currentPage,true)}}}.bind(({user_id:a}))})}function moveAccountTo(a,b){new Ajax.Request("/profile/move_to_"+b+"/"+a,{method:"post",onSuccess:function(d){var c=d.responseJSON;if(c.code==1){is_profile=document.location.href.indexOf("/profile");if(is_profile==-1){reloadAccountMenu(a)}else{updateContent(currentPage,true)}}}.bind(({user_id:a}))})}function reloadAccountMenu(a){new Ajax.Request("/profile/get_account_menu/"+a,{method:"post",onSuccess:function(b){$("menu"+this.user_id).replace(b.responseText)}.bind({user_id:a})})}document.observe("dom:loaded",init);function init(){initTextareaMaxlength();if(AuthorizedUser){new PeriodicalExecuter(updateCounters,25)}var b=$("search_context");var a=$("search_submit_link");b.addClassName("t-empty");b.value=$L.GEN0239;b.observe("focus",function(d){var c=d.element();c.removeClassName("t-empty");if(c.value==$L.GEN0239){c.value=""}});b.observe("blur",function(d){var c=d.element();if(c.value==""){c.addClassName("t-empty");c.value=$L.GEN0239}});a.observe("click",function(c){c.stop();if(!$("search_context").hasClassName("t-empty")){$("search_form").submit()}else{$("search_context").focus()}return false});$$("img").each(function(c){c.observe("error",function(d){d.stop();d.element().src="/img/expo_white.png"})})}function cd(){if(window.console&&window.console.firebug&&document.location.host.search("dev.")!=0){document.location.href="/pages/index/debugger_detected/"}}function beforeInit(){new PeriodicalExecuter(cd,1)}beforeInit();function ShoesaccessSend(){var a=$("error_div");a.hide();a.select(".notice-message").first().update();var b=new Array();if($F("ShoesaccessName").length==0){b.push($L.ERROR0030)}if($F("ShoesaccessPhone").length==0||!regExpPhone.test($F("ShoesaccessPhone"))){b.push($L.ERROR0031)}if($F("ShoesaccessEmail").length==0||!regExpEmail.test($F("ShoesaccessEmail"))){b.push($L.ERROR0032)}if($F("recaptcha_response_field").length==0){b.push($L.ERROR0033)}if($F("ShoesaccessMessage").length==0){b.push($L.ERROR0033)}if(b.length>0){a.select(".notice-message").first().update($L.GEN0165+" "+b.join(", "));a.show()}else{new Ajax.Request("/users/shoesaccess_send/",{method:"post",parameters:$("ShoesaccessForm").serialize(),onSuccess:function(e){var d=e.responseJSON;var c=$("error_div");if(d.code==1){c.select(".notice-message").first().update($L.GEN0166);c.show();$("ShoesaccessForm").reset()}else{if(d.code==0){c.select(".notice-message").first().update($L.ERROR0035);c.show()}else{if(d.code==-1){c.select(".notice-message").first().update($L.ERROR0036);c.show();$("recaptcha_response_field").value=""}}}Recaptcha.reload()}})}}function ShoesaccessOrderSend(){var a=$("error_div");a.hide();a.select(".notice-message").first().update();var b=new Array();if($F("ShoesaccessCompanyName").length==0){b.push($L.ERROR0037)}if($F("ShoesaccessContactFace").length==0){b.push($L.ERROR0038)}if($F("ShoesaccessPost").length==0){b.push($L.ERROR0039)}if($F("ShoesaccessPhone").length==0||!regExpPhone.test($F("ShoesaccessPhone"))){b.push($L.ERROR0040)}if($F("ShoesaccessCellphone").length==0||!regExpPhone.test($F("ShoesaccessCellphone"))){b.push($L.ERROR0041)}if($F("ShoesaccessEmail").length==0||!regExpEmail.test($F("ShoesaccessEmail"))){b.push($L.ERROR0042)}if($F("ShoesaccessAddress").length==0){b.push($L.ERROR0043)}if($F("ShoesaccessProfile")==""){b.push($L.ERROR0044)}if($F("recaptcha_response_field").length==0){b.push($L.ERROR0033)}if(b.length>0){a.select(".notice-message").first().update($L.GEN0165+" "+b.join(", "));a.show()}else{new Ajax.Request("/users/shoesaccess_order_send/",{method:"post",parameters:$("ShoesaccessForm").serialize(),onSuccess:function(e){var d=e.responseJSON;var c=$("error_div");if(d.code==1){c.select(".notice-message").first().update($L.GEN0166);c.show();$("ShoesaccessForm").reset()}else{if(d.code==0){c.select(".notice-message").first().update($L.ERROR0035);c.show()}else{if(d.code==-1){c.select(".notice-message").first().update($L.ERROR0036);c.show();$("recaptcha_response_field").value=""}}}Recaptcha.reload()}})}}function FlashGetFieldValue(a){if($(a)){return $F(a)}else{return null}}function FlashSetFieldValue(a,b){if($(a)){$(a).value=b}}function FlashGetLangVar(a){return $L[a]}function FlashGetDomain(){return document.location.hostname}function FlashClosePopup(){var a=$F("popupname");Popups[a].remove()}function FlashClosePopupTimed(a){var b=$F("popupname");setTimeout(function(){Popups[b].remove()},a)}function updateCounters(){new Ajax.Request("/users/get_counters/",{method:"post",onComplete:function(b){var a=b.responseJSON;if(a.mails>0){$$(".mails_counter_value").each(function(c){c.update(this.mails)}.bind({mails:a.mails}));$("mails_counter_led").title=$L.PRO0245.replace("%u",a.mails);$("mails_counter_led").src="/img/tb_icons/new_mes.gif"}else{$$(".mails_counter_value").each(function(c){c.update()});$("mails_counter_led").title=$L.PRO0244;$("mails_counter_led").src="/img/tb_icons/mes.png"}if(a.new_guests>0){$$(".guests_counter_value").each(function(c){c.update(this.new_guests)}.bind({new_guests:a.new_guests}));$("guests_counter_led").title=$L.PRO0243.replace("%u",a.new_guests);$("guests_counter_led").src="/img/tb_icons/new_guests.gif"}else{$$(".guests_counter_value").each(function(c){c.update()});$("guests_counter_led").title=$L.PRO0242;$("guests_counter_led").src="/img/tb_icons/guests.png"}if(a.clients>0){$$(".clients_counter_value").each(function(c){c.update(this.clients)}.bind({clients:a.clients}))}else{$$(".clients_counter_value").each(function(c){c.update()})}$$(".profile_mails_counter_value").each(function(c){c.update(this.mails)}.bind({mails:a.mails}));$$(".profile_guests_counter_value").each(function(c){c.update(this.new_guests+"/"+this.guests)}.bind({guests:a.guests,new_guests:a.new_guests}));$$(".profile_clients_counter_value").each(function(c){c.update(this.clients)}.bind({clients:a.clients}));$$(".profile_partners_counter_value").each(function(c){c.update(this.partners)}.bind({partners:a.partners}))},on403:function(){document.location.href="/"}})}var BrowserExt={setHomepage:function(b){if(!b){b=document.location.protocol+"//"+document.location.host+"/"}if(document.all){document.body.style.behavior="url(#default#homepage)";document.body.setHomePage(b)}else{if(window.sidebar&&!Prototype.Browser.Chrome){if(window.netscape){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(c){alert($L.ERROR0052.gsub("<br />","\n"))}}var a=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);a.setCharPref("browser.startup.homepage",b)}else{if(Prototype.Browser.Chrome){alert($L.GEN0190.gsub("<br />","\n"))}else{if(Prototype.Browser.Opera){alert($L.GEN0191.gsub("<br />","\n"))}}}}},setFavorite:function(a){if(!a){a=document.location.protocol+"//"+document.location.host+"/"}if(window.sidebar){window.sidebar.addPanel(document.title,a,"")}else{if(window.external&&Prototype.Browser.IE){window.external.AddFavorite(a,document.title)}else{if(Prototype.Browser.Opera){alert($L.GEN0189)}else{alert($L.GEN0189)}}}}};
