// © SuperSaaS 2012
function showflags(a){accid==-2&&(accid=a,new Ajax.Updater("flagbox","/partials/flags.html",{method:"get"}),$("flagbox").observe("mouseleave",function(){this.hide()})),new Effect.BlindDown("flagbox",{duration:.25})}function changetld(a,b){var c=new String(window.location.protocol+"//"+window.location.host),d=new String(window.location.pathname+window.location.search);/[\?&]lang=(\w\w)/.test(d)?d=d.replace(/([\?&])lang=\w\w/,"$1lang="+a):d+=(d.indexOf("?")==-1?"?":"&")+"lang="+a,/(.*supersaas\.)(co.uk|\w{2,3})(.*)/.test(c)&&b!=RegExp.$2&&window.location.protocol!="https:"?window.location=c+"/api/change_tld/"+accid+"?tld="+b+"&after="+encodeURIComponent(d):window.location=c+d,new Effect.BlindUp("flagbox",{duration:.3})}function toggleSpans(a){for(var b=0;b<=5;b++)b==a?$("alist"+b).show():$("alist"+b).hide(),b<5&&(b==a?$("plist"+b).show():$("plist"+b).hide());a==5?$("plist").hide():$("plist").show();var c=$("account_ask_confirm_0"),d=$("account_ask_confirm_1"),e=$("account_ask_confirm_2");a==3?(c.disabled=!0,d.disabled=!0,e.checked=!0,$("limail").show(),$("liconf").show()):(c.disabled=!1,d.disabled=!1)}function setMailspan(){v=$("account_ask_maillogin").checked,$("mail1").style.display=v?"":"none",$("mail2").style.display=v?"none":""}function download_vcard(){window.location="/users/vcard/"+$("olduser_id").value}function showbox(a,b){displaybox("sbox",null,a.clientX-12,a.clientY-12),aid||$("sbox").observe("mouseleave",function(){this.hide()}),aid=b}function show_activity(a,b){window.location=rps.length==1||rps[a+1]?"/schedule/"+encodeURIComponent(aname)+"/"+encodeURIComponent(rps[a])+"?view=agenda&user="+b:"/users/agenda/"+b,$("sbox")&&$("sbox").hide()}function editbox(a,b,c){c=c||"olduser";for(var d=1;d<chip_fields.length;d++)clearNset(c+"_"+chip_fields[d],chip[b][d]);$("oldservice_su_0")&&($("oldservice_su_"+chip[b][0]).checked=!0),$("olduser_role_3")&&(hidepass&&(chip[b][0]==4?$("olduser_pw").show():$("olduser_pw").hide()),$("olduser_role_3").checked=chip[b][0]==3,$("olduser_role_4")&&($("olduser_role_4").checked=chip[b][0]==4),$("olduser_role_-1").checked=chip[b][0]==-1),c=="oldproduct"&&($("oldproduct_ask_quantity_"+chip[b][0]).checked=!0,tinyMCE.get("oldproduct_description").load()),c=="oldservice"&&($("oldservice_level").className="csel col"+chip[b][4],tinyMCE.get("oldservice_description").load()),displaybox("ebox",c,a.clientX,a.clientY),edtarget=b}function newbox(a){displaybox("dbox","user",a.clientX,a.clientY)}function displaybox(a,b,c,d){var e=$("container"),f=$(a),g=f.style,h=document.viewport.getScrollOffsets().top;$("flash").visible()&&new Effect.Fade("flash"),d+=h,b!=null&&$(a+"error").hide(),g.left=c+"px",g.top=d+"px",g.display="",c+f.offsetWidth>e.offsetWidth&&(c=e.offsetWidth-f.offsetWidth,g.left=c+"px"),document.viewport.getHeight()+h<d+f.offsetHeight&&f.scrollIntoView(!1),b!=null&&($(b+"_xpos").value=c,$(b+"_ypos").value=d)}function clearNset(a,b){var c=$(a);c.parentNode.tagName=="SPAN"&&(c.parentNode.style.padding="0",c.parentNode.style.backgroundColor="white",c.parentNode.style.display="inline"),a.indexOf("country")>0&&build_clist(a,b),a.indexOf("timezone")>0&&build_zone(a,b),c.value=b}function changepass(a){if(hidepass){var b=$(a.id.replace(/role_\d/,"pw"));a.value==4?b.show():b.hide()}}function showIndicator(a){return submitted?!1:(submitted=!0,ProgressImg=$(a),$(a).show(),setTimeout("ProgressImg.src = ProgressImg.src",100),!0)}function view_form(a,b,c){displaybox2("fbox",a.clientX,a.clientY),formcache!=b&&(formcache=b,ajaxobj&&ajaxobj.transport.readyState<4&&(ajaxobj.transport.abort(),ajaxobj=!1),$("content").innerHTML='<div style="padding:30px 50px"><img id="ajaxspin" src="//d304pchb3b61hb.cloudfront.net/img/progress.gif" alt="Busy..."/></div>',ajaxobj=new Ajax.Updater("content","/ajax/form/"+b+(c?"?c="+c:""),{method:"get"}))}function displaybox2(a,b,c){var d=$(a),e=d.style,f=document.viewport.getScrollOffsets().top;b=parseInt(b),c=parseInt(c)+f,e.left=b+"px",e.top=c+"px",d.show(),$("flash").visible()&&new Effect.Fade("flash")}function changeform(a){if(a&&a.value=="")$("form_auth").hide(),$("form")&&$("form").hide();else{$("form_auth").show();if($("form")){a&&($("form_name").innerHTML=a.options[a.selectedIndex].text.escapeHTML());var b=$$(".fshow");b[0].checked||b[1]&&b[1].checked?$("form").show():$("form").hide()}}}function jump_to_form(a,b){var c=new String(window.location);window.location=c+(c.indexOf("?")==-1?"?":"&")+"fid="+a+(b?"&rid="+b:"")}var accid=-2,aid,submitted=!1,ajaxobj=!1,formcache=!1
