Sie sind auf Seite 1von 69

VMAUiText={APP_STORE:"App Store",PLAY_STORE:"Google Play",GOTO_APP_STORE:"Go to App

Store",GOTO_PLAY_STORE:"Go to Google Play",page:{COMPOSER_TOP_TEXT:"Compose New


Message",COMPOSER_TOP_TEXT_OTT:"Group
Message",COMPOSE_MESSAGE_OVERLAY:document&&document.body&&"undefined"!==typeof
document.body.draggable?"Type a message or drop attachment...":"Type a
message...",SENDING:"Sending",MARK_AS_READ_PROGRESS:"Marking selected conversations as
read ...",PLEASE_WAIT:"Please wait ...",SHOW_HEADER_FOOTER:"Exit Full Page Mode",

HIDE_HEADER_FOOTER:"Full Page Mode",UNSUPPORTED_BROWSER_NOTI:"You are using a version of


Internet Explorer which is not fully supported by Verizon Messages. For the best experience, please
upgrade to a modern browser such as Chrome, Firefox, Safari 6.0+, or Internet Explorer
10+.",PROMPT_KEEP_LOGGED_IN:"Are you sure you want to keep your Verizon Messages session
logged in? You won't be prompted for login credential next time after you enable this
feature.",SESSION_ABANDONED:"You have either signed out or opened Verizon Messages in other
browser tabs or windows. Please click OK to refresh.",

DEFAULT_SEND_TO_TEXT:"Type a contact or phone number",PRINT_MESSAGE_IE:"In order to print


Emoji in Internet Explorer, please make sure you have background colors and images
enabled.\x3cbr\x3e\x3cbr\x3eClick \x3cb\x3eFile\x3c/b\x3e then select \x3cb\x3ePage setup\x3c/b\x3e
then check \x3cb\x3ePrint Background Colors and Images\x3c/b\x3e",PRINT_MESSAGE_FIREFOX:"In
order to print Emoji in Firefox, please make sure you have background colors and images
enabled.\x3cbr\x3e\x3cbr\x3eClick \x3cb\x3eFirefox\x3c/b\x3e then select \x3cb\x3ePrint\x3c/b\x3e
\x26rarr; \x3cb\x3ePage Setup\x3c/b\x3e then check \x3cb\x3ePrint Background (color \x26
images)\x3c/b\x3e"},

notifications:{NOTIFY_ABOUT_EXPIRE:"Your session is about to expire in {m} minute{s}. Click to extend


the session.",NOTIFY_ABOUT_EXPIRE_DLG:"Your session is about to expire in {m} minute{s}. Click 'Yes'
to extend the session.",NOTIFY_EXPIRED:"Your session is expired. Please login again to continue using
Verizon Messages Service.",SOUND_INCAPABLE:"This browser does not support sound notifications, use
other major browsers like Safari 6.0+, Chrome, Firefox, or Internet Explorer 9+ to enable sound
notifications.",

FIREFOX_ADDON:"You have HTML5 Notifications Add-on installed. Please remove the Add-on in order
for Desktop Notifications to work properly in Firefox."},deviceSplash:{CONTENT:'To enjoy better user
experience, please download \x3ca id\x3d"deviceSplashClientAppLink" target\x3d"_blank"
href\x3d"{link}"\x3eVerizon Messages\x3c/a\x3e in {store}.',CONTENT2:"* This application is also
available in {other_store}.",DO_NOT_SHOW:"Do not show this information again next
time."},confirmReportSpam:{CONTENT:"Are you sure you want to report this message as spam? The
spam message will be deleted.",

PROGRESS:"Please wait ..."},keepLoggedInSplash:{CONTENT:"Stay logged in to Verizon


Messages?",LEARN_MORE:"Learn more",DO_NOT_SHOW:"\x26nbsp;Do not display again.",NOTES:"*
For easier access, create a new bookmark for this feature."},glympse:{HTML:"\x3ca href\x3d'{url}'
class\x3d'glympse' target\x3d'_blank' title\x3d'Show Glympse' alt\x3d'Shared Glympse'\x3e\x3cimg
src\x3d'/vma/web2/resources/images/common/glympseicon1_24x24.png'/\x3e{text}\x3c/a\x3e",text:
{INVITE:"Shared my location",REQUEST:"I want to see your location"}},
browserLogin:{NONE:"No browser is registered",REMOVE_PROMPT:"Are you sure you want to remove
the registration of this browser?",REMOVE_ALL_PROMPT:"Are you sure you want to remove all the
browser registrations?",REMOVE_PROGRESS:"Removing ...",REMOVE_ALL_PROGRESS:"Removing
all ..."},deviceSetting:{NONE:"No device is registered",DISCONNECT_PROMPT:"Are you sure you want to
disconnect this device?",DISCONNECT_ALL_PROMPT:"Are you sure you want to disconnect all the
devices?",DISCONNECT_PROGRESS:"Disconnecting ...",

DISCONNECT_ALL_PROGRESS:"Disconnecting all ..."},audio:{PLAY_ALT_TEXT:"Play audio


clip",PAUSE_ALT_TEXT:"Pause audio clip",DOWNLOAD_ALT_TEXT:"Download audio
clip"},updateContact:{ADD:{TITLE:"Add Contact",PROGRESS:"Adding contact ...",ERROR:"Failed to add
contact."},MODIFY:{TITLE:"Modify Contact",PROGRESS:"Updating contact ...",ERROR:"Failed to modify
contact."},ADDR_LABEL:{EMAIL:"Email:",LONG_CODE:"Address:",INTERNATIONAL:"Phone
Number:",NORTH_AMERICAN:"Phone Number:",INVALID:"Address:"}},messages:{conv:
{GLYMPSE_LAST_MSG_BODY:"Glympse message"}},

attachment:{FILE_TOO_LARGE:{id:1,message:"Sorry, the file is too big to


attach."},EXCEED_TOTAL_LIMIT:{id:2,message:"Your attachment is too big for one message, it exceeds
the {size} size limit."},UNSUPPORTED_TYPE:{id:3,message:"Sorry, attachment of this type is not
supported by this service. Supported types include {types}."},REACHED_MAX_NUMBER:
{id:4,message:"You can only attach up to {num} files."},UNEXPECTED_ERROR:{id:5,message:"An
unexpected error occurred while uploading. Please try the upload again."},

PLEASE_WAIT:{id:6,message:"Please wait until attachment uploading is complete."},BLOCKED:


{id:7,message:"Address for remote image uses an unsupported port number."},INVALID:
{id:8,message:"Invalid remote image."},IO_FAILURE:{id:9,message:"Failed while trying to download
remote image."},NO_RESPONSE:{id:10,message:"Timeout while trying to download remote
image."},NOT_IMAGE:{id:11,message:"Invalid response while downloading remote
image."},ZERO_BYTE_FILE:{id:12,message:"The attachment you tried to upload was 0 bytes."},

INVALID_INPUT:{id:13,message:"An unexpected error occurred while processing the attached image.


Please try again later."}},sharecontent:{SESSION_CHANGED:'You have signed in with different account.
Please click "OK" to reload'},feedback:{GENERAL_FEEDBACK:"Please share your feedback with
us.",THANK_YOU:"Thank you for providing feedback for Verizon Messages."},exportMessages:
{FAILURE:"Failed to export messages. Please try again.",NO_MESSAGE:"There are no messages for the
selected period."},webPreview:{FAILURE:"Unable to generate preview for "},

newUser:{HEADER:"New To Verizon Messages?"},leaveGroup:{MESSAGE:"Are you sure you want to


leave the group?",PROGRESS:"Leaving group ..."},deleteMessages:
{CONFIRM_SELECTED_MESSAGES:"Are you sure you want to delete the {num} selected
{message}",CONFIRM_MEDIA:"Are you sure you want to delete the
message?",PROG_SINGULAR:"Deleting message ...",PROG_PLURAL:"Deleting
messages ...",CONV_SINGULAR:"Deleting conversation ...",CONV_PLURAL:"Deleting
conversations ..."},scheduledMessages:{SUCCESS_ADD:"You have successfully scheduled a message to
send {date}",

SUCCESS_MODIFY:"You have modified your scheduled message which will send


{date}",CONFIRM_DELETE:"Are you sure you would like to remove the scheduled
message?",FAILED:"There was an issue scheduling your message.",FAILED_DELETE:"There was an issue
removing you scheduled
message.",LOAD_PROGRESS:"Loading ...",REMOVE_PROGRESS:"Removing ...",PAST:"You are about to
schedule a messages for a date that has already past. Do you want to send the message
now?",OVER_YEAR:"Invalid date, messages can only be scheduled up to a year in advance."},

group:{YOU_CREATED:"You created {group_name}",CREATED:"{user} created {group_name}.


{users_added} have been added to the group",RENAMED:"{user} changed the group name to
{grp_name}",AVATAR:"{user} changed the group avatar",BACKGROUND:"{user} changed the group
background",ADMIN_ALL_YOU_GRANT:"You granted all participants the right to edit this
group",ADMIN_ALL_GRANT_YOU:"{user} granted you the right to edit this
group",ADMIN_GRANT:"{user} granted admin rights to {admin_user}",ADMIN_REMOVE:"{user}
removed admin rights from {admin_user}",

ADMIN_REMOVE_YOU:"{user} removed your admin rights",YOU_REMOVED:"{user} removed


{user_removed} from the group",REMOVED:"{user} removed {user_removed}",YOU_LEFT:"You left the
group",LEFT:"{user_left} left the group",YOU_ADDED:"{user} added {user_added} to the
group",ADDED:"{user} added {user_added}"}};Object.append(VMAUiText,VMAUiTextBase);var
VMADomBaseClassDef={get:function(a,b){var c;c=b?b:{};var d=c.type;d||
(d="element");if("selector"===d)return a;switch(d){case "element":return!0===c.multiple?$$(a):
$element(a);case "eventRelay":return c.event+":relay("+a+")";default:return null}},gets:function(a,b)
{return this.get(a,this._appendOptions(b,{multiple:!0}))},_appendOptions:function(a,b){var c=a;return
c=c?Object.append(c,b):b},composerText:function(a){return
this.get("#sendMessage",a)},composerGroupName:function(a){return this.get("#groupName",

a)},composerButtons:function(a){return this.get("#composer-
buttons",a)},composerCounterContainer:function(a){return
this.get("#composerTextCount",a)},composerCounter:function(a){return
this.get("#composerTextCount .textCount",a)},composerSendTo:function(a){return
this.get("#sendTo",a)},composerSubmit:function(a){return this.get("#composer-
submit",a)},groupSave:function(a){return this.get("#group-save",a)},composerSuggestion:function(a)
{return this.get("#sendToSuggestion",a)},sendToRecipientBox:function(a){return this.get("#vma-
recipientInput",

a)},sendToRecipientsContainerAdd:function(a){return this.get("#vma-recipientListWrapper .add


.recipientsContainer",a)},sendToRecipientsContainerAddCount:function(a){return this.get("#vma-
recipientListWrapper .add .count",a)},sendToRecipientsContainerCurrent:function(a){return
this.get("#vma-recipientListWrapper .current
.recipientsContainer",a)},sendToRecipientsContainerCurrentCount:function(a){return this.get("#vma-
recipientListWrapper .current .count",a)},sendToRecipientsContainers:function(a){return
this.get("#vma-recipientListWrapper .recipientsContainer",

this._appendOptions(a,{multiple:!0}))},contentContainer:function(a){return
this.get("#buapContents",a)},composerSend:function(a){return this.get("#composer-
submit",a)},composeWrapper:function(a){return this.get("#conversation-new-message-
wrapper",a)},composeToggle:function(a){return this.get("#conversation-new-
message",a)},composeIm:function(a){return this.get("#conversation-new-message-
im",a)},composeImClassic:function(a){return this.get("#conversation-new-message-
classic",a)},composeGroup:function(a){return this.get("#conversation-new-message-grp",

a)},groupAdminToggle:function(a){return this.get("#vma-groupNameWrapper .admin


span",a)},groupEditAvatar:function(a){return this.get("#vma-groupNameWrapper
.avatar",a)},composerMessageType:function(a){return
this.get("#textTypeIndicator",a)},conversationMessageContainer:function(a){return
this.get("#buapContentsMessages .composeMessage",a)},conversationMessageLeft:function(a){return
this.get("#buapContentsMessages .conversation-list",a)},messagesPageContainer:function(a){return
this.get("#buapContentsMessages",

a)},conversationContainer:function(a){return this.get("#convListWrapper
.convList",a)},showMap:function(a){return this.get("#composer-
location",a)},conversationContainerWrapper:function(a){return
this.get("#convListWrapper",a)},sendMessageBox:function(a){return this.get("#conversation-
box",a)},chatContentWrapper:function(a){return this.get("#vma-
chatContentWrapper",a)},chatContent:function(a){return this.get("#vma-
chatContent",a)},chatBubbleContainer:function(a){return this.get("#vma-chatContent",

a)},uploadButton:function(a){return this.get("#uploadAttach",a)},attachmentDrop:function(a){return
this.get("#attachmentDrop",a)},attachmentError:function(a){return this.get("#uploadSlider
.errors",a)},editMessagesLink:function(a){return this.get("#editThread",a)},emoticonsButton:function(a)
{return this.get("#composer-emoji",a)},emoticonsListContainer:function(a){return
this.get(".emoticonList",a)},emoticonsMenuContainer:function(a){return
this.get(".emotions",a)},emoticonsMenuTab:function(a){return this.get("#emoTabs ul",

a)},emoticonsMenuContent:function(a){return this.get("#emoContent",a)},emoticonsIcon:function(a)
{return this.get("#emoContent a",a)},chatContentContainer:function(a){return
this.get("#sendMessageForm",a)},messageLinks:function(a){return this.get("#buapContents
.messageLinks",a)},conversationLinks:function(a){return this.get(".conv
a.convLink",this._appendOptions(a,{multiple:!0}))},conversationInfos:function(a){return this.get(".conv
span.convInfo",this._appendOptions(a,{multiple:!0}))},conversations:function(a){return this.get(".conv",

this._appendOptions(a,{multiple:!0}))},groupToggleContainer:function(a){return
this.get("#grpMsgOptions",a)},convDisplayContact:function(a){return this.get(".info
.name",a)},convLastMessageBody:function(a){return this.get(".info .msg",a)},convOpts:function(a)
{return this.get(".convOpts",a)},msgBubbleStatusSending:function(a){return
this.get("#msgBubbleStatusSending",a)},incomingRecipient:function(a){return
this.get(".incomingRecipient",a)},enterDeleteConversations:function(a){return this.get("#conversation-
delete",

a)},enterReadConversations:function(a){return this.get("#conversation-mark-
read",a)},editConversationsCounter:function(a){return this.get("#conversation-select-all
.amount",a)},editConversationsRadioIcon:function(a){return this.get("#conversation-select-all
.icon",a)},convStackContainer:function(a){return
this.get("#stackContent",a)},convSelectAllCheckbox:function(a){return this.get("#conversation-select-
all",a)},convSelectCheckboxes:function(a){return this.get(".convField .chkBox",this._appendOptions(a,
{multiple:!0}))},convSelectCheckboxesWrappers:function(a){return
this.get(".convField",this._appendOptions(a,{multiple:!0}))},conversationNavNormal:function(a){return
this.get(".conversation-nav.normal",a)},conversationNavEdit:function(a){return this.get(".conversation-
nav.edit",a)},uploadFileForm:function(a){return this.get("#vma-uf-form",a)},topMessageBar:function(a)
{return this.get("#conversation-box .conversation-header h1",a)},topMessageBarLink:function(a){return
this.get("#displayMessageLink",

a)},topRecipientsDropDown:function(a){return this.get("#conversation-recipient-
list",a)},mediaShoeBoxBtn:function(a){return this.get("#media-
shoebox",a)},convAvatarWrapper:function(a){return
a.getElement(this.get("div.avatars",VMADomOptions.SELECTOR_ONLY))},attThumbnails:function(a)
{return this.get(".attachItem",this._appendOptions(a,{multiple:!0}))},quickTextMenu:function(a){return
this.get("#vma-quickTextMenuContainer",a)},quickTextMenuItemsContainer:function(a){return
this.get("#quickTextMenuItems ul",

a)},quickTextMenuItemTpl:function(a){return
this.get("#quickTextMenuItemTpl",a)},componentPool:function(a){return
this.get("#componentPool",a)},convLoadingInd:function(a){return
this.get("#convLoadingInd",a)},messageLoadingInd:function(a){return
this.get("#messageLoadingInd",a)},autoSignatureSetting:function(a){return
this.get("#autoSignatureSetting",a)},inMessageLocation:function(a){return this.get(".chatMessage
a.location",a)},messageContentWrapper:function(a){return this.get(".chatMessage",a)},

stackedConvTpl:function(a){return this.get("#stackedConvTemplate",a)},suggestionTpl:function(a)
{return this.get("#suggestionTemplate",a)},recipientTpl:function(a){return
this.get("#recipientTemplate",a)},contactAddressTypeTemplate:function(a){return
this.get("#contactAddressTypeTemplate",a)},contactDropDownItemTemplate:function(a){return
this.get("#conversation-list-li-template",a)},unknownContactDropDownItemTemplate:function(a){return
this.get("#unknownContactDropDownItemTemplate",a)},knownContactDropDownItemTemplate:functio
n(a){return this.get("#knownContactDropDownItemTemplate",

a)},messageInformationContent:function(a){return
this.get("#messageInformationContent",a)},messageInformationRecipientTemplate:function(a){return
this.get("#messageInformationRecipientTemplate",a)},messageInformationDivTemplate:function(a)
{return this.get("#messageInformationDivTemplate",a)},autoReplyMessageTpl:function(a){return
this.get("#autoReplyMessageTpl",a)},arSaveMessageButton:function(a){return
this.get("#autoReplySaveButton",a)},arCancelMessageButton:function(a){return
this.get("#autoReplyCancelButton",

a)},arTopMessage:function(a){return this.get("#autoReplyMsg",a)},arErrorMessage:function(a){return
this.get("#autoReplyError",a)},arSaveDateButton:function(a){return
this.get("#autoReplyBtn",a)},arDeleteButton:function(a){return this.get("#autoReplySetting .vma-
arDeleteMessage",a)},afTopStatus:function(a){return
this.get("#afSubmitStatusMessage",a)},afTopMessage:function(a){return
this.get("#autoFwdError",a)},afSaveDateButton:function(a){return
this.get("#autoForwardBtn",a)},afAddButton:function(a){return this.get("#addContactBtn",
a)},afInput:function(a){return this.get("#forwardMsg",a)},afDeleteLinkChildWrapper:function(a){return
this.get(".settingDesc2 ul li",a)},nicknameSaveButton:function(a){return
this.get("#emailToTextBtn",a)},emoticonsMenuTabTemplate:function(a){return
this.get("#emojiTabTpl",a)},emoticonsMenuPageTemplate:function(a){return
this.get("#emojiPageTpl",a)},attachmentErrorTemplate:function(a){return
this.get("#attachmentErrorTpl",a)},refreshMessages:function(a){return this.get("#main-
refresh",a)},reactionMenu:function(a){return this.get("#reaction-menu",

a)},messageMenu:function(a){return this.get("#msg-menu",a)},conversationMenu:function(a){return
this.get("#conv-menu .dropdown-menu",a)},doneEditing:function(a){return this.get("#conversation-
edit-done",a)},doReadConversations:function(a){return this.get("#conversation-mark-
read",a)},doDeleteConversations:function(a){return this.get("#conversation-edit-
submit",a)},aboveConvsNotiBar:function(a){return this.get("#vma-
aboveConvsNotiBar",a)},autoReplyNoti:function(a){return this.get("#vma-autoReplyNoti",

a)},autoForwardNoti:function(a){return this.get("#vma-autoForwardNoti",a)}},VMADomBase=new
Class(VMADomBaseClassDef),VMADom=new Class({Extends:VMADomBase}),vmadom=new
VMADom,VMADomOptions={SELECTOR_ONLY:{type:"selector"},RELAY_CLICK:
{type:"eventRelay",event:"click"},RELAY_KEYUP:{type:"eventRelay",event:"keyup"},RELAY_KEYDOWN:
{type:"eventRelay",event:"keydown"},relay:function(a){return{type:"eventRelay",event:a}}};var
VMASettingConst={COMP_SUFFIX:"Setting",OPENBOX_SUFFIX:"SettingOpenBox",CLOSEBOX_SUFFIX:"Se
ttingCloseBox",CONTENT_SUFFIX:"Content",TAB_SUFFIX:"Tab",TEXT_INPUT_COLOR:"#333333"},VMASe
ttingBaseClassDef={Implements:[Options,Events],status:"UNSELECTED",options:
{name:null,prefix:null,onInitForMessages:null,onInitEvents:null,onInitData:null,onUnload:null,onRespon
se:null,onBeforeSelect:null,onAfterSelect:null,onBeforeDeselect:null,onAfterDeselect:null},initialize:func
tion(a){this.setOptions(Object.append({onInitForMessages:this.onInitForMessages,

onInitEvents:this.onInitEvents,onInitData:this.onInitData,onUnload:this.onUnload,onResponse:this.onRe
sponse,onBeforeSelect:this.onBeforeSelect,onAfterSelect:this.onAfterSelect,onBeforeDeselect:this.onBe
foreDeselect,onAfterDeselect:this.onAfterDeselect},a))},select:function()
{this.status="SELECTED";this.fireEvent("beforeSelect");this.getTabElt().replaceClasses(null,"activeTab");t
his.getCompElt().show();this.fireEvent("afterSelect")},deselect:function()
{this.status="UNSELECTED";this.fireEvent("beforeDeselect");

this.getTabElt().replaceClasses("activeTab",null);this.getCompElt().hide();this.fireEvent("afterDeselect")},
buildTabEltId:function(){return
this.options.prefix+VMASettingConst.TAB_SUFFIX},buildCompEltId:function(){return
this.options.prefix+VMASettingConst.COMP_SUFFIX},doShowStatusMessage:function(a){var
b=document.id(a.statusEltId);if(VMAUtils.isEmpty(a.message))b.set("html","").hide();else{b.set("html",a.
message).setStyle("opacity",1).show();var c=b.getWidth(),c=(document.id(a.containerEltId).getWidth()-

c)/2;b.setStyle("left",c);!1!==a.autoHide&&function(){var
b=document.id(a.statusEltId);b&&(VMADebug.write("starting hide status message"),b=new Fx.Tween(b,
{duration:500}),b.addEvent("complete",function(){var
b=document.id(a.statusEltId);b&&b.hide()}),b.start("opacity",1,0))}.delay(8E3)}},getCompElt:function()
{return document.id(this.buildCompEltId())},getTabElt:function(){return
document.id(this.buildTabEltId())},destroyCompElt:function(){var
a=this.getCompElt();a&&a.destroyEx()},getName:function(){return this.options.name},

getPrefix:function(){return this.options.prefix},spin:function(a,b){vmamain.maskPage(!
0);this.getCompElt().showSpinner(!0,{delay:b,name:"compSpinner",spinnerOptions:
{message:a,destroyOnHide:!0},noFx:VMAUtils.isIE8OrLess()})},unspin:function()
{this.getCompElt()&&this.getCompElt().showSpinner(!1,
{name:"compSpinner",noFx:VMAUtils.isIE8OrLess()});vmamain.maskPage(!1)},enableBlock:function(a,b)
{b.toggleField&&b.toggleField.setValue(a);a?(this.showBlockMask(!
1,b.blockElt,b.maskName),b.blockElt.replaceClasses("vma-disableOpacity")):

(this.showBlockMask(b.showMask,b.blockElt,b.maskName),b.blockElt.replaceClasses(null,"vma-
disableOpacity"))},showBlockMask:function(a,b,c){a?b.mask({style:
{opacity:0.5}}):b.unmask()},onCancel:function(a)
{a.stop();this.resetData();this.slideOut()},resetData:function(){},slideOut_deprecated:function()
{this.fireEvent("beforeSlideOut");var
a=this.getCompElt();a.getElement(".accordionTitleText").setStyle("color","");var
b=a.getElement(".accordionContent"),b=new Fx.Slide(b,
{duration:500,transition:Fx.Transitions.Pow.easeOut});

b.addEvent("complete",function()
{a.getElement(".openBox").show();a.getElement(".closeBox").hide();this.fireEvent("afterSlideOut")}.bind
(this));b.slideOut();this.status="SLIDED_OUT"},enableButton:function(a,b){var c=document.id(a);b?
c.set("disabled",!1):c.set("disabled",!0);return c},initDateInput:function(a,b){var c=this;
[a+"Date",a+"Month",a+"Year"].each(function(d){d=document.id(d);d.addEvent("keydown",function(d)
{c.onDateInputKey(d,this,a,b)});d.addEvent("keyup",function(d){c.onDateInputKey(d,

this,a,b)});d.addEvent("blur",function(d){c.onDateInputBlur(d,this,a,b)})})},initDateInput2:function(a,b)
{var c=this;[a+"Date",a+"Month",a+"Year"].each(function(d)
{d=document.id(d);d.addEvent("keydown",function(d)
{c.onDateInputKey(d,this,a,b)});d.addEvent("keyup",function(d)
{c.onDateInputKey(d,this,a,b)})})},initDateInput3:function(a,b){var c=this;[a+"Date"].each(function(d)
{d=document.id(d);d.addEvent("keydown",function(d)
{c.onDateInputKey(d,this,a,b)});d.addEvent("keyup",function(d){c.onDateInputKey(d,

this,a,b)})})},getDateFieldTypeByEltId:function(a){var b;VMAUtils.endsWith(a,"Date")?
b="date":VMAUtils.endsWith(a,"Month")?b="month":VMAUtils.endsWith(a,"Year")&&(b="year");return
b},validateDateInput:function(a,b,c,d){var
e=document.id(c+"Date").get("value"),f=document.id(c+"Month").get("value");c=document.id(c+"Year")
.get("value");e=VMAUtils.validateDate(c,f,e);e.valid?(f=new Date(e.year,e.month-1,e.date),f.isValid()?
(c=new Date,c.clearTime(),f.getTime()<c.getTime()?d(a.type,"past"):
(f=this.getDateFieldTypeByEltId(b.get("id")),

b.set(a.type,e[f+"Str"]),d(a.type,"success",e))):d(a.type,"date")):d(a.type,"date")},validateDateInput2:fu
nction(a,b,c,d){var
e=document.id(c+"Date").get("value"),f=document.id(c+"Month").get("value");c=document.id(c+"Year")
.get("value");e=VMAUtils.validateDate(c,f,e);e.valid?(f=new Date(e.year,e.month-1,e.date),f.isValid()?
(c=new Date,c.clearTime(),f.getTime()<c.getTime()?d(a,"past"):
(f=this.getDateFieldTypeByEltId(b.get("id")),b.set(a,e[f+"Str"]),d(a,"success",e))):d(a,"date")):d(a,"date")
},validateDateTimeInput:function(a,

b,c,d){var e="string"===typeof b?b:b.value,e=e.replace(/[^\d]/g,"");8!=e.length&&12!


=e.length&&d(a,"date");c=e.substring(0,2);var f=e.substring(2,4),g=e.substring(4,8);8!=e.length?
(b=e.substring(8,10),e=e.substring(10,12)):
(b=23,e=59);c=VMAUtils.validateDate(g,c,f);b=VMAUtils.validateTime(b,e,0);c.valid&&b.valid?(f=new
Date(c.year,c.month-1,c.date,b.hour,b.minute,b.second),f.isValid()?(g=new
Date,f.getTime()<g.getTime()?
d(a,"past"):d(a,"success",c,b)):d(a,"date")):d(a,"date")},onDateInputBlur:function(a,

b,c,d){VMADebug.write("onDateInputBlur \x3d
"+c);this.validateDateInput(a,b,c,d);VMADebug.write("onDateInputBlur \x3d "+c+",
end")},onDateInputBlur2:function(a,b,c,d){VMADebug.write("onDateInputBlur2 \x3d
"+c);this.validateDateInput2(a,b,c,d);VMADebug.write("onDateInputBlur2 \x3d "+c+",
end")},onDateTimeInputBlur:function(a,b,c,d){VMADebug.write("onDateTimeInputBlur \x3d
"+c);this.validateDateTimeInput(a,b,c,d);VMADebug.write("onDateTimeInputBlur \x3d "+c+",
end")},onDateInputKey:function(a,b,c,d){VMADebug.write("onDateInputKey("+

a.type+") \x3d "+c);switch(a.type){case "keydown":1===a.key.length&&(VMAUtils.isDigitString(a.key)||


a.stop());break;case
"keyup":a.stop(),this.validateDateInput(a,b,c,d)}VMADebug.write("onDateInputKey("+a.type+") \x3d
"+c+", end")},buildDateString:function(a){return document.id(a+"Month").get("value")
+"/"+document.id(a+"Date").get("value")
+"/"+document.id(a+"Year").get("value")},createDateStr:function(a){return(new
Date(a)).format("%m/%d/%Y")},createDateTimeStr:function(a){return(new Date(a)).format("%m/%d/%Y
%H:%S")},

onInitForMessages:function(){},onInitEvents:function(){vmamain._initTopLinks()},onInitData:function()
{this.getCompElt().store("name",this.options.name)},onResponse:function(a)
{},onBeforeSlideIn_deprecated:function(){var
a=this.getCompElt().getElement(".accordionTitle");a.getElement(".accordionTitleText").setStyles({"font-
weight":"bold",color:"#B20000"});a.setStyle("background","#fefdf0")},onBeforeSlideOut_deprecated:fu
nction(){var
a=this.getCompElt().getElement(".accordionTitle");a.getElement(".accordionTitleText").setStyles({"font-
weight":null,

color:null});a.setStyle("background",null)},onBeforeSelect:function(){},onAfterSelect:function()
{},onBeforeDeselect:function(){},onAfterDeselect:function(){},getOpenBoxId:function(){return
this.getPrefix()+VMASettingConst.OPENBOX_SUFFIX},getCloseBoxId:function(){return this.getPrefix()
+VMASettingConst.CLOSEBOX_SUFFIX},getContentId:function(){return this.getPrefix()
+VMASettingConst.CONTENT_SUFFIX},slideIn_deprecated:function(){this.fireEvent("beforeSlideIn");var
a=this.getCompElt();a.getElement(".accordionTitleText").setStyle("color",

"#B00000");var b=a.getElement(".accordionContent"),b=(new Fx.Slide(b,


{duration:500,transition:Fx.Transitions.Pow.easeOut})).hide();b.addEvent("complete",function()
{a.getElement(".openBox").hide();a.getElement(".closeBox").show();this.fireEvent("afterSlideIn")}.bind(t
his));b.slideIn();this.status="SLIDED_IN"},doShowErrorMessage:function(a){var
b=document.id(a.errorEltId);if(VMAUtils.isEmpty(a.message))b.set("html","").hide();else{b.set("html",a.
message).show();var c=b.getWidth();a=(document.id(a.containerEltId).getWidth()-

c)/2;b.setStyle("left",a)}}},VMASettingBase=new Class(VMASettingBaseClassDef),VMASetting=new
Class({Extends:VMASettingBase});var
VMAAutoReplyBaseClassDef={Extends:VMASetting,TM_ADD:VMAUiText.settings.AUTOREPLY_TO_ADD,f
akeOn:!
1,mode:"NORMAL",selectedMessageEltId:null,pendingSelectedMessageEltId:null,editMessageEltId:null,
arForm:null,messageCharCounter:null,overTextEndDateDate:null,calendar:null,lastDateStr:null,noEndDa
te:"01/01/2099 00:00",settingsToggleField:null,initialize:function(a)
{this.parent(Object.append({name:"AUTO_REPLY",prefix:"autoReply"},a));this.arForm=document.id("aut
oReplyForm")},onInitEvents:function(){this.parent();

this.initEventsCustom()},onUnload:function()
{this.overTextEndDateDate&&(this.overTextEndDateDate.destroy(),this.overTextEndDateDate=null)},init
OverTextsCustom:function(){},initOverTexts:function(){var a=this;VMADebug.write("AutoReply: start
over text custom");this.initOverTextsCustom();VMADebug.write("AutoReply: start over
text");this.overTextEndDateDate=new
OverTextInput({inputElt:"arEndDateDate",defaultText:"MM/DD/YYYY",textColor:VMASettingConst.TEXT
_INPUT_COLOR,onBlur:function(){if("MM/DD/YYYY"!==

document.id("arEndDateDate").value&&0<document.id("arEndDateDate").value.length)a.onDateTimeIn
putBlur("blur",document.id("arEndDateDate"),"arEndDate",a.dateInputEventHandler.bind(a));document
.id("rplyDate").checked=!0}});document.id("arEndDateDate").addEvent("click",function(a)
{a.stop()});VMADebug.write("AutoReply: end over text")},initCharCounter:function()
{this.messageCharCounter=new
CharCounter({containerEltSelector:"#autoReplySetting",textEltSelector:"#replyTextArea",counterEltSele
ctor:"#autoReplyMessageCounterWrapper .textCount",

maxLengthEltSelector:"#autoReplyMessageCounterWrapper
.totalCount",maxLength:VMAIMConst.AUTOREPLY_MESSAGE_CHAR_LIMIT,keyupHandler:this.onKeyUp
MessageCharCounter.bind(this),pasteHandler:this.onPasteMessageCharCounter.bind(this)});VMADebug
.write("AUTO_REPLY: refresh char
counter");this.messageCharCounter.refresh();document.id("replyTextArea").addEvent("click",function(a
){VMADebug.write("AUTO_REPLY::onClick -
replyTextArea");a.stop()})},dateInputEventHandler:function(a,b,c,d){switch(b){case "success":0<

this.options.endDate?(b=new Date(this.options.endDate),b.getMonth()
+1===c.month&&b.getDate()===c.date&&b.getFullYear()===c.year&&b.getHours()===d.hour&&b.getMi
nutes()===d.minute?this.enableButton(vmadom.arSaveDateButton(),!
1):this.enableButton(vmadom.arSaveDateButton(),!0),"blur"!==a&&"validate"!==a||
this.setErrorMessage()):this.setErrorMessage();this.setEndDate(c,d);break;case "date":case
"month":case "year":case "value":"blur"!==a&&"validate"!==a||
this.setErrorMessage(VMAUiText.settings.AUTOREPLY_INVALID_END_DATE);
this.enableButton(vmadom.arSaveDateButton(),!1);break;case "past":"blur"!==a&&"validate"!==a||
this.setErrorMessage(VMAUiText.settings.AUTOREPLY_INVALID_END_DATE),this.enableButton(vmadom
.arSaveDateButton(),!1)}},setErrorMessage:function(a){a?
(this.doShowErrorMessage({message:a,errorEltId:"autoReplyError",containerEltId:"autoReplyContent"})
,this.showStatusMessage()):this.doShowErrorMessage({errorEltId:"autoReplyError",containerEltId:"auto
ReplyContent"})},setTopMessage:function(a){this.showStatusMessage(a?

{operation:"DIRECT",message:a}:null)},onKeyUpMessageCharCounter:function(a,b){var
c=vmadom.arSaveMessageButton();if(0===b.length)this.setErrorMessage(),this.enableButton(c,!
1);else{var d=this.isDuplicateMessage(b);d?
this.setErrorMessage(VMAUiText.settings.AUTOREPLY_DUPLICATED_MESSAGE):this.setErrorMessage();t
his.enableButton(c,!d)}},onPasteMessageCharCounter:function(a,b)
{this.onKeyUpMessageCharCounter(a,b)},isDuplicateMessage:function(a){var b=!
1,c=a.trim();VMAUtils.isEmpty(this.options.messages)||

(b=this.options.messages.some(function(a){return a.body.trim()===c}));return b},_initEvents:function()


{var a=this,b=this.getCompElt();b.addEvent('click:relay(#autoReplyDurationList
input[type\x3d"radio"])',function(b)
{a.validateDurationType(b,this)});b.getElements("#autoReplyDurationList
select").addEvent("change",function(b){document.id("rplyDuration").checked=!
0;a.validateDurationType(b,this)});document.id("autoReplyBtn").addEvent("click",function(b)
{a.onSaveDuration(b,this)});this.settingsToggleField=

new VMAToggleField({element:"#autoReplySetting .settingsTabCont .settingsTopBox .section-buttons


.toggle-field.settingsStatus"});this.settingsToggleField.addEvent("change",function(b)
{a.onTurnOnOff(this)});b.addEvent('click:relay(#autoReplyList input[type\x3d"radio"])',function(b)
{a.onSelectMessage(b,this)});vmadom.arSaveMessageButton().addEvent("click",function(b)
{a.onSaveMessage(b,this)});vmadom.arCancelMessageButton().addEvent("click",function(b)
{a.onCancelEditMessage(b,this)});b.addEvent("click:relay(.vma-arEditMessage)",

function(b){a.onEditMessage(b,this)});b.addEvent("click:relay(.vma-arDeleteMessage)",function(b)
{a.onDeleteMessage(b,this)})},onInitData:function(){var
a=this;this.parent();this.initOverTexts();this._initEvents();this.initCharCounter();this.resetData();this.cale
ndar=new VMACalendar({id:"arCalendar",inputId:"arEndDateDate",triggers:
[".calendarIcon"],onSelect:function(){document.id("rplyDate").checked=!
0;a.overTextEndDateDate.hide();a.onDateTimeInputBlur("blur",document.id("arEndDateDate"),"arEndD
ate",

a.dateInputEventHandler.bind(a))}});vmadom.arErrorMessage().hide()},createDefaultEndDate:function()
{return(new Date).increment("day",14).clearTime()},setDate:function(a,b){var c=a.get("Month")
+1+"/"+a.get("Date")
+"/"+a.get("FullYear");document.id("ar"+b+"Date").set("value",c);this["overText"+b+"Date"].enable().hi
de()},setEndDate:function(a,b){this.dateStr=a.monthStr+"/"+a.dateStr+"/"+a.yearStr+"
"+b.hourStr+":"+b.minuteStr},setEndDatefromDate:function(a){var
b,c,d,e;b=9>=a.getDate()?"0"+a.getDate():
a.getDate();c=9>=a.getMonth()+1?"0"+(a.getMonth()+1):a.getMonth()
+1;d=a.getFullYear();e=9>=a.getHours()?"0"+a.getHours():a.getHours();a=9>=a.getMinutes()?"0"+a.get
Minutes():a.getMinutes();return this.dateStr=c+"/"+b+"/"+d+" "+e+":"+a},showDateOverText:function(a)
{document.id("ar"+a+"Date").set("value","");this["overText"+a+"Date"].show()},turnOnLocal:function(a,
b){this.settingsToggleField.setValue(a);this.enableBlock(a,
{blockElt:this.getOnOffBlockElt(),showMask:b,maskName:"autoReplyOnOffMask"})},

selectMessageLocal:function(a,b){var
c=document.id(a);c&&c.getElement("input.radioButton").set("checked",!1!==b)},turnOffFake:function()
{this.turnOnLocal(!1,!0);this.cancelEditMessage(!
1);this.setTopMessage();this.showDateOverText("EndDate");vmadom.arSaveDateButton().hide();this.fak
eOn=!1},turnOnFake:function(){this.turnOnLocal(!0,!
1);this.resetAddFrom();this.setTopMessage(this.TM_ADD);var
a=this.createDefaultEndDate();this.setEndDatefromDate(a);this.setDate(a,"EndDate");this.setOptions({e
ndDate:a.getTime()});

vmadom.arSaveDateButton().hide();document.id("replyTextArea").set("value","").focus();this.fakeOn=!
0},onTurnOnOff:function(a)
{this.showStatusMessage();if((a=a.getValue())&&VMAUtils.isEmpty(this.options.messages))this.turnOnF
ake();else if(this.fakeOn)this.turnOffFake();else{this.spin(a?"Turning On ...":"Turning Off ...",100);a||
this.cancelEditMessage(!0);var
b;a&&(b=this.createDateTimeStr(this.options.endDate));this._s_enable(a,b)}a||$$
('input[name\x3d"autoReplyDate"]:checked').set("checked",!1)},

_s_enable:function(a,b){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:a?"ENABLE":"DISABLE",endDate:a?b:void
0}})},onSelectMessage:function(a,b){a.stop();VMADebug.write("AUTO_REPLY::onSelectMessage");var
c=b.getParent(".settingFrmRow");switch(this.mode){case
"EDIT":VMADebug.write("AUTO_REPLY::onSelectMessage - none");return}var
d=c.retrieve("arMessage");this.pendingSelectedMessageEltId=c.get("id");c=this.dateStr;this.spin("Upda
ting ...",100);this._s_selectMessage(d,c);

VMADebug.write("AUTO_REPLY::onSelectMessage - done")},_s_selectMessage:function(a,b)
{vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"SELECT",oldBody:a.oldBody,endDate:b}})},_s_saveMessage:func
tion(a,b){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"UPDATE_MESSAGE",autoReplyMessage:
{oldBody:a,body:b}}})},_s_addMessage:function(a,b){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"ADD_MESSAGE",messageBody:a,endDate:b}})},

_s_addFirstMessage:function(a,b){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"ADD_FIRST_MESSAGE",messageBody:a,endDate:b}})},_s_delete
Message:function(a){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"DELETE_MESSAGE",oldBody:a}})},_s_saveEndDate:function(a)
{vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"UPDATE_DATE_RANGE",endDate:a}})},onSaveDuration:function
(a,b){a.stop();var c="";switch(parseInt($$('input[name\x3d"autoReplyDate"]:checked')[0].value)){case
1:c=

this.noEndDate;break;case 2:var
c=document.id("arEndDateDurationHours").selectedIndex,d=document.id("arEndDateDurationMinutes"
).selectedIndex,c=this.calculateDuration(c,d);break;case 3:c=document.id("arEndDateDate").value+"
23:59"}c&&(this.spin("Saving ...",100),this._s_saveEndDate(c))},onAddMessage:function(a,b)
{a.stop();this.showStatusMessage();"EDIT"!
==this.mode&&this.resetAddFrom()},onEditMessage:function(a,b){a.stop();if("EDIT"!==this.mode)
{this.showStatusMessage();this.setErrorMessage();var c=

b.getParent(".settingFrmRow"),d=c.retrieve("arMessage");c.hide();c.grab(this.arForm,"after");document
.id("autoReplyCancelButton").removeClass("hide");var
e=document.id("autoReplyMessageEdit").getElement("input.radioButton");this.selectedMessageEltId==
=c.get("id")?e.set("checked",!0):e.set("checked",!
1);document.id("replyTextArea").set("value",d.body).focus();this.messageCharCounter.refresh();this.arF
orm.getElement(".autoReplyHeader").set("text","Edit
Message");d=vmadom.arSaveMessageButton();d.set("value",

"SAVE");this.enableButton(d,!
1);this.mode="EDIT";this.editMessageEltId=c.get("id")}},onDeleteMessage:function(a,b)
{a.stop();this.showStatusMessage();var
c=b.getParent(".settingFrmRow").retrieve("arMessage");this.resetAddFrom();this.spin("Deleting ...",100)
;this._s_deleteMessage(c.oldBody)},onCancelEditMessage:function(a,b)
{a.stop();this.showStatusMessage();this.fakeOn?this.turnOffFake():this.cancelEditMessage(!
0)},cancelEditMessage:function(a){switch(this.mode){case
"EDIT":document.id(this.editMessageEltId).show()}a&&

this.selectMessageLocal(this.selectedMessageEltId);this.selectMessageLocal("autoReplyForm",!
1);this.resetAddFrom();document.id("replyTextArea").blur();this.mode="NORMAL";this.editMessageEltI
d=null},onResponse:function(a){this.parent(a);this.fakeOn=!1;switch(a.status){case
"SUCCESS":this.setOptions(a.autoReplySetting);this.cancelEditMessage(!1);this.resetData({maskBlock:!
0});this.showStatusMessage(a);vmamain.updateSettingsStatus(a);break;default:vmamain.handleSystem
Error({refresh:!1})}this.updateStatus();

this.unspin()},validateDurationType:function(a,b){var c="";switch(parseInt($$
('input[name\x3d"autoReplyDate"]:checked')[0].value)){case 1:c=this.noEndDate;break;case 2:var
c=document.id("arEndDateDurationHours").selectedIndex,d=document.id("arEndDateDurationMinutes"
).selectedIndex,c=this.calculateDuration(c,d);break;case 3:c=document.id("arEndDateDate").value+"
00:00"}this.validateDateTimeInput("check",c,"arEndDate",this.dateInputEventHandler.bind(this))},calcul
ateDuration:function(a,b){var c=new Date;

c.setHours(c.getHours()+VMAUtils.stringToInt(a));c.setMinutes(c.getMinutes()
+VMAUtils.stringToInt(b));var d,e,f,g;d=9>=c.getDate()?"0"+c.getDate():c.getDate();e=9>=c.getMonth()
+1?"0"+(c.getMonth()+1):c.getMonth()
+1;f=c.getFullYear();g=9>=c.getHours()?"0"+c.getHours():c.getHours();b=9>=c.getMinutes()?"0"+c.getMi
nutes():c.getMinutes();return e+"/"+d+"/"+f+" "+g+":"+b},updateStatus:function()
{elt=document.id("autoReplyStatus");if(this.options.enabled&&0<this.options.endDate){var a="",b=new
Date(this.options.endDate),

c=new Date(this.noEndDate);if(b.getTime()>c.getTime()-864E5)a="No end date";else{var


d,e,f,g="am",a=9>=b.getDate()?"0"+b.getDate():b.getDate();d=9>=b.getMonth()+1?"0"+(b.getMonth()
+1):b.getMonth()+1;e=b.getFullYear();c=b.getHours();12<c?(c-
=12,g="pm"):0===c&&(c=12);f=9>=b.getMinutes()?"0"+b.getMinutes():b.getMinutes();a="Ends on "+
(d+"/"+a+"/"+e+" at ");a=23===b.getHours()&&59===b.getMinutes()?
a+"midnight":12===b.getHours()&&0===b.getMinutes()?a+"noon":a+(c+":"+f+"
"+g)}this.setEndDatefromDate(b);

elt.getElement("div").set("html",a);elt.show()}else elt.hide()},onAfterSelect:function()
{this.parent();this.turnOnLocal(this.options.enabled,!0)},onBeforeDeselect:function()
{this.parent();this.fakeOn?(this.turnOffFake(),this.turnOnLocal(!1,!
1)):this.turnOnLocal(this.options.enabled,!1);this.setErrorMessage()},getOnOffBlockElt:function(){return
vmadom.get("#autoReplySetting .autoReplyMessage")},initEventsCustom:function()
{},showStatusMessage:function(a){if(a){this.setErrorMessage();var b;switch(a.operation){case
"UPDATE_MESSAGE":case "ADD_FIRST_MESSAGE":case "ADD_MESSAGE":case
"DELETE_MESSAGE":case "SELECT":case "UPDATE_DATE_RANGE":b=

"Your auto reply settings have been saved.";break;case


"DIRECT":b=a.message}b&&this.doShowStatusMessage({message:b,statusEltId:"autoReplyMsg",contain
erEltId:"autoReplyContent"})}else
this.doShowStatusMessage({statusEltId:"autoReplyMsg"})},resetData:function(a){var b=!
0,c=document.id("autoReplyList");c.getElements("div.settingFrmRow").each(function(a)
{a.eliminate("arMessage")});c.empty();if(VMAUtils.isEmpty(this.options.messages))this.options.enabled?
(this.setTopMessage(this.TM_ADD),this.resetAddFrom()):

this.setTopMessage(),vmadom.arSaveDateButton().hide();else{this.mode="NORMAL";var
d;this.options.messages.each(function(a){var
b=document.id("autoReplyMessageTpl").clone(),g=String.uniqueID();b.set("id",g);b.getElement("input[n
ame\x3dautoReply]").set("id","ar"+g);b.getElement(".settingDescText").set("for","ar"+g);b.getElement("
.settingDescText").set("text",a.body);b.inject(c,"bottom");g=b.getElement(".settingFrmRow");g.set("id",
b.get("id")+"-row");g.store("arMessage",a);if(a=this.options.selectedMessage===

a.oldBody)this.selectedMessageEltId=g.get("id"),d=b.getElement(".radioButton");a||
b.getElement(".radioButton").check(a)},this);d&&d.check(!
0);this.options.messages.length>=VMAIMConst.AUTOREPLY_MAX_MESSAGE_NUM&&(b=!
1);this.setTopMessage();this.enableButton(vmadom.arSaveDateButton(),!
1).show()}this.showAddControls(b);this.turnOnLocal(this.options.enabled,a&&!
0===a.maskBlock);vmamain.autoReplyOn=this.options.enabled;0===this.options.endDate?
this.setOptions({endDate:this.createDefaultEndDate().getTime()}):

(a=(new
Date).clearTime(),this.options.endDate<a.getTime()&&this.setOptions({endDate:this.createDefaultEndD
ate().getTime()}));this.showDateOverText("EndDate");this.overTextEndDateDate.enable();this.updateSta
tus()},showAddControls:function(a){a?
this.arForm.removeClass("hide"):this.arForm.addClass("hide")},resetAddFrom:function()
{"EDIT"===this.mode&&this.arForm.inject("autoReplyList","after");document.id("replyTextArea").set("v
alue","").focus();var a=vmadom.arSaveMessageButton();a.set("value","ADD NEW MESSAGE");

this.enableButton(a,!
1);this.messageCharCounter.refresh();this.arForm.getElement(".autoReplyHeader").set("text","Create
New
Message");document.id("autoReplyCancelButton").addClass("hide");this.mode="NORMAL"},onSaveMes
sage:function(a,b){a.stop();var
c,d;if(this.fakeOn)c=document.id("replyTextArea").get("value"),d=this.dateStr,this.spin("Saving ...",100),
this._s_addFirstMessage(c,d);else
if("NORMAL"===this.mode||"EDIT"===this.mode)switch(c=document.id("replyTextArea").get("value"),t
his.mode){case "NORMAL":this.spin("Saving ...",

100);d=this.dateStr;document.id("replyTextArea").set("value","");this._s_addMessage(c,d);break;case
"EDIT":d=this.arForm.getPrevious(".settingFrmRow").retrieve("arMessage"),this.spin("Saving ...",100),thi
s._s_saveMessage(d.oldBody,c)}}},VMAAutoReplyBase=new
Class(VMAAutoReplyBaseClassDef),VMAAutoReply=new Class({Extends:VMAAutoReplyBase});var
VMAAutoForwardBaseClassDef={Extends:VMASetting,INPUT_OVERTEXT_VALUE:"Enter your auto
forward destination here",TM_ADD:VMAUiText.settings.AUTOFORWARD_TO_ADD,fakeOn:!
1,mode:"NORMAL",selectedDestinationEltId:null,pendingSelectedDestinationEltId:null,editDestinationEl
tId:null,pendingNewDestination:null,overTextEndDateDate:null,overTextEndDateMonth:null,overTextEn
dDateYear:null,overTextAdd:null,validInput:!1,validDate:!0,settingsToggleField:null,initialize:function(a)
{this.parent(Object.append({name:"AUTO_FORWARD",

prefix:"autoForward"},a))},onInitEvents:function(){this.parent()},_initEvents:function(){var
a=this;vmadom.afAddButton().addEvent("click",function(b)
{a.onSaveNewDestination(b,this)});vmadom.afInput().addEvents({keyup:function(b)
{a.onKeyUpEditAddress(b,this)},blur:function(b){a.onBlurEditAddress(b,this)}});var
b=document.id("autoForwardList");b.addEvent("click:relay(.vma-afRadio)",function(b)
{a.onSelectDestination(b,this)});b.addEvent("click:relay(.vma-afDelete)",function(b)
{a.onDeleteDestination(b,

this)});b.addEvent("click:relay(.vma-afResend)",function(b)
{a.onResendRequest(b,this)});document.id("autoForwardBtn").addEvent("click",function(b)
{a.onSaveDateRange(b,this)});this.initDateInput2("afEndDate",this.dateInputEventHandler.bind(this));thi
s.settingsToggleField=new VMAToggleField({element:"#autoForwardSetting .toggle-
field.settingsStatus"});this.settingsToggleField.addEvent("change",function(b)
{a.onTurnOnOff(this)});document.id("vma-afRefresh").addEvent("click",function(b){a.onRefresh(b,

this)})},onRefresh:function(a,b)
{a.stop();this.spin("Refreshing ...");this._s_refresh()},validateAddressAndShowError:function(a){var
b;if(VMAUtils.isEmpty(a)||a===this.INPUT_OVERTEXT_VALUE)this.validInput=!1;else
if(this.isDuplicateDestination(a))this.validInput=!
1,b=VMAUiText.settings.AUTOFORWARD_DUPLICATED_DEST;else{var
c=VMAUtils.validateMdnMultiFormat(a);c.validFull?c.plain===VMAIMConst.HOST_MDN?
(this.validInput=!1,b=VMAUiText.settings.AUTOFORWARD_SAME_AS_SRC):this.validInput=!
0:VMAUtils.validateEmailAddress(a)?

this.validInput=!0:(this.validInput=!
1,b=VMAUiText.settings.AUTOFORWARD_INVALID_DEST)}a=this.validInput&&this.validDate;this.enable
Button(vmadom.afAddButton(),a);b?
this.setErrorMessage(b):this.validDate&&this.setErrorMessage();a&&this.setTopMessage()},onKeyUpEdi
tAddress:function(a,b)
{this.validateAddressAndShowError(b.get("value").trim())},onBlurEditAddress:function(a,b)
{this.validateAddressAndShowError(b.get("value").trim())},onUnload:function()
{this.overTextEndDateDate&&(this.overTextEndDateDate.destroy(),

this.overTextEndDateDate=null);this.overTextEndDateMonth&&(this.overTextEndDateMonth.destroy(),
this.overTextEndDateMonth=null);this.overTextEndDateYear&&(this.overTextEndDateYear.destroy(),thi
s.overTextEndDateYear=null);this.overTextAdd&&(this.overTextAdd.destroy(),this.overTextAdd=null)},in
itOverTexts:function(){var a=this;this.overTextEndDateDate=new
OverTextInput({inputElt:"afEndDateDate",defaultText:"DD",textColor:VMASettingConst.TEXT_INPUT_CO
LOR,onBlur:function(){a.onDateInputBlur2("blur",document.id("afEndDateDate"),

"afEndDate",a.dateInputEventHandler.bind(a))}});document.id("afEndDateDate").addEvent("click",functi
on(a){a.stop()});this.overTextEndDateMonth=new
OverTextInput({inputElt:"afEndDateMonth",defaultText:"MM",textColor:VMASettingConst.TEXT_INPUT
_COLOR,onBlur:function()
{a.onDateInputBlur2("blur",document.id("afEndDateMonth"),"afEndDate",a.dateInputEventHandler.bin
d(a))}});document.id("afEndDateMonth").addEvent("click",function(a)
{a.stop()});this.overTextEndDateYear=new OverTextInput({inputElt:"afEndDateYear",

defaultText:"YYYY",textColor:VMASettingConst.TEXT_INPUT_COLOR,onBlur:function()
{a.onDateInputBlur2("blur",document.id("afEndDateYear"),"afEndDate",a.dateInputEventHandler.bind(
a))}});document.id("afEndDateYear").addEvent("click",function(a){a.stop()});var
b=this.getAddInputElt();this.overTextAdd=new OverTextInput({inputElt:b,defaultText:"Enter your auto
forward destination
here",textColor:VMASettingConst.TEXT_INPUT_COLOR});this.overTextAdd.enable();b.addEvent("click",fu
nction(a){a.stop()})},dateInputEventHandler:function(a,

b,c){switch(b){case "success":this.validDate=!0;0<this.options.endDate?(b=new
Date(this.options.endDate),b.getMonth()
+1===c.month&&b.getDate()===c.date&&b.getFullYear()===c.year?
this.enableButton(vmadom.afSaveDateButton(),!1):this.enableButton(vmadom.afSaveDateButton(),!
0),"blur"===a&&this.setErrorMessage()):this.setErrorMessage();break;case "date":case "month":case
"year":case "value":this.validDate=!
1;"blur"===a&&this.setErrorMessage(VMAUiText.settings.AUTOFORWARD_INVALID_END_DATE);this.en
ableButton(vmadom.afSaveDateButton(),

!1);break;case "past":this.validDate=!
1,"blur"===a&&this.setErrorMessage(VMAUiText.settings.AUTOFORWARD_INVALID_END_DATE),this.en
ableButton(vmadom.afSaveDateButton(),!1)}},buildStatusMessage:function(a){var
b=null;if(a)switch(a.status){case "ACTIVE":b=new
Date(this.options.endDate);b=VMAUiText.settings.AUTOFORWARD_ACTIVE_STATUS.substitute({dest:V
MAUtils.formatMdn(a.address),date:VMAUtils.formatUTCDate1(b)});break;case
"PENDING":b=VMAUiText.settings.AUTOFORWARD_PENDING_STATUS.substitute({dest:VMAUtils.forma
tMdn(a.address)});

break;case
"DECLINED":b=VMAUiText.settings.AUTOFORWARD_DECLINED_STATUS.substitute({dest:VMAUtils.form
atMdn(a.address)})}return b},isDuplicateDestination:function(a){var b=!
1,c=this.toPlainDestination(a);VMAUtils.isEmpty(this.options.destinations)||
(b=this.options.destinations.some(function(a){return this.toPlainDestination(a.address)===c?!0:!
1},this));return b},toPlainDestination:function(a){a=a.trim();var
b=VMAUtils.validateMdnMultiFormat(a);b.validFull?a=b.plain:(VMAUtils.validateEmailAddress(a),

a=a.toLowerCase());return a},createDefaultEndDate:function(){return(new
Date).increment("day",14).clearTime()},setDate:function(a,b)
{document.id("af"+b+"Date").set("value",a.get("UTCDate"));this["overText"+b+"Date"].enable().hide();d
ocument.id("af"+b+"Month").set("value",a.get("UTCMonth")
+1);this["overText"+b+"Month"].enable().hide();document.id("af"+b+"Year").set("value",a.get("UTCFullY
ear"));this["overText"+b+"Year"].enable().hide()},showDateOverText:function(a)
{document.id("af"+a+"Date").set("value",

"");this["overText"+a+"Date"].show();document.id("af"+a+"Month").set("value","");this["overText"+a+"
Month"].show();document.id("af"+a+"Year").set("value","");this["overText"+a+"Year"].show()},turnOnL
ocal:function(a,b){this.settingsToggleField.setValue(a);this.enableBlock(a,
{blockElt:this.getOnOffBlockElt(),showMask:b,maskName:"autoForwardOnOffMask"})},selectDestination
Local:function(a,b){document.id(a).getElement("input.vma-afRadio").set("checked",!1!
==b)},turnOffFake:function(){this.turnOnLocal(!1,

!
0);this.setTopMessage();this.setErrorMessage();this.showDateOverText("EndDate");vmadom.afSaveDat
eButton().hide();this.fakeOn=!1},turnOnFake:function(){this.turnOnLocal(!0,!
1);this.setTopMessage(this.TM_ADD);this.setErrorMessage();var
a=this.createDefaultEndDate();this.setDate(a,"EndDate");this.setOptions({endDate:a.getTime()});vmado
m.afSaveDateButton().hide();vmadom.afInput().set("value","").focus();this.fakeOn=!
0},onTurnOnOff:function(a)
{if((a=a.getValue())&&VMAUtils.isEmpty(this.options.destinations))this.turnOnFake();

else if(this.fakeOn)this.turnOffFake();else{this.spin(a?"Turning On ...":"Turning Off ...",100);a||


this.cancelEditDestination();var
b;a&&(b=this.createDateStr(this.options.endDate));this._s_enable(a,b)}},_s_enable:function(a,b)
{vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:a?"ENABLE":"DISABLE",endDate:a?b:void
0}})},_s_refresh:function(){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"REFRESH"}})},onResendRequest:function(a,b){a.stop();
if(this.validDate){var
c=this.getDestElt(b),d=c.retrieve("afDestination");this.pendingSelectedDestinationEltId=c.get("id");c=thi
s.buildDateString("afEndDate");this.spin("Updating ...",100);this._s_selectDestination(d,c)}},onSelectDes
tination:function(a,b){a.stop();if(this.validDate){var
c=this.getDestElt(b),d=c.retrieve("afDestination");this.pendingSelectedDestinationEltId=c.get("id");c=thi
s.buildDateString("afEndDate");this.spin("Updating ...",100);this._s_selectDestination(d,c)}},_s_selectDe
stination:function(a,

b){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"SELECT",destination:a.address,endDate:b}})},_s_addDestination:
function(a,b){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"ADD_DESTINATION",destination:a,endDate:b}})},_s_addFirstDes
tination:function(a,b){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"ADD_FIRST_DESTINATION",destination:a,endDate:b}})},_s_delet
eDestination:function(a){vmamain._s_submitSettingsRequest({data:{category:this.options.name,

operation:"DELETE_DESTINATION",destination:a}})},_s_saveEndDate:function(a)
{vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"UPDATE_DATE_RANGE",endDate:a}})},onSaveDateRange:functi
on(a,b){a.stop();var
c=this.buildDateString("afEndDate");this.spin("Saving ...",100);this._s_saveEndDate(c)},onSaveNewDesti
nation:function(a,b){a.stop();var
c=this.toPlainDestination(vmadom.afInput().get("value"));this.pendingNewDestination=c;var
d=this.buildDateString("afEndDate");this.fakeOn?

(this.spin("Saving ...",100),this._s_addFirstDestination(c,d)):
(this.spin("Saving ...",100),this._s_addDestination(c,d))},onDeleteDestination:function(a,b){a.stop();var
c=this.getDestElt(b).retrieve("afDestination");this.spin("Deleting ...",100);this._s_deleteDestination(c.ad
dress)},cancelEditDestination:function()
{vmadom.afInput().set("value","");this.enableButton(vmadom.afAddButton(),!
1)},onResponse:function(a){this.parent(a);this.fakeOn=!1;this.unspin();var b,c=!0;switch(a.status){case
"SUCCESS":switch(a.afStatus){case "SUCCESS":this.setOptions(a.autoForwardSetting);

this.cancelEditDestination(!1);this.resetData();switch(a.operation){case
"UPDATE_DATE_RANGE":b=VMAUiText.settings.AUTOFORWARD_CONFIRM_SAVE;break;default:vmama
in.updateSettingsStatus({autoForwardOn:this.options.enabled})}c=!1;break;case
"INVALID_MDN":b=VMAUiText.settings.AUTOFORWARD_INVALID_DEST;break;case
"DUPLICATE_DESTINATION":b=VMAUiText.settings.AUTOFORWARD_DUPLICATED_DEST;break;case
"ALREADY_AUTO_FORWARDED":b=VMAUiText.settings.AUTOFORWARD_ALREADY_FORWARDED;break;
case "SYSTEM_ERROR":b=VMAUiText.SYSTEM_ERROR}c?

(this.setErrorMessage(b),this.setTopMessage()):
(this.setTopMessage(b),this.setErrorMessage());break;default:vmamain.handleSystemError({refresh:!
1})}},onAfterSelect:function(){this.parent();this.turnOnLocal(this.options.enabled,!
0)},onBeforeDeselect:function(){this.parent();this.fakeOn?(this.turnOffFake(),this.turnOnLocal(!1,!
1)):this.turnOnLocal(this.options.enabled,!1);this.setErrorMessage()},getAddInputElt:function(){return
document.id("forwardMsg")},setDestStatusMessage:function(a){var
b=document.id(a.dstEltId).getElement(".forwardSuccess");

VMAUtils.isEmpty(a.message)?b.hide():
(this.setDestErrorMessage({dstEltId:a.dstEltId}),b.set("html",a.message).show())},setDestErrorMessage:f
unction(a){var b=document.id(a.dstEltId).getElement(".forwardError");VMAUtils.isEmpty(a.message)?
b.hide():
(this.setDestStatusMessage({dstEltId:a.dstEltId}),b.set("html",a.message).show())},setStatusMessage:fun
ction(a){if(a){var b;switch(a.operation){case
"DIRECT":b=a.message}b&&this.doShowStatusMessage({message:b,statusEltId:"autoFwdMsg",containe
rEltId:"autoFwdContent",

autoHide:!0===a.autoHide})}else
this.doShowStatusMessage({statusEltId:"autoFwdMsg"})},setErrorMessage:function(a){a?
(this.setStatusMessage(),this.doShowErrorMessage({message:a,errorEltId:"autoFwdError",containerEltI
d:"autoFwdContent"})):this.doShowErrorMessage({errorEltId:"autoFwdError"})},getDestElt:function(a)
{return document.id(a).getParent("li.vma-afDest")},getOnOffBlockElt:function(){return
vmadom.get("#autoForwardSetting .autoReplyMessage")},resetData:function(){this.validInput=!
1;this.validDate=

!0;var a=document.id("autoForwardList");a.getElements("div.settingFrmRow").each(function(a)
{a.eliminate("afDestination")});a.empty();this.setStatusMessage();if(VMAUtils.isEmpty(this.options.desti
nations))this.options.enabled?
this.setStatusMessage({operation:"DIRECT",message:this.TM_ADD,autoHide:!
1}):this.setStatusMessage(),vmadom.afSaveDateButton().hide();else{this.mode="NORMAL";var
b;this.options.destinations.each(function(c,e){var
f=document.id("autoForwardMessageTpl").clone();f.set("id",String.uniqueID());

f.inject(a,"bottom");"ACTIVE"===c.status||"PENDING"===c.status?
(this.selectedDestinationEltId=f.get("id"),f.getElement(".vma-afDelete").hide(),f.getElement(".vma-
afResend").show("PENDING"===c.status),this.setDestStatusMessage({message:this.buildStatusMessage(
c),dstEltId:f.get("id")}),b=f.getElement(".vma-afRadio")):"DECLINED"===c.status&&0===e?
(f.getElement(".vma-afDelete").show(),f.getElement(".vma-
afResend").hide(),this.setDestErrorMessage({message:this.buildStatusMessage(c),dstEltId:f.get("id")})):

(f.getElement(".vma-afDelete").show(),f.getElement(".vma-
afResend").hide(),this.setDestStatusMessage({dstEltId:f.get("id")}),this.setDestErrorMessage({dstEltId:f.
get("id")}));f.getElement(".settingDescText").set("text",VMAUtils.formatMdn(c.address.toLowerCase()));
f.store("afDestination",c)},this);b&&b.check(!
0);this.setStatusMessage();this.enableButton(vmadom.afSaveDateButton(),!
1).show()}this.turnOnLocal(this.options.enabled,"SELECTED"===this.status&&!
this.options.enabled);if(0===this.options.endDate)this.setOptions({endDate:this.createDefaultEndDate()
.getTime()});

else{var c=(new
Date).clearTime();this.options.endDate<c.getTime()&&this.setOptions({endDate:this.createDefaultEndD
ate().getTime()})}this.options.enabled?this.setDate(new
Date(this.options.endDate),"EndDate"):this.showDateOverText("EndDate");this.getAddInputElt().set("va
lue","");this.overTextAdd.show()},onInitData:function()
{this.parent();this.initOverTexts();this._initEvents();this.initToolTips();this.resetData();this.enableButton(
vmadom.afAddButton(),!1)},initToolTips:function(){this.toolTips=new Tips(".tooltip",

{className:"tool-tip",title:null,fixed:!0,text:function(){return"Messages will not be sent to your phone


and will be \x3cbr/\x3eforwarded to the Verizon mobile number or email \x3cbr/\x3eaddress you
choose."}})},showAddControls_deprecated:function(a){vmadom.get("#autoForwardSetting .vma-
afAddForm").show(a)},setTopMessage:function(a){a?
this.setStatusMessage({operation:"DIRECT",message:a,autoHide:!
0}):this.setStatusMessage()}},VMAAutoForwardBase=new
Class(VMAAutoForwardBaseClassDef),VMAAutoForward=

new Class({Extends:VMAAutoForwardBase});var
VMANicknameBaseClassDef={Extends:VMASetting,UNSET_NICKNAME:"@",status:"BLANK",value:null,ini
tialize:function(a)
{this.parent(Object.append({name:"NICKNAME",prefix:"nickname"},a))},onInitData:function()
{this.parent();document.id("nicknameMdn").set("html",VMAUtils.formatMdn(VMAIMConst.HOST_MDN
));this.resetData();this._initEvents()},_initEvents:function()
{document.id("editEmailTextBtn").addEvent("click",this.onEdit.bind(this));document.id("cancelEmailTxt
Btn").addEvent("click",this.onCancel.bind(this));

document.id("emailToTextBtn").addEvent("click",this.onSave.bind(this));document.id("nicknameInput").
addEvents({keyup:this.onKeyUpInput.bind(this),keydown:function(a)
{a.stopPropagation()},click:function(a){a.stop()}})},onResponse:function(a)
{this.parent(a);this.unspin();var b=!0;switch(a.status){case
"SUCCESS":this.setOptions(a.nicknameSetting);this.setErrorMessage();break;default:b=!
1;switch(a.status){case "DUP_NICKNAME":a=VMAUiText.settings.DUP_NICKNAME;break;case
"INVALID_NICKNAME":a=VMAUiText.settings.INVALID_NICKNAME;

break;default:a=VMAUiText.SYSTEM_ERROR}this.setErrorMessage(a)}b&&this.resetData()},updateEditC
ontrolState:function()
{this.enableButton(this.getSaveBtnElt(),"VALID"===this.status||"BLANK"===this.status)},getNicknameIn
putElt:function(){return document.id("nicknameInput")},validateValue:function(a){var
b="VALID";VMAUtils.isEmpty(a)?b="BLANK":!VMAUtils.validateEmailPrefix(a)||
VMAUtils.validateMdn(a)?b="INVALID":a===this.options.value?b="SAME":0>a.search(/.*[a-z]
+.*/)&&(b="INVALID");return b},onKeyUpInput:function(a){a.stop();

var b=a.target.value.trim().toLowerCase();this.status=this.validateValue(b);switch(this.status){case
"VALID":a.target.setStyle("color","#333333");this.setErrorMessage();if("enter"===a.key)this.onSave();br
eak;case
"INVALID":a.target.setStyle("color","#B00000");this.setErrorMessage(VMAUiText.settings.INVALID_NICK
NAME);break;case "BLANK":a.target.setStyle("color","#B00000");this.setErrorMessage();break;case
"SAME":a.target.setStyle("color","#B00000"),this.setErrorMessage(VMAUiText.settings.SAME_NICKNAM
E)}this.updateEditControlState()},
setErrorMessage:function(a){a?
document.id("emailTextErr").set("html",a).show():document.id("emailTextErr").set("html","").hide()},on
Cancel:function(a){a.stop();this.resetData()},onSave:function(a)
{a&&a.stop();this.value=this.getNicknameInputElt().get("value").trim();this.options.value.toLowerCase()
===this.value.toLowerCase()?this.setErrorMessage(VMAUiText.settings.SAME_NICKNAME):
(this.spin("Saving ...",100),this._s_update(this.value))},_s_update:function(a)
{vmamain._s_submitSettingsRequest({data:{category:this.options.name,

operation:"UPDATE",nickname:a}})},onInitEvents:function(){this.parent()},resetData:function(){var
a=document.id("nicknameSetting"),b=a.getElement(".emailText");VMAUtils.isEmpty(this.options.value)?
(b&&b.set("html","(unset)"),document.id("nicknameInput").set("value","")):(b&&b.set("html",
$escapeHtml(this.options.value+VMAIMConst.NICKNAME_EMAIL_SUFFIX)),document.id("nicknameInpu
t").set("value",this.options.value));a.getElement(".emailExtension
strong").set("html",VMAIMConst.NICKNAME_EMAIL_SUFFIX);b&&

b.show();(a=document.id("editEmailTextBtn"))&&a.show();vmadom.gets("#emailToTextBtn,
#cancelEmailTxtBtn,
#emailTextForm").hide();this.updateEditControlState();this.setErrorMessage()},getSaveBtnElt:function()
{return document.id("emailToTextBtn")},onEdit:function(a)
{a.stop();a.target.hide();vmadom.get("#nicknameSetting
.emailText").hide();document.id("editEmailTextBtn").hide();vmadom.gets("#emailToTextBtn,
#cancelEmailTxtBtn, #emailTextForm").show()}},VMANicknameBase=new
Class(VMANicknameBaseClassDef),

VMANickname=new Class({Extends:VMANicknameBase});var
VMAQuickTextBaseClassDef={Extends:VMASetting,EDIT_ITEM_ID_PREFIX:"quickText-",editCharCounter:
null,selectedEditItem:null,mode:"NORMAL",editBoxEltId:null,initialize:function(a)
{this.parent(Object.append({name:"QUICK_TEXT",prefix:"quickText"},a))},onInitEvents:function()
{this.parent()},onInitData:function()
{this.parent();document.id("quickTextSetting").store("settingName","QUICK_TEXT");this.refreshEdit();do
cument.id("quickCount").set("html",VMAIMConst.MAX_QUICK_TEXT_LENGTH);document.id("quickTxtC
ount").set("html",

VMAIMConst.MAX_QUICK_TEXT_LENGTH);this._initEvents();this.editCharCounter=new
CharCounter({containerEltSelector:document.id("vma-
quickTextSettingDesc"),textEltSelector:"#quickTextArea",counterEltSelector:"#quickTxtCount",maxLengt
h:VMAIMConst.MAX_QUICK_TEXT_LENGTH,keyupHandler:this.onKeyUpEditCharCounter.bind(this),past
eHandler:this.onPasteEditCharCounter.bind(this)})},_initEvents:function(){var
a=this,b=document.id("vma-quickTextList");b.addEvent("click:relay(a.editText)",function(b)
{b.stop();a.onEditItem(b,

this)});b.addEvent("click:relay(.deleteText)",function(b)
{b.stop();a.onDelete(b,this)});document.id("quickTextBtn").addEvent("click",function(b)
{b.stop();a.onSaveEditItem()});document.id("cancelQuickText").addEvent("click",function(b)
{b.stop();a.onCancelEdit(b,this)});document.id("quickTextArea").addEvent("click",function(a)
{a.stop()})},onResponse:function(a){this.parent(a);switch(a.status){case
"SUCCESS":this.setOptions({items:a.quickText});this.refreshMenu();this.refreshEdit();this.mode="NORM
AL";

switch(a.category){case "QUICK_TEXT_IM":vmamain.unmaskContentTransparent();break;case
"QUICK_TEXT":document.id("quickTextArea").set("value",""),this.updateEditControlState(),this.selected
EditItem=null,this.unspin()}break;default:case "SYSTEM_ERROR":vmamain.handleSystemError({refresh:!
1})}},refreshMenu:function(){var
a=vmadom.quickTextMenuItemsContainer();a&&(a.deepEmpty(),this.options.items.each(function(b)
{this._addMenuItem(b,a)},this),this._updateMenuState())},_updateMenuState:function()
{document.id("newTextBox")&&

(this.options.items.length>=VMAIMConst.MAX_QUICK_TEXT_NUM?
document.id("newTextBox").hide():document.id("newTextBox").show())},_addMenuItem:function(a,b)
{var c=vmadom.quickTextMenuItemTpl().clone(),d=c.getElement(".messageTag");d.set("html",
$escapeHtml(a.value));d.store("item",a);b.grab(c,"bottom")},addItemForMessages:function(a)
{this.isDuplicateItem(a)||
(vmamain.maskContentTransparent(10),this._s_addItem(a,"QUICK_TEXT_IM"))},deleteItemForMessage:
function(a){vmamain.maskContentTransparent(10);this._s_deleteItem(a,

"QUICK_TEXT_IM")},_setEditState:function(a,b){b?(a.getElement("span.quickText").replaceClasses(null,
["vma-bold","vma-
italic"]),a.getElement(".editText").hide(),a.getElement(".editTextDisabled").show("inline"),a.addClass("q
uickTextSelected")):(a.getElement("span.quickText").replaceClasses(["vma-bold","vma-
italic"],null),a.getElement(".editText").show("inline"),a.getElement(".editTextDisabled").hide(),a.remove
Class("quickTextSelected"))},onKeyUpEditCharCounter:function(a,b){var
c=this.updateEditControlState();

VMADebug.write("QUICK_TEXT::onKeyUpEditCharCounter: valid\x3d"+c+",
event.key\x3d"+a.key);"enter"===a.key&&c&&(VMADebug.write("QUICK_TEXT::onKeyUpEditCharCount
er: calling onSaveEditItem"),this.onSaveEditItem())},getSaveBtnElt:function(){return
document.id("quickTextBtn")},isDuplicateItem:function(a){var b=!
1;VMAUtils.isEmpty(this.options.items)||(b=this.options.items.some(function(b){return
b.value===a}));return b},updateEditControlState:function(){var a=!
0,b=this.options.items.length>=VMAIMConst.MAX_QUICK_TEXT_NUM,

c=document.id("quickTextArea").get("value"),d=this.getSaveBtnElt();b&&"EDIT"!==this.mode||
0===c.length||this.selectedEditItem&&c===this.selectedEditItem.value||this.isDuplicateItem(c)?(a=!
1,this.enableButton(d,!1)):this.enableButton(d,!
0);document.id("quickTextArea").set("disabled",b&&"EDIT"!==this.mode);return
a},onSaveEditItem:function(){this.spin("Saving ...",100);this.selectedEditItem?
this._s_updateItem(document.id("quickTextArea").get("value"),this.selectedEditItem.idStr,"QUICK_TEXT
"):this._s_addItem(document.id("quickTextArea").get("value"),

"QUICK_TEXT")},onCancelEditItem:function(){if(this.selectedEditItem){var
a=document.id(this.EDIT_ITEM_ID_PREFIX+this.selectedEditItem.idStr);this._setEditState(a,!
1);this.selectedEditItem=null}document.id("quickTextArea").set("value","")},onDeleteEditItem:function(
a)
{this.spin("Saving ...",100);a=a.retrieve("item");this._s_deleteItem(a.idStr,"QUICK_TEXT")},_s_addItem:f
unction(a,b){vmamain._s_submitSettingsRequest({data:
{category:b,operation:"ADD",quickTextItemValue:a}})},_s_deleteItem:function(a,

b){vmamain._s_submitSettingsRequest({data:
{category:b,operation:"DELETE",quickTextItemId:a}})},_s_updateItem:function(a,b,c)
{vmamain._s_submitSettingsRequest({data:
{category:c,operation:"UPDATE",quickTextItemId:b,quickTextItemValue:a}})},onInitForMessages:functio
n(){this.parent();var a=document.id("vma-
quickTextMenuItemsContainer"),b=this;VMADebug.write("VMAQuickTextImpl::onInitForMessages");a.a
ddEvents({"click:relay(li \x3e a)":function(a){a.stop();VMADebug.write("quickText: to insert
item");a=this.retrieve("item");

vmaim.insertQuickText(a);vmaim.showComposeMenu("vma-cp-quickText",!1)},"mouseenter:relay(li
\x3e a)":function(a){this.getNext().show()},"mouseleave:relay(li \x3e a)":function(a)
{this.getNext().hide()},"mouseenter:relay(.deleteTag)":function(a)
{this.getPrevious().setStyles({"background-color":"#DDDDDD","font-
weight":"bold"});this.setStyles({"background-position":"-340px
-370px",display:"block"})},"mouseleave:relay(.deleteTag)":function(a)
{this.getPrevious().setStyles({"background-color":"","font-weight":"normal"});

this.setStyles({"background-position":null,display:"none"})},"click:relay(.deleteTag)":function(a)
{a.stop();a=a.target.getPrevious("a.messageTag");vmamain.quickText.deleteItemForMessage(a.retrieve(
"item").idStr)}});document.id("vma-menuNewQuickText").addEvent("click",function(a)
{a.stop();a.target.hide();document.id("newTag").set("value","");a.target.getNext("div").show()});docume
nt.id("newTag").addEvent("click",function(a)
{a.stop();vmadom.quickTextMenu().show();document.id("vma-newQuickTextTags").replaceClasses(null,

"activeOption");document.id("vma-menuNewQuickText").hide();document.id("vma-
menuNewQuickTextForm").show()});document.id("saveTag").addEvent("click",function(a)
{a.stop();a=document.id("newTag").get("value");0!
==a.trim().length&&(b.addItemForMessages(a),document.id("vma-
menuNewQuickText").show(),document.id("vma-
menuNewQuickTextForm").hide())})},refreshEdit:function(){var a=this.getCompElt();if(a){var
b=a.getElement(".quickTextList");b.getElements("li.vma-quickTextItem").each(function(a)
{a.getElement("div.quickTextBox").eliminate("item")});

b.deepEmpty();this.options.items.each(function(a,d)
{this._addEditItem(a,d,b)},this);a=this.options.items.length>=VMAIMConst.MAX_QUICK_TEXT_NUM;doc
ument.id("quickTextArea").set("disabled",a);this.enableButton(this.getSaveBtnElt(),!
1)}this.editCharCounter&&this.editCharCounter.refresh()},onCancelEdit:function(a,b){this.editBoxEltId?
this.cancelEdit(document.id(this.editBoxeltId)):
(document.id("quickTextArea").set("value",""),this.updateEditControlState())},onEditItem:function(a,b)
{this.editBoxEltId&&

this.cancelEdit(document.id(this.editBoxEltId));this.editItem(b.getParent("div.quickTextBox"));document
.id("quickTextArea").set("disabled",!1)},editItem:function(a){this.mode="EDIT";var
b=a.retrieve("item");document.id("quickTextArea").set("value",b.value);this.updateEditControlState(b);t
his.selectedEditItem=b;this.editBoxEltId=a.get("id");this.editCharCounter.refresh()},cancelEdit:function(
a)
{document.id("quickTextArea").set("value","");this.editBoxEltId=this.selectedEditItem=null;this.editChar
Counter.refresh();

a=this.options.items.length>=VMAIMConst.MAX_QUICK_TEXT_NUM;document.id("quickTextArea").set(
"disabled",a);this.mode="NORMAL"},_addEditItem:function(a,b,c)
{b=document.id("quickTextTemplate").clone();b.getElement("div.quickTextBox").store("item",a);b.getEl
ement("span.quickText").set("html",
$escapeHtml(a.value));b.getElement("div.quickTextBox").set("id",this.EDIT_ITEM_ID_PREFIX+a.idStr);c.g
rab(b,"bottom")},onDelete:function(a,b){this.spin("Deleting ...",100);VMADebug.write("deleting quick
text");var c=

b.getParent("div.quickTextBox").retrieve("item");this._s_deleteItem(c.idStr,"QUICK_TEXT")},onPasteEdit
CharCounter:function(a,b){this.updateEditControlState()}},VMAQuickTextBase=new
Class(VMAQuickTextBaseClassDef),VMAQuickText=new Class({Extends:VMAQuickTextBase});var
VMAAutoSignatureBaseClassDef={Extends:VMASetting,editEnabled:!
1,settingsToggleField:null,initialize:function(a)
{this.parent(Object.append({name:"SIGNATURE",prefix:"autoSignature"},a))},onInitEvents:function()
{this.parent()},onInitData:function()
{this.parent();this._initEvents();this.resetData("LOAD")},_initEvents:function(){this.getCompElt();var
a=this;this.settingsToggleField=new VMAToggleField({element:"#autoSignatureSetting .toggle-
field.settingsStatus"});this.settingsToggleField.addEvent("change",

function(b){a.onTurnOnOff(this)});document.id("autoSignatureCancel").addEvent("click",function(b)
{a.onCancel(b,this)});document.id("signatureBtn").addEvent("click",function(b)
{a.onSave(b,this)})},initCounter:function(){this.signatureCharCounter=new
CharCounter({containerEltSelector:"#autoSignatureSetting",textEltSelector:"#autoSignature",counterElt
Selector:"#vma-asTextCount",maxLengthEltSelector:"#vma-
asTotalCount",maxLength:VMAIMConst.SIGNATURE_MAX_LENGTH,keyupHandler:this.onKeyUpEditChar
Counter.bind(this),

pasteHandler:this.onPasteEditCharCounter.bind(this)});document.id("autoSignature").addEvent("click",f
unction(a){a.stop()})},resetData:function(a)
{this.getValueElt().set("value",this.options.value);this.initCounter();VMADebug.write("AUTO_SIGNATUR
E: refresh char
counter");this.signatureCharCounter.refresh();this.editEnabled=this.options.enabled;this.updateEditCon
trolState();this.turnOnLocal(this.options.enabled,!1)},updateValue:function(a)
{document.id("autoSignature").set("value",a);this.signatureCharCounter.refresh()},

turnOnLocal:function(a,b){this.settingsToggleField.setValue(a);this.enableBlock(a,
{blockElt:vmadom.get("#autoSignatureSetting
.tabBlock"),showMask:b,maskName:"autoSignatureOnOffMask"})},onCancel:function(a,b)
{a.stop();this.updateValue("");this.updateEditControlState()},showStatusMessage:function(a){if(a){var
b;switch(a.operation){case "UPDATE":b="Your auto signature has been
saved."}b&&this.doShowStatusMessage({message:b,statusEltId:"autoSignMsg",containerEltId:"autoSign
atureContent"})}else this.doShowStatusMessage({statusEltId:"autoSignMsg"})},

onResponse:function(a){this.parent(a);this.unspin();switch(a.status){case
"SUCCESS":a.signatureSetting.value||
(a.signatureSetting.value="");this.setOptions(a.signatureSetting);this.showStatusMessage(a);this.resetD
ata(a.operation);this.turnOnLocal(this.options.enabled,!this.options.enabled);break;case
"SYSTEM_ERROR":vmamain.handleSystemError({refresh:!1})}},onSave:function(a)
{a.stop();this.spin("Saving ...",100);a=document.id("autoSignature").get("value").trim();this._s_update(a)
},_s_update:function(a){vmamain._s_submitSettingsRequest({data:{category:this.options.name,

operation:"UPDATE",signature:a}})},_s_enable:function(a){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:a?"ENABLE":"DISABLE"}})},onTurnOnOff:function(a)
{a=a.getValue();this.spin(a?"Enabling ...":"Disabling ...",100);this._s_enable(a)},onKeyUpEditCharCounter
:function(a,b){a.stop();this.updateEditControlState()},onPasteEditCharCounter:function(a,b)
{this.onKeyUpEditCharCounter(a,b)},updateEditControlState:function(){var
a=this.getValueElt().get("value"),b=document.id("signatureBtn");

a===this.options.value?this.enableButton(b,!1):this.enableButton(b,!0)},onAfterSelect:function()
{this.parent();this.turnOnLocal(this.options.enabled,!0)},onBeforeDeselect:function()
{this.parent();this.turnOnLocal(this.options.enabled,!1)},getValueElt:function(){return
document.id("autoSignature")}},VMAAutoSignatureBase=new
Class(VMAAutoSignatureBaseClassDef),VMAAutoSignature=new
Class({Extends:VMAAutoSignatureBase});var
VMADeprovisionBaseClassDef={Extends:VMASetting,initialize:function(a)
{this.parent(Object.append({name:"DEPROVISION",prefix:"deprovision"},a))},onInitEvents:function()
{this.parent()},_initEvents:function(){var
a=this;document.id("deleteAccount").addEvent("click",function(b)
{a.onSubmit(b,this)});document.id("currentPassword").addEvent("click",function(a)
{a.stop()})},onInitData:function(){this.parent();this.resetData();this._initEvents()},resetData:function()
{},onResponse:function(a){this.parent(a);

switch(a.status){case "SUCCESS":vmaim.subscriber.getId()?
vmaim.grpcore.deleteSubscriber({onSuccess:function()
{window.location=VMAIMConst.VTEXT_LOGGEDIN_URL},onFailure:function()
{window.location=VMAIMConst.VTEXT_LOGGEDIN_URL}}):window.location=VMAIMConst.VTEXT_LOGG
EDIN_URL;break;case
"AUTHENTICATION_FAILURE":this.unspin();VMAPopupUtils.alert({message:"Authentication failed.
Please try again.",title:VMAConst.DEFAULT_DIALOG_TITLE,width:300,buttons:["ok"]});break;default:case
"SYSTEM_ERROR":this.unspin(),

vmamain.handleSystemError({reason:"Authentication",refresh:!1})}},onAfterSlideIn:function()
{},onAfterSlideOut:function(){document.id("currentPassword").set("value","")},onSubmit:function(a)
{a.stop();a=document.id("currentPassword").get("value").trim();VMAUtils.isEmpty(a)||
(this.spin("Deprovisioning ...",100),this._s_submit(document.id("currentPassword").get("value")))},_s_su
bmit:function(a){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"UPDATE",password:a}})}},VMADeprovisionBase=
new Class(VMADeprovisionBaseClassDef),VMADeprovision=new
Class({Extends:VMADeprovisionBase});var
VMASpamControlBaseClassDef={Extends:VMASetting,initialize:function(a)
{this.parent(Object.append({name:"SPAM_CONTROL",prefix:"spamControl"},a))},onInitEvents:function()
{this.parent()},onInitData:function(){this.parent();this.resetData()},resetData:function()
{}},VMASpamControlBase=new Class(VMASpamControlBaseClassDef),VMASpamControl=new
Class({Extends:VMASpamControlBase});var
VMAManageDevicesBaseClassDef={Extends:VMASetting,initialize:function(a)
{this.parent(Object.append({name:"MANAGE_DEVICES",prefix:"manageDevices"},a))},onInitEvents:func
tion(){},onInitData:function(){this.parent();this._initEvents();this.resetData()},_initEvents:function(){var
a=this;document.id("removeAllDevices").addEvent("click",function(b)
{a.onRemoveDevices(b,this)});document.id("vma-
deviceListContainer").addEvent("click:relay(.deviceRow a)",function(b)
{a.onRemoveDevice(b,this)})},resetData:function(){this.clearDevicesElts();

var a=this.getCompElt().getElement(".deviceManager"),b=document.id("linkedDeviceTpl"),c=!
1;VMAUtils.isEmpty(this.options.linkedDevices)||(this.options.linkedDevices.each(function(c){var
e=b.clone();e.store("deviceId",c.deviceId);e.store("prid",c.prid);e.getElement(".deviceList").set("html",c.
deviceName?c.deviceName.truncate(40,"..."):"(name not
provided)").addClass("registeredDevices");e.getElement(".deviceDate").set("html",this.buildDateString(c
.createTime));if(null!==e.getElement(".deviceFeature")){var f=

"Disabled",g="Disabled";"Y"===c.messagingFlag&&(f="Enabled");"Y"===c.voiceFlag&&(g="Enabled");c=n
ew Element("div",{"class":["smsFeature icon-message-bubble sms"+f],title:" SMS "+f});g=new
Element("div",{"class":["voiceFeature icon-phone voice"+g],title:" Voice
"+g});e.getElement(".deviceFeature").grab(g);e.getElement(".deviceFeature").grab(c)}a.grab(e,"bottom")
},this),c=!0);c?this.showRemoveButton(!0):
(c=b.clone(),c.getElement(".deviceList").set("html",VMAUiText.deviceSetting.NONE),c.getElement(".devi
ceRemove").hide(),

a.grab(c,"bottom"),this.showRemoveButton(!1))},clearDevicesElts:function()
{this.getCompElt().getElements(".deviceManager .deviceRow").each(function(a)
{VMAUtils.destroyElement(a)});this.showRemoveButton(!1)},showRemoveButton:function(a)
{document.id("removeAllDevices").show(a)},onRemoveDevices:function(a,b)
{a.stop();VMAPopupUtils.alert({message:VMAUiText.deviceSetting.DISCONNECT_ALL_PROMPT,width:40
0,position:"fixed",buttons:["yes","no"],onYes:function(a)
{a.onComplete();VMAUtils.isEmpty(this.options.linkedDevices)||

(this.spin(VMAUiText.deviceSetting.DISCONNECT_ALL_PROGRESS,100),this._s_removeDevices())}.bind(t
his),onNo:function(a){a.onComplete()}})},_s_removeDevices:function()
{vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"DELETE_ALL"}})},onRemoveDevice:function(a,b)
{a.stop();VMAPopupUtils.alert({message:VMAUiText.deviceSetting.DISCONNECT_PROMPT,width:400,po
sition:"fixed",buttons:["yes","no"],onYes:function(a)
{a.onComplete();this.spin(VMAUiText.deviceSetting.DISCONNECT_PROGRESS,
100);a=b.getParent(".deviceRow");this._s_removeDevice(a.retrieve("deviceId"),a.retrieve("prid"))}.bind(
this),onNo:function(a){a.onComplete()}})},_s_removeDevice:function(a,b)
{vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"DELETE",deviceId:a,prid:b}})},onResponse:function(a)
{this.unspin();switch(a.status){case
"SUCCESS":this.setOptions(a.deviceSetting);this.resetData();break;case
"SYSTEM_ERROR":vmamain.handleSystemError({refresh:!1})}},buildDateString:function(a){return(new
Date(a)).format("%B %d, %Y %X")}},

VMAManageDevicesBase=new Class(VMAManageDevicesBaseClassDef),VMAManageDevices=new
Class({Extends:VMAManageDevicesBase});var
VMAManageBrowserLoginsBaseClassDef={Extends:VMASetting,initialize:function(a)
{this.parent(Object.append({name:"MANAGE_BROWSER_LOGINS",prefix:"manageBrowserLogins"},a))},
onInitEvents:function(){},onInitData:function()
{this.parent();this._initEvents();this.resetData()},_initEvents:function(){var
a=this;document.id("removeAllBrowserLogins").addEvent("click",function(b)
{a.onRemoveBrowserLogins(b,this)});document.id("vma-
browserLoginsContainer").addEvent("click:relay(.deviceRow a)",function(b)
{a.onRemoveBrowserLogin(b,

this)})},formatBrowserLoginName:function(a){return a.browserName+" "+a.browserVersion+"


("+a.osName+") "+a.ipAddress},resetData:function(){this.clearBrowserLoginsElts();var
a=this.getCompElt().getElement(".deviceManager"),b=document.id("browserLoginTpl"),c=!
1;VMAUtils.isEmpty(this.options.browserLogins)||(this.options.browserLogins.each(function(c){var
e=b.clone();e.store("loginToken",c.loginToken);e.getElement(".deviceList").set("html",this.formatBrows
erLoginName(c).truncate(60,"..."));e.getElement(".deviceDate").set("html",

this.buildDateString(c.createTime));a.grab(e,"bottom")},this),c=!0);c?this.showRemoveButton(!0):
(c=b.clone(),c.getElement(".deviceList").set("html",VMAUiText.browserLogin.NONE),c.getElement(".devi
ceRemove").hide(),a.grab(c,"bottom"),this.showRemoveButton(!1))},clearBrowserLoginsElts:function()
{this.getCompElt().getElements(".deviceManager .deviceRow").each(function(a)
{VMAUtils.destroyElement(a)});this.showRemoveButton(!1)},showRemoveButton:function(a)
{document.id("removeAllBrowserLogins").show(a)},

onRemoveBrowserLogins:function(a,b)
{a.stop();VMAPopupUtils.alert({message:VMAUiText.browserLogin.REMOVE_ALL_PROMPT,width:470,p
osition:"fixed",buttons:["yes","no"],onYes:function(a)
{a.onComplete();VMAUtils.isEmpty(this.options.browserLogins)||
(this.spin(VMAUiText.browserLogin.REMOVE_ALL_PROGRESS,100),this._s_removeBrowserLogins())}.bin
d(this),onNo:function(a){a.onComplete()}})},_s_removeBrowserLogins:function()
{vmamain._s_submitSettingsRequest({data:{category:this.options.name,operation:"DELETE_ALL"}})},

onRemoveBrowserLogin:function(a,b)
{a.stop();VMAPopupUtils.alert({message:VMAUiText.browserLogin.REMOVE_PROMPT,width:470,positio
n:"fixed",buttons:["yes","no"],onYes:function(a)
{a.onComplete();this.spin(VMAUiText.browserLogin.REMOVE_PROGRESS,100);a=b.getParent(".deviceRo
w");this._s_removeBrowserLogin(a.retrieve("loginToken"))}.bind(this),onNo:function(a)
{a.onComplete()}})},_s_removeBrowserLogin:function(a){vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:"DELETE",loginToken:a}})},

onResponse:function(a){this.unspin();switch(a.status){case
"SUCCESS":this.setOptions(a.browserLoginSetting);this.resetData();break;case
"SYSTEM_ERROR":vmamain.handleSystemError({refresh:!1})}},buildDateString:function(a){return(new
Date(a)).format("%B %d, %Y %X")}},VMAManageBrowserLoginsBase=new
Class(VMAManageBrowserLoginsBaseClassDef),VMAManageBrowserLogins=new
Class({Extends:VMAManageBrowserLoginsBase});var
VMADesktopNotificationsBaseClassDef={Extends:VMASetting,useDesktopNotification:!
0,audioSupported:!
0,TOGGLE_SUFFIX:"Toggle",dnToggleField:null,soundSendToggleField:null,soundReceiveToggleField:null,
initialize:function(a)
{this.parent(Object.append({name:"DESKTOP_NOTIFICATIONS",prefix:"desktopNotifications"},a));this.se
tOptions({receiveSoundNotification:"n"!
==Cookie.read("receiveSoundNotification"),sendSoundNotification:"n"!
==Cookie.read("sendSoundNotification"),alertSoundNotification:"n"!
==Cookie.read("alertSoundNotification")});

this.useDesktopNotification=!
("ios"===Browser.platform||"android"===Browser.platform);this.audioSupported=(a=document.createE
lement("audio"))&&a.play?!0:!1;a&&a.destroy&&a.destroy()},onInitEvents:function(){this.parent();var
a=this;this.dnToggleField=new VMAToggleField({element:"#desktopNotificationsSetting .toggle-
field.dnToggle"});this.soundSendToggleField=new
VMAToggleField({element:"#desktopNotificationsSetting .toggle-
field.sendNotification"});this.soundReceiveToggleField=new
VMAToggleField({element:"#desktopNotificationsSetting .toggle-field.receiveNotification"});

this.dnToggleField.addEvent("change",function(b){if(this.getValue())a.onTurnOn(this);else
a.onTurnOff(this)});this.soundSendToggleField.addEvent("change",function(b)
{a.onTogglePlaySoundSendNotifications(this)});this.soundReceiveToggleField.addEvent("change",functio
n(b){a.onTogglePlaySoundReceiveNotifications(this)})},onInitData:function()
{this.parent();this.resetData()},onTurnOn:function(a)
{vmamain.checkDNState="PAUSE";this.spin("Turning on desktop notifications ...",100);var
b=this;vmamain.createDesktopNotiDlg().show(new EOptions({enable:!0,

server:!0,prompt:!1,onComplete:function(a)
{b.unspin();b.resetData();vmamain.checkDNState="RUN"}}))},onTurnOff:function(a)
{vmamain.checkDNState="PAUSE";this.spin("Turning off desktop
notifications ...",100);this._s_turnOnOff(!1)},_s_turnOnOff:function(a)
{vmamain._s_submitSettingsRequest({data:
{category:this.options.name,operation:a?"ENABLE":"DISABLE"}})},showLinks:function(a){switch(a){case
"on":this.dnToggleField.setValue(!1);break;case "off":this.dnToggleField.setValue(!
0);break;default:document.id("dnToggleContainer").hide()}},

resetData:function(a){a=a?a:desktopNotifications.checkCapability();if(this.getCompElt())
{if(this.useDesktopNotification){var
b="";desktopNotifications.isFirefoxHtml5NotificationsInstalled()&&(b="\x3cbr/\x3e\x3cbr/\x3e\x3ci
style\x3d'color: blue'\x3e"+VMAUiText.notifications.FIREFOX_ADDON+"\x3c/i\x3e");var
c=document.id("desktopNotiCapableText");switch(a.capability){case
DesktopNotificationsCapability.CAPABLE:switch(a.permission){case
DesktopNotificationsPermission.ALLOWED:c.set("html",VMAUiText.desktopNoti.CAPABLE_TEXT+

b);this.showLinks("Y"===vmamain.enableDesktopNotifications?"off":"on");break;case
DesktopNotificationsPermission.NOT_ALLOWED:c.set("html",VMAUiText.desktopNoti.CAPABLE_TEXT+b
);this.showLinks("on");break;case
DesktopNotificationsPermission.DENIED:c.set("html",VMAUiText.desktopNoti.BLOCKED_TEXT+b),this.sh
owLinks("hide")}break;case
DesktopNotificationsCapability.REQ_ADDON:c.set("html",VMAUiText.desktopNoti.REQ_ADDON_TEXT.s
ubstitute({url:a.addonUrl}));this.showLinks("hide");break;default:c.set("html",

VMAUiText.desktopNoti.UNSUPPORTED_TEXT),this.showLinks("hide")}}else
document.id("dnContentContainer").hide();this.audioSupported?
(this.soundReceiveToggleField.setValue(this.options.receiveSoundNotification),this.soundSendToggleFie
ld.setValue(this.options.sendSoundNotification)):
(document.id("desktopNotificationsSoundsContainer").hide(),document.id("soundNotiCapableText").set
("html",VMAUiText.notifications.SOUND_INCAPABLE))}},onResponse:function(a){switch(a.status){case
"SUCCESS":"ENABLE"===a.operation?

(vmamain.enableDesktopNotifications="Y",this.unspin()):
(this.unspin(),vmamain.enableDesktopNotifications="N");this.resetData();break;case
"SYSTEM_ERROR":this.unspin(),vmamain.handleSystemError({refresh:!
1})}vmamain.checkDNState="RUN"},onTogglePlaySoundSendNotifications:function(a){(a=a.getValue())?
Cookie.write("sendSoundNotification","y",
{duration:999999}):Cookie.write("sendSoundNotification","n",
{duration:999999});this.setOptions({sendSoundNotification:a})},onTogglePlaySoundReceiveNotifications:
function(a){(a=

a.getValue())?(Cookie.write("receiveSoundNotification","y",
{duration:999999}),Cookie.write("alertSoundNotification","y",{duration:999999})):
(Cookie.write("receiveSoundNotification","n",
{duration:999999}),Cookie.write("alertSoundNotification","n",
{duration:999999}));this.setOptions({receiveSoundNotification:a})},updateSoundNotification:function(a,
b){Cookie.write(a+"Notification",b?"y":"n");var
c={};c[a+"Notification"]=b;this.setOptions(c)}},VMADesktopNotificationsBase=new
Class(VMADesktopNotificationsBaseClassDef),

VMADesktopNotifications=new Class({Extends:VMADesktopNotificationsBase});var
VMAScheduledMessagesBaseClassDef={Extends:VMASetting,scheduledMessage:null,initialize:function(a
)
{this.parent(Object.append({name:"SCHEDULED_MESSAGES",prefix:"scheduledMessages"},a))},onInitEv
ents:function(){},onInitData:function()
{this.parent();this._initEvents();this.resetData()},_initEvents:function(){var a=this;document.id("vma-
scheduledMessagesList").addEvent("click:relay(a)",function(b)
{if(b.target.hasClass("edit"))a.onModifyScheduledMessage(b);else
if(b.target.hasClass("delete"))a.onRemoveScheduledMessage(b)})},

resetData:function(){this.clearSchedulesElts();var
a=this.getCompElt().getElement(".scheduledMessagesList"),b=document.id("scheduledMessageTpl");V
MAUtils.isEmpty(this.options.scheduledMessages)?
this.getCompElt().getElement(".scheduledMessagesEmpty").removeClass("hide"):
(this.getCompElt().getElement(".scheduledMessagesEmpty").addClass("hide"),this.options.scheduledMe
ssages.each(function(c){var d=b.clone(),e=null;d.set("id",c.scheduleId);1===c.statusCode&&(d.set("data-
status",c.statusCode),d.addClass("error"),

e="Unable to send scheduled message.");var f=[];Array.each(c.recipient,function(a){var


b=vmaim.addressBook.getContactByAddress(a);VMAUtils.defined(b)&&VMAUtils.defined(b.displayNam
e)?f.push(b.displayName):
(a=vmaim.activeConversation.parseRecipientInput(a),f.push(a.formattedAddress))});var g=f.join(",
");null===e&&(e=(c.subject?c.subject+" ":"")+(c.message?c.message:""));var h="Single
Message";1<c.recipient.length&&(h=c.groupMessage?"Group Message":"Individual
Messages");d.set("title",h);d.getElement(".msg").set("text",

e);d.getElement(".recip").set("text",g);d.getElement(".date").set("text",vmaim.formatScheduledMessag
eTime(c.sendTime));a.grab(d,"bottom")},this))},clearSchedulesElts:function()
{this.getCompElt().getElements(".scheduledMessagesList li").each(function(a)
{VMAUtils.destroyElement(a)})},removeScheduleElt:function(a)
{a=document.id(a);VMAUtils.destroyElement(a);0===this.getCompElt().getElements(".scheduledMessag
esList li").length&&this.getCompElt().getElement(".scheduledMessagesEmpty").removeClass("hide")},

onModifyScheduledMessage:function(a){a.stop();
(a=a.target.getParent("li").get("id"))&&this._s_loadScheduledMessage(a)},onRemoveScheduledMessage
:function(a)
{a.stop();VMAPopupUtils.alert({message:VMAUiText.scheduledMessages.CONFIRM_DELETE,width:400,p
osition:"fixed",buttons:["yes","no"],onYes:function(b)
{b.onComplete();this.spin(VMAUiText.scheduledMessages.REMOVE_PROGRESS,100);b=a.target.getPare
nt("li").get("id");VMAUtils.isEmpty(b)||
this._s_removeScheduledMessage(b)}.bind(this),onNo:function(a){a.onComplete()}})},

_s_loadScheduledMessage:function(a,b){var c=new EOptions(b,!


0);this.spin(VMAUiText.scheduledMessages.LOAD_PROGRESS,100);vmaim.imcore.loadScheduledMsg({o
p:"LOAD",scheduleId:a,onSuccess:function(a)
{vmaim.newMessageConversation.postLoadScheduledMessage(a);c.fireEvent("complete")},onFailure:fu
nction(a){c.fireEvent("complete")}})},_s_removeScheduledMessage:function(a,b){var c=new
EOptions(b,!
0),d=this;vmaim.imcore.removeScheduledMsg({op:"DELETE",scheduleId:a,onSuccess:function(a)
{VMAUtils.defined(a.scheduleId)?

d.removeScheduleElt(a.scheduleId):VMAPopupUtils.alert({message:VMAUiText.scheduledMessages.FAI
LED_DELETE,width:400,position:"fixed",buttons:["ok"],onOk:function(a)
{a.onComplete()}.bind(this)});d.unspin();c.fireEvent("complete")},onFailure:function(a)
{VMAPopupUtils.alert({message:VMAUiText.scheduledMessages.FAILED_DELETE,width:400,position:"fix
ed",buttons:["ok"],onOk:function(a)
{a.onComplete()}.bind(this)});d.unspin();c.fireEvent("complete")}})},onResponse:function(a)
{this.unspin();switch(a.status){case "SUCCESS":this.setOptions(a.deviceSetting);

this.resetData();break;case "SYSTEM_ERROR":vmamain.handleSystemError({refresh:!
1})}}},VMAScheduledMessagesBase=new
Class(VMAScheduledMessagesBaseClassDef),VMAScheduledMessages=new
Class({Extends:VMAScheduledMessagesBase});var
VMADisplaySettingsBaseClassDef={Extends:VMASetting,useDisplaySettings:!
0,TOGGLE_SUFFIX:"Toggle",dnToggleField:null,desktoptoggleshowClassicComposer:null,desktoptoggles
howAvatarsGray:null,initialize:function(a)
{this.parent(Object.append({name:"DISPLAY_SETTINGS",prefix:"display"},a))},onInitData:function()
{this.parent();var a=this;this.desktoptoggleshowClassicComposer=new
VMAToggleField({element:"#displaySetting .toggle-
field.showClassicComposer"});this.desktoptoggleshowAvatarsGray=new
VMAToggleField({element:"#displaySetting .toggle-field.showAvatarsGray"});

this.desktoptogglelinkPreview=new VMAToggleField({element:"#displaySetting .toggle-


field.disableWebPreview"});this.desktoptoggleshowClassicComposer.addEvent("change",function(b)
{a.onToggleshowClassicComposer(this)});this.desktoptoggleshowAvatarsGray.addEvent("change",functi
on(b){a.onToggleshowAvatarGray(this)});this.desktoptogglelinkPreview.addEvent("change",function(b)
{a.onToggledisableWebPreview(this)});if(vmamain.showClassicComposer){var
b=document.id("composerToggle");b.className+=" on"}vmamain.showAvatarsGray&&

(b=document.id("avatarToggle"),b.className+=" on");vmamain.disableWebPreview||
(b=document.id("disableWebPreview"),b.className+=" on")},onToggleshowAvatarGray:function(a){var
b="DISABLE";a.getValue()&&(b="ENABLE");vmamain._s_submitSettingsRequest({data:
{category:"DISPLAY_SETTINGS",operation:b,displayName:"showAvatarsGray",status:"SUCCESS"},onCom
plete:function(a){switch(a.status){case "SUCCESS":"ENABLE"==a.operation?
(vmamain.showAvatarsGray=!0,a=document.getElementById("buapContentsMessages"),a.className+=

" gray"):(vmamain.showAvatarsGray=!
1,document.getElementById("buapContentsMessages").className=document.getElementById("buapCo
ntentsMessages").className.replace(/
(?:^|\s)gray(?!\S)/g,""));break;default:dlg.showSystemError(),options.fireEvent("complete",permission)}
}})},onToggleshowClassicComposer:function(a){var
b="DISABLE";a.getValue()&&(b="ENABLE");vmamain._s_submitSettingsRequest({data:
{category:"DISPLAY_SETTINGS",operation:b,displayName:"showClassicComposer",status:"SUCCESS"},on
Complete:function(a){switch(a.status){case "SUCCESS":"ENABLE"==

a.operation?(vmamain.showClassicComposer=!
0,a=document.getElementById("buapContentsMessages"),a.className+=" classic-composer"):
(vmamain.showClassicComposer=!
1,document.getElementById("buapContentsMessages").className=document.getElementById("buapCo
ntentsMessages").className.replace(/(?:^|\s)classic-
composer(?!\S)/g,""));break;default:dlg.showSystemError(),options.fireEvent("complete",permission)}}})
},onToggledisableWebPreview:function(a){var
b="ENABLE";a.getValue()&&(b="DISABLE");vmamain._s_submitSettingsRequest({data:
{category:"DISPLAY_SETTINGS",

operation:b,displayName:"disableWebPreview",status:"SUCCESS"},onComplete:function(a)
{switch(a.status){case "SUCCESS":"DISABLE"==a.operation?(vmamain.showClassicComposer=!
0,a=document.getElementById("buapContentsMessages"),a.className+=" disablelinkPreview"):
(vmamain.showClassicComposer=!
1,document.getElementById("buapContentsMessages").className=document.getElementById("buapCo
ntentsMessages").className.replace(/
(?:^|\s)disablelinkPreview(?!\S)/g,""));break;default:dlg.showSystemError(),options.fireEvent("complete
",

permission)}}})}},VMADisplaySettingsBase=new
Class(VMADisplaySettingsBaseClassDef),VMADisplaySettings=new
Class({Extends:VMADisplaySettingsBase});var
VMAPopupBaseClassDef={overlayEltId:null,windowEltId:null,contentSelector:".popupContent0",footerS
elector:".popupButtons0",windowTemplateEltId:"vmaPopupWindowWrapperTemplate0",overlayTempl
ateEltId:"vmaPopupOverlayTemplate",showClose:!
1,content:null,contentPool:null,title:null,footer:null,top:null,width:null,height:null,fade:!
0,onBeforeShow:null,onAfterShow:null,onBeforeClose:null,onAfterClose:null,params:null,onBeforeClose
_show:null,onAfterClose_show:null,params_show:null,asyncBeforeClose_show:!1,

position:"absolute",state:"HIDDEN",shown:!1,initialize:function(a)
{this.overlayEltId=String.uniqueID();this.windowEltId=String.uniqueID();a||
(a={});a.contentSelector&&(this.contentSelector=a.contentSelector);a.footerSelector&&(this.footerSelec
tor=a.footerSelector);a.windowTemplateEltId&&(this.windowTemplateEltId=a.windowTemplateEltId);a.
overlayTemplateEltId&&(this.overlayTemplateEltId=a.overlayTemplateEltId);a.position&&(this.position=
a.position);this.content=a.content;this.contentPool=a.contentPool?

a.contentPool:"popupPool";this.title=a.title;this.footer=a.footer;VMAUtils.defined(a.top)&&(this.top=a.t
op);this.width=a.width;this.height=a.height;this.params=a.params;this.onBeforeShow=a.onBeforeShow;
this.onAfterShow=a.onAfterShow;this.onBeforeClose=a.onBeforeClose;this.onAfterClose=a.onAfterClose
;this.fade=!1!==a.fade;a.onBeforeInitialize&&a.onBeforeInitialize(a.params,this);var
b=document.id(this.overlayTemplateEltId).clone();b.set("id",this.overlayEltId).inject(this.contentPool,"b
ottom");VMAUtils.defined(a.overlayOpacity)&&

b.getElement(".innerOverlay").setStyle("opacity",a.overlayOpacity);b=document.id(this.windowTemplat
eEltId).clone().set("id",this.windowEltId);b.inject(this.contentPool,"bottom");a.windowStyles&&b.getEle
ment(".popupWindow").setStyles(a.windowStyles);!
0===a.hideTitle&&b.getElement(".popupTitle").hide();this.content&&(!0===a.replaceContent?
document.id(this.content).replaces(b.getElement(this.contentSelector)):b.getElement(this.contentSelec
tor).grab(this.content,"top"));a.styles&&document.id(this.content).setStyles(a.styles);

this.footer?!0===a.replaceFooter?
document.id(this.footer).replaces(b.getElement(this.footerSelector)):"array"===VMAUtils.typeOf(this.fo
oter)?
b.getElement(this.footerSelector).adopt(this.footer):b.getElement(this.footerSelector).grab(this.footer,"
top"):b.getElement(".vma-popupButtons").destroy();this.showCloseButton(!0===a.showClose);var
c=this;b.getElements(".vma-closePopup").addEvent("click",function(a)
{a.stop();c._onClose(a,this)});b.getElements(".cancelButton").addEvent("click",function(a){a.stop();

c._onClose(a,this)});a.zIndexOffset&&this.incZIndex(a.zIndexOffset);a.onAfterInitialize&&a.onAfterInitiali
ze(a.params,this)},incZIndex:function(a){var
b,c=document.id(this.overlayEltId);b=Number.from(c.getStyle("z-index"));c.setStyle("z-
index",b+a);c=document.id(this.windowEltId);b=Number.from(c.getStyle("z-index"));b+=a;c.setStyle("z-
index",b)},_onClose:function(a,b){var c=document.id(b);switch(c.get("tag")){case "button":case "a":case
"input":break;default:"X"!==c.get("html")&&"Close"!==c.get("text")&&

(c=c.getParent("button"))}(c=c.get("id"))||(c="");this.hide(null,c)},destroy:function(){if("DESTROYED"!
==this.state){this.state="DESTROYED";if(this.content){var
a=document.id(this.contentPool);a.grab(this.content,"bottom");this.footer&&("array"===VMAUtils.type
Of(this.footer)?
a.adopt(this.footer):a.grab(this.footer,"bottom"))}VMAUtils.destroyElement(this.overlayEltId);VMAUtils.
destroyElement(this.windowEltId)}},getWindowElt:function(){return
document.id(this.windowEltId)},getContentElt:function(){return document.id(this.content)},

show:function(a){a||
(a={});this.onBeforeClose_show=a.onBeforeClose;this.onAfterClose_show=a.onAfterClose;this.params_s
how=a.params;this.asyncBeforeClose_show=VMAUtils.defined(a.asyncBeforeClose)?
a.asyncBeforeClose:!1;if(a.onBeforeShow)a.onBeforeShow(a.params,this);else
this.onBeforeShow&&this.onBeforeShow(this.params,this);var
b=document.id(this.overlayEltId),c=document.id(this.windowEltId),d=a.title?
a.title:this.title;d&&c.getElement(".popupTitleText").set("html",d);d=a.width?a.width:this.width;

document.body.grab(b,"bottom");document.body.grab(c,"bottom");c.getElement(".popupWindow").set
Style("width",d);VMAUtils.defined(this.top)&&!0!==this.top&&!1!
==this.top&&c.setStyle("top",this.top);this.fade?VMAUtils.isIE8OrLess()?
(b.fade("show"),c.fade("show")):(b.fade("in"),c.fade("in")):(b.fade("show"),c.fade("show"));this.shown=!
0;if(a.onAfterShow)a.onAfterShow(a.params,this);else
this.onAfterShow&&this.onAfterShow(this.params,this)},hide:function(a,b){if("DESTROYED"!
==this.state){a||(a={});a.asyncBeforeClose=

VMAUtils.defined(a.asyncBeforeClose)?a.asyncBeforeClose:!1;var c=this,d=!
1;if(a.onBeforeClose)if(a.asyncBeforeClose)d=!0,a.onBeforeClose(a.params,b,this,function()
{c._postAsyncBeforeClose(a,b)});else a.onBeforeClose(a.params,b,this);else
if(this.onBeforeClose_show)if(this.asyncBeforeClose_show)d=!
0,this.onBeforeClose_show(this.params_show,b,this,function(){c._postAsyncBeforeClose(a,b)});else
this.onBeforeClose_show(this.params_show,b,this);else
if(this.onBeforeClose)this.onBeforeClose(this.params,

b,this);this.shown=!1;d||this._postAsyncBeforeClose(a,b)}},replaceContent:function(a){var
b=document.id(this.windowEltId);document.id(this.content).inject(this.contentPool,"top");b.getElement
(this.contentSelector).grab(a,"top")},showFooter:function(a){var
b=document.id(this.windowEltId).getElement(this.footerSelector);a?
b.show():b.hide()},showCloseButton:function(a){document.id(this.windowEltId).getElement(".vma-
closePopup").setStyle("display",a?"block":"none")},_postAsyncBeforeClose:function(a,b){var c=

document.id(this.overlayEltId),d=document.id(this.windowEltId);if(c&&d)if(this.fade)if(VMAUtils.isIE8Or
Less())c.fade("hide"),c.inject(this.contentPool,"bottom"),this._cleanupAfterClose(a,b,"overlay"),d.fade("
hide"),d.inject(this.contentPool,"bottom"),this._cleanupAfterClose(a,b,"window");else{var
e=this;c.fade("out",{onComplete:function()
{c.inject(e.contentPool,"bottom");e._cleanupAfterClose(a,b,"overlay")}});d.fade("out",
{onComplete:function(){d.inject(e.contentPool,"bottom");e._cleanupAfterClose(a,

b,"window")}})}else
c.fade("hide"),c.inject(this.contentPool,"bottom"),this._cleanupAfterClose(a,b,"overlay"),d.fade("hide"),
d.inject(this.contentPool,"bottom"),this._cleanupAfterClose(a,b,"window")},_cleanupAfterClose:functio
n(a,b,c){if("overlay"!==c){if(a.onAfterClose)a.onAfterClose(a.params,b,this);else
if(this.onAfterClose_show)this.onAfterClose_show(this.params_show,b,this);else
if(this.onAfterClose)this.onAfterClose(this.params,b,this);this.params_show=this.onAfterClose_show=thi
s.onBeforeClose_show=

null;this.asyncBeforeClose_show=!1}}},VMAPopupBase=new
Class(VMAPopupBaseClassDef),VMAPopup=new
Class({Extends:VMAPopupBase}),VMADelayedDlgClassDef={dlg:null,done:!
1,delay:0,fnCreateDlg:null,createDlgArgs:void 0,initialize:function(a,b,c)
{this.delay=a;this.fnCreateDlg=b;this.createDlgArgs=c},start:function()
{this._createDlg.delay(this.delay,this)},destroy:function(){this.done=!
0;this.dlg&&this.dlg.hide()},_createDlg:function(){this.done||
(this.dlg=this.fnCreateDlg.pass(this.createDlgArgs)(),this.done=

!0)}},VMADelayedDlg=new Class(VMADelayedDlgClassDef),VMAPopupUtils={alert:function(a){a.styles||
(a.styles={"font-size":"15px"});a=new VMAAlertDlg(a);a.show();return a},progress:function(a){var
b={"font-size":"15px",padding:"5px 20px 5px 20px",border:"0 solid"},c=new Element("div",
{html:a.message,styles:b,"class":"vma-measure"});document.body.grab(c,"bottom");var
d=c.getComputedSize(["padding"]);c.destroy();b={hideTitle:!0,styles:b,width:d.totalWidth,showClose:!
1,overlayOpacity:0.4,position:"fixed",

top:200};Object.append(b,a);a=new VMAAlertDlg(b);a.show();return a},delayedProgress:function(a,b)


{var c=new VMADelayedDlg(b,function(a){return VMAPopupUtils.progress(a)},[a]);c.start();return
c}},VMAAlertDlgBaseClassDef={Extends:VMAPopup,buttonsMap:null,onClose:null,showClose:!
0,initialize:function(a){var
b=document.id("alertDlgContentTpl").clone().inject("popupPool","bottom");b.set("id",String.uniqueID())
;b.set("html",a.message);a.styles&&b.setStyles(a.styles);var c;a.buttons&&(this.buttonsMap={},

c=[],("array"!==VMAUtils.typeOf(a.buttons)?[a.buttons]:a.buttons).each(function(b)
{this.buttonsMap[b]={id:String.uniqueID(),handler:a["on"+b.capitalize()]};var
d=document.id(b+"ButtonTpl");d||
(d=document.id("customizedButtonTpl"));d.clone().set({id:this.buttonsMap[b].id,value:b.capitalize()}).inj
ect("popupPool","bottom");c.push(this.buttonsMap[b].id)},this));var d=a.title;d||
(d=VMAConst.DEFAULT_DIALOG_TITLE);this.onClose=a.onClose;this.parent({content:b.get("id"),width:a.
width,top:a.top,title:d,footer:c,

showClose:!
0===a.showClose,contentSelector:".popupContent0",footerSelector:".popupButtons0",position:a.positi
on,onAfterShow:a.onAfterShow,fade:a.fade,zIndexOffset:a.zIndexOffset,hideTitle:!
0===a.hideTitle,overlayOpacity:a.overlayOpacity})},show:function(){this.parent({asyncBeforeClose:!
0,onBeforeClose:function(a,b,c,d){var e=!1;Object.some(c.buttonsMap,function(f){return f.id===b?
(f.handler&&(f.handler({params:a,dlg:c,onComplete:d}),e=!0),!0):!1},this);e||
d()},onAfterClose:function(a,b,c,d){if(c.onClose)c.onClose({params:a,

dlg:c,onComplete:d})}})},setMessage:function(a){},_cleanupAfterClose:function(a,b,c)
{this.parent(a,b,c);switch(c){case "window":this.destroy();break;case
"overlay":VMAUtils.destroyElement(this.overlayEltId)}},destroy:function(){"DESTROYED"!
==this.state&&(this.parent(),VMAUtils.destroyElement(this.content),Object.each(this.buttonsMap,functi
on(a){VMAUtils.destroyElement(a.id)}))}},VMAAlertDlgBase=new
Class(VMAAlertDlgBaseClassDef),VMAAlertDlg=new Class({Extends:VMAAlertDlgBase});var
VMAViewAttachmentImageDlgClassDef={Extends:VMAPopup,maxImageSize:
{width:600,height:600},minImageSize:
{width:250,height:250},curImageSize:null,paddingSize:20,downloadUrl:null,att:null,initialize:function()
{this.parent({content:"viewAttachmentImageContent",contentPool:"messagesTemplatesPool",title:VMA
Const.DEFAULT_DIALOG_TITLE,footer:
["viewAttachmentImageContentClose","viewAttachmentImageContentSave"]});var
a=this;document.id(this.windowEltId).addEvent("click:relay(#viewAttachmentImageContentSave)",

function(b){a.onDownload(b,this)})},onDownload:function(a,b)
{window.location=this.buildDownloadUrl(this.att.dataUrl)},buildDownloadUrl:function(a){return
a+"\x26download\x3dtrue"},showView:function(a){this.att=a;var
b=document.id(this.content).getElement("img");if(b&&b.get("src")===a.dataUrl)this._showDlg();else{vm
amain.maskContentTransparent(300);var c={state:"ready"};c.timer=function(a)
{"ready"===a.state&&(vmamain.unmaskContentTransparent(),a.state="progress_shown",vmamain.sho
wProgressDlg({text:"Loading ...",

width:300,onCancel:function(){a.state="canceled"}.bind(this)}))}.delay(500,this,c);a.dataLoaded?
c.newImgElt=Asset.image(a.dataUrl,{onLoad:function()
{this.onImageLoaded(c)}.bind(this),onError:function(){}}):vmaim._s_loadAttachments(a,
{onSuccess:function(){c.newImgElt=Asset.image(a.dataUrl,{onLoad:function()
{this.onImageLoaded(c)}.bind(this),onError:function(){}})}.bind(this),onFailure:function()
{}})}},onImageLoaded:function(a){switch(a.state){case
"ready":a.timer&&clearTimeout(a.timer);a.state="image_loaded";

vmamain.unmaskContentTransparent();break;case
"progress_shown":a.state="image_loaded";vmamain.hideProgressDlg();break;case
"canceled":VMAUtils.destroyElement(a.newImgElt);return}var
b=document.id(this.content),c=b.getElement("img");VMAUtils.destroyElement(c);b.grab(a.newImgElt);t
his.curImageSize=VMAUtils.calculateImageSize(a.newImgElt,this.maxImageSize,this.minImageSize);this.
_showDlg()},_showDlg:function(){this.show({asyncBeforeClose:!
1,width:this.curImageSize.width+this.paddingSize,onBeforeShow:function(a,

b)
{document.id(b.content).getElement("img").set({width:b.curImageSize.width,height:b.curImageSize.heig
ht})}})}},VMAViewAttachmentImageDlg=new
Class(VMAViewAttachmentImageDlgClassDef),VMAConfirmDeleteConversationsDlgClassDef={Extends:V
MAPopup,initialize:function()
{this.parent(this.buildDlgOptions());document.id("confirmDeleteConversationsContent").set("html",VM
AUiText.chat.CONFIRM_DELETE_CONVERSATIONS)},buildDlgOptions:function()
{return{content:"confirmDeleteConversationsContentWrapper",contentPool:"messagesTemplatesPool",

title:VMAConst.DEFAULT_DIALOG_TITLE,width:vmauiconst.$
("CONFIRM_DEL_CONV_DLG_WIDTH"),showClose:!1,footer:
["confirmDeleteConversationsButtonNo","confirmDeleteConversationsButtonYes"]}},hideProgress:functi
on()
{document.id("confirmDeleteConversationsContent").set("html",this.confirmText).show();document.id(
"confirmDeleteConversationsProgress").hide();this.showFooter(!0)},showProgress:function(){var
a=1===this.messageNum?
VMAUiText.deleteMessages.CONV_SINGULAR:VMAUiText.deleteMessages.CONV_PLURAL;document.id(
"confirmDeleteConversationsContent").hide();

document.id("confirmDeleteConversationsProgress").set("html",a).show();this.showFooter(!
1)},show:function(a){new EOptions(a,!0);this.confirmText=a.confirmText;this.parent({asyncBeforeClose:!
0,onBeforeShow:function(a,c){c.hideProgress()},onBeforeClose:function(b,c,d,e){switch(c){case
"confirmDeleteConversationsButtonYes":d.showProgress();vmaim.deleteConversationsByEltId(a.convEltI
ds,{onComplete:e});break;case "confirmDeleteConversationsButtonNo":case
"":e()}}})}},VMAConfirmDeleteConversationsDlg=new
Class(VMAConfirmDeleteConversationsDlgClassDef),

VMAConfirmLeaveGroupDlgClassDef={Extends:VMAPopup,initialize:function()
{this.parent(this.buildDlgOptions());document.id("confirmLeaveGroupContent").set("html",VMAUiText.l
eaveGroup.MESSAGE)},buildDlgOptions:function()
{return{content:"confirmLeaveGroupContentWrapper",contentPool:"messagesTemplatesPool",title:VM
AConst.DEFAULT_DIALOG_TITLE,width:vmauiconst.$
("CONFIRM_LEAVE_GRP_DLG_WIDTH"),showClose:!1,footer:
["confirmLeaveGroupButtonNo","confirmLeaveGroupButtonYes"]}},hideProgress:function()
{document.id("confirmLeaveGroupContent").show();

document.id("confirmLeaveGroupProgress").hide();this.showFooter(!0)},showProgress:function()
{document.id("confirmLeaveGroupContent").hide();document.id("confirmLeaveGroupProgress").show();
this.showFooter(!1)},show:function(a){new EOptions(a,!0);this.parent({asyncBeforeClose:!
0,onBeforeShow:function(a,c){c.hideProgress()},onBeforeClose:function(b,c,d,e){switch(c){case
"confirmLeaveGroupButtonYes":d.showProgress();vmaim._s_leaveGroup(a.groupId,
{onComplete:e});break;case "confirmLeaveGroupButtonNo":case "":e()}}})}},
VMAConfirmLeaveGroupDlg=new
Class(VMAConfirmLeaveGroupDlgClassDef),VMAConfirmDeleteMessagesDlgClassDef={Extends:VMAPop
up,messageNum:0,confirmText:"",initialize:function()
{this.parent(this.buildDlgOptions());document.id("confirmDeleteMessagesContent").set("html",VMAUiT
ext.chat.CONFIRM_DELETE_MESSAGES)},buildDlgOptions:function()
{return{content:"confirmDeleteMessagesContentWrapper",contentPool:"messagesTemplatesPool",title:
VMAConst.DEFAULT_DIALOG_TITLE,width:vmauiconst.$("CONFIRM_DEL_MSG_DLG_WIDTH"),

showClose:!1,footer:
["confirmDeleteMessagesButtonNo","confirmDeleteMessagesButtonYes"]}},hideProgress:function()
{document.id("confirmDeleteMessagesContent").set("html",this.confirmText).show();document.id("con
firmDeleteMessagesProgress").hide();this.showFooter(!0)},showProgress:function(){var
a=1===this.messageNum?
VMAUiText.deleteMessages.PROG_SINGULAR:VMAUiText.deleteMessages.PROG_PLURAL;document.id(
"confirmDeleteMessagesContent").hide();document.id("confirmDeleteMessagesProgress").set("html",a)
.show();

this.showFooter(!1)},show:function(a){var b=new EOptions(a,!


0);this.confirmText=a.confirmText;this.parent({asyncBeforeClose:!0,onBeforeShow:function(a,b)
{b.hideProgress()},onBeforeClose:function(c,d,e,f){switch(d){case
"confirmDeleteMessagesButtonYes":a.conv&&a.msgEltIds?
(e.messageNum=a.msgEltIds.length,e.showProgress(),a.conv.deleteMessagesByEltId({msgEltIds:a.msgElt
Ids,onComplete:function(c){!0!==c?(f(),!
0===a.loweredShoebox&&vmaim.mediaShoeboxDlg.incZIndex(15)):vmaim.deleteConversationsByEltId([
a.conv.conversationEltId],

{onComplete:function(){f();!
0===a.loweredShoebox&&vmaim.mediaShoeboxDlg.incZIndex(15);b.fireEvent("complete")}})}}),vmaim.s
electedMessages=0,vmaim.onDoneEditMode()):
(e.messageNum=1,e.showProgress(),vmaim.deleteMessageByMedia({media:a.media,onComplete:functi
on(){f();!
0===a.loweredShoebox&&vmaim.mediaShoeboxDlg.incZIndex(15);b.fireEvent("complete")}}));break;cas
e "confirmDeleteMessagesButtonNo":case "":f(),!
0===a.loweredShoebox&&vmaim.mediaShoeboxDlg.incZIndex(15)}}})}},VMAConfirmDeleteMessagesDlg
=

new
Class(VMAConfirmDeleteMessagesDlgClassDef),VMAConfirmSwitchConversationDlgClassDef={Extends:V
MAPopup,initialize:function()
{this.parent({content:"confirmSwitchConversationContent",contentPool:"messagesTemplatesPool",posi
tion:"fixed",showClose:!1,title:"Confirm",width:400,footer:
["confirmSwitchConversationButtonNo","confirmSwitchConversationButtonYes"]})},show:function(a,b)
{this.parent({asyncBeforeClose:!0,onBeforeClose:function(c,d,e,f){switch(d){case
"confirmSwitchConversationButtonYes":f();vmaim.attachments.cancelAllUploads();

vmaim.attachments.clearErrorMessages();vmaim.stopPlayingAudio();vmaim.updateSendTime("RESET");
vmaim.commitAndHideSendToSuggestion();a?
vmaim.activateConversationByEltId(a):vmaim.activeConversation.newMessage&&b();break;case
"confirmSwitchConversationButtonNo":case "":f()}}})}},VMAConfirmSwitchConversationDlg=new
Class(VMAConfirmSwitchConversationDlgClassDef),VMACaptchaDlgClassDef={Extends:VMAPopup,captc
haId:null,tryCounter:0,conv:null,initialize:function(){this.parent({content:"showCaptchaDlgContent",

contentPool:"messagesTemplatesPool",title:VMAConst.DEFAULT_DIALOG_TITLE,width:525});this.showR
efreshing(!1);this.showVerifying(!1);this.setErrorMessage();var
a=document.id(this.content),b=this;a.addEvent("click:relay(#captchaRefresh)",function(a)
{a.stop();b._s_refreshCaptcha()});a.addEvent("click:relay(#captchaVerifyCode)",function(a)
{a.stop();b._s_verifyCaptchaCode()});a.addEvent("keyup:relay(#captchaCode)",function(a)
{a.stop();"enter"===a.key&&b._s_verifyCaptchaCode()})},maskInput:function(a)
{document.id(this.windowEltId).showMask(a,

{name:"disableInput",maskOptions:{"class":"vma-transDisableMask"}})},showRefreshing:function(a)
{document.id("captchaRefreshing").show(a);document.id("captchaRefresh").show(!
a)},showVerifying:function(a){document.id("captchaVerifyCode").show(!
a);document.id("captchaVerifyCodeDisabled").show(a)},_s_refreshCaptcha:function(){this.maskInput(!
0);this.showRefreshing(!0);var
a=this;vmaim.imcore.refreshCaptcha({captchaId:this.captchaId,onSuccess:function(b)
{a.updateCaptchaImage(b.captchaId);a.maskInput(!1);

a.showRefreshing(!1)},onFailure:function(b){VMAPopupUtils.alert({message:"Failed to refresh the


captcha, please try
again.",title:VMAConst.DEFAULT_DIALOG_TITLE,buttons:"ok",width:250});a.maskInput(!
1);a.showRefreshing(!1)}})},setErrorMessage:function(a){a?
(document.id("captchaError").set("html",a),document.id("captchaErrorWrapper").show()):
(document.id("captchaError").set("html",""),document.id("captchaErrorWrapper").hide())},getCaptchaC
odeElt:function(){return document.id("captchaCode")},_s_verifyCaptchaCode:function(){var a=

this.getCaptchaCodeElt().get("value").trim();if(!VMAUtils.isEmpty(a)){this.maskInput(!
0);this.showVerifying(!0);var
b=this;vmaim.messageState="SENDING";vmaim.imcore.verifyCaptcha({captchaId:b.captchaId,captchaCo
de:a,onSuccess:function(a){vmaim.messageState="READY";switch(a.status){case
"CAPTCHA_VERIFY_FAILURE":b.tryCounter++;b.setErrorMessage("Please enter a valid captcha
code.");b.clearInput();b.tryCounter>=VMAIMConst.CAPTCHA_MAX_TRIES?(b.maskInput(!
1),b.hide(),VMAPopupUtils.alert({message:"You have exceeded maximum tries.",

title:VMAConst.DEFAULT_DIALOG_TITLE,buttons:"ok",width:250})):
(b.updateCaptchaImage(a.captchaId),b.maskInput(!1),b.showVerifying(!1));break;case
"SHOW_CAPTCHA":b.tryCounter=0;b.setErrorMessage();b.clearInput();b.updateCaptchaImage(a.captcha
Id);b.maskInput(!1);b.showVerifying(!1);break;default:b.setErrorMessage();b.maskInput(!
1);b.showVerifying(!1);var d=b.conv;b.hide();d.fireEvent("postSendMessage",
{state:"success",params:a})}},onFailure:function(a)
{vmaim.messageState="READY";VMAPopupUtils.alert({message:"Failed to verify captcha code. Please
try again.",
title:VMAConst.DEFAULT_DIALOG_TITLE,buttons:"ok",width:250});b.maskInput(!1);b.showRefreshing(!
1)}})}},buildCaptchaImageUrl:function(a){var b=new
URI(vmaim.imcore.imBaseUrl+"/im/CaptchaImage.do");b.setData({id:a,isid:vmaim.imcore.session.isid,si
d:vmaim.imcore.session.sid});return b.toString()},getImageElt:function(){return
document.id(this.content).getElement(".popupLeft img")},updateCaptchaImage:function(a)
{this.captchaId=a;this.getImageElt().set("src",this.buildCaptchaImageUrl(a))},clearInput:function()
{this.getCaptchaCodeElt().set("value",

"")},show:function(a,b){this.showRefreshing(!1);this.showVerifying(!
1);this.setErrorMessage();this.clearInput();this.tryCounter=0;this.conv=b;this.parent({asyncBeforeClose:!
1,onBeforeShow:function(b,d){d.updateCaptchaImage(a)},onBeforeClose:function(a,b,e)
{e.conv=null}})}},VMACaptchaDlg=new
Class(VMACaptchaDlgClassDef),VMAPinDlgClassDef={Extends:VMAPopup,sendCounter:0,tryCounter:0,c
onv:null,initialize:function()
{this.parent({content:"showPinDlgContent",contentPool:"messagesTemplatesPool",title:VMAConst.DEF
AULT_DIALOG_TITLE,

width:410});this.showResend(!1);this.enableVerify(!1);this.setErrorMessage();var
a=document.id(this.content),b=this;a.addEvent("click:relay(#pinResend)",function(a)
{a.stop();b._s_sendPin()});a.addEvent("click:relay(#pinVerifyCode)",function(a)
{a.stop();b._s_verifyPinCode()});a.addEvent("keyup:relay(#pinCode)",function(a)
{a.stop();"enter"===a.key&&b._s_verifyPinCode()})},maskInput:function(a)
{document.id(this.windowEltId).showMask(a,{name:"disableInput",maskOptions:{"class":"vma-
transDisableMask"}})},

showResend:function(a){a?document.id("pinResend").show("inline-
block"):document.id("pinResend").hide()},enableVerify:function(a){a?
document.id("pinVerifyCode").removeProperty("disabled"):document.id("pinVerifyCode").set("disabled
","disabled")},_s_sendPin:function(){this.maskInput(!0);this.showResend(!1);var
a=this;vmaim.imcore.sendPin({onSuccess:function(b){a.maskInput(!1);a.showResend(!
0);a.setErrorMessage();0<a.sendCounter&&a.setNoticeMessage("New pin code sent
successfully");a.clearInput();a.sendCounter++},

onFailure:function(b){VMAPopupUtils.alert({message:"Failed to resend the pin, please try again in 15


minutes.",title:VMAConst.DEFAULT_DIALOG_TITLE,buttons:"ok",width:250});a.maskInput(!
1);a.showResend(!0)}})},setErrorMessage:function(a){a?
(document.id("pinError").set("html",a),document.id("pinErrorWrapper").show()):
(document.id("pinError").set("html",""),document.id("pinErrorWrapper").hide())},setNoticeMessage:fun
ction(a){a?(document.id("pinMessage").set("html",a),document.id("pinMessageWrapper").show()):

(document.id("pinMessage").set("html",""),document.id("pinMessageWrapper").hide())},getPinCodeElt:
function(){return document.id("pinCode")},_s_verifyPinCode:function(){var
a=this.getPinCodeElt().get("value").trim();if(!VMAUtils.isEmpty(a)){this.maskInput(!0);this.enableVerify(!
1);this.showResend(!1);var
b=this;vmaim.messageState="SENDING";vmaim.imcore.verifyPin({pinCode:a,onSuccess:function(a)
{vmaim.messageState="READY";switch(a.status){case "PIN_VERIFY_FAILURE":b.tryCounter+
+;b.setErrorMessage("Please enter a valid pin code.");
b.setNoticeMessage();b.clearInput();b.tryCounter>=VMAIMConst.PIN_MAX_TRIES?(b.maskInput(!
1),b.hide(),VMAPopupUtils.alert({message:"You have exceeded maximum
tries.",title:VMAConst.DEFAULT_DIALOG_TITLE,buttons:"ok",width:250})):(b.maskInput(!
1),b.enableVerify(!0),b.showResend(!0));break;case
"SHOW_PIN":b.tryCounter=0;b.setErrorMessage();b.setNoticeMessage();b.clearInput();b.maskInput(!
1);b.enableVerify(!0);b.showResend(!
0);break;default:b.setErrorMessage();b.setNoticeMessage();b.maskInput(!1);var d=

b.conv;b.hide();d.fireEvent("postSendMessage",{state:"success",params:a})}},onFailure:function(a)
{vmaim.messageState="READY";VMAPopupUtils.alert({message:"Failed to verify pin code. Please try
again.",title:VMAConst.DEFAULT_DIALOG_TITLE,buttons:"ok",width:250});b.maskInput(!
1);b.showResend(!0);b.enableVerify(!0)}})}},clearInput:function()
{this.getPinCodeElt().set("value","")},show:function(a){this._s_sendPin();this.enableVerify(!
0);this.setErrorMessage();this.setNoticeMessage();this.clearInput();

this.sendCounter=this.tryCounter=0;this.conv=a;this.parent({asyncBeforeClose:!
1,onBeforeClose:function(a,c,d){d.conv=null}})}},VMAPinDlg=new
Class(VMAPinDlgClassDef),VMAImportContactsDlgClassDef={Extends:VMAPopup,initialize:function()
{this.parent(this.buildDlgOptions());document.id("importContactsDlgContent").set("html",VMAUiText.a
ddressBook.importContacts.CONFIRM_TEXT);document.id("importContactsDlgProgress").set("html",VM
AUiText.addressBook.importContacts.PROGRESS)},buildDlgOptions:function()
{return{content:"importContactsDlgContentWrapper",

contentPool:"messagesTemplatesPool",title:VMAConst.DEFAULT_DIALOG_TITLE,width:vmauiconst.$
("IMPORT_CONTACTS_DLG_WIDTH"),footer:
["importContactsDlgButtonNo","importContactsDlgButtonYes"]}},hideProgress:function()
{document.id("importContactsDlgContent").show();document.id("importContactsDlgProgress").hide();th
is.showFooter(!0)},showProgress:function()
{document.id("importContactsDlgContent").hide();document.id("importContactsDlgProgress").show();th
is.showFooter(!1)},show:function(a){this.parent({asyncBeforeClose:!0,

onBeforeShow:function(a,c){c.hideProgress()},onBeforeClose:function(a,c,d,e){switch(c){case
"importContactsDlgButtonYes":d.showProgress();d.onImportContacts({onComplete:e});break;case
"importContactsDlgButtonNo":case "":e()}}})},onImportContacts:function(a){var b=new
EOptions(a),c=this;vmamain._s_importContacts({onComplete:function(a){switch(a.status){case
"success":c.importContactsCompleteOptions=b;break;case
"failure":b.fireEvent("complete")}}})},onNabResponse:function(a)
{this.importContactsCompleteOptions.fireEvent("complete");

switch(a.status){case
"SUCCESS":vmaim.onPacketUpdateAddressBook(a.otherData);VMAIMConst.IMPORT_CONTACTS=!
1;break;case "FAILURE":VMAIMConst.IMPORT_CONTACTS=!1}}},VMAImportContactsDlg=new
Class(VMAImportContactsDlgClassDef),VMAProgressDlgClassDef={Extends:VMAPopup,_options:null,initi
alize:function()
{this.parent({content:"progressDlgContent",contentPool:"mainComponentPool",title:VMAConst.DEFAUL
T_DIALOG_TITLE,footer:["progressDlgCancel"]});this.showCloseButton(!1);var
a=this;document.id("progressDlgCancel").addEvent("click",
function(b){a._options&&a._options.fireEvent("cancel");a.hide()})},show:function(a){this._options=new
EOptions(a);this.parent({asyncBeforeClose:!1,width:a.width,onBeforeShow:function(a,c)
{document.id("progressDlgText").set("html",c._options.get("text"))}})}},VMAProgressDlg=new
Class(VMAProgressDlgClassDef),VMAUpdateContactDlgClassDef={Extends:VMAPopup,ucOptions:null,ch
osenContact:null,oldName:null,initialize:function()
{this.parent({content:"updateContactDlgContent",contentPool:"messagesTemplatesPool",

title:"",width:400,footer:["updateContactDlgButtonCancel","updateContactDlgButtonSave"]});var
a=this;document.id(this.content).addEvent("keyup:relay(#updateContactDlgName)",function(b)
{a.onKeyUpInputContactName(b,this)});document.id(this.content).addEvent("click:relay(.contactSugges
tion ul li)",function(b){a.onSelectSugContact(b,this)});this.getWindowElt().addEvent("click",function(a)
{this.getElement(".contactSuggestion").hide()})},show:function(a)
{this.ucOptions=a;this.chosenContact=null;this.oldName=

"MODIFY"===a.op?a.recipient.name.trim():"";this.enableControls(!1);var
b;this.parent({asyncBeforeClose:!
0,title:VMAUiText.updateContact[a.op].TITLE,onBeforeShow:function(c,d)
{b=RecipientAddressUtil.parse(a.recipient.address,"ALL",!
1,VMAIMConst.HOST_AREA_CODE);document.id("updateContactDlgMobileNumber").set("html",b.form
atted);document.id("updateContactDlgName").set("value",d.oldName);document.id("updateContactDlg
ErrorMessage").hide();document.id("updateContactDlgAddressLabel").set("html",VMAUiText.updateCo
ntact.ADDR_LABEL[b.type])},

onAfterShow:function(a,b)
{document.id("updateContactDlgName").focus()},onBeforeClose:function(a,d,e,f){switch(d){case
"updateContactDlgButtonSave":a=document.id("updateContactDlgName").get("value").trim();if(0<a.len
gth)e.onSaveContact(a,b,{onComplete:f});break;case "updateContactDlgButtonCancel":case
"":e.chosenContact=null,f()}}})},showInfo:function(a){var
b=this.getContentElt().getElement("#updateContactDlgErrorMessage");b.replaceClasses("contactError",
"contactInfoMessage");b.show().set("html",

a)},showError:function(a){var
b=this.getContentElt().getElement("#updateContactDlgErrorMessage");b.replaceClasses("contactInfoMe
ssage","contactError");b.show().set("html",a)},hideInfoOrError:function()
{this.getContentElt().getElement("#updateContactDlgErrorMessage").hide().set("html","")},enableContr
ols:function(a){var b=document.id("updateContactDlgButtonSave");a?b.set("disabled",!
1):b.set("disabled",!0)},onNabResponse:function(a){document.id(this.content).showTransMask(!
1);this.chosenContact=null;

switch(a.status){case
"SUCCESS":this.hideInfoOrError();EventHandlerUtil.onComplete(this.newContactCloseArgs);vmaim.onA
fterUpdateContact(a.joContact,this.ucOptions.op);break;case
"FAILURE":this.showError(VMAUiText.updateContact[this.ucOptions.op].ERROR)}},onSaveContact:functi
on(a,b,c)
{a=vmaim.prepareUpdateContact(a,this.chosenContact);"MODIFY"===this.ucOptions.op&&(a.contactId
=this.ucOptions.recipient.contactId);this.showInfo(VMAUiText.updateContact[this.ucOptions.op].PROG
RESS);document.id(this.content).showTransMask(!0);
vmaim._s_updateContact({firstName:a.firstName,lastName:a.lastName,contactId:a.contactId,tn:b.norm
alized,op:this.ucOptions.op,onSuccess:function(a){switch(a.status){case
"success":this.newContactCloseArgs=c;a.contact&&(a.nabResponseStatus="SUCCESS",this.onNabRespo
nse(a));break;case
"failure":this.showError(VMAUiText.updateContact[this.ucOptions.op].ERROR),document.id(this.conten
t).showTransMask(!1)}}.bind(this),onFailure:function()
{this.showError(VMAUiText.updateContact[this.ucOptions.op].ERROR);document.id(this.content).showT
ransMask(!1)}})},

onKeyUpInputContactName:function(a,b){var
c=document.id(this.content);c.getElement("#updateContactDlgErrorMessage").hide();c=c.getElement(".
contactSuggestion");c.empty();var d=b.get("value").trim();if(1>=d.length)c.hide();else{var
e=vmaim.addressBook.searchContactsByName(d);if(VMAUtils.isEmpty(e))c.hide();else{var f=new
Element("ul");e.each(function(a){var
b=document.id("updateContactSugTpl").clone();b.getElement(".suggestionName").set("html",a.displayN
ame);b.store("contact",a);b.inject(f,"bottom")},

this);f.inject(c,"top");e=a.target.getHeight()-2;c.show("block",{top:e})}}switch(this.ucOptions.op){case
"ADD":this.enableControls(0<d.length);break;case "MODIFY":this.enableControls(0<d.length&&d!
==this.oldName)}},onSelectSugContact:function(a,b)
{this.chosenContact=b.retrieve("contact");document.id("updateContactDlgName").set("value",this.chos
enContact.displayName);b.getParent(".contactSuggestion").empty().hide()}},VMAUpdateContactDlg=ne
w Class(VMAUpdateContactDlgClassDef);

function SWF_loaded(){vmaim.attachmentAvDlg?vmaim.attachmentAvDlg.updateAvUrl():alert("not
initialized yet.")}

var
VMAViewAttachmentAvDlgClassDef={Extends:VMAPopup,paddingSize:20,downloadUrl:null,dataUrl:null,
videoPlayer:null,audioPlayer:null,DLG_WIDTH:420,initialize:function()
{this.parent({content:"viewAttachmentAvContent",contentPool:"messagesTemplatesPool",title:VMACo
nst.DEFAULT_DIALOG_TITLE,width:this.DLG_WIDTH,footer:
["viewAttachmentAvContentClose","viewAttachmentAvContentSave"]});var
a=document.id(this.windowEltId);a.getElement(".popupButtons2").setStyles({"margin-top":"0"});var
b=this;a.addEvent("click:relay(#viewAttachmentAvContentSave)",

function(a){b.onDownload(a,this)})},onDownload:function(a,b)
{window.location=this.downloadUrl},buildDownloadUrl:function(a){return
a+"\x26download\x3dtrue"},updateAvUrl:function(){VMAUtils.isVideo(this.att.mimeType)?
this.updateVideoUrl():this.updateAudioUrl()},updateVideoUrl:function()
{VMAFLASH.setVideo(this.dataUrl)},updateAudioUrl:function()
{VMAAUDIOFLASH.setAudio(this.dataUrl)},showVideo:function()
{document.id("viewAttachmentAudio").hide();document.id("viewAttachmentVideo").show()},showAudi
o:function(){document.id("viewAttachmentAudio").show();

document.id("viewAttachmentVideo").hide()},createVideoObject:function(a)
{this.showVideo();this.videoPlayer||(this.videoPlayer=new
SWFObject(VMAIMConst.VIDEO_PLAYER_URL,"VMAFLASH",VMAIMConst.VIDEO_PLAYBACK_DIM.width,
VMAIMConst.VIDEO_PLAYBACK_DIM.height,"9","#ffffff"),this.videoPlayer.addParam("loop","false"),this.
videoPlayer.addParam("play","true"),this.videoPlayer.addParam("quality","high"),this.videoPlayer.addP
aram("wmode","opaque"),this.videoPlayer.addParam("allowScriptAccess","always"),this.videoPlayer.ad
dParam("swLiveConnect",

"true"),this.videoPlayer.write("viewAttachmentVideo"))},createAudioObject:function(a)
{this.showAudio();this.audioPlayer||(this.audioPlayer=new
SWFObject(VMAIMConst.AUDIO_PLAYER_URL,"VMAAUDIOFLASH",VMAIMConst.AUDIO_PLAYBACK_DI
M.width,VMAIMConst.AUDIO_PLAYBACK_DIM.height,"9","#ffffff"),this.audioPlayer.addParam("loop","f
alse"),this.audioPlayer.addParam("play","true"),this.audioPlayer.addParam("quality","high"),this.audioP
layer.addParam("wmode","opaque"),this.audioPlayer.addParam("allowScriptAccess",

"always"),this.audioPlayer.addParam("swLiveConnect","true"),this.audioPlayer.write("viewAttachmentA
udio"))},stopMedia:function(){VMAUtils.isVideo(this.att.mimeType)?
VMAFLASH.stopVideo():VMAUtils.isAudio(this.att.mimeType)&&VMAAUDIOFLASH.stopAudio()},showVi
ew:function(a)
{this.att=a;this.dataUrl=a.dataUrl;this.downloadUrl=this.buildDownloadUrl(a.dataUrl);this.show({asyncB
eforeClose:!1,onAfterShow:function(b,c){VMAUtils.isVideo(a.mimeType)?
c.createVideoObject(a):VMAUtils.isAudio(a.mimeType)&&c.createAudioObject(a)},

onBeforeClose:function(a,c,d){d.stopMedia()},onAfterClose:function(a,c,d)
{}})}},VMAViewAttachmentAvDlg=new
Class(VMAViewAttachmentAvDlgClassDef),VMADesktopNotificationsDlgClassDef={Extends:VMAPopup,E
NABLED_TEXT:"Desktop Notifications is enabled",DISABLED_TEXT:"Desktop Notifications is
disabled",ENABLING_TEXT:"Enabling desktop notification",ENABLING_TEXT_IND:{DEFAULT:"Please
allow notifications to enable Desktop Notifications.",CHROME:'Please select "Allow" in the notification
bar on top of the page to enable Desktop Notifications.',

FIREFOX:'Please select "Show for this session" in the notification bar on top of the page to enable
Desktop Notifications.'},DISABLING_TEXT:"Disabling Desktop Notification",opts:null,initialize:function()
{this.parent({content:"desktopNotificationsDlgContentWrapper",contentPool:"mainComponentPool",titl
e:VMAConst.DEFAULT_DIALOG_TITLE,width:350,footer:
["desktopNotificationsDlgButtonCancel"]})},setContentText:function(a)
{document.id("desktopNotificationsDlgContent").set("html",a)},hideProgress:function(a)
{document.id("desktopNotificationsDlgContent").set("html",

a).show();document.id("desktopNotificationsDlgProgress").hide();this.showFooter(!
0);this.showCloseButton(!1)},showProgress:function(a)
{document.id("desktopNotificationsDlgContent").hide();document.id("desktopNotificationsDlgProgress"
).set("html",a).show();this.showFooter(!0);this.showCloseButton(!1)},showConfirmEnabled:function()
{this.hideProgress(this.ENABLED_TEXT)},showSystemError:function()
{this.hideProgress(VMAUiText.SYSTEM_ERROR)},show:function(a)
{this.opts=a;this.parent({asyncBeforeClose:!0,

onBeforeShow:function(b,c){c.toHide=!1;a.get("enable")?a.get("server")?
c.showProgress(c.ENABLING_TEXT):c.hideProgress(c.ENABLED_TEXT):a.get("server")?
c.showProgress(c.DISABLING_TEXT):c.hideProgress(c.ENABLED_TEXT);a.get("server")?
desktopNotifications.enable({maxDelay:6E4,showAlert:!1,onStart:function(a){switch(a){case
DesktopNotificationsPermission.NOT_ALLOWED:"chrome"===Browser.name?
c.showProgress(c.ENABLING_TEXT_IND.CHROME):"firefox"===Browser.name?
c.showProgress(c.ENABLING_TEXT_IND.FIREFOX):c.showProgress(c.ENABLING_TEXT_IND.DEFAULT)}},

onComplete:function(b){vmamain.lastDNPermission=b;desktopNotifications.cancelEnable=!1;switch(b)
{case
DesktopNotificationsPermission.ALLOWED:c.showProgress(c.ENABLING_TEXT);vmamain._s_enableDesk
topNotifications(new
EOptions({enable:a.get("enable"),category:"DESKTOP_NOTIFICATIONS_IM",onComplete:function(e)
{switch(e.status){case "SUCCESS":a.get("prompt")?
c.showConfirmEnabled():c.hide();a.fireEvent("complete",b);break;default:c.showSystemError(),a.fireEve
nt("complete",b)}}}));break;case
DesktopNotificationsPermission.DENIED:c.hideProgress(c.DISABLED_TEXT);

a.fireEvent("complete",b);break;default:c.hide(),c.toHide=!
0,a.fireEvent("complete",b)}}}):a.fireEvent("complete")},onAfterShow:function(a,c){!
0===c.toHide&&c.hide()},onBeforeClose:function(a,c,d,e){switch(c){case
"desktopNotificationsDlgButtonCancel":desktopNotifications.cancelEnable=!
0,d.hideProgress(d.DISABLING_TEXT)}e()}})}},VMADesktopNotificationsDlg=new
Class(VMADesktopNotificationsDlgClassDef),VMAMessageInformationDlgClassDef={Extends:VMAPopup,
initialize:function(){this.parent(this.buildDlgOptions())},

buildDlgOptions:function()
{return{content:"messageInformationContentWrapper",contentPool:"messagesTemplatesPool",title:"M
essage Info",width:vmauiconst.$("MESSAGE_INFO_DLG_WIDTH"),showClose:!1,footer:
["messageInformationContentClose"]}},show:function(a){var
b=null;vmadom.messageInformationContent().deepEmpty();"Received"===a.outbound&&this.insert("Fr
om",a.from);this.insert(a.outbound,a.time);this.insert("Type",a.type);0<a.size&&this.insert("Size",a.size)
;a.messageSource&&this.insert("Message Source",

a.messageSource);a.uid&&this.insert("UID",a.uid);this.insert("Message ID",a.messageId,"msgId",!
0);this.insert("Date",a.date);a.recipients&&(b=document.id("miReceived").clone(),"Received"===a.outb
ound?b.getElement("b").set("text","Sent To: "):b.getElement("b").set("text","Delivery Status:
"),a.recipients.each(function(c,d){var
e="",f=vmadom.messageInformationRecipientTemplate().clone();c.display&&(f.getElement(".recipientN
ame").grab(new Element("h3",{text:c.display}),"top"),f.addClass("addressbook"));

c.type&&(e=c.type.capitalize()+": ");e+=c.number;f.getElement("span").set("text",e);if("Received"!
==a.outbound&&c.status){var
e=f.getElement(".recipientStatus"),g=c.status.value.toLowerCase().capitalize();e.getElement("span").set(
"text",g);0<c.status.time&&(g=VMAUtils.timestampToDateString(c.status.time),e.grab(new
Element("span",{text:g})),8>=g.length||(14>=g.length?
f.addClass("fulltime"):f.addClass("fulldate")))}b.grab(f)}),vmadom.messageInformationContent().grab(b))
;this.parent({asyncBeforeClose:!1,
onBeforeClose:function(a,b,e){}})},insert:function(a,b,c,d){var
e=vmadom.messageInformationDivTemplate().clone();e.getElement("b").set("text",a+":
");e.getElement("span").set("text",b);d&&e.set("title",b);c&&e.addClass(c);vmadom.messageInformatio
nContent().grab(e)}},VMAMessageInformationDlg=new
Class(VMAMessageInformationDlgClassDef),VMADeviceSplashDlgClassDef={Extends:VMAPopup,initializ
e:function(){this.parent(this.buildDlgOptions());var a,b,c;"ios"===Browser.platform?
(a=VMAUiText.APP_STORE,c=VMAUiText.PLAY_STORE,

b=VMAConst.APP_STORE_LINK,document.id("deviceSplashAppStoreIcon").show(),document.id("deviceS
plashGooglePlayIcon").hide(),document.id("deviceSplashButtonGoto").set("value",VMAUiText.GOTO_AP
P_STORE)):"android"===Browser.platform?
(a=VMAUiText.PLAY_STORE,c=VMAUiText.APP_STORE,b=VMAConst.PLAY_STORE_LINK,document.id("d
eviceSplashAppStoreIcon").hide(),document.id("deviceSplashGooglePlayIcon").show(),document.id("dev
iceSplashButtonGoto").set("value",VMAUiText.GOTO_PLAY_STORE)):b=c=a="";VMAUtils.isEmpty(b)||

document.id("deviceSplashButtonGoto").addEvent("click",function(a)
{window.open(b,"_blank")});a=VMAUiText.deviceSplash.CONTENT.substitute({link:b,store:a});c=VMAUiT
ext.deviceSplash.CONTENT2.substitute({other_store:c});document.id("deviceSplashContent").set("html"
,a);document.id("deviceSplashContent2").set("html",c);document.id("deviceSplashAppStoreIcon").set("
href",VMAConst.APP_STORE_LINK);document.id("deviceSplashGooglePlayIcon").set("href",VMAConst.P
LAY_STORE_LINK);document.id("deviceSplashDoNotShowText").set("html",

VMAUiText.deviceSplash.DO_NOT_SHOW);document.id("deviceSplashDoNotShowCheckbox").addEvent
("click",function(){this.get("checked")?Cookie.write("deviceSplashDoNotShow","y",
{duration:999999}):Cookie.write("deviceSplashDoNotShow","n",
{duration:999999})})},buildDlgOptions:function()
{return{content:"deviceSplash",contentPool:"messagesTemplatesPool",title:VMAConst.DEFAULT_DIALO
G_TITLE,width:vmauiconst.$("DEVICE_SPLASH_DLG_WIDTH"),showClose:!1,footer:
["deviceSplashButtonOk","deviceSplashButtonGoto"]}}},VMADeviceSplashDlg=

new
Class(VMADeviceSplashDlgClassDef),VMAConfirmReportSpamDlgClassDef={Extends:VMAPopup,initialize
:function()
{this.parent(this.buildDlgOptions());document.id("confirmReportSpamContent").set("html",VMAUiText.
confirmReportSpam.CONTENT);document.id("confirmReportSpamProgress").set("html",VMAUiText.con
firmReportSpam.PROGRESS)},buildDlgOptions:function()
{return{content:"confirmReportSpamContentWrapper",contentPool:"messagesTemplatesPool",title:VM
AConst.DEFAULT_DIALOG_TITLE,width:vmauiconst.$("CONFIRM_REPORT_SPAM_DLG_WIDTH"),

showClose:!1,footer:
["confirmReportSpamContentButtonNo","confirmReportSpamContentButtonYes"]}},hideProgress:functi
on()
{document.id("confirmReportSpamContent").show();document.id("confirmReportSpamProgress").hide()
;this.showFooter(!0)},showProgress:function()
{document.id("confirmReportSpamContent").hide();document.id("confirmReportSpamProgress").show()
;this.showFooter(!1)},show:function(a,b,c){this.parent({asyncBeforeClose:!
0,onBeforeShow:function(a,b){b.hideProgress()},onBeforeClose:function(d,e,
f,g){switch(e){case "confirmReportSpamContentButtonYes":f.showProgress();a.reportSpam(b,c,
{onComplete:g});break;case "confirmReportSpamContentButtonNo":case
"":g()}}})}},VMAConfirmReportSpamDlg=new
Class(VMAConfirmReportSpamDlgClassDef),VMACustomerFeedbackDlgClassDef={Extends:VMAPopup,el
t:null,formElt:null,progressElt:null,validEmail:!0,validComment:!
1,feedbackPlaceholder:null,emailPlaceholder:null,initialize:function(){var
a=this;this.parent(this.buildDlgOptions());this.elt=document.id("customerFeedback");

this.formElt=document.id("customerFeedbackForm");this.progressElt=document.id("customerFeedback
Progress");document.id("cfFeedbackTextarea").set("maxlength",VMAIMConst.CUSTOMER_FEEDBACK_T
EXT_MAX_COUNT);this.feedbackPlaceholder=new
Placeholder({eltId:"cfFeedbackTextarea",placeholder:VMAUiText.feedback.GENERAL_FEEDBACK});this.e
mailPlaceholder=new
Placeholder({eltId:"cfEmailInput",placeholder:"optional"});this.feedbackCounter=new
CharCounter({containerEltSelector:"#customerFeedback",textEltSelector:"#cfFeedbackTextarea",

counterEltSelector:"#cfFeedbackCountCnt",maxLengthEltSelector:"#cfFeedbackCountTotal",maxLength:
VMAIMConst.CUSTOMER_FEEDBACK_TEXT_MAX_COUNT,keyupHandler:this.onKeyUpTextCounter.bind(
this),pasteHandler:this.onKeyUpTextCounter.bind(this)});a=this;document.id("cfEmailInput").addEvents(
{keyup:function(b){a.onKeyUpEmail()},blur:function(b){a.onBlurEmail()}})},resetForm:function()
{document.id("cfFeedbackCountCnt").set("text",VMAIMConst.CUSTOMER_FEEDBACK_TEXT_MAX_COU
NT);this.formElt.getElements(".cfContainer input, .cfContainer textarea").set("value",

"");this.emailPlaceholder.show();document.id("cfEmailInput").removeClass("error");this.formElt.getEle
ment(".emailError").hide()},buildDlgOptions:function()
{return{content:"customerFeedback",contentPool:"messagesTemplatesPool",title:VMAConst.DEFAULT_
DIALOG_TITLE,width:vmauiconst.$("CUSTOMER_FEEDBACK_DLG_WIDTH"),showClose:!1,footer:
["customerFeedbackDlgCancel","customerFeedbackDlgSubmit"]}},hideProgress:function()
{this.elt.removeClass("progress");document.id(this.windowEltId).getElement(".popupWindow").setStyle
("width",

vmauiconst.$("CUSTOMER_FEEDBACK_DLG_WIDTH"));this.showFooter(!0)},showProgress:function()
{this.elt.addClass("progress");document.id(this.windowEltId).getElement(".popupWindow").setStyle("wi
dth",vmauiconst.$("CUSTOMER_FEEDBACK_DLG_PROG_WIDTH"));this.showFooter(!
1)},enableSubmitButton:function(a){var b=document.id("customerFeedbackDlgSubmit");a?
b.set("disabled",!1):b.set("disabled",!0)},updateControls:function()
{this.enableSubmitButton(this.validEmail&&this.validComment)},onKeyUpTextCounter:function(a,

b){var
c=document.id("cfFeedbackTextarea").get("value"),c=c.trim();this.validComment=0<c.length;this.update
Controls()},onBlurEmail:function(){var
a=this.elt.getElement(".emailError"),b=this._checkEmail();b&&(a.set("html",b.message),!0===b.show?
a.show():a.hide());this.updateControls()},onKeyUpEmail:function(){var
a=this.elt.getElement(".emailError"),b=document.id("cfEmailInput"),c=this._checkEmail();c&&(!
0===c.show?b.addClass("error"):
(b.removeClass("error"),a.hide()));this.updateControls()},_checkEmail:function(){var a=
document.id("cfEmailInput").get("value").trim(),b={show:!1,message:""};0===a.length||"optional"===a?
this.validEmail=!0:"EMAIL"!==RecipientAddressUtil.parseEmail(a).type?(b.message="Invalid email
address.",b.show=!0,this.validEmail=!1):this.validEmail=!0;return b},_buildContent:function(){var
a="",b=document.id("cfEmailInput").get("value").trim(),a=a+"Email: "+(b&&"optional"!==b?
b:"n/a"),a=a+"\n",b=document.id("cfFeedbackTextarea").get("value").trim(),a=a+("Feedback:\n"+b?
b:"n/a");return a+="\n"},

show:function(a,b){this.parent({asyncBeforeClose:!0,onBeforeShow:function(a,b)
{b.hideProgress();b.validEmail=!0;b.validComment=!
1;b.resetForm();b.updateControls()},onBeforeClose:function(a,b,e,f){switch(b){case
"customerFeedbackDlgSubmit":e.showProgress();vmamain._s_submitFeedback({content:document.id("
cfFeedbackTextarea").get("value").trim(),email:document.id("cfEmailInput").get("value").trim(),onComp
lete:function(){f();VMAPopupUtils.alert({message:"\x3cdiv style\x3d'padding: 15px 0 0 10px'\x3e"+

VMAUiText.feedback.THANK_YOU+"\x3c/div\x3e",width:460,styles:{"font-size":16},buttons:
["ok"],showClose:!1})}});break;default:f()}}})}},VMACustomerFeedbackDlg=new
Class(VMACustomerFeedbackDlgClassDef),VMAConfirmSwitchUploadingConversationDlgClassDef={Exte
nds:VMAPopup,initialize:function()
{this.parent({content:"confirmSwitchUploadingConversationContent",contentPool:"messagesTemplates
Pool",title:"Confirm",width:400,footer:
["confirmSwitchUploadingConversationButtonNo","confirmSwitchUploadingConversationButtonYes"]})},

show:function(a){this.parent({asyncBeforeClose:!0,onBeforeClose:function(b,c,d,e){switch(c){case
"confirmSwitchUploadingConversationButtonYes":e();vmaim.attachments.cancelAllUploads();vmaim.att
achments.clearErrorMessages();vmaim.activateConversationByEltId(a);break;case
"confirmSwitchUploadingConversationButtonNo":case
"":e()}}})}},VMAConfirmSwitchUploadingConversationDlg=new
Class(VMAConfirmSwitchUploadingConversationDlgClassDef);

Object.append(Element.NativeEvents,
{loadeddata:2,loadedmetadata:2,canplaythrough:2,timeupdate:2,ended:2,progress:2,stalled:2,waiting:2
,play:2,playing:2});

var VMAAudioPlayerClassDef={audio:{},uploading_audio:[],shoebox_audio:[],audioStatus:
{},initAudio:function(a,b,c,d,e){this._initHTML5Audio(a,b,c,d,e)},_initHTML5Audio:function(a,b,c,d,e)
{c=c||!1;b=this.buildStreamURL(b);var f=VMAUtils.supportsHTML5Audio();if(!
VMAUtils.isIE8OrLess()&&"undefined"===typeof
this.audio[a]&&this.audioStatus[a]&&"loading"===this.audioStatus[a]){if("undefined"!==typeof
Audio)this.audio[a]=new
Audio(b),this.audio[a].load(),this.audioStatus[a]=c?"play":"resume",this.setupEvents(this.audio[a],

d,a,c);else{var g=new Element("audio");b=new Element("source",{src:b,type:f,preload:!


0});g.grab(b);this.setupEvents(b,d,a,c);$$
(document.body).grab(g);this.audio[a]=g;this.audioStatus[a]="resume"}"uploading"===e?
this.uploading_audio.push(a):"shoebox"===e&&this.shoebox_audio.push(a)}},setupEvents:function(a,b,
c,d){var e=this;a.addEvents({loadedmetadata:function(a)
{0<this.duration&&e.setDurationHtml(this.duration,b)},ended:function(a)
{e.setDurationHtml(this.duration,b);e.setPlayHtml(b);e.audioStatus[c]=

"restart"},timeupdate:function(a){if(isFinite(this.duration)||
0<this.duration)e.setDurationHtml(this.duration-this.currentTime,b),(a=b.getSiblings(".vma-att-
embedded-audio-wrapper"))&&a.length&&(a=a[0].getElement(".vma-att-embedded-audio-
progress"))&&isFinite(this.currentTime)&&isFinite(this.duration)&&a.setStyle("left",this.currentTime/thi
s.duration*100+"%")},error:function(a){e.toggleLoading(b,!1)},stalled:function(a){"safari"!
==Browser.name&&e.toggleLoading(b,!0)},waiting:function(a){"safari"!==

Browser.name&&e.toggleLoading(b,!0)},playing:function(a){e.toggleLoading(b,!1)},play:function(a)
{e.toggleLoading(b,!1)}});a.addEvent("progress",function(){var c=b.getSiblings(".vma-att-embedded-
audio-wrapper");if(c&&c.length&&(c=c[0].getElement(".vma-att-embedded-audio-buffer"))){for(var
d=0,e=0,l=0,k=0;k<a.buffered.length;k++)e=a.buffered.start(k),l=a.buffered.end(k),d+=100/a.duration*(l-
e);d&&c.setStyle("width",d+"%")}});d&&a.addEvent("canplaythrough",function(a){e.toggleLoading(b,!
1);"play"===

e.audioStatus[c]&&this.play()})},toggleLoading:function(a,b){b?
a.addClass("loading"):a.removeClass("loading")},setDurationHtml:function(a,b){var
c=b.getSiblings(".vma-att-embedded-audio-duration");if(c&&c.length){var
d=VMAUtils.convertDuration(a);d?c.set("text",d).show():b.getSiblings(".vma-att-embedded-audio-
duration").hide()}},setPlayHtml:function(a)
{a.removeClass("pause").addClass("play").set("title",VMAUiText.audio.PAUSE_ALT_TEXT)},setPauseHtml
:function(a){a.removeClass("play").addClass("pause").set("title",

VMAUiText.audio.PLAY_ALT_TEXT)},resetHtml:function(a){var b=document.id(a);if(b){var
c=b.getElement(".vma-att-embedded-audio-control"),d=b.getElement(".vma-att-embedded-audio-
progress");this.setPlayHtml(c);this.audio[a]&&0<this.audio[a].duration?
this.setDurationHtml(this.audio[a].duration,c):b.getElement(".vma-att-embedded-audio-
duration").hide();d&&d.setStyle("left","-3px")}},play:function(a){return"undefined"===typeof
this.audio[a]||VMAUtils.isIE8OrLess()?!1:("restart"===this.audioStatus[a]&&("chrome"===

Browser.name||"safari"===Browser.name?
this.audio[a].load():this.audio[a].currentTime=0),this.audioStatus[a]="play",this.audio[a].play(),!
0)},pause:function(a){return"undefined"===typeof this.audio[a]||VMAUtils.isIE8OrLess()?!1:
(this.audio[a].pause(),this.audioStatus[a]="resume",!0)},stop:function(a){return"undefined"===typeof
this.audio[a]||VMAUtils.isIE8OrLess()?!1:(this.audio[a].pause(),this.audioStatus[a]="restart",!
0)},buildStreamURL:function(a){var
b=VMAUtils.supportsHTML5Audio();b&&(a+="\x26targetMimeType\x3d"+

b);return a},cleanup:function(a){var b=this,c;switch(a){case


"uploaded":c=this.uploading_audio,this.uploading_audio=[]}c.each(function(a)
{VMAUtils.defined(b.audio[a])&&(b.audio[a].pause(),delete
b.audio[a]);VMAUtils.defined(b.audioStatus[a])&&delete b.audioStatus[a]})}},VMAAudioPlayer=new
Class(VMAAudioPlayerClassDef),VMAKeepLoggedInSplashDlgClassDef={Extends:VMAPopup,initialize:fun
ction()
{this.parent(this.buildDlgOptions());document.id("keepLoggedInSplashContent").set("html",VMAUiText.
keepLoggedInSplash.CONTENT);

document.id("keepLoggedInSplashDoNotShowText").set("html",VMAUiText.keepLoggedInSplash.DO_N
OT_SHOW);document.id("keepLoggedInLearnMore").set("html",VMAUiText.keepLoggedInSplash.LEARN
_MORE);document.id("keepLoggedInNotes").set("html",VMAUiText.keepLoggedInSplash.NOTES);docum
ent.id("keepLoggedInSplashButtonYes").addEvent("click",function(a)
{vmamain.startKeepLoggedIn()});document.id("keepLoggedInSplashDoNotShowCheckbox").addEvent("cl
ick",function(){this.get("checked")?Cookie.write("keepLoggedInSplashDoNotShow",

"y",{duration:999999}):Cookie.write("keepLoggedInSplashDoNotShow","n",
{duration:999999})})},buildDlgOptions:function()
{return{content:"keepLoggedInSplashDlg",contentPool:"messagesTemplatesPool",title:VMAConst.DEFA
ULT_DIALOG_TITLE,width:vmauiconst.$
("KEEP_LOGGED_IN_SPLASH_DLG_WIDTH"),position:"fixed",showClose:!1,footer:
["keepLoggedInSplashButtonYes","keepLoggedInSplashButtonNo"]}},show:function(a)
{document.id("keepLoggedInSplashDoNotShowContainer").show(!
a);this.parent()}},VMAKeepLoggedInSplashDlg=

new
Class(VMAKeepLoggedInSplashDlgClassDef),VMANewUserSplashDlgClassDef={Extends:VMAPopup,show
KeepSignedInDlg:!1,initialize:function(){this.parent(this.buildDlgOptions())},buildDlgOptions:function()
{return{content:"newUserSplashDlg",contentPool:"messagesTemplatesPool",title:VMAUiText.newUser.
HEADER,width:vmauiconst.$("NEW_USER_DLG_WIDTH"),height:vmauiconst.$
("NEW_USER_DLG_HEIGHT"),position:"absolute",showClose:!0}},show:function(a)
{this.showKeepSignedInDlg=!a;this.parent({onAfterClose:function(a,

c,d)
{d.showKeepSignedInDlg&&(vmaim.turnOffIntroDialogOnServer(),vmaim._showDeviceSplashDlg(),vmai
m._showKeepLoggedInsplashDlg(!1))}})}},VMANewUserSplashDlgClass=new
Class(VMANewUserSplashDlgClassDef),VMACalendarClassDef={Implements:Options,monthStr:"January
February March April May June July August September October November December".split(" "),options:
{id:"arCalendar",inputId:"arEndDateDate",triggers:[],showTimePicker:!1,allowOlder:!
1,positionId:null,position:{position:"upperLeft",edge:"BottomLeft"},

classes:{calendar:"popupCalendar",selected:"selected",today:"today",prevMonth:"prev-
month",nextMonth:"next-month"},onBeforeShow:function(){},onAfterShow:function()
{},onSelect:function(){}},selected:!1,showing:!
1,today:null,date:null,month:null,year:null,totalDaysInMonthPre:null,totalDaysInMonthCur:null,dayOfW
eekForFirst:null,initialize:function(a,b){this.setOptions(a);this.date=b||new
Date;this.date.setSeconds(0,0);this.setMonth(this.date.getMonth()
+1,this.date.getFullYear());this.createMonthCalendarElt();

this.setupTimeElt(this.date);this._initEvents()},_initEvents:function(){var
a=document.id(this.options.id),b=document.id(this.options.inputId),c="hidden"==b.get("type"),d=a.getE
lement(".prev"),e=a.getElement(".next"),f=this;d.addEvent("click",function()
{f.setPrevMonth()});e.addEvent("click",function(){f.setNextMonth()});a.addEvent("click",function(a)
{a.stop()});this.options.allowOlder?a.addEvent("click:relay('td')",function(a)
{f.selectDay(a)}):a.addEvent("click:relay('td:not(.disabled)')",function(a){f.selectDay(a)});

Array.each(this.options.triggers,function(a){$$(a).addEvent("click",function(a)
{a.stop();f.toggleCalendar()})},this);c||b.addEvent("click",function(a)
{f.showCalendar()});this.options.showTimePicker&&(a.addEvent("click:relay('div.up')",function(b){var
c=b.target.getParent();b=f.getTimeType(c);c=c.getElement(".value").get("text");f.toggleTime(a,b,c,!
0)}),a.addEvent("click:relay('div.down')",function(b){var
c=b.target.getParent();b=f.getTimeType(c);c=c.getElement(".value").get("text");f.toggleTime(a,

b,c,!1)}),a.getElement("button").addEvent("click",function(a)
{f.hideCalendar();f.selectTime();f.options.onSelect()}))},setNextMonth:function(){12===this.month?
(this.month=1,this.year+=1):this.month+
+;this.setMonth(this.month,this.year);this.updateMonthCalendarElt()},setPrevMonth:function()
{1===this.month?(this.month=12,this.year-
=1):this.month--;this.setMonth(this.month,this.year);this.updateMonthCalendarElt()},setSelectedDate:f
unction(a,b,c){this.date.setFullYear(a,b-1,c)},setSelectedTime:function(a,

b){this.options.showTimePicker&&this.date.setHours(a,b,0,0)},setDate:function(a){this.date=a;a=!
1;this.getSelectedElt()&&parseInt(this.getSelectedElt().get("text"))===this.date.getDate()||(a=!
0);if(this.month!==this.date.getMonth()+1||this.year!
==this.date.getFullYear())this.setMonth(this.date.getMonth()+1,this.date.getFullYear()),a=!
0;a&&this.updateMonthCalendarElt();this.setupTimeElt(this.date)},setMonth:function(a,b)
{this.month=a;this.year=b;var c=a-1,d=b;1===a&&(c=12,d=b-1);this.totalDaysInMonthPre=

this.getDaysInMonth(c,d);this.totalDaysInMonthCur=this.getDaysInMonth();this.dayOfWeekForFirst=thi
s.getFirstDayOfMonth()},getDaysInMonth:function(a,b){a=a||this.month;b=b||this.year;return(new
Date(b,a,0)).getDate()},getFirstDayOfMonth:function(a,b){a=a||this.month;b=b||this.year;return(new
Date(b,a-1,1)).getDay()},setHeader:function()
{this.elt.getElement("h1").set("text",this.monthStr[this.month-1]+"
"+this.year)},createMonthCalendarElt:function()
{this.elt=document.id("calendarTpl").clone();this.elt.addClass(this.options.classes.calendar);

this.elt.set("id",this.options.id);this.elt.setStyle("display","none");this.options.showTimePicker||
this.elt.addClass("notime");this.updateMonthCalendarElt();this.insertCalendar()},updateMonthCalendar
Elt:function(){this.setHeader();var
a=this.elt.getElement("tbody");a.empty();this.createCalendarDaysElt(a)},createCalendarDaysElt:function
(a){this.updateToday();var b=this.totalDaysInMonthPre-(0==this.dayOfWeekForFirst?
0:this.dayOfWeekForFirst-1),c=this.createWeekElt(),d=0,e=1,f;f=0<this.dayOfWeekForFirst?

new Date(1===this.month?this.year-1:this.year,(1===this.month?12:this.month-1)-1,b):new
Date(this.year,this.month-1,1);f=this.today.clearTime().diff(f);var g=!this.options.allowOlder&&0>f+
+;if(0<this.dayOfWeekForFirst)for(;b<=this.totalDaysInMonthPre;)c.grab(this.createDayElt(b,g,this.optio
ns.classes.prevMonth)),g=!this.options.allowOlder&&0>f++,b++,d+
+;for(;e<=this.totalDaysInMonthCur;)0===d
%7&&(a.grab(c),c=this.createWeekElt(),d=0),this.isSelected(e,this.month,this.year)?
c.grab(this.createDayElt(e,
g,this.options.classes.selected)):this.isToday(e,this.month,this.year)?
c.grab(this.createDayElt(e,g,this.options.classes.today)):c.grab(this.createDayElt(e,g)),g=!
this.options.allowOlder&&0>f++,d++,e+
+;for(b=1;7>d;)c.grab(this.createDayElt(b,g,this.options.classes.nextMonth)),g=!
this.options.allowOlder&&0>f++,d++,b++;a.grab(c)},insertCalendar:function()
{document.id(this.options.inputId).grab(this.elt,"after")},createDayElt:function(a,b,c)
{a=a||"";c=c||"";a=(new Element("td")).set("text",a);c&&a.addClass(c);

b&&a.addClass("disabled");return a},createWeekElt:function(){return new


Element("tr")},updateToday:function(){this.today=new Date},isToday:function(a,b,c){return
a===this.today.getDate()&&b===this.today.getMonth()+1&&c===this.today.getFullYear()?!0:!
1},isSelected:function(a,b,c){return a===this.date.getDate()&&b===this.date.getMonth()
+1&&c===this.date.getFullYear()?!0:!1},getSelectedElt:function(){return
document.id(this.options.id).getElement("td."+this.options.classes.selected)},showCalendar:function()
{if(!1===

this.showing){this.options.onBeforeShow();this.setDate(this.date);this.showing=!0;var a;a=null!
=this.options.positionId?
document.id(this.options.positionId):document.id(this.options.inputId);this.elt.position({relativeTo:a,po
sition:this.options.position.position,edge:this.options.position.edge});document.addEvent("click",this.hi
deCalendar.bind(this));this.elt.show();this.options.onAfterShow()}},hideCalendar:function(){!
0===this.showing&&(document.id(this.options.inputId),this.elt.hide(),document.removeEvent("click",

this.hideCalendar.bind(this)),this.showing=!1)},toggleCalendar:function(){!0===this.showing?
this.hideCalendar():this.showCalendar()},selectDay:function(a,b){b=b||!1;var c,d,e;"input"===b?
(c=a.date,d=a.month,e=a.year):
(c=a.target.get("text"),d=this.month,e=this.year,a.target.hasClass(this.options.classes.prevMonth)?
1===d?(d=12,e-=1):d--:a.target.hasClass(this.options.classes.nextMonth)&&(12===d?(d=1,e+=1):d+
+));this.setSelectedDate(e,d,c);this.options.showTimePicker||b||(this.hideCalendar(),this.setInput(c,

d,e));this.setMonth(d,e);this.updateMonthCalendarElt();if(!
this.options.showTimePicker)this.options.onSelect()},selectTime:function(){var
a=this.getTimeVal("hour"),b=this.getTimeVal("minute");this.setSelectedTime(a,b)},setInput:function(a,b,
c)
{9>=a&&(a="0"+a);9>=b&&(b="0"+b);document.id(this.options.inputId).set("value",b+"/"+a+"/"+c)},set
DateFromInput:function(){var a=document.id(this.options.inputId).get("value");
(a=this.validateDateStr(a))&&!0===a.valid&&this.selectDay(a,"input")},validateDateStr:function(a){a=

a.replace(/[^\d]/g,"");var b=!1;if(8===a.length||6===a.length){var
b=a.substring(0,2),c=a.substring(2,4);a=a.substring(4,8);b=VMAUtils.validateDate(a,b,c)}return
b},setupTimeElt:function(a){if(this.options.showTimePicker){var
b=document.id(this.options.id),c="AM",d=a.getHours();12===d?c="PM":12<d?(c="PM",d-
=12):0===d&&(d=12);a=a.getMinutes();b.getElement(".hour
.value").set("text",d);b.getElement(".minute .value").set("text",10>a?"0"+a:a);b.getElement(".ampm
.value").set("text",c)}},getTimeVal:function(a){var b=
document.id(this.options.id),c=-1;switch(a){case "hour":c=b.getElement(".hour
.value").get("text");b=b.getElement(".ampm .value").get("text");c=parseInt(c);12===c&&"AM"==b?
c=0:12>c&&"PM"==b&&(c+=12);break;case "minute":b=b.getElement(".minute
.value").get("text"),c=parseInt(b)}return c},getTimeType:function(a){var b=null;a.hasClass("hour")?
b="hour":a.hasClass("minute")?b="minute":a.hasClass("ampm")&&(b="ampm");return
b},toggleTime:function(a,b,c,d){"hour"===b?(c=parseInt(c),d&&11===c?(a.getElement(".hour
.value").set("text",

12),c=a.getElement(".ampm .value").get("text"),this.toggleTime(a,"ampm",c,!1)):d||12!==c?
d&&12===c?a.getElement(".hour .value").set("text",1):d||1!==c?(c=d?++c:--c,a.getElement(".hour
.value").set("text",c)):a.getElement(".hour .value").set("text",12):(a.getElement(".hour
.value").set("text",11),c=a.getElement(".ampm .value").get("text"),this.toggleTime(a,"ampm",c,!
1))):"minute"===b?(c=parseInt(c),d&&59===c?(a.getElement(".minute
.value").set("text","00"),c=parseInt(a.getElement(".hour .value").get("text")),

this.toggleTime(a,"hour",c,!0)):d||0!==c?(c=d?++c:--c,c=10>c?"0"+c:c,a.getElement(".minute
.value").set("text",c)):(a.getElement(".minute .value").set("text",59),c=parseInt(a.getElement(".hour
.value").get("text")),this.toggleTime(a,"hour",c,!
1))):"ampm"===b&&(c="PM"===c?"AM":"PM",a.getElement(".ampm
.value").set("text",c))}},VMACalendar=new
Class(VMACalendarClassDef),VMAExportMessagesDlgClassDef={Extends:VMAPopup,inProgress:!
1,initialize:function(){this.parent(this.buildDlgOptions())},buildDlgOptions:function()
{return{content:"exportMessagesDlgContent",

contentPool:"messagesTemplatesPool",title:"Export Messages",width:vmauiconst.$
("EXPORT_MESSAGES_DLG_WIDTH"),showClose:!1,footer:
["exportMessagesDlgCancel","exportMessagesDlgExport"]}},show:function()
{this.parent({asyncBeforeClose:!0,onBeforeShow:function(a,b){b.showProgress(!
1)},onBeforeClose:function(a,b,c,d){switch(b){case "exportMessagesDlgExport":c.showProgress(!
0);switch(document.id("exportMessagesDlgDateRangeSelect").getSelected()[0].get("value")){case
"lastWeek":a=6048E5;break;case "lastMonth":a=

2592E6;break;case "last2Months":a=5184E6;break;default:a=31536E6}a=Date.now()-
a;vmaim.imcore.exportMessages({startTime:a,conversationId:vmaim.activeConversation.convData.id,on
Success:function(a){d();a.url?
window.location=VMAConst.MAIN_URL_PREFIX+a.url:VMAPopupUtils.alert({message:VMAUiText.expor
tMessages.NO_MESSAGE,width:vmauiconst.$("ALERT_DIALOG_WIDTH"),buttons:["ok"],showClose:!
1})},onFailure:function()
{d();VMAPopupUtils.alert({message:VMAUiText.exportMessages.FAILURE,width:vmauiconst.$
("ALERT_DIALOG_WIDTH"),

buttons:["ok"],showClose:!1})}});break;case "exportMessagesDlgCancel":c.inProgress?c.showProgress(!
1):d()}}})},showProgress:function(a){this.inProgress=a;var
b=document.id("exportMessagesDlgContent");b.getElement(".exportMessagesDlgHeadline").show(!
a);b.getElement(".exportMessagesDlgDateRange").show(!
a);b.getElement(".exportMessagesDlgProgress").show(a);document.id("exportMessagesDlgExport").sho
w(!a,"inline-block")}},VMAExportMessagesDlg=new
Class(VMAExportMessagesDlgClassDef),VMAAddLocationMapBaseClassDef=

{TypeData:{INSERT:{insertButtonText:"Insert"},IN_MESSAGE:{insertButtonText:"Insert to
Message"},SHOEBOX:
{insertButtonText:""}},INIT_ZOOM:3,SEARCH_RESULT_ZOOM:14,DEFAULT_ADDRESS:"USA",map:null,pla
ceService:null,autocomplete:null,initMapOptions:null,inputValue:null,inputRegExp:null,selectedResEltId:
null,infoWindow:null,infoWindowEltId:null,marker:null,doUpdateMarker:!
1,mapIdleListener:null,resultArray:null,geocoderResArr:null,placeResArr:null,curLocMarker:null,curLocS
upported:!1,curLocTimer:!1,enableCurLoc:!0,

initialize:function(a){var b={content:"location-map-box",resultBox:"location-list-box",footer:["location-
cancel","location-submit"]};a&&Object.append(b,a);Object.append(this,b);this._init()},_init:function()
{var
a=this,b=document.id(this.content);document.id(this.resultBox).addEvent("click:relay(li)",function(b)
{a.onSelectResItem(b,this)});document.id("location-search-button").addEvent("click",function(b)
{a.onSearch(b,this)});document.id("location-submit").addEvent("click",function(b){a.submit(b,

this)});b.addEvent("click:relay(#location-cancel)",function(b)
{a.hide(b,this)});b.addEvent("click:relay(.location-search-box)",function(a){document.id("search-map-
input").focus()})},updateGpsIcon:function(a,b){b||
(b=this.curLocWrapperElt.getElement("span"));switch(a){case
"init":clearTimeout(this.curLocTimer);b.replaceClasses(["icon-gps-fixed","icon-gps-not-fixed","icon-gps-
off"],"icon-gps-fixed");this.curLocWrapperElt.removeClass("locked");break;case
"loading":b.replaceClasses(["icon-gps-fixed",

"icon-gps-not-fixed","icon-gps-off"],"icon-gps-fixed");this.curLocWrapperElt.hasClass("locked")?
this.curLocWrapperElt.removeClass("locked"):this.curLocWrapperElt.addClass("locked");var
c=this;this.curLocTimer=setTimeout(function(){c.updateGpsIcon("loading")},500);break;case
"fixed":clearTimeout(this.curLocTimer);b.replaceClasses(["icon-gps-fixed","icon-gps-not-fixed","icon-
gps-off"],"icon-gps-fixed");this.curLocWrapperElt.addClass("locked");break;case
"disabled":clearTimeout(this.curLocTimer),b.replaceClasses(["icon-gps-fixed",

"icon-gps-not-fixed","icon-gps-off"],"icon-gps-
off"),this.curLocWrapperElt.removeClass("locked").addClass("disabled")}b.hasClass("gps-not-
fixed")},refreshCurrentPosition:function(){if(this.enableCurLoc&&navigator.geolocation){if(!
this.curLocWrapperElt||!this.curLocWrapperElt.hasClass("disabled")){this.initCurLocButton();var
a=this;a.updateGpsIcon("loading");navigator.geolocation.getCurrentPosition(function(b)
{a.curLocSupported=!0;a.updateGpsIcon("fixed");b=new google.maps.LatLng(b.coords.latitude,

b.coords.longitude);a.onInitGeocode({latLng:b,zoom:a.SEARCH_RESULT_ZOOM,isCurPos:!
0})},function(b){switch(b.code){case b.PERMISSION_DENIED:a.curLocSupported=!
1;a.updateGpsIcon("disabled");break;case b.POSITION_UNAVAILABLE:case
b.TIMEOUT:a.curLocSupported=!0;a.updateGpsIcon("init");break;default:case
b.UNKNOWN_ERROR:a.curLocSupported=!
1,a.updateGpsIcon("disabled")}a.onInitGeocode({address:a.DEFAULT_ADDRESS,zoom:a.INIT_ZOOM})})}}
else this.onInitGeocode({address:this.DEFAULT_ADDRESS,zoom:this.INIT_ZOOM})},
initCurLocButton:function(){if(this.enableCurLoc&&navigator.geolocation){if(!this.curLocWrapperElt){var
a=this;this.curLocWrapperElt=new Element("div",{title:"Go to your current location.","class":"gps"});var
b=new Element("span",{"class":"icon-gps-
fixed"});this.curLocWrapperElt.grab(b);google.maps.event.addDomListener(this.curLocWrapperElt,"click
",function(b)
{a.refreshCurrentPosition(b)});this.curLocWrapperElt.set("index",1);this.map.controls[google.maps.Cont
rolPosition.RIGHT_BOTTOM].push(this.curLocWrapperElt)}}else this.curLocWrapperElt&&

(this.map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].pop(),this.curLocWrapperElt.destroy()
,this.curLocWrapperElt=null)},_initShow:function(a){if(this.map)alert("This should never happen! An
error had occured.");else{var b=this;vmamap.createMap({canvas:"map-canvas",onComplete:function(c)
{b.map=c;b.placeService=new google.maps.places.PlacesService(b.map);b.autocomplete=new
google.maps.places.Autocomplete(document.id("search-map-
input"));b.autocomplete.bindTo("bounds",b.map);google.maps.event.addListener(b.autocomplete,

"place_changed",function(){b.onSugSelectPlace()});switch(a.type){case
"INSERT":b.reset();b.refreshCurrentPosition();break;case "IN_MESSAGE":case
"SHOEBOX":c={},VMAUtils.isValidLatLng(a.latLng)&&(c.latLng=new
google.maps.LatLng(a.latLng.lat,a.latLng.lng,!0)),c.address=a.locationStr,c.address?
c.zoom=b.SEARCH_RESULT_ZOOM:
(c.address=b.DEFAULT_ADDRESS,c.zoom=b.INIT_ZOOM,c.latLng=null),b.onInitGeocode(c)}}})}},onInitGeo
code:function(a){this.initCurLocButton(a);if(a.isCurPos&&a.latLng)this.updateCurPosMarker(a.latLng),

this.map.setOptions({center:a.latLng,mapTypeId:google.maps.MapTypeId.ROADMAP,zoom:a.zoom});els
e{var
b=this,c={};a.latLng&&(c.location=a.latLng);a.address&&(c.address=a.address);vmamap.geocoder.geoco
de(c,function(d,e)
{e===google.maps.GeocoderStatus.OK&&(b.initMapOptions={center:d[0].geometry.location,mapTypeId
:google.maps.MapTypeId.ROADMAP,zoom:a.zoom},c.address?c.address===b.DEFAULT_ADDRESS?
a.zoom===b.INIT_ZOOM?
b.map.setOptions(b.initMapOptions):b.map.setOptions({center:b.initMapOptions.center,mapTypeId:b.i
nitMapOptions.mapTypeId,

zoom:a.zoom}):
(b.map.setMapTypeId(google.maps.MapTypeId.ROADMAP),b._doInitSearch(c.address)):b.map.setOptio
ns({center:b.initMapOptions.center,mapTypeId:b.initMapOptions.mapTypeId,zoom:a.zoom}))})}},_doInit
Search:function(a){document.id("search-map-input").set("value",a.clean());this.doSearch(a,!
1)},onSelectResItem:function(a,b){this._selectResItem(b)},_selectFirstResItem:function(){var
a=document.id(this.resultBox).getElement("ul");a&&(a=a.getElement("li"))&&this._selectResItem(a)},_s
electResItem:function(a){if(this.selectedResEltId){var b=

document.id(this.selectedResEltId);b&&this.highlightResItem(b,!1)}this.highlightResItem(a,!
0);this.selectedResEltId=a.get("id");this._updateMarker(a);document.id("location-
submit").removeAttribute("disabled")},_updateMarker:function(a){a=a.retrieve("result");var
b=this._buildResultText(a);this.map.setOptions({center:a.result.geometry.location,zoom:this.SEARCH_R
ESULT_ZOOM});this.updateMarker(a.result.geometry.location,b)},updateCurPosMarker:function(a){var
b=this;this.curLocMarker||(this.curLocMarker=
new google.maps.Marker({flat:!0,position:a,visible:!
0,icon:"/vma/web2/resources/images/common/location.png",title:"Your
Location"}),google.maps.event.addListener(this.curLocMarker,"click",function(a)
{b.onClickCurPosMarker(a)}));this.curLocMarker.setPosition(a);this.curLocMarker.setMap(this.map)},up
dateMarker:function(a,b){var c=this,d={title:b.title,clickable:!
0,map:this.map,position:a,zIndex:1};this.marker?this.marker.setOptions(d):(this.marker=new
google.maps.Marker(d),google.maps.event.addListener(this.marker,

"click",function(a){c.onClickMarker(a)}));this.marker.setVisible(!0)},onClickMarker:function(a)
{},onClickCurPosMarker:function(a){},highlightResItem:function(a,b){b?
a.replaceClasses(null,"selected"):a.replaceClasses("selected")},_buildResultText:function(a){var
b={};switch(a.type){case vmamap.ResultType.PLACE:b.name=a.result.name;a.result.formatted_address?
(b.address=a.result.formatted_address,b.address=b.address.replace(", United States","").replace(",
USA","")):a.result.vicinity&&(b.address=a.result.vicinity);

break;case vmamap.ResultType.GEOCODER:b.address=a.result.formatted_address}return
b},_addResult:function(a){var
b=document.id(this.resultBox).getElement("ul"),c=document.id("addLocationMapResTpl").clone().set("i
d",String.uniqueID());switch(a.type){case vmamap.ResultType.PLACE:this._buildPlaceElt(a,c);break;case
vmamap.ResultType.GEOCODER:this._buildGeoElt(a,c)}b.grab(c,"bottom")},_buildPlaceElt:function(a,b)
{var c=a.result,d="",e=c.name,f=c.rating||-1,g=c.price_level||-
1,h=null;c.opening_hours&&c.opening_hours.open_now&&

(h=!!c.opening_hours.open_now);c.formatted_address?(d=c.formatted_address,d=d.replace(", United
States",""),d=d.replace(",
USA","")):c.vicinity&&(d=c.vicinity);b.getElement(".name").set("html",e);b.getElement(".address").set("h
tml",d);c=[];-1<f&&(d=document.id("location-
rating").clone(),d.getElement(".rating").set("text",f.toFixed(1)+"
"),d.getElement(".full").setStyle("width",f/5*100+"%"),c.push(d.outerHTML));-
1<g&&4>=g&&c.push("$".repeat(g));!0===h?c.push("Open now"):!1===h&&c.push("Closed");0<

c.length&&b.getElement(".details").set("html",c.join(" \x26bull; ")).removeClass("hide");b.addClass("list-


item place");b.store("result",a)},_buildGeoElt:function(a,b){var
c=a.result,d,e=null,f;c.formatted_address?(d=c.formatted_address,d.replace(", United
States","")):a.result.vicinity&&(d=a.result.vicinity);c.address_components.each(function(a)
{a.types.contains("locality")&&(e=d.split(a.long_name,1),2===e.length&&(e[1]=a.long_name+e[1]))});nu
ll!==e?(c=e[0],f=e[1]):(c=d,f="");b.getElement(".name").set("text",

c);b.getElement(".address").set("text",f);b.addClass("list-item
geo");b.store("result",a)},_setInput:function(a){this.inputRegExp=(this.inputValue=a)?
VMAUtils.createSearchInputRegExp(a,VMAIMConst.MAP_SEARCH_HINT_MAX_KEYWORDS):null},_prepa
reForAddResults:function(){var
a=document.id(this.resultBox);a.getElement("ul").empty();a.getElement(".location-list-
info").hide()},resetResultArrays:function(){this.resultArray?
this.resultArray.empty():this.resultArray=[];this.geocoderResArr?this.geocoderResArr.empty():
this.geocoderResArr=[];this.placeResArr?
this.placeResArr.empty():this.placeResArr=[]},doSearch:function(a,b){this.resetResultArrays();var
c=a.clean();this._setInput(c);c?this._doPlaceSearch():this.reset()},_doPlaceSearch:function(a){var
b=this;this.placeService.textSearch({query:this.inputValue,bounds:this.map.getBounds()},function(c,d)
{if(b.onAfterPlaceSearch(c,d))if(a&&a.onSuccess)EventHandlerUtil.onSuccess(a);else
b._showResults()})},onSearch:function(a){a.stop();this.doSearch(document.id("search-map-
input").get("value"))},

onSugSelectPlace:function(){var a=this.autocomplete.getPlace();a.address_components?
(this._setInput(document.id("search-map-
input").get("value").clean()),this._prepareForAddResults(),this._addResult({result:a,type:vmamap.Result
Type.PLACE}),this._selectFirstResItem()):this.doSearch(a.name)},onAfterPlaceSearch:function(a,b){var
c=!0;switch(b){case google.maps.places.PlacesServiceStatus.OK:a.each(function(a)
{this.placeResArr.push({result:a,type:vmamap.ResultType.PLACE})},this);break;case
google.maps.places.PlacesServiceStatus.ZERO_RESULTS:break;

default:c=!1}return c},normalizeSearchResults:function(){var
a=this.map.getBounds(),b=[];this.geocoderResArr.each(function(c)
{a&&a.contains(c.result.geometry.location)?
this.resultArray.push(c):b.push(c)},this);this.resultArray.append(this.placeResArr);this.resultArray.appen
d(b)},_showResults:function()
{this._prepareForAddResults();VMAUtils.isEmpty(this.geocoderResArr)&&VMAUtils.isEmpty(this.placeR
esArr)?this._showZeroResults():(this.normalizeSearchResults(),this.resultArray.each(function(a)
{this._addResult(a)},

this),this._selectFirstResItem())},_showZeroResults:function(){var
a=document.id(this.resultBox);a.getElement("ul").empty();a.getElement(".location-list-
info").set("html","Search results not found").show();document.id("location-
submit").setAttribute("disabled",!0);this.marker&&this.marker.setVisible(!1)},insertLocation:function()
{var a=!1;if(this.selectedResEltId){var
b=document.id(this.selectedResEltId);if(b&&(b=b.retrieve("result"))){var
a=this._buildResultText(b),b=[],c=a.address.substr(0,a.name.length)!==

a.name;a.name&&c&&b.push(a.name);a.address&&b.push(a.address);vmaim.insertLocation(b.join(" -
"));a=!0}}return a},show:function(a)
{this.map&&this.curLocMarker&&this.curLocMarker.setMap(null);switch(a.type){case "INSERT":case
"IN_MESSAGE":document.id("location-
submit").set("value",this.TypeData[a.type].insertButtonText)}if(this.map)switch(a.type){case
"INSERT":this.reset();this.refreshCurrentPosition();break;case "IN_MESSAGE":case
"SHOEBOX":this._doInitSearch(a.locationStr)}else this._initShow(a);

vmadom.conversationMessageContainer().addClass("location");vmadom.showMap().addClass("active");
(new Fx.Tween(document.id(this.content),{duration:500})).start("opacity",0,1);(new
Fx.Tween(document.id(this.resultBox),{duration:500})).start("opacity",0,1)},hide:function(){var
a=vmadom.conversationMessageContainer(),b=new Fx.Tween(document.id(this.content),
{duration:500}),c=new Fx.Tween(document.id(this.resultBox),
{duration:500});document.id("convListWrapper").setStyle("opacity",0);a.getElement(".footerMain").setS
tyle("opacity",

0);b.addEvent("complete",function(){(new Fx.Tween(document.id("vma-composerContent"),
{duration:500})).start("opacity",0,1);(new Fx.Tween(document.id("convListWrapper"),
{duration:500})).start("opacity",0,1);(new Fx.Tween(a.getElement(".footerMain"),
{duration:500})).start("opacity",0,1);a.removeClass("location");vmadom.showMap().removeClass("activ
e")}.bind(this));b.start("opacity",1,0);c.start("opacity",1,0)},isShowing:function(){return
vmadom.conversationMessageContainer().hasClass("location")},submit:function(){this.insertLocation();

this.hide()},reset:function(){var
a=document.id(this.resultBox);a.getElement("ul").empty();a.getElement(".location-list-
info").set("html","Please enter a location to search.").show();document.id("search-map-
input").set("value","");this.removeMarker()},removeMarker:function()
{this.infoWindow&&this.infoWindow.close();this.marker&&this.marker.setVisible(!
1);document.id("location-submit").setAttribute("disabled",!0)}},VMAAddLocationMapBase=new
Class(VMAAddLocationMapBaseClassDef),VMAAddLocationMap=new
Class({Extends:VMAAddLocationMapBase}),

VMADropdownClassDef={Implements:[Options,Events],options:{element:null,hideDelay:500,isContext:!
1,relay:null,wrapper:null,onLoad:function(){},onShow:function(){},onHide:function(){},onClick:function()
{}},dropdownElement:null,dropdownMenu:null,dropdownList:null,hideDropdownListTimer:null,touchTi
mer:void 0,triggerElt:null,initialize:function(a){this.setOptions(a);this.init()},init:function(){null!
==this.options.element&&(this.dropdownElement=vmadom.get(this.options.element),this.dropdownM
enu=vmadom.get(this.options.element+

" .dropdown-menu"),this.dropdownList=vmadom.get(this.options.element+" .dropdown-


list"),this.attachEvents(),this.fireEvent("onLoad",[this]))},clearTouchTimeout:function()
{clearTimeout(this.touchTimer);this.touchTimer=void 0},attachEvents:function(){var
a=this,b,c;this.options.isContext?
(b=vmadom.get(this.options.wrapper),c="contextmenu:relay("+this.options.relay+")",b.addEvent(c,func
tion(b,c)
{b.stop();a.triggerElt=c;a.onClickMessageMenu(b,c)}),c="touchstart:relay("+this.options.relay+")",b.addE
vent(c,

function(b,c){b.stop();1<b.touches.length?a.clearTouchTimeout():a.touchTimer=function()
{a.triggerElt=c;a.onClickMessageMenu(b,c)}.delay(750,this)}),b.addEvents({touchmove:a.clearTouchTim
eout.bind(this),touchcancel:a.clearTouchTimeout.bind(this),touchend:a.clearTouchTimeout.bind(this)})):
this.options.relay?
(b=vmadom.get(this.options.wrapper),c="click:relay("+this.options.relay+")",b.addEvent(c,function(b,c)
{b.stop();a.triggerElt=c;a.onClickMessageMenu(b,c);a.triggerElt.addEvents({mouseleave:function(b,

c)
{a.hideDropdownListTimer&&clearTimeout(a.hideDropdownListTimer);a.hideDropdownListTimer=functi
on(){a.toggleDropdownList(b,c,"hide")}.delay(a.options.hideDelay,a)},mouseenter:function(b,c)
{a.hideDropdownListTimer&&(clearTimeout(a.hideDropdownListTimer),a.hideDropdownListTimer=null)}
})})):this.dropdownMenu.addEvents({click:function(b,c)
{b.stop();a.onClickMessageMenu(b,c)},mouseleave:function(b,c)
{a.hideDropdownListTimer&&clearTimeout(a.hideDropdownListTimer);a.hideDropdownListTimer=functi
on(){a.toggleDropdownList(b,

c,"hide")}.delay(a.options.hideDelay,a)},mouseenter:function(b,c)
{a.hideDropdownListTimer&&(clearTimeout(a.hideDropdownListTimer),a.hideDropdownListTimer=null)}
});this.dropdownList.addEvents({mouseleave:function(b,c)
{a.hideDropdownListTimer&&clearTimeout(a.hideDropdownListTimer);a.hideDropdownListTimer=functi
on(){a.toggleDropdownList(b,c,"hide")}.delay(a.options.hideDelay,a)},mouseenter:function(b,c)
{a.hideDropdownListTimer&&(clearTimeout(a.hideDropdownListTimer),a.hideDropdownListTimer=null)}
});

this.dropdownList.addEvent("click:relay(li)",function(b,c)
{b.stop();a.onClickMessageMenuItem(b,c,a.triggerElt);a.toggleDropdownList(b,c,"hide")})},isOpen:functi
on(){return this.dropdownElement.hasClass("open")},toggleDropdownList:function(a,b,c){var d=!
1,e=this;(d=VMAUtils.defined(c)?"hide"!==c:!this.isOpen())?(this.fireEvent("onShow",
[this,a,b,c]),this.dropdownElement.addClass("open"),document.body.addEvent("click",function(a)
{document.body.removeEvent("click");e.toggleDropdownList(null,null,"hide")})):

(this.fireEvent("onHide",
[this,a,b,c]),this.dropdownElement.removeClass("open"),document.body.removeEvent("click"),this.trigg
erElt&&this.triggerElt.removeEvents(["mouseenter","mouseleave"]))},onClickMessageMenuItem:functio
n(a,b,c){this.fireEvent("onClick",[a,b,c])},onClickMessageMenu:function(a,b)
{this.isOpen();this.toggleDropdownList(a,b)}},VMADropdown=new
Class(VMADropdownClassDef),VMAToggleFieldClassDef={Implements:
[Options,Events],toggleFieldElement:null,initialize:function(a){this.opts={element:null};

a&&Object.append(this.opts,a);this.init()},init:function(){null!
=this.opts.element&&(this.toggleFieldElement=vmadom.get(this.opts.element),this.attachEvents())},att
achEvents:function(){var a=this;this.toggleFieldElement.addEvents({click:function(b)
{b.stop();a.toggleValue();a.fireEvent("change")}})},getValue:function(){return
this.toggleFieldElement.hasClass("on")},setValue:function(a){a=a?!0:!
1;this.toggleFieldElement.removeClass("on");a&&this.toggleFieldElement.addClass("on")},toggleValue:f
unction(){this.setValue(!this.getValue())}},

VMAToggleField=new Class(VMAToggleFieldClassDef),VMATabsClassDef={Implements:
[Options,Events],tabElement:null,tabHighlightElt:null,tabMenus:null,_selectedItem:null,_selectedIndex:-
1,initialize:function(a){this.opts={element:null};a&&Object.append(this.opts,a);this.init()},init:function()
{null!
=this.opts.element&&(this.tabElement=vmadom.get(this.opts.element),this.tabHighlightElt=this.tabEle
ment.getElement(".highlight-tab"),this._initEvents())},_initEvents:function(){var
a=this;this.tabElement.addEvent("click:relay(li)",

function(b){b.stop();a.selectedItem(this)})},selectedItem:function(a){if(0==arguments.length)return
_selectedItem;var b=this._getTabIndex(a);this.selectedIndex(b)},selectedIndex:function(a)
{if(0==arguments.length)return this._selectedIndex;if(this._selectedIndex!=a){var
b=this._getTabAtIndex(this._selectedIndex),c=this._getTabAtIndex(a);this._selectedIndex=-
1;this._selectedItem=c;b&&b.removeClass("active");if(c&&(c.addClass("active"),this._selectedIndex=a,th
is.tabHighlightElt&&c)){var b=c.getSize(),

d=c.offsetLeft;this.tabHighlightElt.setStyle("width",b.x+"px");this.tabHighlightElt.setStyle("left",d)}this.fir
eEvent("onChange",[c,this._selectedIndex])}},_getTabIndex:function(a){var
b=this.tabElement.getElements(".tab-menu"),c=-1;Object.each(b,function(b,e){if(b===a)return c=e,!
1});return c},_getTabAtIndex:function(a){var b=this.tabElement.getElements(".tab-
menu"),c=null;b.length>a&&(c=b[a]);return c}},VMATabs=new
Class(VMATabsClassDef),VMAManageAdminDlgClassDef={Extends:VMAPopup,inProgress:!1,

selectAllElt:null,currAdmins:[],addAdmins:[],removeAdmins:[],initialize:function()
{this.parent(this.buildDlgOptions());this.selectAllElt=document.id("manageAdminDlgContent").getEleme
nt("\x3e div a");this._initEvents()},buildDlgOptions:function()
{return{content:"manageAdminDlgContent",contentPool:"messagesTemplatesPool",title:"Manage
Admins",width:vmauiconst.$("EXPORT_MESSAGES_DLG_WIDTH"),showClose:!1,footer:
["manageAdminDlgCancel","manageAdminDlgSave"]}},show:function(){this.parent({asyncBeforeClose:!
0,

onBeforeShow:function(a,b){b.showProgress(!
1);b.loadGroupParticipants();b.currAdmins=vmaim.activeConversation.convData.adminIds;b.addAdmins
=[];b.removeAdmins=[];b.enableSave(!1);b.checkSelectAll()},onBeforeClose:function(a,b,c,d){switch(b)
{case "manageAdminDlgSave":c.showProgress(!
0);a={id:vmaim.activeConversation.convData.id};0<c.addAdmins.length&&(a.promotedAdminIds=c.addA
dmins);0<c.removeAdmins.length&&(a.demotedAdminIds=c.removeAdmins);vmaim.grpcore.updateGro
ups(a,{onSuccess:function(a){VMADebug.write(a);

a=a[a.length-1].object;!0!==a.group.admin?
(vmaim.activeConversation.convData.adminIds=[],vmaim.activeConversation.convData.admin=!
1):a.group.adminIds&&(vmaim.activeConversation.convData.adminIds=a.group.adminIds);vmaim.showE
ditGroup();vmaim.editGroupSaveStatus();d()}.bind(this),onFailure:function(a)
{this._onDoneEditGroup();VMAPopupUtils.alert({message:"Error Updating Admins",width:vmauiconst.$
("ALERT_DIALOG_WIDTH"),buttons:["ok"],showClose:!1});d()}});break;case
"manageAdminDlgCancel":c.inProgress?

c.showProgress(!1):d()}}})},loadGroupParticipants:function()
{document.id("manageAdminDlgContent").getElement("ul").deepEmpty();var
a=vmaim.activeConversation.convData.recipients;!
0===vmaim.activeConversation.convData.member&&this.loadGroupParticipant({subscriberId:vmaim.su
bscriber.getId()});a&&0<a.length&&a.each(this.loadGroupParticipant,this)},loadGroupParticipant:functio
n(a){var b=vmaim.addressBook.getContactById(a.subscriberId);if(b){var
c=vmaim.addressBook.getAvatarUrlByContact(b),b=VMAAddressBookUtils.contactToRecipient(b,

a.subscriberId,c);b.addressType="mobile";b.address===vmaim.subscriber.getId()&&(b.displayName="Yo
u");!1!==vmaim.activeConversation.convData.admin&&(b.admin=-
1<vmaim.activeConversation.convData.adminIds.indexOf(a.subscriberId));a=new
VMARecipient(b);this.addRecipient(a)}},addRecipient:function(a){var
b=a.getElt(),c=document.id("manageAdminDlgRecipientTpl").clone();c.getElement(".recipientWrap").gra
b(b);a.admin&&c.addClass("selected");document.id("manageAdminDlgContent").getElement("ul").grab(
c)},_initEvents:function(){var a=

this,b=document.id("manageAdminDlgContent");b.addEvent("click:relay(li)",function(b,d)
{b.stop();a.selectAdmin(d)});b.getElements("\x3e div a").addEvent("click",function(b)
{b.stop();a.selectAll("Select
All"===this.get("text"))});b.getElements("ul").addEvent("mousewheel",vmaim.scroller)},selectAdmin:fun
ction(a){var b=a.getElement(".recipient").get("data-id");a.hasClass("selected")?
(a.removeClass("selected"),this.removeAdmin(b),this.selectAllText(!0)):
(a.addClass("selected"),this.addAdmin(b),this.checkSelectAll());

this.enableSave(0<this.addAdmins.length||0<this.removeAdmins.length)},addAdmin:function(a){var b;-
1<this.currAdmins.indexOf(a)?(b=this.removeAdmins.indexOf(a),-1<b&&this.removeAdmins.splice(b,1)):
(b=this.addAdmins.indexOf(a),-1===b&&this.addAdmins.push(a))},removeAdmin:function(a){-
1<this.currAdmins.indexOf(a)?-1===this.removeAdmins.indexOf(a)&&this.removeAdmins.push(a):
(a=this.addAdmins.indexOf(a),-1<a&&this.addAdmins.splice(a,1))},checkSelectAll:function()
{0<document.id("manageAdminDlgContent").getElements("li:not(.selected)").length?

this.selectAllText(!0):this.selectAllText(!1)},selectAll:function(a){var
b=this,c=document.id("manageAdminDlgContent").getElements("li");a?(c.each(function(a){var
c=a.getElement(".recipient").get("data-id");b.addAdmin(c);a.addClass("selected")}),this.selectAllText(!
1)):(c.each(function(a){var c=a.getElement(".recipient").get("data-
id");b.removeAdmin(c);a.removeClass("selected")}),this.selectAllText(!
0));this.enableSave(0<this.addAdmins.length||0<this.removeAdmins.length)},selectAllText:function(a)
{a?

this.selectAllElt.set("text","Select All"):this.selectAllElt.set("text","Unselect All")},enableSave:function(a)


{document.id("manageAdminDlgSave").set("disabled",!a)},showProgress:function(a)
{this.inProgress=a;var
b=document.id("manageAdminDlgContent");b.getElement(".manageAdminDlgHeadline").show(!
a);b.getElement(".manageAdminDlgRecipients").show(!
a);b.getElement(".manageAdminDlgProgress").show(a);document.id("manageAdminDlgSave").show(!
a,"inline-block")}},VMAManageAdminDlg=new Class(VMAManageAdminDlgClassDef),

VMAMessageReactionDlgClassDef={Extends:VMAPopup,message:null,initialize:function()
{this.parent(this.buildDlgOptions());var
a=this;document.id("messageReaction").getElements("li").addEvent("click",function(b)
{vmaim.onClickReactionMenuItem(b,this,null,a.message)})},buildDlgOptions:function()
{return{content:"messageReaction",contentPool:"messagesTemplatesPool",title:"Reaction
Details",width:295,showClose:!0,footer:[]}},show:function(a){if(a){this.message=a;var
b=this.getContentElt(),c=a.getMessageElt();

b.getElement(".msgDetails").deepEmpty();if(c){var d=c.getElement(".text");
(c=c.getElement(".attachments"))&&b.getElement(".msgDetails").grab(c.clone());d&&b.getElement(".ms
gDetails").grab(d.clone())}a.comments&&(a=a.comments||
{},this.updateCountElt(b,a),this.updateRecipientsElt(b,a))}this.state="SHOWN";this.parent({asyncBefore
Close:!1,onBeforeClose:function(a,b,c){c.message=null;c.state="HIDDEN"}})},updateElt:function(a)
{if("SHOWN"===this.state&&this.message.messageEltId===a.messageEltId){var b=this.getContentElt();

a=a.comments||
{};this.updateCountElt(b,a);this.updateRecipientsElt(b,a)}},updateCountElt:function(a,b){var
c,d;"thumbs-up heart laugh wow sad mad".split(" ").each(function(e){d=b.count[e]||
0;c=a.getElement("li."+e);c.getElement(".count").set("text",d);b[vmaim.subscriber.getId()]&&b[vmaim.s
ubscriber.getId()].emoji.text===e?c.addClass("you"):c.removeClass("you");0<d?
c.addClass("vote"):c.removeClass("vote")})},updateRecipientsElt:function(a,b){var
c=a.getElement(".recipients");a.getElement(".recipients").deepEmpty();

Object.each(b,function(a,b){if("count"!==b){var f=vmaim.addressBook.getGrpContactName(b,!
1),g=a.emoji.text,h=document.id("messageReactionRecipient").clone();h.getElement(".reaction").addCla
ss("rea-"+g);h.getElement(".name").set("text",f);c.grab(h)}})},getMessage:function(){return
this.message}},VMAMessageReactionDlg=new
Class(VMAMessageReactionDlgClassDef),VMAGroupNameDlgClassDef={Extends:VMAPopup,initialize:fu
nction(){this.parent({content:"groupNameDlg",contentPool:"messagesTemplatesPool",title:"Group
Name",

width:410,showClose:!
0});this.getButtonElt().addEvent("click",this._createGroup.bind(this));this.getInputElt().addEvent("keyup
",this._enableButton.bind(this))},_createGroup:function(){var
a=this.getInputElt().get("value").trim();VMAUtils.isEmpty(a)||
(vmaim.newMessageConversation.name=a,vmaim.activeConversation.onSendMessage(),this.hide())},ge
tInputElt:function(){return
this.getContentElt().getElement('input[name\x3d"groupName"]')},getButtonElt:function(){return
this.getContentElt().getElement('button[name\x3d"createGroup"]')},

_enableButton:function(a){a=this.getInputElt().get("value").trim();VMAUtils.isEmpty(a)?
this.getButtonElt().setProperty("disabled","disabled"):this.getButtonElt().removeProperties("disabled")},
_clearInput:function(){this.getInputElt().set("value","")},show:function()
{this._clearInput();this._enableButton();this.getInputElt().focus();this.parent({asyncBeforeClose:!
1,onBeforeClose:function(a,b,c){}})}},VMAGroupNameDlg=new
Class(VMAGroupNameDlgClassDef),VMAClientDownloadDlgClassDef={Extends:VMAPopup,

initialize:function()
{this.parent({content:"downloadClientDlg",contentPool:"messagesTemplatesPool",title:"Get
Message+",width:1E3,hideTitle:!0,showClose:!0})},show:function(){this.parent({asyncBeforeClose:!
1,onBeforeClose:function(a,b,c){}})}},VMAClientDownloadDlg=new
Class(VMAClientDownloadDlgClassDef);var
VMANetworkStatus={CONNECTED:0,DISCONNECTED:1},VMAMainBaseClassDef={Implements:Events,Ext
ends:VMAMainAttr,BUAP_CONTENTS_PREFIX:"buapContents",TAB_MODULE_MESSAGES:"Messages",T
AB_MODULE_SETTINGS:"Settings",topMenuInitialized:!1,terminted:!
1,webBaseUrl:null,doReloadMessages:!1,navMenuShown:!
0,selectedSettingName:null,isNotifyingExpiration:!1,signOutElt:null,clickedSignOut:!1,useILogOut:!
1,quickText:null,autoSignature:null,nickname:null,PING_TIMEOUT_SECONDS:60,ACCESS_TIMEOUT_SEC
ONDS:60,networkStatus:VMANetworkStatus.CONNECTED,
lastWebPingTime:0,pingTimeOutMonitorId:null,promptingAbandon:!
1,abandonAlertDlg:null,returnContentsToPool:function(a)
{document.id("buapContentsPool").grab(a)},loadContentsFromPool:function(a){var
b=a.get("contentsId"),c=document.id("buapContents").grab(b);!1!==a.get("doFx")?(b=function(){var
b=new Fx.Tween(c,{duration:250});b.addEvent("complete",function()
{a.fireEvent("complete")});b.start("opacity",0,1)},!0===a.get("asyncAfterGrab")?
a.fireEvent("afterGrabContents",b):(a.fireEvent("afterGrabContents"),

b())):!0===a.get("asyncAfterGrab")?a.fireEvent("afterGrabContents",function()
{a.fireEvent("complete")}):
(a.fireEvent("afterGrabContents"),a.fireEvent("complete"))},buildContentsId:function(a){return
this.BUAP_CONTENTS_PREFIX+a},setActiveTabModule:function(a)
{vmamain.mainServerParam.activeTabModule=a},getActiveTabModule:function(){return
vmamain.mainServerParam.activeTabModule},_initDialogs:function(){},_initAjaxForms:function()
{},_s_submitSettingsRequest:function(a){var b=new
EOptions(a),c={jsonData:JSON.encode(b.get("data"))},

b=[];b.push(new Promise(function(b,e){(new
Request({method:"post",data:c,url:VMAConst.MAIN_URL_PREFIX+"/a/Preference/Update.do?
p\x3dtrue",link:"ignore",noCache:!0,onSuccess:function(c,e){var h="string"===typeof c?
JSON.decode(c):c;vmamain._processSettingsResponse(h,a);b(h)},onFailure:function(a)
{vmamain.handleSystemError({reason:a});b()}})).send()}));Promise.all(b).then(function(a)
{console.log(a)}).catch(function(a){VMADebug.logError(a)})},_s_submitFeedback:function(a){var b=new
EOptions(a);JSON.encode(b.get("data"));

(new Request({method:"post",data:
{content:a.content,email:a.email},url:VMAConst.MAIN_URL_PREFIX+"/a/Preference/SubmitFeedback.d
o",link:"ignore",noCache:!0,onSuccess:function(a,d){b.fireEvent("complete")},onFailure:function(a)
{b.fireEvent("complete");vmamain.handleSystemError({reason:a})}})).send()},_processSettingsResponse:
function(a,b){if("SYSTEM_ERROR"===a.status)this.handleSystemError({refresh:"forceRefresh"});else{var
c=new EOptions(b);switch(a.category){case "QUICK_TEXT_IM":this.quickText.onResponse(a);

break;case "DESKTOP_NOTIFICATIONS_IM":c.fireEvent("complete",a);break;case
"DISPLAY_SETTINGS":c.fireEvent("complete",a);break;case "SHOW_IPHONE_NOTIFICATION":break;case
"SHOW_WEB_INTRO":break;default:"undefined"!==typeof
vmasettings&&vmasettings&&vmasettings.processResponse(a)}}},_initSettingsForMessages:function()
{VMADebug.write("_initSettingsForMessages");this.autoSignature.fireEvent("initForMessages");this.nick
name.fireEvent("initForMessages")},showAjaxLoaderFullPage:function(a){a=a?a:{};a.target||

(a.target=document.body);this.showAjaxLoader(a)},hideAjaxLoaderFullPage:function(a){a=a?a:
{};a.target||(a.target=document.body);this.hideAjaxLoader(a)},showContentsAjaxLoader:function(a)
{VMAUtils.isIE8OrLess()?
this._ie8_showContentsAjaxLoader(a):this.showAjaxLoader(a)},hideContentsAjaxLoader:function(a)
{VMAUtils.isIE8OrLess()?
this._ie8_hideContentsAjaxLoader(a):this.hideAjaxLoader(a)},_ie8_showContentsAjaxLoader:function(a)
{document.id("buapContents").getChildren().some(function(a){switch(a.get("id")){case
"buapContentsMessages":case "buapContentsSettings":return a.hide(),
document.id("vma-contentsLoader").show(),!0;default:return!
1}})},_ie8_hideContentsAjaxLoader:function(a)
{document.id("buapContents").getChildren().some(function(a){switch(a.get("id")){case
"buapContentsMessages":case "buapContentsSettings":return document.id("vma-
contentsLoader").hide(),a.show(),!0;default:return!1}})},showAjaxLoader:function(a){a=new
EOptions(a);var b;b=a.get("target")?
document.id(a.get("target")):vmadom.contentContainer();this.maskPage(!0);b.showSpinner(!0,
{delay:a.get("delay"),

name:a.get("name"),noFx:!1!==a.get("noFx"),spinnerOptions:
{message:a.get("message"),destroyOnHide:!1,inject:
{where:"top",target:b}}})},hideAjaxLoader:function(a){a=new EOptions(a);(a.get("target")?
document.id(a.get("target")):vmadom.contentContainer()).showSpinner(!1,{name:a.get("name"),noFx:!
1!==a.get("noFx")});this.maskPage(!1)},createDesktopNotification:function(a)
{a=Object.clone(a);a.iconUrl=VMAConst.NOTI_FAVICON_URL;a.closeInSecs=15;desktopNotifications.noti
fy(a)},buildSupportedAttachmentTypesStr:function(){var a=

"";VMAIMConst.SUPPORTED_ATT_TYPE_EXTS.each(function(b,c){0<c&&(a+=",
");a+=b});return{types:a}},_initNetworkMonitor:function()
{this._monitorNetwork.delay(3E3,this)},_monitorNetwork:function(){if(!this.isTerminated())
{VMADebug.writec("_monitorNetwork: started","mon");var a=Date.now();this.pingEnabled&&!
this.pingRequest&&0<this.lastWebPingTime&&a-
this.lastWebPingTime>1E3*this.PING_TIMEOUT_SECONDS&&(this.clearPingTimeoutMonitor(),this.ping
Request.cancel(),this._webPingRequest.delay(1E3,this));"undefined"!==

typeof
vmaim&&vmaim&&vmaim.imcore&&vmaim.imcore.monitorNetwork(a);VMADebug.writec("_monitorN
etwork: done","mon");this._monitorNetwork.delay(3E3,this)}},onBeforeLoad:function(){var
a=this;VMAConst.USER_CHECK_ACCESS?this._checkAccessIframe({onSuccess:function(b){b?
window.location=VMAConst.SECURE_BASE_URL+"/Message.do":a.initMain()},onFailure:function()
{a.initMain()}}):a.initMain()},initMain:function()
{this.webBaseUrl=VMAUtils.getBaseUrl();VMAUtils.browserIE11WorkAround();this._initTopNotiBar();thi
s._initSettingsData();

this._initFeatures();this._initDialogs();this._initAjaxForms();this._initIFrames();this._initWebPing();this._i
nitPromotionLink();this.showAjaxLoader();this._initTopLinks();this._initOthers();this.startDesktopNotifica
tionsChecker();this._initNetworkMonitor();this._initTest();(function(){vmamain.fireEvent("afterLoad",
[])}).delay(200,this)},_initOthers:function()
{this.signOutElt=document.id("vzwsignout");VMADebug.write("capture signout start");this.signOutElt?
(VMADebug.write("captured signout"),this.signOutElt.addEvent("click",

function(a){vmamain.injectSignOut(a)})):VMADebug.write("captured NOT signout");(function()


{this.useILogOut=!0}).delay(36E5,this);document.id("vma-
subheader").set("text",VMAUtils.formatMdn(VMAIMConst.HOST_MDN))},injectSignOut:function(a)
{this.clickedSignOut=!0;this.useILogOut&&(a.stop(),this.logout())},_initPromotionLink:function(){var
a=this,b=document.id("vma-appStoreLink"),c=document.id("vma-playStoreLink"),d=document.id("vma-
desktopLink");b.addEvent("click",function(){a.vmaClientDownloadDlg||(a.vmaClientDownloadDlg=
new VMAClientDownloadDlg);a.vmaClientDownloadDlg.show("ios")});c.addEvent("click",function()
{a.vmaClientDownloadDlg||(a.vmaClientDownloadDlg=new
VMAClientDownloadDlg);a.vmaClientDownloadDlg.show("android")});"win"!
==Browser.platform&&"windows"!==Browser.platform||d.addEvent("click",function()
{a.vmaClientDownloadDlg||(a.vmaClientDownloadDlg=new
VMAClientDownloadDlg);a.vmaClientDownloadDlg.show("windows")});"mac"===Browser.platform?
d.addEvent("click",function(){a.vmaClientDownloadDlg||(a.vmaClientDownloadDlg=

new VMAClientDownloadDlg);a.vmaClientDownloadDlg.show("mac")}):d.addEvent("click",function()
{a.vmaClientDownloadDlg||(a.vmaClientDownloadDlg=new
VMAClientDownloadDlg);a.vmaClientDownloadDlg.show()})},_initSettingsData:function()
{this.autoSignature=new VMAAutoSignature(this.autoSignatureData);this.nickname=new
VMANickname(this.nicknameData)},_initFeatures:function()
{this.isFeatureEnabled("SCHEDULED_MESSAGES")||
document.id("buapContents").addClass("noSm")},_initTopNotiBar:function(){if(VMAUtils.isIE8OrLess())
{var a=

document.id("vma-
unsupportedBrowserBar");a.getElement("div").set("html",VMAUiText.page.UNSUPPORTED_BROWSER_
NOTI);a.show();a.getElement(".vma-topNotiBarCancel").addEvent("click",function(b)
{b.stop();a.hide()})}},_initWebPing:function()
{this.pingEnabled&&this._webPingRequest()},isWebPingLost:function(){return
0<this.lastWebPingTime&&Date.now()-
this.lastWebPingTime>6E4*(VMAIMConst.WEB_IDLE_TIMEOUT_MINUTES-
1)},clearPingTimeoutMonitor:function()
{this.pingTimeoutMonitorId&&(clearTimeout(this.pingTimeoutMonitorId),

this.pingTimeoutMonitorId=null)},_pingTimeoutMonitor:function()
{this.networkStatus=VMANetworkStatus.DISCONNECTED;VMADebug.writec("WEB_PING::_pingTimeout
Monitor: timeout
happened","webping");this.pingTimeoutMonitorId=null;this.pingRequest&&this.pingRequest.cancel();th
is._webPingRequest.delay(1E3,this)},_checkAccessIframe:function(a){var b=this,c=new
Element("iframe",{src:VMAConst.LOGIN_URL+
(VMAConst.MAIN_BASE_URL+VMAConst.SECURE_BASE_URL+"/checkAccess.do"),id:"web_access_check
_iframe",style:"display:none;width:0;height:0;",

height:0,width:0});c.inject(document.body);c.addEvent("load",function()
{b._checkAccess(a)});c.addEvent("error",function()
{b._checkAccess(a);c.dispose()})},_checkAccess:function(a){this.accessRequest=new
Request({url:VMAConst.SECURE_BASE_URL+"/checkAccess.do",method:"get",noCache:!
0,link:"ignore",timeout:1E3*this.ACCESS_TIMEOUT_SECONDS,onSuccess:function(b,c){var d=!1,e=!
1;try{"string"===typeof b&&JSON.decode(b),d=jobRes.status,e=jobRes.mdn}catch(f)
{d="SUCCEEDED"}if("SUCCEEDED"==d||"FAILED"==d)a.onSuccess(e&&

VMAIMConst.HOST_MDN!=e);else a.onFailure()},onCancel:function(){},onFailure:function(b)
{a.onFailure()},onTimeout:function(){a.onFailure()},onException:function(a,c)
{VMADebug.write("CheckAccess, throws
exception")}});this.accessRequest.send()},_webPingRequest:function(){this.isTerminated()||
(this.pingRequest?this.pingRequest.send():"undefined"!==typeof
vmaim&&vmaim&&vmaim.initParams?
(this.isWebPingLost()&&(this.networkStatus=VMANetworkStatus.DISCONNECTED),this.pingRequest=ne
w Request({url:VMAConst.MAIN_URL_PREFIX+

"/external/ping",method:"get",noCache:!
0,link:"ignore",timeout:1E3*this.PING_TIMEOUT_SECONDS,data:
{jsonData:JSON.encode(vmaim.initParams)},onRequest:function()
{vmamain.clearPingTimeoutMonitor();vmamain.lastWebPingTime=Date.now();vmamain.pingTimeoutM
onitorId=vmamain._pingTimeoutMonitor.delay(1E3*vmamain.PING_TIMEOUT_SECONDS,vmamain)},on
Success:function(a,b){vmamain.clearPingTimeoutMonitor();VMADebug.writec("WEB_PING::Response:
"+a,"webping");switch(("string"===typeof a?JSON.decode(a):a).status){case
"ALIVE":vmamain._webPingRequest.delay(1E3*

vmamain.pingIntervalSeconds,vmamain);break;case
"REMOTE_ALIVE":vmamain.refreshMessages();break;case
"INVALIDATED":vmamain.promptSessionExpired();break;default:vmamain.handleSystemError()}vmamai
n.networkStatus=VMANetworkStatus.CONNECTED},onCancel:function()
{vmamain.clearPingTimeoutMonitor();VMADebug.writec("WEB_PING::Response:
canceled","webping")},onFailure:function(a)
{vmamain.clearPingTimeoutMonitor();VMADebug.writec("WEB_PING::Response: failed -
"+a.statusText,"webping");vmamain.networkStatus=VMANetworkStatus.DISCONNECTED;

vmamain._webPingRequest.delay(3E3,vmamain)},onTimeout:function()
{VMADebug.writec("WEB_PING::Response:
timeout","webping");vmamain.networkStatus=VMANetworkStatus.DISCONNECTED},onException:functi
on(a,b){vmamain.clearPingTimeoutMonitor();VMADebug.writec("WEB_PING::Response: exception -
headerName\x3d"+a+",value\x3d"+b,"webping");vmamain._webPingRequest.delay(3E3,vmamain)}}),thi
s.lastWebPingTime=Date.now(),this.pingRequest.send()):vmamain._webPingRequest.delay(1E3,vmamai
n))},_initIFrames:function(){var a,

b;a=new
URI(vmamain.imBaseUrl+"/im/Core.do");a.setData({mdn:VMAIMConst.HOST_MDN,exWsid:VMAIMCons
t.EX_WSID});b=new
URI(vmamain.imBaseUrl+"/im/FileUploadFrame.do");b.setData({mdn:VMAIMConst.HOST_MDN,exWsid:
VMAIMConst.EX_WSID});this.imiframe=new IFrame({id:"vma-imiframe",name:"vma-
imiframe",src:a.toString(),styles:{display:"none"},events:{load:function(){VMADebug.write("Loaded
imiframe, now load ufiframe");vmamain.ufiframe=new IFrame({id:"vma-ufiframe",name:"vma-
ufiframe",src:b.toString(),styles:{display:"none"}});

vmamain.ufiframe.inject(document.body,"bottom")}}});VMADebug.write("Loading
imiframe");this.imiframe.inject(document.body,"bottom")},promptSessionAbandoned:function()
{this.terminated||this.promptingAbandon||(this.promptingAbandon=!
0,this.stopScheduledTasks(),this.unmaskAll(),this.abandonAlertDlg=VMAPopupUtils.alert({message:VMA
UiText.page.SESSION_ABANDONED,width:vmauiconst.$("ALERT_DIALOG_WIDTH"),buttons:
["ok"],showClose:!1,zIndexOffset:15,onOk:function(a)
{vmaim.onReloadMessages();vmamain.abandonAlertDlg=

null;a.onComplete();vmamain.promptingAbandon=!1}}))},promptSessionExpired:function()
{this.clickedSignOut||this.terminated||(this.terminated=!0,VMAConst.IS_AM?
(this.stopScheduledTasks(),"Y"===this.enableDesktopNotifications&&desktopNotifications.notify({iconU
rl:VMAConst.NOTI_FAVICON_URL,title:VMAConst.DEFAULT_DIALOG_TITLE,text:VMAUiText.notifications
.NOTIFY_EXPIRED}),this.notifyExpirationDlg&&(this.notifyExpirationDlg.destroy(),this.notifyExpirationDlg
=null),this.abandonAlertDlg&&(this.abandonAlertDlg.hide(),

this.promptingAbandon=!
1),this.unmaskAll(),VMAPopupUtils.alert({message:VMAUiText.SESSION_EXPIRED,width:vmauiconst.$
("ALERT_DIALOG_WIDTH"),buttons:["ok"],showClose:!1,onOk:function(){vmamain.logout(!
0)}})):this.reloadMessagePage())},logout:function(a,b,c){this.terminated=!0;var d=!0===a?
VMAConst.I_LOGOUT_URL:VMAConst.LOGOUT_URL;a=[];b=b||!1;var e=!1;VMAConst.IS_AM||
Cookie.read("VMA_LOGIN_TOKEN")&&(e=!0);!b&&e&&a.push(new Promise(function(a){(new
Request({method:"POST",url:VMAConst.MAIN_URL_PREFIX+

"/RemoveLoginToken",link:"ignore",noCache:!0,onSuccess:function(b){b="string"===typeof b?
JSON.decode(b):b;VMADebug.write("removeLoginToken response status \x3d
"+b.status);a()},onFailure:function(b)
{a()}})).send()}));vmaim&&vmaim.subscriber&&vmaim.subscriber.getId()&&a.push(new
Promise(function(a){vmaim.grpcore.logout({onComplete:function()
{a()}})}));Promise.all(a).then(function(){c?c():window.location=d}).catch(function(a)
{VMADebug.logError(a);c?c():window.location=d})},gotoVtext:function(){window.location=

VMAConst.VTEXT_LOGGEDIN_URL},isNavMenuShown:function(){return
this.navMenuShown},putComponentToPool:function(a){a="string"===VMAUtils.typeOf(a)?
[a]:a;vmadom.componentPool().adopt(a)},spinContent:function(a,b)
{vmadom.contentContainer().showSpinner(!0,{delay:b,name:"contentSpinner",spinnerOptions:
{message:a,destroyOnHide:!0}})},unspinContent:function(){vmadom.contentContainer().showSpinner(!
1,{name:"contentSpinner"})},maskContent:function(a){vmadom.contentContainer().showMask(!0,
{name:"ajaxLoader",

maskOptions:{"class":"vma-ajaxLoadMask"},delay:a})},unmaskContent:function(a)
{vmadom.contentContainer().showMask(!1,{name:"ajaxLoader",maskOptions:{"class":"vma-
ajaxLoadMask"},delay:a})},maskContentTransparent:function(a)
{vmadom.contentContainer().showMask(!0,{name:"ajaxLoaderTrans",maskOptions:{"class":"vma-
ajaxLoadMaskTransparent"},delay:a})},unmaskContentTransparent:function(a)
{vmadom.contentContainer().showMask(!1,{name:"ajaxLoaderTrans",maskOptions:{"class":"vma-
ajaxLoadMaskTransparent"},delay:a})},

unmaskAll:function()
{this.hideAjaxLoader();this.unspinContent();this.unmaskContent();this.unmaskContentTransparent();"un
defined"!==typeof
vmaim&&(vmaim._hideAjaxLoaderForChatContainer(),vmaim.unmaskAfterSend(),vmaim.maskForLoad
More(!1),vmaim.maskForActivateConversation(!1))},linkToManageContacts:function()
{window.open(VMAIMConst.MANAGE_CONTACTS_URL,"_blank")},vmaimInitialized:function()
{return"undefined"!==typeof vmaim&&vmaim},_s_importContacts:function(a){var b=new
EOptions(a);vmaim.imcore.importContacts({onSuccess:function(a){b.fireEvent("complete",

a)},onFailure:function(a){vmamain.handleSystemError({reason:a})}})},handleRequestFailure:function(a)
{this.handleSystemError(a)},handleSystemError:function(a){var b=a;b||
(b={});this.unmaskAll();VMAPopupUtils.alert({message:VMAUiText.SYSTEM_ERROR,width:vmauiconst.$
("ALERT_DIALOG_WIDTH"),buttons:["ok"],zIndexOffset:15,onClose:function(){!1!
==b.refresh&&vmamain.refreshMessages("forceRefresh"===b.refresh)}})},handleAccountError:function(
a){this.unmaskAll();a=VMAUiText.sendMsg[a];a||(a=VMAUiText.SYSTEM_ERROR);

VMAPopupUtils.alert({message:a,width:vmauiconst.$("ALERT_DIALOG_WIDTH"),buttons:
["ok"],zIndexOffset:15,onOk:function(){vmamain.logout()}})},checkAndNotifyExpiration:function(a){if(!
this.clickedSignOut&&a===VMAIMConst.NOTIFY_EXPIRE_MINUTES&&!this.isNotifyingExpiration)
{this.isNotifyingExpiration=!0;this.unmaskAll();var
b=VMAUiText.notifications.NOTIFY_ABOUT_EXPIRE_DLG.substitute({m:a,s:1===a?"":"s"});this.notifyExpi
rationDlg=VMAPopupUtils.alert({message:b,width:400,buttons:["yes","no"],showClose:!1,

onYes:function(a){"undefined"!==typeof
vmaim&&vmaim&&vmaim.imcore&&(vmamain.isNotifyingExpiration=!
1,vmaim.imcore.extendSession());a.onComplete()},onNo:function(a)
{a.onComplete()}});"Y"===this.enableDesktopNotifications&&(b=VMAUiText.notifications.NOTIFY_ABOU
T_EXPIRE.substitute({m:a,s:1===a?"":"s"}),desktopNotifications.notify({iconUrl:VMAConst.NOTI_FAVICO
N_URL,closeInSecs:60*a,title:VMAConst.DEFAULT_DIALOG_TITLE,text:b,onClick:function(a)
{"undefined"!==typeof vmaim&&vmaim&&vmaim.imcore&&(vmamain.isNotifyingExpiration=

!
1,vmaim.imcore.extendSession());vmamain.notifyExpirationDlg&&(vmamain.notifyExpirationDlg.destroy
(),vmamain.notifyExpirationDlg=null)}}))}},isFeatureEnabled:function(a){return!1!
==this.featureMap[a]},showProgressDlg:function(a){this.progressDlg||(this.progressDlg=new
VMAProgressDlg);this.progressDlg.show(a)},hideProgressDlg:function()
{this.progressDlg&&this.progressDlg.hide()},showWebNotiBanner:function(a){var
b=document.id("enableWebNotiBanner");b&&b.show(a)},maskPage:function(a)
{document.body.showMask(a,

{maskOptions:{"class":"vma-transDisableMask",destroyOnHide:!0}})},_initTopLinks:function(){if(!
VMAUtils.isIE8OrLess()){var a=document.id("buapContents");a.addEvent("click:relay(.vma-
tabLink)",function(a){a.stop();vmamain.onLoadTab(this)});a.addEvent("click:relay(#vma-
refreshSettings)",function(a){a.stop();vmamain.refreshSettings(a,this)})}},linkIdToTabModule:function(a)
{return a.substr(10)},refreshSettings:function(a,b)
{vmamain.selectedSettingName=vmasettings.getSelectedSettingName();vmamain.showAjaxLoader();

vmasettings.destroyCompElts();VMAUtils.destroyElement("buapContentsSettings");(new
Request.HTML({url:VMAConst.MAIN_URL_PREFIX+"/a/Preference.do?
p\x3dtrue",method:"get",noCache:!0,append:"buapContentsPool",evalScripts:!0,onRequest:function()
{},onFailure:function(){vmamain.hideAjaxLoader()},onComplete:function()
{}})).send()},refreshMessages:function(a)
{this.TAB_MODULE_MESSAGES===this.mainServerParam.activeTabModule||!0===a?
window.location=VMAConst.MAIN_URL_PREFIX+"/Message.do?"+VMAUtils.randomString(8):

this.doReloadMessages=!0},reloadMessagePage:function()
{window.location=VMAConst.MAIN_URL_PREFIX+"/Message.do?"+VMAUtils.randomString(8)},onLoadT
ab:function(a){var b=document.id(a),c=b.get("id");if("undefined"!==typeof vmaim&&vmaim){var
d=this,e=!1,f=vmaim.activeConversation.newMessage&&"main-menu-settings"===c;a=function()
{if(f)vmaim.activeConversation.onDiscardMessage();d.loadTab({tabModule:d.linkIdToTabModule(c),href
:b.get("href"),forceAjax:!1})};vmaim.activeConversation?
f&&vmaim.activeConversation.containsComposerData()&&

(this.confirmSwitchConversationDlg||(this.confirmSwitchConversationDlg=new
VMAConfirmSwitchConversationDlg),this.confirmSwitchConversationDlg.show(!1,a),e=!
0):vmaim.activeConversation.saveDraft()}e||
d.loadTab({tabModule:d.linkIdToTabModule(c),href:b.get("href"),forceAjax:!1})},loadTab:function(a){var
b=a.tabModule;if(b!
==this.mainServerParam.activeTabModule)if(b===this.TAB_MODULE_MESSAGES&&this.doReloadMessa
ges)window.location=VMAConst.MAIN_URL_PREFIX+"/Message.do?"+VMAUtils.randomString(8);else{v
ar c=

this.getActiveContentsId(),d=this.getActiveTabModule(),e=d!
==this.TAB_MODULE_MESSAGES;this.returnContentsToPool(c);var
f=this.buildContentsId(b),g=a.href;a=!0;switch(b){case
this.TAB_MODULE_SETTINGS:vmaim.stopPlayingAudio();break;case
this.TAB_MODULE_MESSAGES:document.id(f)&&(a=!
1)}this.setActiveTabModule(b);vmamain.showAjaxLoader({noFx:!0});if(a)(function(){(new
Request.HTML({url:g,method:"get",append:"buapContentsPool",noCache:!0,evalScripts:!
0,onRequest:function(){VMADebug.write("start ajax request.")},

onFailure:function(){vmamain.hideAjaxLoader()},onComplete:function()
{e&&VMAUtils.destroyElement(c)}})).send()})();else if(this.onAfterLoadContents(),e){switch(d){case
this.TAB_MODULE_SETTINGS:vmasettings.onUnload()}VMAUtils.destroyElement(c)}}},buildSidebarId:fun
ction(a){return this.BUAP_SIDEBAR_PREFIX+a},getActiveSidebarId:function(){return
this.buildSidebarId(this.mainServerParam.activeTabModule)},getActiveContentsId:function(){return
this.buildContentsId(this.mainServerParam.activeTabModule)},

moduleFromSidebarId:function(a){return
a.substr(this.BUAP_SIDEBAR_PREFIX.length)},moduleFromContentsId:function(a){return
a.substr(this.BUAP_CONTENTS_PREFIX.length)},contentsIdFromSidebarId:function(a){return
this.buildContentsId(this.moduleFromSidebarId(a))},onAfterLoadContents:function(a){var b=new
EOptions({contentsId:vmamain.buildContentsId(vmamain.mainServerParam.activeTabModule),doFx:!
1,asyncAfterGrab:a?!0===a.get("asyncAfterGrab"):!1,onAfterGrabContents:function(b)
{a&&a.fireEvent("afterGrabContents",

b)},onComplete:function(){VMADebug.write("start hide ajax


loader");switch(vmamain.mainServerParam.activeTabModule){case
"Messages":vmaim.fireEvent("afterActivate")}vmamain.hideAjaxLoader({noFx:!
0})}});vmamain.loadContentsFromPool(b)},_initShowHideNavMenu:function(){this.isNavMenuShown()||
vmadom.contentContainer().setStyles({display:"block",width:938})},startDesktopNotificationsChecker:fu
nction(){this.checkDNState="RUN";var
a=desktopNotifications.checkCapability();this.lastDNPermission=a.permission;

switch(a.capability){case
DesktopNotificationsCapability.UNSUPPORTED:break;default:this._checkDesktopNotificationsTimer.peri
odical(5E3,this)}},_checkDesktopNotificationsTimer:function(){if("PAUSE"!==this.checkDNState){var
a=desktopNotifications.checkCapability();if(a.permission!==this.lastDNPermission){if("undefined"!
==typeof vmasettings&&vmasettings){var
b=vmasettings.settings.DESKTOP_NOTIFICATIONS;b&&b.resetData(a)}"undefined"!==typeof
vmaim&&vmaim&&vmaim.updateWebNotiBanner(a);this.lastDNPermission=

a.permission}}},createDesktopNotiDlg:function(){this.desktopNotiDlg||(this.desktopNotiDlg=new
VMADesktopNotificationsDlg);return this.desktopNotiDlg},_s_enableDesktopNotifications:function(a)
{vmamain._s_submitSettingsRequest({data:
{category:a.get("category"),operation:a.get("enable")?"ENABLE":"DISABLE"},onComplete:function(b)
{switch(b.status){case
"SUCCESS":vmamain.enableDesktopNotifications="Y"}a.fireEvent("complete",b)}})},onGotoAutoReplySe
ttings:function(){vmamain.selectedSettingName="AUTO_REPLY";

vmamain.onLoadTab("main-menu-settings")},onGotoAutoForwardSettings:function()
{vmamain.selectedSettingName="AUTO_FORWARD";vmamain.onLoadTab("main-menu-
settings")},onGotoScheduledMessageSettings:function()
{vmamain.selectedSettingName="SCHEDULED_MESSAGES";vmamain.onLoadTab("main-menu-
settings")},updateSettingsStatus:function(a)
{VMAUtils.defined(a.autoReplyOn)&&(this.autoReplyOn=a.autoReplyOn);VMAUtils.defined(a.autoForwa
rdOn)&&(this.autoForwardOn=a.autoForwardOn);"undefined"!==typeof
vmaim&&vmaim&&vmaim.updateAboveConvsNotiBar()},

onEnableDesktopNotifications:function(){this.checkDNState="PAUSE";var
a=desktopNotifications.checkCapability(),b="none";switch(a.capability){case
DesktopNotificationsCapability.CAPABLE:"Y"===vmamain.enableDesktopNotifications&&DesktopNotific
ationsPermission.ALLOWED?(b="simpleYes",vmamain.showWebNotiBanner(!
1)):a.permission===DesktopNotificationsPermission.DENIED?
(b="toSetting",vmamain.showWebNotiBanner(!1)):b="promptYes";break;case
DesktopNotificationsCapability.REQ_ADDON:switch(vmamain.enableDesktopNotifications){case "U":b=

"toSetting";break;case "Y":b="toSettingY";default:case "N":}break;case


DesktopNotificationsCapability.UNSUPPORTED:VMADebug.write("ERROR: Browser does not support
desktop notification.")}switch(b){case "simpleYes":this.createDesktopNotiDlg().show(new
EOptions({enable:!0,server:!1}));this.checkDNState="RUN";break;case
"promptYes":this.createDesktopNotiDlg().show(new EOptions({enable:!0,server:!
0,onComplete:function(a){VMADebug.write("got permission: "+a);switch(a){case
DesktopNotificationsPermission.ALLOWED:case
DesktopNotificationsPermission.DENIED:vmamain.showWebNotiBanner(!1)}vmamain.checkDNState=
"RUN"}}));break;case
"toSettingY":vmamain.selectedSettingName="DESKTOP_NOTIFICATIONS";vmamain.onLoadTab("main-
menu-settings");break;case
"toSetting":vmamain.selectedSettingName="DESKTOP_NOTIFICATIONS",this.createDesktopNotiDlg().sh
ow(new EOptions({enable:!0,server:!0,prompt:!1,onComplete:function(){vmamain.onLoadTab("main-
menu-settings");vmamain.checkDNState="RUN"}}))}},hideOtherMenus:function()
{this.vmaimInitialized()&&vmaim.showSendToSuggestion(!1)},startKeepLoggedIn:function(){var a=new
URI(VMAConst.KEEP_LOGGED_IN_URL);

window.location=a.toString()},doDownload:function(a)
{window.location=a+"\x26download\x3dtrue"},_initTest:function()
{document.id("testPopup")&&document.id("testPopup").addEvent("click",function(a)
{document.id("buapContents").toggleMask()}.bind(this))},isTerminated:function(){return
this.terminated||"undefined"!==typeof
vmaim&&vmaim&&vmaim.imcore&&vmaim.imcore.terminated},stopScheduledTasks:function()
{"undefined"!==typeof
vmaim&&vmaim&&(vmaim.stopBackgroundLoadMessages(),vmaim.imcore&&vmaim.imcore.cancelInb
oundRequest(),

vmaim.grpcore&&vmaim.grpcore.cancelInboundRequest())}},VMAMainBase=new
Class(VMAMainBaseClassDef),VMAMain=new
Class({Extends:VMAMainBase,Implements:Events}),vmamain=new
VMAMain;vmamain.addEvent("beforeLoad",function(){vmamain.onBeforeLoad()});

Das könnte Ihnen auch gefallen