var mmRegAPI=mm.registration;var mmCP=null;var mmYahoo=mm.yahoo;var mmReg={init:function(A){if(!A){mm.phrases._load("loading_providers,loading_vendors,loading_devices,select_provider,select_vendor,select_device,countries,service_providers,most_popular_vendors,all_vendors,most_popular_devices,all_devices,please_select_vendor,cant_find_phone,enter_model_name_here,cant_find_vendor,enter_vendor_name_here,cant_find_service_provider,enter_service_provider_name_here",null,{onSuccess:function(){mmReg.init(true)}});return false}mmReg.devices.imgContainer().setOpacity(0).block();setTimeout(function(){$("CustomDevice").observe("focus",function(C){var B=Event.element(C);if(mmReg.devices.customDeviceText==""){mmReg.devices.customDeviceText=B.value}if(B.value==mmReg.devices.customDeviceText){B.value="";B.style.color="#333"}});$("CustomDevice").observe("blur",function(C){var B=Event.element(C);if(B.value==""){B.value=mmReg.devices.customDeviceText;B.style.color="#666";B.up(1).removeClassName("select1_selected")}else{B.up(1).addClassName("select1_selected")}})},1);setTimeout(function(){document.observe("mouseup",function(C){var B=Event.element(C);var D=B.ancestors();var E=true;D.each(function(F){if(F.className&&F.hasClassName("select_list_container1")){E=false}});if(E){mmReg.hideSelect()}if(!B.hasClassName("select1_active")&&B.up(0)&&!B.up(0).hasClassName("select1_active")){$$(".select1_active").each(function(F){F.removeClassName("select1_active")})}})},1);$$(".select1").each(function(B){setTimeout(function(){B.observe("focus",function(){B.hideFocus=true;mmReg.hideSelect();$$(".select1_active").each(function(C){C.removeClassName("select1_active")});B.up(0).addClassName("select1_active")});B.observe("blur",function(){var C=true;$$(".select_list1").each(function(D){if(D.visible()){C=false}});if(C){$$(".select1_active").each(function(D){D.removeClassName("select1_active")})}});B.observe("keydown",function(F){var E=(F.which||F.keyCode);var C=B.id.replace("select_","");var D="select_list_"+C+"_container";if(E==Event.KEY_RETURN||E==32){mmReg.showSelect(D,B)}})},1)});setTimeout(function(){document.observe("keydown",function(C){var B=(C.which||C.keyCode);if(B==Event.KEY_ESC){$$(".popupMessage").invoke("hide");mmReg.hideSelect()}})},1);mmReg.prepareSelects();mmReg.initReg()},prepareSelects:function(){$$(".select_list1").each(function(A){setTimeout(function(){A.observe("keydown",function(C){var F=Event.element(C);var K=(C.which||C.keyCode);var G=A.id.replace("select_list_","");var J=$("select_"+G);var E=mmReg[G].active;var B=null;var H=A;var I=mmReg[G].items;var D=G=="devices"?6:1;if(F.className!="select_list1_cantFind_text"){if(K==Event.KEY_DOWN||K==Event.KEY_END){Event.stop(C);if(E){if((I.indexOf(E)+D)>(I.length-1)){B=I[0];H.scrollTop=0}else{if(K==Event.KEY_END){B=I[I.length-1];H.scrollTop=(B.cumulativeOffset()[1])}else{B=I[I.indexOf(E)+D];if(B.className=="top_devices_option_divider"){lngCounter=1;(function(){B=I[I.indexOf(E)+D+lngCounter];if(B.className=="top_devices_option_divider"){lngCounter++;arguments.callee()}})()}}}if(B.className.indexOf("top")!=-1){E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");B.addClassName("top_"+G+"_option_hover")}else{E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");B.addClassName("select_list_option_hover")}}else{B=I[0];H.scrollTop=0;if(K==Event.KEY_END){B=I[I.length-1];H.scrollTop=(B.cumulativeOffset()[1])}if(B.className.indexOf("top")!=-1){B.addClassName("top_"+G+"_option_hover")}else{B.addClassName("select_list_option_hover")}}mmReg[G].active=B;if((B.cumulativeOffset()[1]+(B.getHeight()+20))>(H.cumulativeOffset()[1]+H.getHeight()+H.scrollTop)){H.scrollTop=H.scrollTop+B.getHeight()}if(G=="devices"){B.onmouseover()}}else{if(K==Event.KEY_RIGHT){Event.stop(C);if(E){if((I.indexOf(E)+1)>(I.length-1)){B=I[0];H.scrollTop=0}else{if(K==Event.KEY_END){B=I[I.length-1];H.scrollTop=(B.cumulativeOffset()[1])}else{B=I[I.indexOf(E)+1];if(B.className=="top_devices_option_divider"){lngCounter=2;(function(){B=I[I.indexOf(E)+lngCounter];if(B.className=="top_devices_option_divider"){lngCounter++;arguments.callee()}})()}}}if(B.className.indexOf("top")!=-1){E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");B.addClassName("top_"+G+"_option_hover")}else{E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");B.addClassName("select_list_option_hover")}}else{B=I[0];H.scrollTop=0;if(K==Event.KEY_END){B=I[I.length-1];H.scrollTop=(B.cumulativeOffset()[1])}if(B.className.indexOf("top")!=-1){B.addClassName("top_"+G+"_option_hover")}else{B.addClassName("select_list_option_hover")}}mmReg[G].active=B;if((B.cumulativeOffset()[1]+(B.getHeight()+20))>(H.cumulativeOffset()[1]+H.getHeight()+H.scrollTop)){H.scrollTop=H.scrollTop+B.getHeight()}if(G=="devices"){B.onmouseover()}}else{if(K==Event.KEY_UP||K==Event.KEY_HOME){Event.stop(C);if(E){if((I.indexOf(E)-D)<0){B=I[I.length-1];H.scrollTop=(B.cumulativeOffset()[1])}else{if(K==Event.KEY_HOME){B=I[0];H.scrollTop=0}else{B=I[I.indexOf(E)-D];if(B.className=="top_devices_option_divider"){lngCounter=1;(function(){B=I[I.indexOf(E)-D-lngCounter];if(B.className=="top_devices_option_divider"){lngCounter++;arguments.callee()}})()}}}if(B.className.indexOf("top")!=-1){E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");B.addClassName("top_"+G+"_option_hover")}else{E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");B.addClassName("select_list_option_hover")}}else{B=I[I.length-1];H.scrollTop=(B.cumulativeOffset()[1]);if(K==Event.KEY_HOME){B=I[0];H.scrollTop=0}if(B.className.indexOf("top")!=-1){B.addClassName("top_"+G+"_option_hover")}else{B.addClassName("select_list_option_hover")}}mmReg[G].active=B;if((B.cumulativeOffset()[1]-20)<(H.cumulativeOffset()[1]+H.scrollTop)){H.scrollTop=H.scrollTop-B.getHeight()}if(G=="devices"){B.onmouseover()}}else{if(K==Event.KEY_LEFT){Event.stop(C);if(E){if((I.indexOf(E)-1)<0){B=I[I.length-1];H.scrollTop=(B.cumulativeOffset()[1])}else{if(K==Event.KEY_HOME){B=I[0];H.scrollTop=0}else{B=I[I.indexOf(E)-1];if(B.className=="top_devices_option_divider"){lngCounter=2;(function(){B=I[I.indexOf(E)-lngCounter];if(B.className=="top_devices_option_divider"){lngCounter++;arguments.callee()}})()}}}if(B.className.indexOf("top")!=-1){E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");B.addClassName("top_"+G+"_option_hover")}else{E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");B.addClassName("select_list_option_hover")}}else{B=I[I.length-1];H.scrollTop=(B.cumulativeOffset()[1]);if(K==Event.KEY_HOME){B=I[0];H.scrollTop=0}if(B.className.indexOf("top")!=-1){B.addClassName("top_"+G+"_option_hover")}else{B.addClassName("select_list_option_hover")}}mmReg[G].active=B;if((B.cumulativeOffset()[1]-20)<(H.cumulativeOffset()[1]+H.scrollTop)){H.scrollTop=H.scrollTop-B.getHeight()}if(G=="devices"){B.onmouseover()}}else{if(K==Event.KEY_RETURN||K==32){if(E){$(mmReg[G].active).onmousedown()}else{H.hide();J.focus()}}else{var L=String.fromCharCode(K).toLowerCase();I=I.findAll(function(M){return(M.className!="top_devices_option_divider"&&M.innerHTML.substr(M.innerHTML.indexOf(">")+1,1).toLowerCase()==L)});I.each(function(N,M){B=N;if(E){E.removeClassName("top_"+G+"_option_hover");E.removeClassName("select_list_option_hover");if(B.innerHTML.substr(0,1).toLowerCase()==E.innerHTML.substr(0,1).toLowerCase()){if(I[I.indexOf(E)+1]&&I[I.indexOf(E)+1].innerHTML.substr(I[I.indexOf(E)+1].innerHTML.indexOf(">")+1,1).toLowerCase()==L){B=I[I.indexOf(E)+1]}}}if(B.className.indexOf("top")!=-1){B.addClassName("top_"+G+"_option_hover")}else{B.addClassName("select_list_option_hover")}mmReg[G].active=B;if((B.cumulativeOffset()[1]+(B.getHeight()*2))>(H.cumulativeOffset()[1]+H.getHeight()+H.scrollTop)){H.scrollTop=(B.cumulativeOffset()[1]-H.cumulativeOffset()[1]-H.getHeight()+(B.getHeight()*2))}if((B.cumulativeOffset()[1]-B.getHeight())<(H.cumulativeOffset()[1]+H.scrollTop)){H.scrollTop=(B.cumulativeOffset()[1]-H.cumulativeOffset()[1]-B.getHeight())}if(G=="devices"){B.onmouseover()}throw $break})}}}}}}})},1);setTimeout(function(){A.observe("mousedown",function(C){var B=Event.element(C);if(B.className!="select_list1_cantFind_text"){Event.stop(C)}})},1)})},initReg:function(B,A){if(mm.user.deviceId!=undefined){A=mm.user.deviceId}this.service_provider=0;this.vendor=0;this.device=0;mmRegAPI.init();mmRegAPI.countries.get({onSuccess:function(){mmReg.countries.set(mm.site.countryId,A)}});$$(".message_failure").invoke("hide")},page:"",showSelect:function(C,B){selectList=$(C.replace(/_container/ig,""));C=$(C);B=$(B);if(selectList&&selectList.innerHTML!=""){mmReg.hideSelect();var A=selectList.id.replace("select_list_","");var D=$(mmReg[A].selected);selectList.select(".top_"+A+"_option_hover",".select_list_option_hover").invoke("removeClassName","top_"+A+"_option_hover").invoke("removeClassName","select_list_option_hover");C.style.position="absolute";$(C).clonePosition($(B),{setHeight:false,setWidth:false,offsetTop:17,offsetLeft:-8});C.block();setTimeout(function(){selectList.focus()},100);selectList.scrollTop=0;if(D){if((D.cumulativeOffset()[1]+(D.getHeight()*2))>(selectList.cumulativeOffset()[1]+selectList.getHeight()+selectList.scrollTop)){selectList.scrollTop=(D.cumulativeOffset()[1]-selectList.cumulativeOffset()[1]-selectList.getHeight()+(D.getHeight()*2))}if((D.cumulativeOffset()[1]-D.getHeight())<(selectList.cumulativeOffset()[1]+selectList.scrollTop)){selectList.scrollTop=(D.cumulativeOffset()[1]-selectList.cumulativeOffset()[1]-D.getHeight())}}}},hideSelect:function(){if(mmReg.devices.active&&mmReg.devices.selected&&$("select_list_devices_container")&&$("select_list_devices_container").visible()&&mmReg.devices.imgContainer().getOpacity()==0){var A=mmReg.devices.selected.replace(/devices/ig,"").replace(/popular/ig,"");mmRegAPI.devices.listAll.each(function(B){if(B.id==A){mmReg.devices.previewContainer().hide();mmReg.devices.set(B.id,B.n,B.img,B.e,true);throw $break}})}else{if(!mmReg.devices.setting&&mmReg.devices.previewContainer()){mmReg.devices.previewContainer().hide()}}$$(".select_list_container1").invoke("hide")},countries:{build:function(){var E=Builder.node("div");var D=$("select_list_countries");D.scrollTop=0;var B=$("select_country");var C=0;var A=null;this.items=[];this.active=null;this.selected=null;E.appendChild(Builder.node("span",{className:"select_list_heading"},mm.phrases.countries));mmRegAPI.countries.listAll.each(function(F){setTimeout(function(){A=Builder.node("a",{id:"countries"+F.id,className:"select_list_option",onmousedown:'mmReg.countries.set("countries'+F.id+'");return false;'},F.n);E.appendChild(A);mmReg.countries.items.push($(A))},1);C++});D.appendChild(E);if(C>10){D.addClassName("select_list1_max_height")}else{D.removeClassName("select_list1_max_height")}},items:[],set:function(F,B){mm.countryId=String(F).replace("countries","");this.selected=String(F).replace("countries","");this.active=$(F);mmRegAPI.countries.listAll.each(function(G){if(G.id==F){mm.countryCode=G.code;mm.countryName=G.n;mm.countryDomain=G.domain;throw $break}});var D=$("select_serviceProviders");if(D){D.innerHTML=mm.phrases.loading_providers;D.addClassName("select_loading1");var A=0;var C=0;A=mm.user.providerId;C=mm.user.vendorId;setTimeout(function(){mmRegAPI.serviceProviders.get({onSuccess:function(){mmReg.serviceProviders.build(A)}})},1);setTimeout(function(){var G=$("select_vendors");G.innerHTML=mm.phrases.loading_vendors;G.addClassName("select_loading1");mmRegAPI.vendors.get({onSuccess:function(){mmReg.vendors.build(C,B)}})},1);$("select_devices").innerHTML=mm.phrases.please_select_vendor;var E=$("select_list_devices");E.innerHTML="";E.style.visibility="hidden";mmReg.devices.imgContainer().setOpacity(0)}},selected:null,active:null},serviceProviders:{build:function(H){var A=Builder.node("div");var D=$("select_list_serviceProviders");var F=$("select_serviceProviders");if(F){D.scrollTop=0;D.innerHTML="";var E=0;this.items=[];this.active=null;this.selected=null;A.appendChild(Builder.node("span",{className:"select_list_heading"},mm.phrases.service_providers));mmRegAPI.serviceProviders.listAll.each(function(I){if(I.cId==mm.countryId){newItem=Builder.node("a",{id:"serviceProvider"+I.id,className:"select_list_option",onmousedown:'mmReg.serviceProviders.set("serviceProvider'+I.id+'", "'+I.n+'");return false;'},I.n);A.appendChild(newItem);mmReg.serviceProviders.items.push($(newItem));E++}});var C=Builder.node("div",{className:"select_list1_cantFind"},[Builder.node("div",{className:"blackH1"},[Builder.node("text",mm.phrases.cant_find_service_provider)]),Builder.node("div",mm.phrases.enter_service_provider_name_here+":")]);var B="";if(mm.user.customProviderName){var B=mm.user.customProviderName}var G=Builder.node("input",{type:"text",autoComplete:"off",id:"select_list_serviceProviders_cantFind",className:"select_list1_cantFind_text",value:B});$(G).observe("keyup",function(I){mmReg.autoComplete.run(this,{list:"serviceProviders"},I)});C.appendChild(G);C.appendChild(Builder.node("div",{id:"select_list_serviceProviders_autoComplete",className:"select_list_vendors_autoComplete",onclick:"return false;"}));A.appendChild(C);mmReg.autoComplete.init(G,"serviceProviders");D.appendChild(A);if(E>10){D.addClassName("select_list1_max_height")}else{D.removeClassName("select_list1_max_height")}F.innerHTML=mm.phrases.select_provider;F.removeClassName("select_loading1");if(H){if(Number(H)!=0){mmRegAPI.serviceProviders.listAll.each(function(I){if(I.id==H){mmReg.serviceProviders.set(I.id,I.n);throw $break}})}}if(mm.user.customProviderName){mmReg.serviceProviders.set(0,mm.user.customProviderName)}if(mmReg.serviceProviders.items.length==1){mmReg.serviceProviders.items[0].onmousedown()}}},items:[],set:function(C,A){this.selected=String(C);$("ServiceProviderId").value=String(C).replace(/serviceProvider/ig,"").replace(/popular/ig,"");$("ServiceProviderName").value=A;if(C=="0"){$("CustomServiceProvider").value=A;$("ServiceProviderId").value="";$("ServiceProviderName").value=""}this.active=$(this.selected)?$(this.selected):$("serviceProvider"+this.selected);$("select_list_serviceProviders").select(".select_list_option_active").invoke("removeClassName","select_list_option_active");if(this.active!=undefined){this.active.addClassName("select_list_option_active")}var B=$("select_serviceProviders");B.innerHTML=A;B.up(1).addClassName("select1_selected");$("select_list_serviceProviders_container").hide();if($("select_serviceProviders").visible()&&$("select_serviceProviders").getStyle("display")!="none"){$("select_serviceProviders").focus()}},selected:null,active:null},vendors:{build:function(L,G){var I=Builder.node("div");var A=$("select_list_vendors");var H=$("select_vendors");if(A){A.scrollTop=0;A.innerHTML="";var C=0;this.items=[];this.active=null;this.selected=null;var J=Builder.node("div",{className:"top_vendors"});J.appendChild(Builder.node("div",{className:"select_list_heading"},mm.phrases.most_popular_vendors));mmRegAPI.vendors.listTop.each(function(M){if(M.cId==mm.countryId&&M.p!=0){setTimeout(function(){imgURL="img/novendor.png";if(M.img!=""){imgURL=mmRegAPI.vendors.baseImgURL+M.img}newItem=Builder.node("a",{id:"vendorsPopular"+M.id,className:"top_vendors_option",onmousedown:'mmReg.vendors.set("vendorsPopular'+M.id+'","'+M.n+'");',style:"background-image:url("+imgURL+")"},M.n);J.appendChild(newItem);mmReg.vendors.items.push($(newItem))},1);C++;if(C==5){throw $break}}});I.appendChild(J);var K=Builder.node("div",{className:"all_vendors"});K.appendChild(Builder.node("div",{className:"select_list_heading"},mm.phrases.all_vendors));var B="";mmRegAPI.vendors.listAll.each(function(M){setTimeout(function(){if(M.n.substr(0,1).toLowerCase()!=B){newItem=Builder.node("div",{className:"top_vendors_option_divider"},M.n.substr(0,1).toUpperCase());K.appendChild(newItem);mmReg.vendors.items.push($(newItem))}newItem=Builder.node("a",{id:"vendors"+M.id,className:"select_list_option",onmousedown:'mmReg.vendors.set("vendors'+M.id+'","'+M.n+'");'},M.n);K.appendChild(newItem);mmReg.vendors.items.push($(newItem.id));B=M.n.substr(0,1).toLowerCase()},1);C++});I.appendChild(K);var F=Builder.node("div",{className:"select_list1_cantFind"},[Builder.node("div",{className:"blackH1"},[Builder.node("text",mm.phrases.cant_find_vendor)]),Builder.node("div",mm.phrases.enter_vendor_name_here+":")]);var D="";if(mm.user.customVendorName){D=mm.user.customVendorName}var E=Builder.node("input",{type:"text",autoComplete:"off",id:"select_list_vendors_cantFind",className:"select_list1_cantFind_text",value:D});$(E).observe("keyup",function(M){mmReg.autoComplete.run(this,{list:"vendors"},M)});F.appendChild(E);F.appendChild(Builder.node("div",{id:"select_list_vendors_autoComplete",className:"select_list_vendors_autoComplete",onclick:"return false;"}));I.appendChild(F);mmReg.autoComplete.init(E,"vendors");A.appendChild(I);if(C>8){A.addClassName("select_list1_max_height")}else{A.removeClassName("select_list1_max_height")}A.style.height="235px";H.innerHTML=mm.phrases.select_vendor;H.removeClassName("select_loading1");H.focus();if(L){if(Number(L)!=0){mmRegAPI.vendors.listAll.each(function(M){if(M.id==L){mmReg.vendors.set(L,M.n,G);throw $break}})}}if(mm.user.customVendorName){mmReg.vendors.set(0,mm.user.customVendorName)}}},items:[],set:function(D,A,C){mmReg.devices.active=null;mmReg.devices.selected=null;var B=$("select_vendors");B.innerHTML=A;B.up(1).addClassName("select1_selected");$("select_list_vendors_container").hide();mmReg.devices.imgContainer().setOpacity(0);this.selected=String(D);$("VendorId").value=this.selected.replace(/vendors/ig,"").replace(/popular/ig,"");$("VendorName").value=A;if(D=="0"){$("CustomVendor").value=A;$("VendorId").value="";$("VendorName").value=""}this.active=$(this.selected)?$(this.selected):$("vendors"+this.selected);$("select_list_vendors").select(".select_list_option_active",".top_vendors_option_active").invoke("removeClassName","select_list_option_active").invoke("removeClassName","top_vendors_option_active");if(this.active!=undefined){if(String(D).indexOf("Popular")!=-1){this.active.addClassName("top_vendors_option_active")}else{this.active.addClassName("select_list_option_active")}}$("emailClientWarning").hide();if(B.visible()&&B.getStyle("display")!="none"){B.focus()}if(D==0){$("select_devices").hide().up(1).removeClassName("select1_selected");if(mm.user.customDeviceName){$("CustomDevice").value=mm.user.customDeviceName}$("CustomDevice").block();$("DeviceId").value="";$("DeviceName").value=""}else{$("select_devices").block();$("CustomDevice").hide();mmReg.devices.build(this.selected,mm.countryId,C)}},selected:null,active:null},devices:{build:function(R,L,J){R=String(R).replace("vendors","").replace("Popular","");var D=$("select_devices");if(D){D.innerHTML=mm.phrases.loading_devices;D.addClassName("select_loading1");D.up(1).removeClassName("select1_selected");var T=false;var E=false;if(mmRegAPI.devices.listAll.length>0){mmRegAPI.devices.listAll.each(function(Y){if(Y.cId==L&&Y.vId==R){T=true;throw $break}});if(mmRegAPI.devices.listTop.length>0){mmRegAPI.devices.listTop.each(function(Y){if(Y.cId==L&&Y.vId==R&&Y.p!=0){E=true;throw $break}if(Y.cId==L&&Y.vId==R&&Y.p==0){throw $break}})}}if(!T){mmRegAPI.devices.get(R,{onSuccess:function(){mmReg.devices.build(R,L,J)}});return false}var B=Builder.node("div");var F=$("select_list_devices");var P=$("select_list_devices_container");F.scrollTop=0;F.innerHTML="";var I=0;var X="";var S="";var V=null;this.items=[];bolBreak=false;mmRegAPI.devices.sprites.each(function(Z){if(Z.vId==R){S=mm.baseURL.img+"images/device/sprite/"+Z.sprite;var Y=new Image();Y.src=S;throw $break}});if(E){var G=Builder.node("div",{className:"top_devices"});G.appendChild(Builder.node("div",{className:"select_list_heading"},mm.phrases.most_popular_devices.replace(/\{0\}/ig,$("select_vendors").innerHTML)));var U=G.appendChild(Builder.node("div"));mmRegAPI.devices.listTop.each(function(Y){if(Y.cId==L&&Y.vId==R&&Y.p!=0){if(I==6){U=G.appendChild(Builder.node("div"))}if(Y.img!=""){X="background-image:url("+S+");background-position:-"+((Y.c*63)-15)+"px 1px;";strImgURL=mmRegAPI.devices.baseImgURL+Y.img}else{X="background-image:url("+S+");background-position:14px 1px;";strImgURL=mm.path.skin+"default_device.jpg"}newItem=Builder.node("a",{id:"devicesPopular"+Y.id,style:X,className:"top_devices_option",onmousedown:'mmReg.devices.set("devicesPopular'+Y.id+'", "'+Y.n+'", "'+Y.img+'",'+Y.e+");return false;",onmouseover:'mmReg.devices.startPreview(this,"'+strImgURL+'");'},Y.n);U.appendChild(newItem);mmReg.devices.items.push($(newItem));I++;if(I==12){throw $break}}});if(I<11){if(I<7){for(i=0;i<(6-I);i++){newItem=Builder.node("div",{className:"top_devices_option_divider",style:"border:0px;background-image:none;"});U.appendChild(newItem);mmReg.devices.items.push($(newItem))}}else{for(i=0;i<(12-I);i++){newItem=Builder.node("div",{className:"top_devices_option_divider",style:"border:0px;background-image:none;"});U.appendChild(newItem);mmReg.devices.items.push($(newItem))}}}B.appendChild(G)}var W=Builder.node("div",{className:"top_devices"});W.appendChild(Builder.node("div",{className:"select_list_heading"},mm.phrases.all_devices.replace(/\{0\}/ig,$("select_vendors").innerHTML)));var H=0;var A=W.appendChild(Builder.node("div"));var Q="";var O=0;newItem=Builder.node("a",{id:"devices0",style:"background-image:url("+S+");background-position:14px 1px;display:none;",className:"top_devices_option",onmousedown:'mmReg.devices.set("devices0", "", "",false);return false;',onmouseover:'mmReg.devices.startPreview(this,"'+mm.path.skin+'default_device.jpg");'},"");A.appendChild(newItem);mmRegAPI.devices.listAll.each(function(Y){if(Y.vId==R){if(H==6){H=0;A=W.appendChild(Builder.node("div"))}if(Y.n.substr(0,1).toLowerCase()!=Q){newItem=Builder.node("div",{className:"top_devices_option_divider"},Y.n.substr(0,1).toUpperCase());H++;A.appendChild(newItem);mmReg.devices.items.push($(newItem))}if(H==6){H=0;A=W.appendChild(Builder.node("div"))}if(Y.img!=""){X="background-image:url("+S+");background-position:-"+((Y.c*63)-15)+"px 1px;";strImgURL=mmRegAPI.devices.baseImgURL+Y.img}else{X="background-image:url("+S+");background-position:14px 1px;";strImgURL=mm.path.skin+"default_device.jpg"}newItem=Builder.node("a",{id:"devices"+Y.id,style:X,className:"top_devices_option",onmousedown:'mmReg.devices.set("devices'+Y.id+'", "'+Y.n+'", "'+Y.img+'",'+Y.e+");return false;",onmouseover:'mmReg.devices.startPreview(this,"'+strImgURL+'");'},Y.n);A.appendChild(newItem);mmReg.devices.items.push($(newItem));Q=Y.n.substr(0,1).toLowerCase();H++;I++}});B.appendChild(W);try{document.execCommand("BackgroundImageCache",false,true)}catch(N){}var K=Builder.node("div",{className:"select_list1_cantFind"},[Builder.node("div",{className:"blackH1"},[Builder.node("text",mm.phrases.cant_find_phone)]),Builder.node("div",mm.phrases.enter_model_name_here+":")]);var M="";if(mm.user.customDeviceName){M=mm.user.customDeviceName}var C=Builder.node("input",{type:"text",autoComplete:"off",id:"select_list_devices_cantFind",className:"select_list1_cantFind_text",value:M});$(C).observe("keyup",function(Y){mmReg.autoComplete.run(this,{list:"devices"},Y)});K.appendChild(C);K.appendChild(Builder.node("div",{id:"select_list_devices_autoComplete",className:"select_list_devices_autoComplete",onclick:"return false;"}));$(K).observe("mouseover",function(){if(mm.browser.agent()=="MSIE"){mmReg.devices.previewContainer().addClassName("mm_dialog_container_no_shadow")}mmReg.devices.previewFade=new Effect.Fade(mmReg.devices.previewContainer(),{duration:0.3,afterFinish:function(){mmReg.devices.previewContainer().removeClassName("mm_dialog_container_no_shadow")}})});B.appendChild(K);mmReg.autoComplete.init(C,"devices");F.appendChild(B);if(I>8){F.addClassName("select_list1_max_height");if(E){F.style.height="300px"}}else{F.removeClassName("select_list1_max_height");F.style.height=""}P.style.marginLeft="-90px";F.style.width="485px";F.style.visibility="visible";D.innerHTML=mm.phrases.select_device;D.removeClassName("select_loading1");if(J!=undefined){if(Number(J)!=0){mmRegAPI.devices.listAll.each(function(Y){if(Y.id==J){(function(){var Z=arguments.callee;if($("devices"+Y.id)){mmReg.devices.set(Y.id,Y.n,Y.img,Y.e,true)}else{setTimeout(function(){Z()},100)}})();throw $break}})}if(mm.user.customDeviceName!=undefined&&mm.user.customDeviceName!=""){mmReg.devices.set(0,mm.user.customDeviceName,"",null,true)}}mmReg.devices.imgContainer().setOpacity(0).block();mmReg.devices.previewContainer().clonePosition(mmReg.devices.imgContainer(),{setHeight:false,setWidth:false})}},items:[],set:function(B,A,D,F,I){this.previewSelected=true;B=String(B);this.setting=true;$("DeviceId").value=B.replace(/devices/ig,"").replace(/popular/ig,"");$("DeviceName").value=A;if(B=="0"){$("CustomDevice").value=A;$("DeviceId").value="";$("DeviceName").value=""}this.active=$(B)?$(B):$("devices"+B);this.selected=this.active.id;$("select_list_devices").select(".select_list_option_active",".top_devices_option_active").invoke("removeClassName","select_list_option_active").invoke("removeClassName","top_devices_option_active");if(this.active!=undefined){this.active.addClassName("top_devices_option_active")}var G=$("select_devices");G.up(1).addClassName("select1_selected");G.innerHTML=A;$("select_list_devices_container").hide();if($("select_devices").visible()&&$("select_devices").getStyle("display")!="none"){$("select_devices").focus()}if(F==false){$("emailClientWarning").block();$("no_email_client").innerHTML=$("select_vendors").innerHTML+" "+A}else{$("emailClientWarning").hide()}if(I){imgURL=mm.path.img+"www/skins/default/default_device.jpg";if(D!=""){imgURL=mmRegAPI.devices.baseImgURL+D}this.imgContainer().innerHTML="";this.imgContainer().appendChild(Builder.node("img",{src:imgURL}));this.imgContainer().innerHTML+=A;this.imgContainer().appear({duration:0.5});mmReg.devices.previewSelected=false;mmReg.devices.setting=false}else{if(mmReg.devices.previewContainer().getOpacity()==0||!mmReg.devices.previewContainer().visible()){imgURL=mm.path.img+"www/skins/default/default_device.jpg";if(D!=""&&D!=undefined){imgURL=mmRegAPI.devices.baseImgURL+D}mmReg.devices.previewImg().innerHTML='<div><img src="'+imgURL+'" /></div>'+A.truncate(13);mmReg.devices.imgContainer().setOpacity(0);mmReg.devices.previewContainer().setOpacity(1);mmReg.devices.previewContainer().setStyle({top:mmReg.autoComplete.previewPos[1]+document.viewport.getScrollOffsets().top,left:mmReg.autoComplete.previewPos[0]});mmReg.devices.previewContainer().block()}var E=this.previewImg().down(0).innerHTML+A.truncate(12);this.previewImg().innerHTML=E;this.imgContainer().innerHTML=E;var C=this.previewImg().firstDescendant();var H=this.imgContainer().viewportOffset();if(this.previewAnim!=null){this.previewAnim.cancel()}this.previewAnim=new Effect.Move(this.previewContainer(),{x:(H[0]-7),y:(H[1]-3+document.viewport.getScrollOffsets().top),mode:"absolute",duration:0.3,afterFinish:function(){mmReg.devices.imgContainer().setOpacity(1);if(mm.browser.agent()=="MSIE"){mmReg.devices.previewContainer().addClassName("mm_dialog_container_no_shadow")}mmReg.devices.previewContainer().fade({duration:0.2,afterFinish:function(){mmReg.devices.previewContainer().removeClassName("mm_dialog_container_no_shadow")}});mmReg.devices.previewSelected=false;mmReg.devices.setting=false}});new Effect.Scale(C,84.5,{duration:0.3})}},customDeviceText:"",setting:false,selected:null,active:null,imgContainer:function(){return $("deviceImgContainer")},previewImg:function(){return $("devicesPreview")},previewName:function(){return $("devicesPreviewName")},previewContainer:function(){return $("devicesPreviewContainer")},previewContainerShadows:null,previewAnim:null,previewFade:null,previewFading:false,previewAnimating:false,previewSelected:false,previewPushAway:function(){if(!this.previewSelected){this.previewAnimating=true;if(this.previewAnim!=null){this.previewAnim.cancel()}var A=mm.browser.agent()=="MSIE"?Effect.Transitions.EaseTo:Effect.Transitions.sinoidal;this.previewAnim=new Effect.Move(this.previewContainer(),{x:-90,y:-110,duration:0.2,transition:A,afterFinish:function(){mmReg.devices.previewAnimating=false}});setTimeout(function(){if(!mmReg.devices.previewAnimating){if(mmReg.devices.previewFade!=null){mmReg.devices.previewFade.cancel()}if(mm.browser.agent()=="MSIE"){mmReg.devices.previewContainer().addClassName("mm_dialog_container_no_shadow")}mmReg.devices.previewFade=new Effect.Fade(mmReg.devices.previewContainer(),{duration:0.3,afterFinish:function(){mmReg.devices.previewContainer().removeClassName("mm_dialog_container_no_shadow")}})}},300)}},startPreview:function(B,C){mmReg.devices.previewAnimating=true;var A=B.innerHTML;if(mmReg.devices.previewFade!=null){mmReg.devices.previewFade.cancel()}mmReg.devices.imgContainer().setOpacity(0);mmReg.devices.previewImg().innerHTML='<div><img src="'+C+'" /></div>'+A.truncate(13);mmReg.devices.previewContainer().block().removeClassName("mm_dialog_container_no_shadow");if(mmReg.devices.previewAnim!=null){mmReg.devices.previewAnim.cancel()}mmReg.devices.previewContainer().setOpacity(1);ePosition=B.viewportOffset();mmReg.devices.previewAnim=new Effect.Move(mmReg.devices.previewContainer(),{x:(ePosition[0]-102),y:(ePosition[1]-156+document.viewport.getScrollOffsets().top),mode:"absolute",duration:0.3,afterFinish:function(){mmReg.devices.previewAnimating=false}})}},autoComplete:{init:function(B,A){$(B).observe("keydown",function(G){var E=(G.which||G.keyCode);var J=mmReg.autoComplete.active;var C=null;var D=$("select_list_"+A+"_autoComplete_list");var I=mmReg.autoComplete.items;var F=1;if(E==Event.KEY_DOWN||E==Event.KEY_END){Event.stop(G);if(J){if((I.indexOf(J)+F)>(I.length-1)){C=I[0];D.scrollTop=0}else{if(E==Event.KEY_END){C=I[I.length-1];D.scrollTop=(C.cumulativeOffset()[1])}else{C=I[I.indexOf(J)+F]}}J.removeClassName("select_list_option_hover");C.addClassName("select_list_option_hover")}else{C=I[0];D.scrollTop=0;if(E==Event.KEY_END){C=I[I.length-1];D.scrollTop=(C.cumulativeOffset()[1])}C.addClassName("select_list_option_hover")}if(A=="devices"){strImgUrl=mm.path.img+"www/skins/default/default_device.jpg";if(C.lang!=""){strImgUrl=mmRegAPI.devices.baseImgURL+C.lang}var H=$("select_list_"+A+"_autoComplete_preview");H.innerHTML='<div><img src="'+strImgUrl+'" /></div>'+C.innerHTML.truncate(14)}mmReg.autoComplete.active=C;if((C.cumulativeOffset()[1]+(C.getHeight()+20))>(D.cumulativeOffset()[1]+D.getHeight()+D.scrollTop)){D.scrollTop=D.scrollTop+C.getHeight()}}else{if(E==Event.KEY_UP||E==Event.KEY_HOME){Event.stop(G);if(J){if((I.indexOf(J)-F)<0){C=I[I.length-1];D.scrollTop=(C.cumulativeOffset()[1])}else{if(E==Event.KEY_HOME){C=I[0];D.scrollTop=0}else{C=I[I.indexOf(J)-F]}}J.removeClassName("select_list_option_hover");C.addClassName("select_list_option_hover")}else{C=I[I.length-1];D.scrollTop=(C.cumulativeOffset()[1]);if(E==Event.KEY_HOME){C=I[0];D.scrollTop=0}C.addClassName("select_list_option_hover")}if(A=="devices"){strImgUrl=mm.path.img+"www/skins/default/default_device.jpg";if(C.lang!=""){strImgUrl=mmRegAPI.devices.baseImgURL+C.lang}var H=$("select_list_"+A+"_autoComplete_preview");H.innerHTML='<div><img src="'+strImgUrl+'" /></div>'+C.innerHTML.truncate(14)}mmReg.autoComplete.active=C;if((C.cumulativeOffset()[1]-20)<(D.cumulativeOffset()[1]+D.scrollTop)){D.scrollTop=D.scrollTop-C.getHeight()}}else{if(E==Event.KEY_RETURN){if(J){mmReg.autoComplete.active.onmousedown()}else{mmReg[A].set(0,B.value)}}}}})},run:function(D,A,B){var I=(B.which||B.keyCode);if(I!=Event.KEY_DOWN&&I!=Event.KEY_END&&I!=Event.KEY_RETURN&&I!=Event.KEY_LEFT&&I!=Event.KEY_UP&&I!=Event.KEY_RIGHT&&I!=Event.KEY_HOME&&I!=Event.KEY_PAGEUP&&I!=Event.KEY_PAGEDOWN&&I!=Event.KEY_TAB&&I!=Event.KEY_ESC){D=$(D);var F=$("select_list_"+A.list);var C=$("select_list_"+A.list+"_autoComplete");C.innerHTML="";mmReg.autoComplete.items=[];mmReg.autoComplete.active=null;var J=D.value.toLowerCase();var H=String(mmReg.vendors.selected).replace("vendors","").replace("Popular","");if(J.length>1){if(A.list=="serviceProviders"){var G=Builder.node("div",{id:"select_list_serviceProviders_autoComplete_list",className:"select_list_vendors_autoComplete_list"});mmRegAPI.serviceProviders.listAll.each(function(K){if(K.n.toLowerCase().indexOf(J)!=-1){if(mmReg.autoComplete.items.length==0){newItem=Builder.node("a",{id:"serviceProvider"+K.id+"_autoComplete",className:"select_list_option select_list_option_hover",onmousedown:'mmReg.serviceProviders.set("serviceProvider'+K.id+'", "'+K.n+'");return false;'},K.n);mmReg.autoComplete.active=$(newItem)}else{newItem=Builder.node("a",{id:"serviceProvider"+K.id+"_autoComplete",className:"select_list_option",onmousedown:'mmReg.serviceProviders.set("serviceProvider'+K.id+'", "'+K.n+'");return false;'},K.n)}$(newItem).observe("mouseover",function(M){var L=Event.element(M);mmReg.autoComplete.active.removeClassName("select_list_option_hover");L.addClassName("select_list_option_hover");mmReg.autoComplete.active=L});G.appendChild(newItem);mmReg.autoComplete.items.push($(newItem))}});if(mmReg.autoComplete.items.length>0){C.appendChild(G);if(!C.visible()){C.block();new Effect.Tween(F,F.scrollTop,F.scrollTop+158,{duration:0.5},function(K){this.scrollTop=K.round()})}}}else{if(A.list=="vendors"){var G=Builder.node("div",{id:"select_list_vendors_autoComplete_list",className:"select_list_vendors_autoComplete_list"});mmRegAPI.vendors.listAll.each(function(K){if(K.n.toLowerCase().indexOf(J)!=-1){if(mmReg.autoComplete.items.length==0){newItem=Builder.node("a",{id:"vendors"+K.id+"_autoComplete",className:"select_list_option select_list_option_hover",onmousedown:'mmReg.vendors.set("vendors'+K.id+'","'+K.n+'");return false;'},K.n);mmReg.autoComplete.active=$(newItem)}else{newItem=Builder.node("a",{id:"vendors"+K.id+"_autoComplete",className:"select_list_option",onmousedown:'mmReg.vendors.set("vendors'+K.id+'","'+K.n+'");return false;'},K.n)}$(newItem).observe("mouseover",function(M){var L=Event.element(M);mmReg.autoComplete.active.removeClassName("select_list_option_hover");L.addClassName("select_list_option_hover");mmReg.autoComplete.active=L});G.appendChild(newItem);mmReg.autoComplete.items.push($(newItem))}});if(mmReg.autoComplete.items.length>0){C.appendChild(G);if(!C.visible()){C.block();new Effect.Tween(F,F.scrollTop,F.scrollTop+158,{duration:0.5},function(K){this.scrollTop=K.round()})}}}else{if(A.list=="devices"){var E=Builder.node("div",{id:"select_list_devices_autoComplete_preview"});var G=Builder.node("div",{id:"select_list_devices_autoComplete_list",className:"select_list_devices_autoComplete_list"});mmRegAPI.devices.listAll.each(function(K){if(K.vId==H&&K.n.toLowerCase().indexOf(J)!=-1){if(mmReg.autoComplete.items.length==0){strImgUrl=mm.path.img+"www/skins/default/default_device.jpg";if(K.img!=""){strImgUrl=mmRegAPI.devices.baseImgURL+K.img}E.innerHTML='<div><img src="'+strImgUrl+'" /></div>'+K.n.truncate(14);newItem=Builder.node("a",{id:"devices"+K.id+"_autoComplete",lang:K.img,className:"select_list_option select_list_option_hover",onmousedown:'mmReg.devices.set("devices'+K.id+'", "'+K.n+'", "'+K.img+'",'+K.e+");return false;"},K.n);mmReg.autoComplete.active=$(newItem)}else{newItem=Builder.node("a",{id:"devices"+K.id+"_autoComplete",lang:K.img,className:"select_list_option",onmousedown:'mmReg.devices.set("devices'+K.id+'", "'+K.n+'", "'+K.img+'",'+K.e+");return false;"},K.n)}$(newItem).observe("mouseover",function(M){var L=Event.element(M);strImgUrl=mm.path.img+"www/skins/default/default_device.jpg";if(L.lang!=""){strImgUrl=mmRegAPI.devices.baseImgURL+L.lang}E.innerHTML='<div><img src="'+strImgUrl+'" /></div>'+K.n.truncate(14);mmReg.autoComplete.active.removeClassName("select_list_option_hover");L.addClassName("select_list_option_hover");mmReg.autoComplete.active=L});G.appendChild(newItem);mmReg.autoComplete.items.push($(newItem))}});if(mmReg.autoComplete.items.length>0){C.appendChild(E);C.appendChild(G);if(!C.visible()){C.block();new Effect.Tween(F,F.scrollTop,F.scrollTop+158,{duration:0.5,afterFinish:function(){mmReg.autoComplete.previewPos=$("select_list_devices_autoComplete_preview").viewportOffset()}},function(K){this.scrollTop=K.round()})}}else{strImgUrl=mm.path.img+"www/skins/default/default_device.jpg";E.innerHTML='<div><img src="'+strImgUrl+'" /></div>'+J.truncate(14);C.appendChild(E);if(!C.visible()){C.block();new Effect.Tween(F,F.scrollTop,F.scrollTop+158,{duration:0.5,afterFinish:function(){mmReg.autoComplete.previewPos=$("select_list_devices_autoComplete_preview").viewportOffset()}},function(K){this.scrollTop=K.round()})}}}}}}}},items:[],selected:null,active:null,previewPos:null},activePage:null};var mmRegistrationFileLoaded="null";
var mmAjaxFileLoaded='null';
