var config;var deviceApp;var baseUrl;function initConfig(a){baseUrl=a;config={global:{imageDir:baseUrl+"/images/ap-landingpage/",requiredImages:["pre.jpg","pre_glow.jpg","iphone.jpg","iphone_glow.jpg","bb.jpg","bb_glow.jpg"]},devices:{list:[{id:"devicePre",name:"Pre",url:"pre.jpg",url2:"pre_glow.jpg",infoId:"infoWAP",dropdownIndex:0},{id:"deviceIphone",name:"iPhone",url:"iphone.jpg",url2:"iphone_glow.jpg",infoId:"infoIphone",storeLinkId:"storeLinkiPhone",dropdownIndex:1},{id:"deviceBlackberry",name:"BlackBerry",url:"bb.jpg",url2:"bb_glow.jpg",infoId:"infoBB",storeLinkId:"storeLinkBB",dropdownIndex:2}],loadFirst:0},shareConfig:{mapping:[{id:"deviceBlackberry",shareId:2},{id:"deviceIphone",shareId:3},{id:"devicePre",shareId:1}]}}}var currentDevice,previousDevice;function pInit(b,a){initConfig(b);deviceID="devicePre";if(a){currentDevice=getDeviceId(a)}else{currentDevice=config.devices.loadFirst}phoneNumber=document.getElementById("phoneNumber");loader=new ImageLoader(initializeDone);loader.setImageUrls(config.global.requiredImages);loader.startLoading()}function initializeDone(){selectDevice(currentDevice)}function focusDevice(a){document.getElementById("bubbleEnter").style.display="block";document.getElementById("bubbleSubmitted").style.display="none";if(currentDevice!=a){previousDevice=currentDevice;unselectDevice(previousDevice);currentDevice=a;selectDevice(currentDevice)}}function getShareId(c){var b=config.devices.list[c].id;for(var a=0;a<config.shareConfig.mapping.length;a++){if(b==config.shareConfig.mapping[a].id){return config.shareConfig.mapping[a].shareId}}}function getDeviceId(b){var c;for(var a=0;a<config.shareConfig.mapping.length;a++){if(b==config.shareConfig.mapping[a].shareId){c=config.shareConfig.mapping[a].id}}for(var a=0;a<config.devices.list.length;a++){if(c==config.devices.list[a].id){return a}}}function unselectDevice(c){var b=document.getElementById(config.devices.list[c].id);b.src=config.global.imageDir+config.devices.list[c].url;var d=document.getElementById(config.devices.list[c].infoId);d.style.display="none";var a;if(a=document.getElementById(config.devices.list[c].storeLinkId)){a.style.display="none"}}function selectDropdown(c,b){for(var a=0;a<c.options.length;a++){if(c.options[a].value==b){c.options[a].selected=true}}}function selectDevice(c){var b=document.getElementById(config.devices.list[c].id);b.src=config.global.imageDir+config.devices.list[c].url2;var d=document.getElementById(config.devices.list[c].infoId);d.style.display="block";var a;if(a=document.getElementById(config.devices.list[c].storeLinkId)){a.style.display="block"}selectDropdown(document.getElementById("handset"),getShareId(c))}function phoneNumberFocus(){if(phoneNumber.value=="Your Phone Number"){phoneNumber.value="";phoneNumber.className=""}}function phoneNumberBlur(){if(phoneNumber.value=="Your Phone Number"||phoneNumber.value==""){phoneNumber.value="Your Phone Number";phoneNumber.className="gray"}}Object.prototype.bind=function(b,a){var c=this;return function(){return c.apply(b,a)}};function ImageLoader(a){this.m_callback=a;this.m_imagesLoaded=0;this.m_imageUrls=[];this.m_images=[]}ImageLoader.prototype.setImageUrls=function(a){this.m_imagesLoaded=0;this.m_imageUrls=a;this.m_images=new Array(a.length)};ImageLoader.prototype.imageUrls=function(){return this.m_imageUrls};ImageLoader.prototype.startLoading=function(){var a;for(var a=0;a<this.m_imageUrls.length;++a){var b=new Image();b.onload=function(d,c){this._imageLoaded(d,c)}.bind(this,[b,a]);b.src=config.global.imageDir+this.m_imageUrls[a]}};ImageLoader.prototype._imageLoaded=function(b,a){this.m_images[a]=b;++this.m_imagesLoaded;if(this.m_imagesLoaded==this.m_imageUrls.length){this.m_callback()}};function demoSubmit(){phone=document.getElementById("phoneNumber");if(phone.value=="Your Phone Number"||phone.value==""){document.getElementById("errorPhone").style.display="block"}else{document.getElementById("errorPhone").style.display="none";document.getElementById("bubbleEnter").style.display="none";document.getElementById("bubbleSubmitted").style.display="block"}};
