function populateMemberArray(n){n.infobox=null,memberArray.push(n),setHtml(n.identifier)}function setHtml(n){var t=famMapHtml.replace("{memberName}",memberArray[n].firstName);t=t.replace("{memberName}",memberArray[n].firstName),t=t.replace("{identifier}",memberArray[n].identifier),t=t.replace("{color}","#"+memberArray[n].accentColor),t=t.replace("{color}","#"+memberArray[n].accentColor),memberArray[n].latitude==null||memberArray[n].error?(t=t.replace("{memberLocationInformation1}",memberArray[n].errorMessage),t=t.replace("{memberLocationInformation2}",""),t=t.replace("{memberLocationInformation3}",memberArray[n].locationMessage3),t=t.replace("{ViewDetailsLink}",memberArray[n].forwardUrl),t=t.replace("/Images/familymap_pointer2.png","/Images/familymap_pointer2_grey.png")):(t=t.replace("{memberLocationInformation1}",memberArray[n].locationMessage1),t=t.replace("{memberLocationInformation2}",memberArray[n].locationMessage2),t=t.replace("{memberLocationInformation3}",memberArray[n].locationMessage3),t=t.replace("{ViewDetailsLink}",memberArray[n].forwardUrl),t=t.replace("/Images/familymap_pointer2_grey.png","/Images/familymap_pointer2.png")),memberArray[n].renderHtml=t}function GeocodeExecute(n){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",n),document.body.appendChild(t)}function GeocodeCallback(n){if(n&&n.resourceSets&&n.resourceSets.length>0&&n.resourceSets[0].resources&&n.resourceSets[0].resources.length>0){var t=n.resourceSets[0].resources[0].address;bingCallback(t.formattedAddress)}else bingCallback("")}var phoneService,progressBarMethods,pagination;(function(n){var r,f=n('input[name="__RequestVerificationToken"]').val(),t={isPreferredEmailEmpty:!1,newEmail:"",currEmail:"",init:function(){n("#updateEmailPopup").modalDialog(),t.currEmail=n("#newEmailInput").val(),n("#updateEmailLink").click(t.show),n("#updateEmail").click(t.execute)},show:function(i){i.preventDefault(),n("#newEmailInput, #confirmEmailInput").val(t.currEmail),n("#updateEmailError").hide(),n("#updateEmailPopup").trigger("show")},error:function(t){n("#updateEmailError").html(t).show()},validate:function(){var i=n("#confirmEmailInput").val();return t.newEmail!=i?(t.error(r.strings.emailMatch),!1):t.newEmail.length>0&&!t.newEmail.match(r.emailRegex)?(t.error(r.strings.emailRegex),!1):!0},execute:function(i){if(i.preventDefault(),t.newEmail=n("#newEmailInput").val(),t.isPreferredEmailEmpty=t.newEmail.length==0,t.validate()){var u={email:t.newEmail,__RequestVerificationToken:f};n.ajax({type:"POST",url:r.urls.updateEmail,data:u,cache:!1,success:t.succeeded,error:t.failed})}},succeeded:function(i){i.Success?(t.currEmail=t.newEmail,t.isPreferredEmailEmpty?n("#preferredEmail").html(r.strings.userLiveIdMemberName):n("#preferredEmail").html(t.newEmail),n("#updateEmailPopup").trigger("hide")):t.error(r.strings.emailError)},failed:function(){t.error(r.strings.emailError)}},u={init:function(){n("#removePopup").modalDialog(),n("#removeLink").click(u.show),n("#removePhone").click(u.execute)},show:function(t){t.preventDefault(),n("#removePopup .error").hide(),n("#removePopup").trigger("show")},execute:function(){var t={deleteBackups:n("#WipeBackupsOnRemoveCheckbox").is(":checked"),__RequestVerificationToken:f};n.ajax({type:"POST",url:r.urls.removeDevice,data:t,cache:!1,success:u.succeeded,error:u.failed})},succeeded:function(t){t.Success?window.location.href=r.urls.accountPage:n("#removePopup .error").show()},failed:function(){n("#removePopup .error").show()}},i={currPhoneNumber:"",currRegion:"",currDisclaimer:"",init:function(){i.currDisclaimer=n("#disclaimerCheckbox").attr("checked"),i.currPhoneNumber=n('input[name="PhoneNumber"]').val(),i.currRegion=n("#region").val(),n("#updatePhoneNumberPopup").modalDialog(),n("#updatePhoneNumberLink").click(i.show),n("#updatePhoneNumberAction").click(i.execute),n("#region").change(i.changeRegion).keyup(i.changeRegion),i.updateDialingCode()},changeRegion:function(){i.updateDialingCode(),n("#disclaimerCheckbox").attr("checked","")},updateDialingCode:function(){var t=n("#region option:selected").attr("data-dialingCode");n("#dialingCode").html("+"+t)},show:function(t){t.preventDefault(),n("#serverError").hide(),n("#disclaimerCheckbox").attr("checked",i.currDisclaimer).change(),n('input[name="PhoneNumber"]').val(i.currPhoneNumber),n("#region").val(i.currRegion),i.updateDialingCode(),n("#updatePhoneNumberPopup").trigger("show")},execute:function(t){t.preventDefault();var r={optIn:n("#disclaimerCheckbox").is(":checked"),phoneNumber:n('input[name="PhoneNumber"]').val(),region:n("#region").val(),__RequestVerificationToken:f};n.ajax({type:"POST",url:n("#smsSettings").attr("action"),data:r,cache:!1,success:i.succeeded,error:i.failed})},succeeded:function(t){t.Success?(n("#serverError").hide(),i.currDisclaimer=n("#disclaimerCheckbox").attr("checked"),i.currPhoneNumber=n('input[name="PhoneNumber"]').val(),i.currRegion=n("#region").val(),n("#PhoneNumberSpan").html(t.DisplayNumber),n("#updatePhoneNumberPopup").trigger("hide")):(n("#serverError").html(t.ErrorMessage),n("#serverError").show())},failed:function(){n("#serverError").html(r.strings.phoneNumberError),n("#serverError").show()}};n.fn.accountPage=function(n){r=n,t.init(),u.init(),i.init()}})(jQuery),$(function(){function u(n){return(n=n?n:window.event,n.which&&n.which>31&&(n.which<48||n.which>57))?!1:!0}var n=$("#smsSetup select#region"),t=$("#smsSetup #disclaimerCheckbox"),i=n.val(),r=$("#smsSetup #PhoneNumber").val();t.change(function(){SmsSetupSettings.DisclaimerSelectedCallback(t.is(":checked"))}),n.change(function(){$("#smsSetup #dialingCode").html("+"+$("#region option:selected").attr("data-dialingCode")),t.attr("checked",!1),t.change(),SmsSetupSettings.DisclaimerSelectedCallback(!1)}),SmsSetupSettings={DisclaimerSelectedCallback:function(){},Save:function(){i=n.val(),r=$("#smsSetup #PhoneNumber").val()},Reset:function(){n.val(i),$("#smsSetup #PhoneNumber").val(r),$("#smsSetup #serverError").html(""),$("#smsSetup .phoneNumberValidationError .field-validation-error > span").html(""),n.change()},ServerError:function(n){$("#smsSetup #userError").hide(),$("#smsSetup #serverError").html(n),$("#smsSetup #serverError").show()}},jQuery("input#PhoneNumber").bind("paste",function(){return!1}),jQuery("input#PhoneNumber").bind("keypress",function(n){return u(n)}),jQuery("input#PhoneNumber").bind("keydown",function(){$("#smsSetup #serverError").hide(),$("#smsSetup #userError").show()})});var bingCallback=function(n){$("#Geolocation").html(n)},memberArray=[],famMapHtml='<div id="infobox" class="{identifier}"><div id="infobox_container"><div id="infobox_name"><span>{memberName}</span></div><div id="infobox_detailedView"><div id="infobox_locationInformation"><div id="infobox_locationInformationText"><p>{memberLocationInformation1}</p><p>{memberLocationInformation2}</p><a style="color:{color}"; href="{ViewDetailsLink}">{memberLocationInformation3}</a></div></div><div id="infobox_memberTile" style="background-color:{color};"><div id="memberTileText"><div id="memberTileTextPlacement"><span class="title4">{memberName}</span></div></div></div></div></div><div id="infobox_pointer"><img src="/Images/familymap_pointer2.png"></div></div>',requestValidationTokenValue=$('input[name="__RequestVerificationToken"]').val();(function(n){function f(){return Math.ceil((+new Date-s.getTime())/1e3)}function b(n){if(memberArray[n].geoCode!=null){var t="GeocodeCallback"+n;window[t]=g(n),GeocodeExecute(memberArray[n].geoCode)}}function g(n){return function(t){var r=n,i;t&&t.resourceSets&&t.resourceSets.length>0&&t.resourceSets[0].resources&&t.resourceSets[0].resources.length>0?(i=t.resourceSets[0].resources[0].address,memberArray[n].location?(memberArray[n].renderHtml=memberArray[n].renderHtml.replace(memberArray[n].location,i.formattedAddress),memberArray[n].renderHtml=memberArray[n].renderHtml.replace("{memberLocation}",i.formattedAddress)):memberArray[n].renderHtml=memberArray[n].renderHtml.replace("{memberLocation}",i.formattedAddress),memberArray[n].location=i.formattedAddress,u.trigger("createMemberInfobox",n)):(memberArray[n].renderHtml=memberArray[n].location?memberArray[n].renderHtml.replace(memberArray[n].location,""):memberArray[n].renderHtml.replace("{memberLocation}",""),memberArray[n].location=null,u.trigger("createMemberInfobox",n))}}function d(n){for(var i,t=0;t<memberArray.length;t++)i=memberArray[t],i.latitude!=null&&(n?(u.trigger("createMemberInfobox",t),b(t)):u.trigger("memberLocationWithPushPins",memberArray[t]))}var tt=n(document.body),u=n("#MapControl"),p=n("#ProgressBar"),k=n("#smsNotificationPopup"),nt=100,l=0,y=0,s,t;memberArray=[];var i={init:function(){n("#SuccessOkButton, .button.cancel").click(function(n){n.preventDefault(),i.hide()}),n("#LockPin").bind("keyup blur",function(){return n("#LockPin").val().length==n("#LockPin").attr("maxlength")?n("#LockButton").removeAttr("disabled"):n("#LockButton").attr("disabled","disabled"),!0}),n("#LockPin").keypress(function(n){return(n=n?n:window.event,n.which&&n.which>31&&(n.which<48||n.which>57))?!1:!0}),n("#LockPin").bind("paste",function(){return!1}),n("#LockMessage").bind("change keyup keydown blur",function(){var t=n("#LockMessage").val();return t.length>160&&(t=t.substring(0,160),n("#LockMessage").val(t)),n("#LockMessageCount").text(t.length+"/160"),t})},progress:function(t,r,u){i.hide(),n("#ProgressText").html(t),n("#ProgressOverlay img").remove(),u!=null&&n("#ProgressOverlay").append('<image src="'+u+'"/>'),n("#ProgressBackground, #ProgressOverlay").show(),p.progressBar("autoProgress",nt,r)},success:function(t,r,u){i.hide(),n("#SuccessText").html(t),n("#SuccessOverlay img").remove(),u!=null&&n("#SuccessOverlay").append('<image src="'+u+'"/>'),n("#SuccessSupportingText").html(r),n("#SuccessBackground, #SuccessOverlay").show()},error:function(t,r){function u(n){n.preventDefault(),i.hide()}i.hide(),n("#FailureText").html(t),r==null||r==""?n("#FailureStatusPendingMessage").hide():n("#FailureStatusPendingMessage").show(),n("#FailureOkButton").bind("click",u),n("#FailureBackground, #FailureOverlay").show()},lock:function(t){i.hide(),n("#LockPin").val(""),n("#UnlockedOwnPin").hide(),n("#UnlockedOurPin").hide(),t?n("#UnlockedOwnPin").show():(n("#UnlockedOurPin").show(),n("#LockButton").attr("disabled","disabled")),n("#LockMessageCount").text(n("#LockMessage").val().length+"/160"),n("#LockFormBackground, #LockFormOverlay").show()},wipe:function(){i.hide(),n("#WipeCheckbox").attr("checked","").change(),n("#WipeButton").attr("disabled","disabled"),n("#WipeFormBackground, #WipeFormOverlay").show()},smsSetup:function(){i.hide(),e.reset(),n("#disclaimerCheckbox").attr("checked","").change(),n("#SmsSetupButton").attr("disabled","disabled"),n("#SmsFormBackground, #SmsFormOverlay").show()},smsNotify:function(t){n("#SmsNotifications").hide(),t.SmsMessage!=""&&(n("#SmsNotificationText").html(t.SmsMessage),t.ReachedLimit&&(t.Sent||k.trigger("show")),n("#SmsNotifications").show())},hide:function(){n("#BingMap .overlay, #BingMap .background").hide(),p.progressBar("setProgress",0)}},c={init:function(){n("#MembersLocationRefresh").click(c.execute)},execute:function(n){n.preventDefault(),i.progress(t.attemptLocate,t.pollLimit,null);for(var r=0;r<memberArray.length;r++)w.command(memberArray[r].locate,null,c.commandSuccess,c.commandError,r),memberArray[r].completed=!1,memberArray[r].remainingPolls=0,memberArray[r].maxTime=t.pollLimit,memberArray[r].startTime=new Date,memberArray[r].error=!1,memberArray[r].refining=!1,memberArray[r].locationCellTower=!1},commandSuccess:function(n,i){i.Sent&&(memberArray[n].remainingPolls=t.pollLimit/t.pollInterval,w.status(i.StatusUrl,c.commandStatusSuccess,c.commandError,n))},commandStatusSuccess:function(n,t){switch(t.State){case"Completed":t.UsedGps?(memberArray[n].error=!1,memberArray[n].longitude=t.Longitude,memberArray[n].latitude=t.Latitude,memberArray[n].accuracy=t.accuracy,memberArray[n].geoCode=t.GeoCode.replace("GeocodeCallback","GeocodeCallback"+n),u.trigger("updateLocationWithInfobox",n),b(n),memberArray[n].completed=!0,c.completed()):memberArray[n].refining||(memberArray[n].refining=!0,t.Latitude!=memberArray[n].latitude&&(memberArray[n].locationCellTower=!0,memberArray[n].error=!1,memberArray[n].longitude=t.Longitude,memberArray[n].latitude=t.Latitude,memberArray[n].accuracy=t.accuracy,memberArray[n].geoCode=t.GeoCode.replace("GeocodeCallback","GeocodeCallback"+n),u.trigger("updateLocationWithInfobox",n),b(n)),w.status(t.StatusUrl,c.commandStatusSuccess,c.commandError,n))}},commandError:function(n){memberArray[n].locationCellTower||(memberArray[n].error=!0,u.trigger("updateLocationWithInfobox",n)),memberArray[n].completed=!0,c.completed()},completed:function(){for(var n=0;n<memberArray.length;n++)if(!memberArray[n].completed)return;i.hide()}},o={refining:!1,init:function(){n("#LocationFind, #LocationRefresh").click(o.execute)},execute:function(n){n.preventDefault(),o.refining=!1,i.progress(t.strings.attemptLocate,t.pollLimit,null),h.command(t.locate,null,o.commandSuccess,o.commandError),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneStart,"Locate")},commandSuccess:function(n){i.smsNotify(n),n.Sent?(l=t.pollLimit/t.pollInterval,y=t.pollLimit,s=new Date,h.status(n.StatusUrl,o.commandStatusSuccess,o.commandError)):(WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,"0, Locate"),n.PhoneNumberError!=""?i.smsSetup(n.PhoneNumberError):i.error(t.strings.failedLocate,""))},commandStatusSuccess:function(r){switch(r.State){case"Completed":n("#LocationAndActions > div").hide(),n("#LocationInfo").show(),n("#LocationTime").html(r.Time),n("#LocationButtons").show(),GeocodeExecute(r.GeoCode),r.UsedGps?(u.trigger("updateLocation",{latitude:r.Latitude,longitude:r.Longitude,accuracy:r.Accuracy}),i.hide(),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneSuccess,f()+", Locate")):o.refining||(o.refining=!0,l=t.refineLimit/t.pollInterval,y=t.refineLimit,s=new Date,u.trigger("updateLocation",{latitude:r.Latitude,longitude:r.Longitude,accuracy:r.Accuracy}),i.progress(t.strings.refineLocate,t.refineLimit,null),h.status(r.StatusUrl,o.commandStatusSuccess,o.commandError))}},commandError:function(n,r){n=="pollLimit"?(i.error(r.Message,r.Supporting),o.refining?WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneSuccess,f()+", Locate"):WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneTimeout,"Locate")):(i.error(t.strings.failedLocate,""),s?WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,f()+", Locate"):WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,"0, Locate"))}},a={image:"/images/phone_white.png",init:function(){n("#RingAction").click(a.execute)},execute:function(n){n.preventDefault(),i.progress(t.strings.attemptRing,t.pollLimit,a.image),h.command(t.ring,null,a.commandSuccess,a.commandError),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneStart,"Ring")},commandSuccess:function(n){i.smsNotify(n),n.Sent?(l=t.pollLimit/t.pollInterval,y=t.pollLimit,s=new Date,h.status(n.StatusUrl,a.commandStatusSuccess,a.commandError)):(WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,"0, Ring"),n.PhoneNumberError!=""?i.smsSetup(n.PhoneNumberError):i.error(t.strings.failedRing,""))},commandStatusSuccess:function(n){switch(n.State){case"Completed":i.success(n.Message,"",a.image),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneSuccess,f()+", Ring");break;case"Failed":i.error(n.Message,""),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,f()+", Ring")}},commandError:function(n,r){n=="pollLimit"?(i.error(r.Message,""),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneTimeout,"Ring")):(i.error(t.strings.failedRing,""),s?WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,f()+", Ring"):WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,"0, Ring"))}},r={isLocked:!1,existingPin:!1,isRing:!1,image:"/images/lock_white.png",ringImage:"/images/lock_and_phone_white.png",init:function(t){n("#LockAction").click(r.show),n("#LockButton").click(r.execute),r.existingPin=t},show:function(n){n.preventDefault(),i.lock(r.existingPin)},execute:function(){var u,f;r.isRing=n("#LockRingCheckbox").is(":checked"),u=r.isRing?r.ringImage:r.image,i.progress(t.strings.attemptLock,t.pollLimit,u),f={pin:n("#LockPin").val(),message:n("#LockMessage").val()||t.strings.defaultLockMsg,ring:r.isRing},h.command(t.lock,f,r.commandSuccess,r.commandError),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneStart,"Lock")},commandSuccess:function(n){i.smsNotify(n),n.Sent?(l=t.pollLimit/t.pollInterval,y=t.pollLimit,s=new Date,h.status(n.StatusUrl,r.commandStatusSuccess,r.commandError)):(WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,"0, Lock"),n.PhoneNumberError!=""?i.smsSetup(n.PhoneNumberError):i.error(t.strings.failedLock,""))},commandStatusSuccess:function(n){switch(n.State){case"Completed":r.isLocked=n.Locked,r.existingPin=r.existingPin||n.UsedExistingPin;var t=r.isRing?r.ringImage:r.image;i.success(n.Message,n.Supporting,t),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneSuccess,f()+", Lock");break;case"Failed":i.error(n.Message,n.Supporting),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,f()+", Lock")}},commandError:function(n,r){n=="pollLimit"?(i.error(r.Message,r.Supporting),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneTimeout,"Lock")):(i.error(t.strings.failedLock,""),s?WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,f()+", Lock"):WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,"0, Lock"))}},v={init:function(){n("#EraseAction").click(v.show),n("#WipeButton").click(v.execute),n("#WipeCheckbox").change(v.toggleWipe),n("#DeleteBackupsOnWipeCheckbox").attr("disabled","disabled"),n("#DeleteBackupsOnWipeCheckbox").syncControlStates()},show:function(n){n.preventDefault(),i.wipe()},toggleWipe:function(){n("#WipeCheckbox").is(":checked")?(n("#WipeButton").attr("disabled",""),n("#DeleteBackupsOnWipeCheckbox").attr("disabled","")):(n("#WipeButton").attr("disabled","disabled"),n("#DeleteBackupsOnWipeCheckbox").attr("disabled","disabled"))},execute:function(){var u={deleteBackups:n("#DeleteBackupsOnWipeCheckbox").is(":checked")};i.progress(t.strings.attemptWipe,t.pollLimit,null),h.command(t.wipe,u,v.commandSuccess,v.commandError),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneStart,"Wipe")},commandSuccess:function(n){i.smsNotify(n),n.Sent?(l=t.pollLimit/t.pollInterval,y=t.pollLimit,s=new Date,h.status(n.StatusUrl,v.commandStatusSuccess,v.commandError)):(WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,"0, Wipe"),n.PhoneNumberError!=""?i.smsSetup(n.PhoneNumberError):n.OptInDeleteBackups?n.BackupsDeleted?i.error(t.strings.failedWipeBackupsDeleted,""):i.error(t.strings.failedWipeBackupsNotDeleted,""):i.error(t.strings.failedWipe,""))},commandStatusSuccess:function(n){switch(n.State){case"Completed":i.success(n.Message,n.Supporting,null),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneSuccess,f()+", Wipe");break;case"Failed":i.error(n.Message,n.Supporting),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,f()+", Wipe")}},commandError:function(n,r){n=="pollLimit"?(i.error(r.Message,r.Supporting),WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneTimeout,"Wipe")):(i.error(t.strings.failedWipe,""),s?WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,f()+", Wipe"):WpsTracking.omnitureCustomTrack(WpsTracking.properties.myPhoneFailure,"0, Wipe"))}},e={phoneNumber:n('input[name="PhoneNumber"]').val(),selectedRegion:n("#region").val(),init:function(){n("#SmsSetupButton").click(e.execute),n("#disclaimerCheckbox").change(e.changeSetup),n("#region").change(e.changeRegion)},changeSetup:function(){n("#disclaimerCheckbox").is(":checked")?n("#SmsSetupButton").attr("disabled",""):n("#SmsSetupButton").attr("disabled","disabled")},changeRegion:function(){var t=n("#region option:selected").attr("data-dialingCode");n("#dialingCode").html("+"+t),n("#disclaimerCheckbox").attr("checked",""),e.changeSetup()},execute:function(t){t.preventDefault();var i=n("#smsSettings").attr("action"),r={optIn:n("#disclaimerCheckbox").is(":checked"),phoneNumber:n('input[name="PhoneNumber"]').val(),region:n("#region").val()};h.command(i,r,e.success,e.error)},success:function(t){t.Success?(n("#PhoneNumberSpan").html(t.DisplayNumber),e.phoneNumber=n('input[name="PhoneNumber"]').val(),e.selectedRegion=n("#region").val(),i.hide()):n("#serverError").html(t.ErrorMessage)},error:function(){n("#serverError").html(t.strings.failedSms)},reset:function(){n("#serverError").html(""),n('input[name="PhoneNumber"]').val(e.phoneNumber),n("#region").val(e.selectedRegion)}},w={command:function(t,i,r,u,f){i?(i.__RequestVerificationToken={},i.__RequestVerificationToken=requestValidationTokenValue):i={__RequestVerificationToken:requestValidationTokenValue},n.ajax({type:"POST",url:t,data:i,cache:!1,success:function(n){r(f,n)},error:function(n){n.status==403?document.location=document.location:u(f)}})},status:function(i,r,u,f){var e=this;memberArray[f].remainingPolls--,setTimeout(function(){n.ajax({type:"GET",url:i,data:{lastPoll:memberArray[f].remainingPolls==0},cache:!1,success:function(n){if(n.State=="Completed"||n.State=="Failed")r(f,n);else{var t=+new Date-memberArray[f].startTime.getTime()>memberArray[f].maxTime;memberArray[f].remainingPolls>0&&!t?e.status(i,r,u,f):u(f,n)}},error:function(n){n.status==403?document.location=document.location:u(f)}})},t.pollInterval)}},h={command:function(t,i,r,u){if(t.length==0){u("failed");return}i?(i.__RequestVerificationToken={},i.__RequestVerificationToken=requestValidationTokenValue):i={__RequestVerificationToken:requestValidationTokenValue},n.ajax({type:"POST",url:t,data:i,cache:!1,success:r,error:function(n){n.status==403?document.location=document.location:u("failed")}})},status:function(i,r,u){var f=this;l--,setTimeout(function(){n.ajax({type:"GET",url:i,data:{lastPoll:l==0},cache:!1,success:function(n){if(n.State=="Completed"||n.State=="Failed")r(n);else{var t=+new Date-s.getTime()>y;l>0&&!t?f.status(i,r,u):l<1?u("pollLimit",n):u("failed")}},error:function(n){n.status==403?document.location=document.location:u("failed")}})},t.pollInterval)}};n.fn.findAndSecurePage=function(f){t=f,u.bingMap(t),p.progressBar(),k.modalDialog(),i.init(),o.init(),r.init(t.ownPin),a.init(),e.init(),v.init(),n("#LocationCenter").click(function(n){n.preventDefault(),u.trigger("center")}),n("#LocationPrint").click(function(n){n.preventDefault(),window.print()}),t.latitude!=null&&u.trigger("updateLocation",{latitude:t.latitude,longitude:t.longitude,accuracy:t.accuracy}),t.geoCode!=null&&GeocodeExecute(t.geoCode),t.strings.dateTimeMsg!=null&&n("#LocationTime").html(t.strings.dateTimeMsg)},n.fn.familyMapPage=function(n){t=n,u.bingMap(t),p.progressBar(),i.init(),c.init(),d(!0)},n.fn.familyDashboardPage=function(n){t=n,u.bingMap(t),d(!1)}})(jQuery),function(n){var t={init:function(){return this.each(function(){var t=n(this);t.append('<div class="currentProgress"/>'),t.data("timerId",null),n(".currentProgress",this).css("width",0)})},setProgress:function(i){return t.stop.apply(this),this.each(function(){var t=n(this);n(".currentProgress",this).css("width",i+"%")})},autoProgress:function(i,r){return t.stop.apply(this),this.each(function(){var t=n(this),f=i/r*100,u=0;n(".currentProgress",t).css("width",0),timerId=setInterval(function(){u>100&&(u=100,clearInterval(timerId),t.data("timerId",null)),u+=f,n(".currentProgress",t).css("width",u+"%")},i),t.data("timerId",timerId)})},stop:function(){return this.each(function(){var t=n(this),i=t.data("timerId");i!=null&&(clearInterval(i),t.data("timerId",null))})}};n.fn.progressBar=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice.call(arguments,1));if(typeof i!="object"&&i)n.error(i+" is not valid on progressBar");else return t.init.apply(this,arguments)}}(jQuery),function(n){n.fn.bingMap=function(t){return this.each(function(){function it(n,t){d(t.latitude,t.longitude,t.accuracy,rt),s=new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(t.latitude,t.longitude),{icon:"/Images/me_poi.png",anchor:new Microsoft.Maps.Point(13,13)}),u.entities.push(s)}function d(n,t,i,r,f){var y=6371,s=n*Math.PI/180,p=t*Math.PI/180,w=i/1e3,h=parseFloat(w)/y,l=[],e,a,v;for(x=0;x<=360;x++)e=new Microsoft.Maps.Location(0,0),brng=x*Math.PI/180,e.latitude=Math.asin(Math.sin(s)*Math.cos(h)+Math.cos(s)*Math.sin(h)*Math.cos(brng)),e.longitude=(p+Math.atan2(Math.sin(brng)*Math.sin(h)*Math.cos(s),Math.cos(h)-Math.sin(s)*Math.sin(e.latitude)))*180/Math.PI,e.latitude=e.latitude*180/Math.PI,l.push(e);a=new Microsoft.Maps.Color.fromHex("#"+r),v=new Microsoft.Maps.Color.fromHex("#"+r),a.a=51,v.a=255,ot(),o=new Microsoft.Maps.Polygon(l,{fillColor:a,strokeColor:v,strokeThickness:2}),u.entities.push(o),f?(memberArray[f].circle=o,o=null):(c=Microsoft.Maps.LocationRect.fromLocations(l),k())}function b(t,r){nt(r),tt(r),memberArray[r].circle&&(u.entities.remove(memberArray[r].circle),memberArray[r].circle=null),memberArray[r].error?n("."+r,i).find("#infobox_name",i).css("background-color","#999999"):d(memberArray[r].latitude,memberArray[r].longitude,memberArray[r].accuracy,memberArray[r].accentColor,r),w(memberArray[r]),h()}function et(n,t){var i=new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(t.latitude,t.longitude),{icon:"/Images/me_poi.png",anchor:new Microsoft.Maps.Point(13,13)});u.entities.push(i),w(t),h()}function g(n,t){setHtml(t),b(n,t)}function nt(t){memberArray[t].infobox&&(u.entities.remove(memberArray[t].infobox),memberArray[t].infobox=null);var r=new Microsoft.Maps.Infobox(new Microsoft.Maps.Location(memberArray[t].latitude,memberArray[t].longitude),{visible:!0});u.entities.push(r),r.setOptions({htmlContent:memberArray[t].renderHtml,id:memberArray[t].identifier,visible:!0,zIndex:0,offset:new Microsoft.Maps.Point(0,0),showPointer:!0}),memberArray[t].infobox=r,r.setOptions({offset:new Microsoft.Maps.Point(0,-100)}),n("."+t,i).find("#infobox_detailedView",i).addClass("nohover")}function tt(n){Microsoft.Maps.Events.hasHandler(memberArray[n].infobox,"mouseleave")&&Microsoft.Maps.Events.removeHandler(memberArray[n].infobox.mouseLeaveHandler),Microsoft.Maps.Events.hasHandler(memberArray[n].infobox,"mouseenter")&&Microsoft.Maps.Events.removeHandler(memberArray[n].infobox.mouseEnterHandler),Microsoft.Maps.Events.hasHandler(memberArray[n].infobox,"mouseover")&&Microsoft.Maps.Events.removeHandler(member.infobox.mouseOverHandler),memberArray[n].error?(Microsoft.Maps.Events.addHandler(memberArray[n].infobox,"mouseover",y),Microsoft.Maps.Events.addHandler(memberArray[n].infobox,"mouseenter",y)):(Microsoft.Maps.Events.addHandler(memberArray[n].infobox,"mouseover",p),Microsoft.Maps.Events.addHandler(memberArray[n].infobox,"mouseenter",p))}function l(){for(var n=0;n<memberArray.length;n++)if(e.getId()==memberArray[n].identifier){r=memberArray[n];break}}function w(n){f[n.identifier]=new Microsoft.Maps.Location(n.latitude,n.longitude),a=f.length}function p(t){e=t.target,e.setOptions({offset:new Microsoft.Maps.Point(0,-24)}),l(),n("."+r.identifier,i).find("#infobox_name",i).addClass("nohover"),n("."+r.identifier,i).find("#infobox_detailedView",i).removeClass("nohover"),v(t,r.identifier),Microsoft.Maps.Events.addHandler(t.target,"mouseleave",ft)}function y(t){e=t.target,e.setOptions({offset:new Microsoft.Maps.Point(0,-24)}),l(),n("."+r.identifier,i).find("#infobox_detailedView",i).removeClass("nohover"),n("."+r.identifier,i).find("#infobox_name",i).addClass("nohover"),n("."+r.identifier,i).find("#infobox_memberTile",i).addClass("nohover"),n("."+r.identifier,i).html(n("."+r.identifier,i).html().replace("/Images/familymap_pointer2_grey.png","/Images/familymap_pointer2.png")),v(t,r.identifier),Microsoft.Maps.Events.addHandler(t.target,"mouseleave",ut)}function ut(t){e=t.target,l(),e.setOptions({offset:new Microsoft.Maps.Point(0,-100)}),n("."+r.identifier,i).find("#infobox_detailedView",i).addClass("nohover"),n("."+r.identifier,i).find("#infobox_name",i).removeClass("nohover"),n("."+r.identifier,i).find("#infobox_name",i).css("background-color","#999999"),h()}function ft(t){e=t.target,l(),e.setOptions({offset:new Microsoft.Maps.Point(0,-100)}),n("."+r.identifier,i).find("#infobox_detailedView",i).addClass("nohover"),n("."+r.identifier,i).find("#infobox_name",i).removeClass("nohover"),h()}function v(n,t){var s=memberArray[t].infobox,r=25,h=s.getOffset(),e=s.getAnchor(),o=u.tryLocationToPixel(n.target.getLocation(),Microsoft.Maps.PixelReference.control),i=o.x-h.x-e.x,f=o.y-25-e.y;f<r?(f*=-1,f+=r):f=0,i<r?(i*=-1,i+=r):(i=u.getWidth()-o.x+e.x-400,i>r?i=0:i-=r),(i!=0||f!=0)&&u.setView({centerOffset:new Microsoft.Maps.Point(i,f),center:u.getCenter()})}function h(){var r=0,e=0,s=0,n=-180,t=-1,i,o;for(index in f)r+=f[index].latitude,e+=f[index].longitude,f[index].latitude>n&&(n=f[index].latitude,t=index);f[t].latitude+=.16,i=Microsoft.Maps.LocationRect.fromLocations(f),f[t].latitude=n,o=new Microsoft.Maps.Location(r/a,e/a),u.setView({center:o,bounds:i}),u.setView({bounds:i})}function k(){c&&u.setView({bounds:c})}function ot(){c=null,o&&(u.entities.remove(o),o=null),s&&(u.entities.remove(s),s=null)}var i=n(this),o=null,s=null,ht=null,c=null,f=[],a=0,r=null,e=null,st=null,rt=t.accent,u=new Microsoft.Maps.Map(this,{credentials:t.key,mapTypeId:Microsoft.Maps.MapTypeId.road,showCopyright:!1,showLogo:!1,showScalebar:!1,disableKeyboardInput:!0,showDashboard:t.showDashBoard==null?!0:t.showDashBoard,disableMouseInput:t.disableMouse==null?!1:t.disableMouse,disableTouchInput:t.disableTouch==null?!1:t.disableTouch,disableUserInput:t.disableUser==null?!1:t.disableUser});i.bind("updateLocation",it),i.bind("center",k),i.bind("memberLocationWithPushPins",et),i.bind("centerMembersOnMap",h),i.bind("updateLocationWithInfobox",g),i.bind("createMemberInfobox",b)})}}(jQuery),$.fn.purchaseHistoryPage=function(n){phoneService.init(n),pagination.init(n)},phoneService={settings:null,strings:null,retries:2,timeout:15e3,init:function(n){this.settings=n,this.timeout=n.timeout,this.strings=n.strings,this.bind()},bind:function(){$(".reinstall").each(function(){var n=$(this);n.click(phoneService.installApp),n.parent().data("inProgress",!1)})},installApp:function(n){n.preventDefault();var t=$(this).parent();t.data("inProgress")||(t.data("inProgress",!0),phoneService.createInstallAppProgressBar(t),$.ajax({type:"POST",cache:!1,timeout:phoneService.timeout,url:phoneService.settings.installAppUrl,data:{app:t.attr("id"),__RequestVerificationToken:$('input[name="__RequestVerificationToken"]').val()},success:function(n){n.IsError||n.InstallAppRequestId===-1?(t.data("inProgress",!1),t.phProgressBar("resume",function(){phoneService.showMessage(t,n.Message,n.IsError,n.IsRetryable)})):(t.data("pollcount",phoneService.settings.pollLimit),t.data("retries",phoneService.retries),phoneService.installAppStatus(t,n.InstallAppRequestId),t.data("offer",n.Offer),t.phProgressBar("goToNextCheckPoint"))},error:function(n){t.phProgressBar("resume",function(){t.data("inProgress",!1),n.status===403?phoneService.showMessage(t,phoneService.strings.sessionExpired,!0,!1):phoneService.showMessage(t,phoneService.strings.installAppUnknownError,!0,!0)})}}))},showMessage:function(n,t,i,r){var u=$('<span class="smallText">'+t+"</span>");i&&u.addClass("error"),r?(n.children().not("a.reinstall").remove(),$("a.reinstall",n).removeClass("disabled")):n.empty(),n.append(u)},createInstallAppProgressBar:function(n){var t,i;n.children().not("a.reinstall").remove(),$("a.reinstall",n).addClass("disabled"),t=$('<div class="progressbar"><span class="smallText">'+phoneService.settings.strings.installingText+"</span></div>"),n.append(t),i=$(".progressbar",n),i.phProgressBar("init",phoneService.settings.pollLimit+2,phoneService.settings.pollInterval)},installAppStatus:function(n,t){var i=n.data("pollcount");setTimeout(function(){n.data("pollcount",i-1),$.ajax({type:"GET",timeout:phoneService.timeout,url:phoneService.settings.installAppStatusUrl+"?installAppRequestId="+t,cache:!1,success:function(i){if(i.State=="Completed")phoneService.installAppStatusSuccess(n),WpsTracking.omnitureCustomTrack(WpsTracking.properties.oneclickReinstallCompleted,"MPN");else if(i.State=="Failed")phoneService.installAppFailure(n);else{n.data("retries",phoneService.retries);var r=n.data("pollcount");r>0?(phoneService.installAppStatus(n,t),n.phProgressBar("goToNextCheckPoint")):(WpsTracking.omnitureCustomTrack(WpsTracking.properties.oneclickReinstallCompleted,"MPN_TIMEOUT"),n.data("inProgress",!1),n.phProgressBar("resume",function(){phoneService.showMessage(n,phoneService.strings.installAppNotSend,!0,!0)}))}},error:function(i){var e=n.data("pollcount"),f=n.data("retries");i.status===503&&e>0&&f>0?(n.data("retries",f-1),phoneService.installAppStatus(n,t)):phoneService.installAppFailure(n)}})},phoneService.settings.pollInterval)},installAppStatusSuccess:function(n){n.data("inProgress",!1),n.phProgressBar("resume",function(){phoneService.showMessage(n,phoneService.strings.appDelivered,!1,!1)})},installAppFailure:function(n){WpsTracking.omnitureCustomTrack(WpsTracking.properties.oneclickReinstallCompleted,"FAILED"),n.data("inProgress",!1),n.phProgressBar("resume",function(){phoneService.showMessage(n,phoneService.strings.installAppUnknownError,!0,!0)})}},$.fn.phProgressBar=function(n){if(progressBarMethods[n])return progressBarMethods[n].apply(this,Array.prototype.slice.call(arguments,1));if(typeof n!="object"&&n)$.error(n+" is not valid on progressBar");else return progressBarMethods.init.apply(this,arguments)},progressBarMethods={pollInterval:null,interval:250,nrCheckPoints:0,percentagePerCheckpoint:0,init:function(n,t){return this.each(function(){var f=$('<div class="progress"><div style="width=0" class="bar accent background"></div></div>'),i,u,r;$(this).append(f),i=$(".progress",$(this)),i.data("timerId",null),i.data("currentcheckpoint","1"),progressBarMethods.pollInterval=t,progressBarMethods.nrCheckPoints=n,progressBarMethods.percentagePerCheckpoint=100/n,$(".bar",i).css("width",0),u=progressBarMethods.interval/(progressBarMethods.pollInterval*progressBarMethods.nrCheckPoints)*100,i.data("current",0),r=setInterval(function(){var n=i.data("current");if(n<i.data("currentcheckpoint")*progressBarMethods.percentagePerCheckpoint){if(n>100){clearInterval(r),i.data("timerId",null);return}n+=u,i.data("current",n),$(".bar",i).css("width",n+"%")}},progressBarMethods.interval),i.data("timerId",r)})},goToNextCheckPoint:function(){return this.each(function(){var n=$(".progress",$(this)),t=parseInt(n.data("currentcheckpoint"));n.data("currentcheckpoint",t+1)})},resume:function(n){return progressBarMethods.stop.apply(this),this.each(function(){var t=$(".progress",$(this));t.data("timerId",null),t.data("currentcheckpoint","1"),t.data("current","0"),$(".bar",t).animate({width:"100%"},750,function(){n()})})},stop:function(){return this.each(function(){var n=$(".progress",$(this)),t=n.data("timerId");t!=null&&(clearInterval(t),n.data("timerId",null))})}},pagination={strings:null,$element:null,$link:null,$message:null,timeout:15e3,init:function(n){this.strings=n.strings,this.timeout=n.timeout,this.bind()},bind:function(){pagination.$element=$("#purchases #moreApps"),pagination.$link=$("#purchases #moreApps a"),pagination.$message=$("#purchases #moreApps span"),pagination.$link.data("inProgress",!1),pagination.$link.click(pagination.getMoreApps)},getMoreApps:function(n){n.preventDefault(),pagination.$link.data("inProgress")||(pagination.$link.data("inProgress",!0),pagination.$link.hide(),pagination.$message.text(pagination.strings.paginationLoading),pagination.$message.show(),$.ajax({type:"GET",cache:!1,timeout:pagination.timeout,url:pagination.$link.attr("href"),success:pagination.getMoreAppsSuccess,error:pagination.getMoreAppsError}))},getMoreAppsError:function(n){pagination.$link.data("inProgress",!1),n.status===403?(pagination.$link.remove(),pagination.$message.text(pagination.strings.sessionExpired)):(pagination.$link.text(pagination.strings.paginationError),pagination.$link.show(),pagination.$message.hide())},getMoreAppsSuccess:function(n){pagination.$link.data("inProgress",!1),pagination.$element.remove(),$("#purchases #apps").append(n),pagination.bind(),phoneService.bind()}}