<?xml version="1.0" encoding="UTF-8"?>
<!--
****************************************************************************

     File Name:   imGadgets.box

****************************************************************************
   C O P Y R I G H T   A N D   C O N F I D E N T I A L I T Y   N O T I C E
****************************************************************************

//      Copyright (c) 2006 AOL LLC.  All rights reserved.
//      This software contains valuable confidential and proprietary
//      information of AOL LLC. and is subject to applicable
//      licensing agreements.  Unauthorized reproduction, transmission or
//      distribution of this file and its contents is a violation of
//      applicable laws.
//
//            A O L   C O N F I D E N T I A L

****************************************************************************
-->


<!DOCTYPE window SYSTEM "box://imApp/resources/im.dtd">

<?import href="box://aimToolkit/content/gadgets.box"?>
<?import href="box://aimToolkit/theme/toolkit.box"?>
<?import href="box://imApp/content/imAppLib.box"?>
<?import href="box://imApp/theme/imGadgetStyles.box"?>

<library xmlns="http://www.aol.com/boxely/resource.xsd"
         xmlns:box="http://www.aol.com/boxely/box.xsd"
         xmlns:s="http://www.aol.com/boxely/style.xsd"
         xmlns:on="http://www.aol.com/boxely/reaction.xsd">

    <gadget id="conversationPane" type="box" language="jscript"  script="box://imApp/content/im/conversationPane.js">
        <script language="jscript" href="box://imApp/content/viewGadgetInterface.js"/>
        <script language="jscript" href="box://imApp/content/htmlSupport.js"/>
        <script language="jscript" href="box://imApp/content/im/templateCallbackObject.js"/> 
        <attributes toUser="" typing="false" flash="false"/>
        <parts>
            <box:binding objectSource="model" targetProperty="isInitial" path="isInitial" method="oneWay" />
            <box:binding objectSource="model" targetProperty="isChat" path="isChat" method="oneWay" />
            <box:binding objectSource="model" targetProperty="toUser" path="toUser" method="twoWay" />
            <box:binding objectSource="model" targetProperty="isCaught" path="isCaught" />
            <box:binding objectSource="primaryPrefs" targetProperty="showMyExpressions" path="expressionsShowMyExpressions" method="oneWay"/>
            <box:vbox id="conversationArea" s:flex="1" s:hAlign="stretch" s:vAlign="stretch">
                <box:binding targetProperty="collapsed" path="isCaught" objectSource="model"/>
                <box:vbox id="topContainer" s:padding="1 1 0 1">
                    <box:vbox id="toUserPanelContainer" s:flex="1">
                        <box:binding elementSource="_gadget" targetProperty="collapsed" path="isInitial" sourceTransformer="toolkit:not" />
                        <box:toUserPanel id="toUserPanel" s:flex="1"/>
                    </box:vbox>
                    <box:vbox id="conversationContainer" s:flex="1">
                        <box:binding elementSource="_gadget" targetProperty="collapsed" path="isInitial" />
                    </box:vbox>
                    <box:secondarySessionPrompt id="promptPanel" />
                    <box:vbox id="fileTransferList" s:maxHeight="60" s:overflow="scroll" />
                </box:vbox>
                <box:spacer id="historyInputSpacer"/>
                <box:vbox id="imComposerContainer">
                        <box:binding elementSource="_gadget" targetProperty="collapsed" path="isCurrent" sourceTransformer="toolkit:not"/>
                </box:vbox>
                <box:vbox id="smsInfo" s:overflow="hidden" s:maxWidth="auto" collapsed="true" hidden="true">
                    <box:hbox s:vAlign="center">
                        <box:aolLabel id="smsStatus" s:fontSize="9"/>
                        <box:spacer s:flex="1"/>
                        <box:aolTextButton tabIndex="2" fontSize="9" label="&im.form.charge;" on:command="gadget:launchSMSDisclaimer();"/>
                    </box:hbox>
                    <box:hbox s:vAlign="center" id="smsCheckArea">
                        <box:aolCheckButton tabIndex="2" id="smsCheck">
                            <box:binding objectSource="primaryPrefs" targetProperty="toggled" path="aimccAcceptedSmsTerms" method="twoWay"/>
                        </box:aolCheckButton>
                        <box:aolTextButton tabIndex="2" fontSize="9" label="&im.form.acceptSMSCharge;" on:command="gadget:launchSMSTerms();"/>
                    </box:hbox>
                </box:vbox>
                <box:hbox  id="sendBar">
                    <box:binding targetProperty="disabled" elementSource="_gadget" path="disableSendBar" />
                    <box:binding objectSource="primaryPrefs" targetProperty="collapsed" path="imShowSendBar" method="oneWay" sourceTransformer="gadget:showSendBar();"/>
                    <box:hbox id="EIMButtons">
                        <box:binding targetProperty="collapsed" objectSource="model" path="isChat" />
                        <box:aolButton id="audioButton" label="&im.form.talk;" tooltip="&im.form.audioTip;" on:command="gadget:startTalk();" tabIndex="4" showBevel="true"/>
                        <box:aolButton id="videoButton" label="&im.form.video;"  tooltip="&im.form.videoTip;" on:command="gadget:startVideo();" tabIndex="5" showBevel="true" />
                        <box:aolButton id="picturesButton" label="&im.form.pictures;" tooltip="&im.form.picturesTip;" on:command="gadget:startPictures();" tabIndex="6" showBevel="true" />
                        <box:aolMenuButton id="fileButton" label="&im.form.sendfiles;"  tooltip="&im.form.filesTip;" tabIndex="7" showBevel="true">
                            <box:reaction event="keyPress" keyCode="ENTER" action="toolkit:Pop"/>
                            <box:menuPopup style="popupWithoutTransition">
                                <box:aolMenuItem label="&im.form.sendfile;" on:command="gadget:sendFile();" />    
                                <box:aolMenuItem label="&im.form.sendfolder;" on:command="gadget:sendFolder();" />    
                            </box:menuPopup>                        
                        </box:aolMenuButton>
                        <box:spacer s:fill="url(#brush.mainStrokeColor)" s:width="1"/>
                    </box:hbox>
                    <box:spacer s:flex="1" />
                    <box:aolButton id="sendButton" tabIndex="3" defaultButton="true" label="&im.form.send;" tooltip="&im.form.sendTip;" on:command="gadget:sendIM();" >
                        <box:binding targetProperty="disabled" elementSource="_gadget" path="disableSend" />
                    </box:aolButton>

                </box:hbox>
            </box:vbox>
            <box:vbox id="knockKnockArea" s:flex="1" s:hAlign="stretch" s:vAlign="center" s:padding="10" collapsed="true">
                <box:binding targetProperty="accDescription" path="caughtImTimestamp" objectSource="model" sourceTransformer="gadget:buildKKAccDescription();"/>
                <box:binding targetProperty="collapsed" path="isCaught" objectSource="model" sourceTransformer="toolkit:not" />
                <box:aolLabel id="knockKnockTimeStamp">
                     <box:binding targetProperty="value" path="caughtImTimestamp" objectSource="model" sourceTransformer="gadget:showCaughtImTimestamp();"/>
                </box:aolLabel>
                <box:spacer s:height="20" />
                <box:hbox s:maxWidth="auto">
                    <box:aolLabel s:height="18" s:fontSize="14" s:fontBold="true" s:marginRight="0">
                        <box:binding targetProperty="value" elementSource="_gadget" path="toUser"/>
                    </box:aolLabel>
                    <box:aolLabel value="&im.catcher.headingText1;" s:fontSize="14" s:marginRight="0"/>
                    <box:aolLabel s:fontSize="14" s:fontBold="true" s:marginRight="0">
                        <box:binding targetProperty="value" path="caughtImCount" objectSource="model"/>
                    </box:aolLabel>
                    <box:aolLabel value="&im.catcher.headingText2;" s:fontSize="14" wordwrap="true" s:flex="1"/>
                </box:hbox>
                <box:hbox s:maxWidth="auto">
                    <box:aolLabel value="&im.catcher.infoText;" wordwrap="true" s:flex="1"/>
                </box:hbox>
                <box:spacer s:height="20" />
                <box:vbox s:hAlign="start">
                    <box:aolButton id="acceptIMButton" label="&im.catcher.showButton;" defaultButton="true" s:minWidth="50" on:command="gadget:acceptIM();" s:marginBottom="0"/>
                    <box:aolCheckButton id="chkAddToBuddyList" label="&im.catcher.addBuddy;" s:marginTop="0"/>
                </box:vbox>
                <box:spacer s:height="10" />
                <box:hbox>
                    <box:aolButton label="&im.catcher.closeButton;" s:minWidth="50" s:marginRight="10" on:command="gadget:removeForm();"/>
                    <box:aolButton label="&im.catcher.reportButton;" on:command="gadget:reportIMSpam();" />
                </box:hbox>
            </box:vbox>
            <box:box id="chatRosterHolder" />
            <box:dimChooserPopup id="dimChooser" anchor="conversationArea" popupAlign="none" 
                on:popping="gadget:onChooserPopping();"
                on:dragOut="toolkit:stopPropagation"
            />


        </parts>
        <behavior>

            <reaction event="boxDestroyed"   action="gadget:onBoxDestroyed();"/>
            <reaction event="presented" action="gadget:onBoxPresented();"/>
            <reaction event="dragOver" action="gadget:OnDragOver();" />
            <reaction event="dragDrop" action="gadget:OnDragDrop();" />
            <reaction event="keyPress" ctrl="true" keyCode="RETURN" action="gadget:sendIM();" />
            <reaction event="keyPress" keyCode="f2" action="gadget:flipTimestamp();" />
            <reaction event="attributeSet" attributeName="toUser" action="gadget:toUserChanged();" />
        </behavior>
    </gadget>

    <style tag="conversationPane" id="conversationPaneStyle" flex="1">
        <part name="topContainer" flex="1" />
    </style>

    <gadget id="conversation" type="dhtml" language="jscript" script="box://imApp/content/im/conversation.js">
        <script language="jscript" href="box://imApp/content/htmlSupport.js"/>
        <attributes accRole="bstrWnd"
                    tabIndex="0"
                    wantTab="false"
                    context="conversationContext"
                    security="useCache,images,frames,scripts,behaviors,runActiveX"/>
        <behavior>
            <reaction event="readyStateChanged" action="gadget:onConversationReadyStateChanged();"/>
            <reaction event="navigate" action="gadget:onConversationNavigate();"/>
            <reaction event="focus" action="gadget:onConversationFocus();"/>
            <box:reaction event="keyPress" ctrl="true" keyCode="p" action="shell.getCurrentEvent().stopPropagation();" />
            <box:reaction event="keyPress" ctrl="true" keyCode="s" action="shell.getCurrentEvent().stopPropagation();" />
            <box:reaction event="keyPress" ctrl="true" keyCode="f" action="shell.getCurrentEvent().stopPropagation();" />
        </behavior>

    </gadget>

    <style tag="conversation" flex="1" left="0" right="0" fill="white"
                                minWidth="50" minHeight="20"
                                strokeCornerRadius="0" fillCornerRadius="0"
                                overflow="scroll"/>

    <gadget id="buddyIcon" type="box" language="jscript" script="box://imApp/content/im/buddyIcon.js">
        <attributes focusMode="ignore" buddyURL="" compact="false" fadeInFirstIcon="false"/>
        <parts>
            <box:box id="iconHolder" />
        </parts>
    </gadget>
    <style tag="buddyIcon" width="58" vAlign="stretch" hAlign="center" flex="1">
        <part name="iconHolder" flex="1" opacity="0">
            <attribute name="fadeIn" value="true" opacity="100" animate="url(#iconOpacityAnimate)" />
        </part>
    </style>

    <gadget id="superBuddyDHTML" type="dhtml">
        <attributes security="useCache,images,frames,scripts,behaviors,runActiveX"
                    href="box://imApp/content/im/templateUser.html"
                    focusMode="ignore"/>
    </gadget>
    <style tag="superBuddyDHTML" flex="1" width="58" minWidth="58" minHeight="48">
        <attribute name="compact" value="true" width="48" minWidth="48" margin="1"/> 
    </style>
    
    <gadget id="imComposer" type="box" language="jscript" script="box://imApp/content/im/imComposer.js">
        <script language="jscript" href="box://imApp/content/htmlSupport.js"/>
        <attributes focusMode="defer" hideFontBar="false" isVoip="false" noToUser="false"/>
        <parts>
            <box:hbox id="fontbarBox" s:minHeight="16px" s:fill="url(#grayWhiteGradient)" inherits="collapsed=hideFontBar">
                <box:imAppFontToolbar id="fontbar1" s:flex="1" >
                    <box:hbox s:flex="1"/>
                    <box:imFontBarImageButton id="getInfoButton" icon="#bmp.bl.buddyInfo.small" tooltip="&im.form.profile.accName;" accName="&im.form.profile.accName;" collapseDropMark="true" on:click="gadget:openBuddyInfo();" focusMode="ignore">
                        <box:binding targetProperty="ornament" elementSource="_gadget" path="noToUser" />                    
                    </box:imFontBarImageButton>
                    <box:imFontBarImageButton id="expressionIcon" inherits="collapsed=fontSettingsOnly" icon="box://imApp/resources/expressions.png"                                   
                                        tooltip="&im.form.toggleExpression.myExpressionTooltip;" accName="&im.form.toggleExpression.myExpressionTooltip;"
                                        focusMode="ignore">
                        <box:binding elementSource="_gadget" targetProperty="collapsed" path="isInitial" sourceTransformer="gadget:showExpressionIcon();" method="oneWay"/>
                        <box:binding elementSource="_gadget" targetProperty="collapsed" path="showMyExpressions" sourceTransformer="gadget:showExpressionIcon();" method="oneWay"/>
                        <box:binding elementSource="_gadget" targetProperty="collapsed" path="isChat" sourceTransformer="gadget:showExpressionIcon();" method="oneWay"/>                        

                        <box:menuPopup id="expressionMenu" on:popping="gadget:updateExpressionMenu();">
                            <box:aolMenuItem id="mnuToggleExpression" label="&im.form.menu.expressions.toggle;" on:command="gadget:flipToggleExpression();"/>
                            <box:aolMenuItem id="mnuChangeExpression" label="&im.form.menu.expressions.change;" on:command="gadget:changeExpression();"/>
                        </box:menuPopup>                                        
                    </box:imFontBarImageButton>
                    <box:spacer s:width="8" />
                </box:imAppFontToolbar>
            </box:hbox>
            <box:hbox id="voipDialpad" collapsed="true" s:vAlign="center" s:fill="url(#grayWhiteGradient)">
                <box:binding targetProperty="collapsed" elementSource="_gadget" path="isVoip" sourceTransformer="toolkit:not"/>
                <box:aolLabel value="&im.form.sendTone;"/>
            </box:hbox> 
            <box:hbox id="inputAndIconContainer">
                <box:binding targetProperty="collapsed" elementSource="_gadget" path="isVoip" />
                <box:vbox id="inputContainer"> 
                    <box:imAppEditor id="input" focusMode="normal"
                                s:margin="1" s:minHeight="48" s:height="48"
                                minEditorHeight="48" maxEditorHeight="72"
                                wantEnter="false" wantTab="false"
                                context="dhtmlInputContext"
                                fontbar="fontbar1"
                                tabIndex="1"
                                autoConvertEnter="false"
                                href="box://imApp/content/im/inputTemplate.html"
                                on:modified="gadget:updateTypingIndicator();"
                                on:focus="gadget:onInputFocus();"
                                accName="&im.form.input;">

                        <box:reaction event="keyPress" ctrl="true"  keyCode="p" action="shell.getCurrentEvent().stopPropagation();" />
                        <box:reaction event="keyPress" ctrl="true"  keyCode="k" action="shell.getCurrentEvent().stopPropagation();" />
                        <box:reaction event="keyPress" ctrl="true"  keyCode="m" action="shell.getCurrentEvent().stopPropagation();" />
                        <box:reaction event="keyPress" ctrl="false" shift="true" keyCode="TAB" action="shell.getCurrentEvent().stopPropagation();" />
                        <box:reaction event="keyPress" ctrl="true"  keyCode="s" action="shell.getCurrentEvent().stopPropagation();" />
                        <box:reaction event="keyPress" ctrl="true"  keyCode="f" action="shell.getCurrentEvent().stopPropagation();" />
                        <box:reaction event="keyPress" ctrl="false" keyCode="RETURN" action="gadget:onEnterPressed();"/>
                        <box:reaction event="keyPress" shift="true" keyCode="RETURN" action="gadget:onEnterPressed();"/>
                        <box:reaction event="attributeSet" attributeName="editorInitialized" action="gadget:updateSmileyExpression();"/>
                    </box:imAppEditor>
                </box:vbox>
                <box:box id="localIconContainer"/>
            </box:hbox>
        </parts>
        <behavior>
            <reaction event="keyPress" keyCode="0" action="gadget:addDialCharacterIfVoipIsOn( '0' );" />
            <reaction event="keyPress" keyCode="1" action="gadget:addDialCharacterIfVoipIsOn( '1' );" />
            <reaction event="keyPress" keyCode="2" action="gadget:addDialCharacterIfVoipIsOn( '2' );" />
            <reaction event="keyPress" keyCode="3" action="gadget:addDialCharacterIfVoipIsOn( '3' );" />
            <reaction event="keyPress" keyCode="4" action="gadget:addDialCharacterIfVoipIsOn( '4' );" />
            <reaction event="keyPress" keyCode="5" action="gadget:addDialCharacterIfVoipIsOn( '5' );" />
            <reaction event="keyPress" keyCode="6" action="gadget:addDialCharacterIfVoipIsOn( '6' );" />
            <reaction event="keyPress" keyCode="7" action="gadget:addDialCharacterIfVoipIsOn( '7' );" />
            <reaction event="keyPress" keyCode="8" action="gadget:addDialCharacterIfVoipIsOn( '8' );" />
            <reaction event="keyPress" keyCode="9" action="gadget:addDialCharacterIfVoipIsOn( '9' );" />
            <reaction event="keyPress" keyCode="MULTIPLY" action="gadget:addDialCharacterIfVoipIsOn( '*' );" />        
            <reaction event="keyPress" keyCode="NUMPAD0" action="gadget:addDialCharacterIfVoipIsOn( '0' );" />
            <reaction event="keyPress" keyCode="NUMPAD1" action="gadget:addDialCharacterIfVoipIsOn( '1' );" />
            <reaction event="keyPress" keyCode="NUMPAD2" action="gadget:addDialCharacterIfVoipIsOn( '2' );" />
            <reaction event="keyPress" keyCode="NUMPAD3" action="gadget:addDialCharacterIfVoipIsOn( '3' );" />
            <reaction event="keyPress" keyCode="NUMPAD4" action="gadget:addDialCharacterIfVoipIsOn( '4' );" />
            <reaction event="keyPress" keyCode="NUMPAD5" action="gadget:addDialCharacterIfVoipIsOn( '5' );" />
            <reaction event="keyPress" keyCode="NUMPAD6" action="gadget:addDialCharacterIfVoipIsOn( '6' );" />
            <reaction event="keyPress" keyCode="NUMPAD7" action="gadget:addDialCharacterIfVoipIsOn( '7' );" />
            <reaction event="keyPress" keyCode="NUMPAD8" action="gadget:addDialCharacterIfVoipIsOn( '8' );" />
            <reaction event="keyPress" keyCode="NUMPAD9" action="gadget:addDialCharacterIfVoipIsOn( '9' );" />
            <reaction event="keyPress" keyCode="3" shift="true" action="gadget:addDialCharacterIfVoipIsOn( '#' );" />
            <reaction event="keyPress" keyCode="8" shift="true" action="gadget:addDialCharacterIfVoipIsOn( '*' );" />
        </behavior>
    </gadget>
    <style tag="imComposer" orient="vertical" fill="white">
        <part name="inputContainer" flex="1" />
        <part name="buttonContainer" vAlign="end" />
    </style>

    <gadget id="aolIMTab" type="control" >
        <attributes selectableMode="item" focusMode="defer" accRole="pageTab" context="tabContext" blockEvents="false" video="false" talk="false" typing="false" flash="false"/>
        <parts>
            <box:box id="icon" ornament="true" inherits="typing,flash,video,talk,isCaught" collapsed="true"/>
            <box:aolLabel id="label" ornament="true" flex="1"  inherits="value=label,icon,focused,selected" />
            <box:aolImageButton focusMode="defer" id="closeButton" icon="#closeIcon.small" inherits="preLight=selected" on:mouseDown="toolkit:StopEventPropagation" on:command="onTabCloseClicked();" tooltip="&im.form.closeIM_tabTip;"/> 
        </parts> 
        <behavior inherits="box://aimToolkit/content/behaviors.box#commandable">
            <reaction event="keyPress" keyCode="RETURN" action="toolkit:Command" />
            <reaction event="attributeSet" attributeName="isChanging" action="scene.imTabController.onTabChanging();" />
            <reaction event="mouseReleased" action="scene.imTabController.onTabMouseReleased();" />
            <reaction event="mouseDown" action="scene.imTabController.onTabMouseDown();" />
            <reaction event="dragOver" action="scene.imTabController.onTabDragOver();" />
            <reaction event="dragDrop" action="scene.imTabController.onTabDragDrop();" />
            <reaction event="hoverHold" action="scene.imTabController.onTabHoverHold();" />

        </behavior>
    </gadget>

    <style tag="aolIMTab" id="aolIMTabStyle" maxWidth="auto" zIndex="1" vAlign="center" hAlign="start">
        <part name="label" flex="1" crop="right" />
    </style>    

    <gadget id="secondarySessionPrompt" type="box" language="jscript" script="box://imApp/content/im/secondarySessionPrompt.js">
        <attributes expandedHeight="75" collapsed="true" />
        <parts>
            <box:vbox id="wholeGadget">
                <box:box s:position="fixed" s:width="100%" s:height="100%" s:fill="#AFAFAF" s:opacity="50%" collapsed="true">
                    <box:binding objectSource="model" targetProperty="collapsed"
                                 path="isOffline" method="oneWay" sourceTransformer="toolkit:not" targetTransformer="toolkit:not"/>
                </box:box>
                <box:hbox s:maxWidth="auto" s:padding="0 10" >
                    <box:aolLabel id="PromptMessage" wordwrap="true" s:flex="1" />
                </box:hbox>
                <box:hbox id="PromptConflict" collapsed="true" s:maxWidth="auto" s:padding="0 10" >
                    <box:aolLabel id="PromptConflictLabel" wordwrap="true" s:flex="1"/>
                </box:hbox>
                <box:hbox id="fileXferProposal" s:marginTop="-3" s:maxWidth="auto" s:hAlign="center">
                    <box:aolLabel id="fileSavedTo" value="&im.form.filessavedto;" s:fontBold="true" accName="&im.form.filessavedto;"/>
                    <box:aolLabel id="fileTransferFolder" s:crop="right" s:marginLeft="-3"/>

                    <box:aolTextButton id="fileChangeButton" label="&im.form.change;" on:command="gadget:openFolder();"/>
                </box:hbox>   
                <box:hbox s:hAlign="center">
                    <box:hbox id="sessionProposal" collapsed="true">
                        <box:aolButton style="imPromptButton" id="acceptSessionPrompt" label="&im.form.accept;" on:command="gadget:respondPrompt(0);" />
                        <box:aolButton style="imPromptButton" id="rejectSessionPrompt" label="&im.form.reject;" on:command="gadget:respondPrompt(1);" />
                        <box:aolButton style="imPromptButton" id="blockSessionPrompt" label="&im.form.block_normal;"  on:command="gadget:respondPrompt(3);" />
                        <box:aolButton style="imPromptButton" id="ignoreSessionPrompt" label="&im.form.ignore_normal;" on:command="gadget:respondPrompt(4);" />
                    </box:hbox>
                    <box:hbox id="sessionYesNo" collapsed="true">
                        <box:aolButton style="imPromptButton" id="yesSessionPrompt" label="&im.form.yes;" on:command="gadget:respondPrompt(7);" />
                        <box:aolButton style="imPromptButton" label="&im.form.no;" on:command="gadget:respondPrompt(8);" />
                    </box:hbox>
                    <box:hbox id="sessionOKCancel">
                        <box:aolButton style="imPromptButton" id="promptok" on:command="gadget:respondPrompt(9);" collapsed="true"/>
                        <box:aolButton style="imPromptButton" id="promptcancel" label="&im.form.cancel;" on:command="gadget:respondPrompt(2);" collapsed="true"/>
                    </box:hbox>
                </box:hbox>
                <box:hbox s:hAlign="center">
                    <box:aolCheckButton id="autoAcceptCheckbox" s:margin="0px" s:padding="0px">
                        <box:binding targetProperty="toggled" objectSource="primaryPrefs" path="imAutoAcceptFileXfer" method="twoWay"/>
                    </box:aolCheckButton>
                </box:hbox>
            </box:vbox>
        </parts>
    </gadget>

    <style tag="secondarySessionPrompt" id="secondarySessionPromptStyle" 
           orient="vertical" overflow="none" maxWidth="auto" maxHeight="auto" height="0" hAlign="stretch" vAlign="center"
           stroke="#DCDDE2 none none none" strokeCornerRadius="2" strokeWidth="2"
           fill="#EEEFF1" fillCornerRadius="3" >

        <part name="wholeGadget" padding="0 0" />
    </style>
    <style id="accSecondarySessionPromptStyle" accStyleFor="secondarySessionPromptStyle" inherits="#secondarySessionPromptStyle" fill="sysColorWindow" />
    
    <style id="imPromptButton" padding="5" minWidth="25" >
        <part name="label" fontSize="10" />
    </style>
    
    <gadget id="fileTransferStatus" type="box" language="jscript" script="fileTransferStatus.js">
        <attributes filename="" sending="false" progress="0" transferStatus="" progressLabel="" 
                    completed="false" failed="false" active="false"/>
        <parts>
            <box:hbox id="contentArea" s:flex="1" s:vAlign="center" s:hAlign="begin" context="optionsMenu">
                <box:image src="#imform.fileupload" margin="0">
                    <box:binding targetProperty="collapsed" elementSource="_gadget" path="sending" sourceTransformer="toolkit:not"/>
                </box:image>
                <box:image src="#imform.filedownload" margin="0">
                    <box:binding targetProperty="collapsed" elementSource="_gadget" path="sending" />
                </box:image>
                <box:hbox s:flex="1" s:maxWidth="auto">
                    <box:aolLabel inherits="value=filename" s:flex="1" s:crop="right" s:minWidth="20"/>
                </box:hbox>
                <box:hbox id="controlPanel" >
                    <box:hbox id="failedPanel" >
                        <box:binding targetProperty="collapsed" elementSource="_gadget" path="failed" sourceTransformer="toolkit:not" />
                    </box:hbox>
                    <box:hbox id="activePanel">
                        <box:binding targetProperty="collapsed" elementSource="_gadget" path="active" sourceTransformer="toolkit:not" />
                        <box:aolTextButton id="cancelButton" label="&fileTransfer.cancel;" on:command="gadget:onCancel();" />
                    </box:hbox>
                    <box:hbox id="completedPanel">
                        <box:binding targetProperty="collapsed" elementSource="_gadget" path="completed" sourceTransformer="toolkit:not" />
                        <box:aolTextButton id="optionsButton" label="&fileTransfer.options;" popup="optionsMenu" accRole="buttonMenu" accName="&fileTransfer.options.accName;" >
                            <box:reaction event="keyPress" keyCode="ENTER" action="toolkit:Pop"/>
                            <box:reaction event="keyPress" keyCode="SPACE" action="toolkit:Pop"/>
                        </box:aolTextButton>
                    </box:hbox>
                </box:hbox>
                <box:fileProgressBar id="progress" style="fileProgressBar" inherits="label=progressLabel,value=progress,transferState" min="0" max="100" />
                <box:aolImageButton id="closeButton" icon="#closeIcon.small" on:command="gadget:hide();" on:doubleClick="gadget:onCloseDoubleClick();">
                    <box:binding targetProperty="hidden" elementSource="_gadget" path="transferState" sourceTransformer="gadget:hideCloseButton()" />
                </box:aolImageButton>
            </box:hbox>
            <box:menuPopup id="optionsMenu" popupAlign="cursor_end" on:popping="gadget:onOptionsMenuPopping();" >
                <box:aolMenuItem id="menuOpenFile" label="&fileTransferMenu.openFile;" on:command="gadget:launchFile();" />
                <box:aolMenuItem label="&fileTransferMenu.openFolder;" on:command="gadget:launchFolder();" />
                <box:aolMenuItem id="menuRemove" label="&fileTransferMenu.remove;" on:command="gadget:hide();" />
                <box:aolMenuItem id="menuCancel" label="&fileTransferMenu.cancel;" on:command="gadget:onCancel();" />
            </box:menuPopup>
        </parts>
        <behavior inherits="box://aimToolkit/content/behaviors.box#commandable">
            <reaction event="attributeSet" attributeName="transferState" action="gadget:onTransferStateChange();" />
            <reaction event="attributeSet" attributeName="hideAnimateComplete" action="gadget:onHideComplete();" />
            <reaction event="doubleClick" action="gadget:onDoubleClick();" />
			<reaction event="mouseWheel" detail="1" action="gadget:onMouseWheel(1);"/>
			<reaction event="mouseWheel" detail="-1" action="gadget:onMouseWheel(-1);"/>
        </behavior>
    </gadget>
    <style tag="fileTransferStatus" maxHeight="auto" >
        <attribute name="hide" value="true" animate="url(#hideFileStatusPanel)" />
    </style>

    <gadget id="fileProgressBar" type="select" language="jscript" code="fileProgressBar.js">
        <attributes axis="x" focusMode="ignore" accRole="progressBar" min="0" max="100"/>
        <parts>
            <box:box id="numeratorStroke" collapsed="true" inherits="transferState">
                <box:binding elementSource="_gadget" path="value" sourceTransformer="gadget:onSetValue();" method="oneWay"/>
            </box:box>
            <box:box id="numeratorContainer" collapsed="true" >
                <box:binding elementSource="_gadget" path="value" sourceTransformer="gadget:onSetValue();" method="oneWay"/>
                <box:box id="numerator" inherits="transferState" s:zIndex="0"/>
            </box:box>
            <box:aolLabel id="label" inherits="value=label" />
        </parts>
        <behavior>
            <reaction event="presented" action="gadget:onPresented();" />
            <reaction event="attributeSet" attributeName="value" action="gadget:onSetValue();" />
        </behavior>
    </gadget>

    <gadget id="toUserPanel" type="box" language="jscript" script="box://imApp/content/im/toUserPanel.js">
        <script language="jscript" href="box://imApp/content/buddyInfo.js" />
        <attributes focusMode="defer" showUserInfo="true" lockToUser="false" onlineStatus="" onlineTime=""/>
        <parts>
            <box:hbox s:flex="1">
                <box:aolLabel id="imToLabel" value="&im.form.to;"/>
                <box:vbox s:flex="1">
                    <box:hbox s:marginBottom="3">
                        <box:binding elementSource="_gadget" targetProperty="collapsed" path="lockToUser" sourceTransformer="toolkit:not"/>
                        <box:aolLabel id="toUserLabel" inherits="value=text" s:fontBold="true" s:fontSize="12px"
                                      on:click="gadget:unlockToUser();" s:cursor="text"
                        />
                        <box:aolTextButton label="change" on:command="gadget:unlockToUser();"/>
                    </box:hbox>
                    <box:imSmartInput id="toUser" inherits="text" accName="&im.form.to.accName;" smartBoxId="autoCompletePopup" on:blur="gadget:toUserBlur();" s:minWidth="136">
                        <box:binding elementSource="_gadget" targetProperty="collapsed" path="lockToUser" />
                    </box:imSmartInput>
                    <box:vbox id="textInfoContainer" inherits="show=showUserInfo" collapsed="false">
                        <box:hbox>
                            <box:aolLabel value="&quicknote.form.onlinestatus;" s:marginRight="0"/>
                            <box:aolLabel inherits="value=onlineStatus"/>
                        </box:hbox>
                        <box:hbox>
                            <box:aolLabel value="&quicknote.form.onlinetime;" s:marginRight="0" s:marginTop="0"/>
                            <box:aolLabel inherits="value=onlineTime" s:marginTop="0"/>
                            <box:binding targetProperty="collapsed" elementSource="_gadget" path="onlineTime" sourceTransformer="toolkit:empty" />
                        </box:hbox>
                    </box:vbox>
                    <box:spacer s:flex="1" />
                </box:vbox>
            </box:hbox>
            <box:hbox id="buddyIconContainer" inherits="show=showUserInfo" collapsed="false">
                <box:buddyIcon id="buddyIcon" compact="true" />
            </box:hbox>
        </parts>        
        
    </gadget>
    <style tag="toUserPanel" id="toUserPanelStyle" orient="horizontal">
        <part name="imToLabel" marginTop="3" />
        <part name="buddyIconContainer" overflow="hidden" width="48" maxHeight="auto" maxWidth="auto" vAlign="start">
            <attribute name="show" width="1" padding="0" value="false" animate="url(#ani.shrinkPanelX)" animateExit="url(#ani.growPanelX)"/>
        </part>
        <part name="buddyIcon" minHeight="48" minWidth="48" />
        <part name="textInfoContainer" overflow="hidden" maxHeight="auto" maxWidth="auto" >
            <attribute name="show" height="1" value="false" animate="url(#ani.shrinkPanelY)" animateExit="url(#ani.growPanelY)"/>
        </part>
    </style>
    <style id="accToUserPanelStyle" accStyleFor="toUserPanelTheme" inherits="#toUserPanelTheme" fill="sysColorWindow">
    </style>

    <gadget id="aolRosterAndInvite" type="box" language="jscript" script="box://imApp/content/im/imRosterAndInvite.js">
        <script language="jscript" href="box://imApp/content/popContextMenu.js" />
        <script language="jscript" href="box://imApp/content/buddyInfo.js" />
        <script language="jscript" href="box://imApp/content/screenNameParsing.js"/>
        <parts>
            <box:vbox id="mainContainer" s:flex="1">
                <box:hbox id="inviteBuddy" axis="x">
                    <box:imSmartInput accName="&im.form.chat.inviteSmartInput.accName;" id="smartInputChatInvite" smartBoxId="rosterAutoCompletePopup" autoSeparator="true" smartboxSeparator=","  on:modified="gadget:updateInviteAddButton();" 
                        customButtonLabel="&im.form.add;" hideCustomButton="false">
                        <box:binding objectSource="model" targetProperty="screenName" path="fromUser" method="twoWay"/>
                    </box:imSmartInput>
                </box:hbox>
                <box:aolListBox accName="&im.form.chat.rosterList.accName;" id="chatBuddiesListBox" selectMode="single" rightMouseMode="select">
                    <box:reaction event="doubleClick" action="gadget:chatListDoubleClick();"/>
                    <box:columns >
                        <box:aolColumn s:width="16"/>
                        <box:aolColumn s:flex="1" s:maxWidth="auto"/>
                        <box:aolColumn s:width="12" />    
                    </box:columns>
                    <box:rows id="chatBuddies">
                    </box:rows>
                    <box:reaction event="keyPress" keyCode="&im.form.appsKeyOpenContext_assessKey;" action="gadget:openContext();"/>
                    <box:reaction event="keyPress" keyCode="&im.form.fKeyOpenContext_assessKey;" ctrl="false" shift="true" alt="false" action="gadget:openContext();"/>
                </box:aolListBox>
                <box:vbox>
                    <box:aolLabel collapsed="true" id="timeLeftLabel" value=""/>
                </box:vbox>
            </box:vbox>
        </parts>
        <behavior>
            <reaction event="boxCreated"    action="gadget:onConstructed();"/>
            <reaction event="command"       action="gadget:onRosterCommand();"/>
            <reaction event="dragOver" action="gadget:OnDragOver();" />
            <reaction event="dragDrop" action="gadget:OnDragDrop();" />
        </behavior>
    </gadget>

    <gadget id="buddyStatus" type="box" >
        <attributes context="chatBuddyContext" currentSpeaker="false" showIcon="0"/>
        <parts>
            <box:box id="filledArea">
                <box:binding elementSource="_gadget" targetProperty="collapsed" path="showIcon" method="oneWay" />
            </box:box>
            <box:image id="icon" inherits="src=icon">
                <box:binding elementSource="_gadget" targetProperty="src" path="icon" method="oneWay"/>
                <box:binding elementSource="_gadget" targetProperty="collapsed" path="showIcon"
                        sourceTransformer="toolkit:not" method="oneWay" />
            </box:image>
        </parts>
    </gadget>
    <style tag="buddyStatus" width="10" vAlign="center">
        <part name="filledArea" width="10" height="10" fillCornerRadius="5" fill="#00444444">
            <attribute name="currentSpeaker" value="1" fill="#FF44FF44" animate="url(#ani.currentSpeaker.spot)" animateOut="url(#ani.currentSpeaker.spot.out)"/>
            <attribute name="currentSpeaker" value="0" fill="#00444444"/>
        </part>
    </style>

    <gadget id="buddyCell" type="box" language="jscript" script="box://imApp/content/im/buddyCell.js">
        <attributes accNameAt="label" context="chatBuddyContext" blockedUser="false" invitedNotJoined="false" textHighlight="url(#brush.searchHilight)" crop="right" isOwner="false"/>
        <parts>            
            <box:binding elementSource="_parent" targetProperty="selected" path="selected" method="twoWay" />
            <box:hbox id="container" blockEvents="true" inherits="tooltip,instantTooltip,customTooltip" autoTooltip="label" tooltipAlign="overlap">
                <box:aolLabel id="label" inherits="value,isOwner" autoTooltip="none"/>                    
            </box:hbox>
            <box:content/>
        </parts>
        <behavior>
            <reaction event="lastFrame" action="gadget:onBuddyCellLastFrame();" />
            <reaction event="attributeSet" attributeName="blockedUser" action="gadget:onBuddyCellBlockedUser();" />
            <reaction event="hoverHold" action="gadget:onBuddyCellHoverHold();" />
        </behavior>
    </gadget>

    <style tag="buddyCell" id="buddyCellStyle" flex="1" maxWidth="auto" overflow="hidden">
        <part name="container" vAlign="center" flex="1" maxWidth="auto"/>       
        <part name="label" crop="right" flex="1" padding="1" textColor="#000000" fontSize="11px" textHighlight="url(#brush.searchHighlight)">
            <attribute name="isOwner" value="true" fontBold="true" />
        </part>
        <attribute name="buddyInChat" value="1" animate="url(#ani.joinChat)"/>
        <attribute name="buddyInChat" value="0" animate="url(#ani.leaveChat)"/>
        <attribute name="invitedNotJoined" value="1" opacity="50%"/>
        <attribute name="invitedNotJoined" value="0" opacity="100%"/>
    </style>
 
    <gadget id="cancelInvitationForBuddy">
        <attributes buddyName=""/>
        <parts>
            <box:aolImageButton accName="&im.form.cancelInvite;" id="close" />
        </parts>
    </gadget>
 
    <gadget id="dimChooserPopup" type="popup" language="jscript" script="dimChooserPopup.js">
        <attributes showNoActivate="ignoreInput" popupAlign="end_before" blockEvents="false" translucent="true"  />
        <parts>
            <box:vbox id="dragArea" s:flex="1" s:hAlign="stretch">
                <box:hbox id="dragAreaSendFile">
                    <box:aolLabel id="sendFileLabel" value="&im.form.dimchooser.sendFile;" ornament="true" s:fontSize="15" wordwrap="true" justify="center">
                        <box:binding targetProperty="highlight" elementSource="_parent" path="highlight" />
                    </box:aolLabel>
                </box:hbox>
                <box:hbox id="dragAreaSendDIM">
                    <box:aolLabel id="sendDIMLabel" value="&im.form.dimchooser.sendPicShare;" ornament="true" s:fontSize="15" wordwrap="true" justify="center">
                        <box:binding targetProperty="highlight" elementSource="_parent" path="highlight" />
                    </box:aolLabel>
                </box:hbox>
            </box:vbox>
        </parts>
        <behavior>
            <reaction event="dragOver" action="gadget:onDragOver();" />
            <reaction event="dragOut" action="gadget:onDragOut();" />
            <reaction event="click" action="gadget:hide();" />
        </behavior>
    </gadget>
    <style id="dimChooserPopupStyle" tag="dimChooserPopup" position="fixed" layer="stack" fill="#80ffffff">
        <part name="dragAreaSendFile" flex="1" hAlign="center" vAlign="center" 
              fill="#d078A9B8" fillCornerRadius="5 5 0 0" margin="10 10 0 10"
            >
            <attribute name="highlight" value="true" fill="#e0ACCFEA" animate="url(#fillAnimate)" animateExit="url(#fillAnimate)"/>
        </part>
        <part name="dragAreaSendDIM" flex="1" hAlign="center" vAlign="center" 
              fill="#d078A2B8" fillCornerRadius="0 0 5 5" margin="0 10 10 10"
            >
            <attribute name="highlight" value="true" fill="#e0ACC7EA" animate="url(#fillAnimate)" animateExit="url(#fillAnimate)" />
        </part>
        <part name="sendFileLabel" padding="15 5" fillCornerRadius="3" fill="#40ffffff" flex="1" margin="0 35" maxWidth="auto">
            <attribute name="highlight" value="true" fill="#a0ffffff" animate="url(#fillAnimate)" animateExit="url(#fillAnimate)" />
        </part>
        <part name="sendDIMLabel" padding="15 5" fillCornerRadius="3" fill="#40ffffff" flex="1" margin="0 35" maxWidth="auto">
            <attribute name="highlight" value="true" fill="#a0ffffff" animate="url(#fillAnimate)" animateExit="url(#fillAnimate)" />
        </part>
    </style>
    
    <gadget id="awayStatusPanel" type="box" language="JScript" script="awayStatusPanel.js">
        <script language="JScript" href="../dateFormat.js" />
        <script language="jscript" href="../ImConst.js"/>
        <attributes />
        <parts>
            <box:hbox id="controlPanel" s:marginBottom="5" s:vAlign="center" collapsed="true">
                <box:aolLabel id="awayComboBoxLabel" value="&im.awayPanel.awayStatusFor;" s:fontBold="true" />
                <box:aolComboBox id="awayStatusComboBox" on:select="gadget:onComboSelect();" s:minWidth="125" s:maxWidth="125" accName="&im.awayPanel.comboBoxAccName;"/>
            </box:hbox>
            <box:deck id="awayStatusHolder" s:clip="0">
            
            </box:deck>
            <box:hbox>
                <box:aolButton id="returnFromAway" label="&im.awayPanel.returnFromAway;" defaultButton="true" on:command="gadget:returnFromAway();" />
                <box:aolButton id="hideIMButton" label="&im.awayPanel.hideIMs;" tooltip="&im.awayPanel.hideIMs.tooltip;" on:command="gadget:hideIMs();" />
            </box:hbox>
            <box:vbox s:margin="5 5 5 5">
                <box:aolCheckButton label="&im.awayPanel.stayAway;" s:margin="0" s:padding="0">
                    <box:binding targetProperty="toggled" objectSource="primaryPrefs" path="imReturnFromAwayOnSend" method="twoWay" sourceTransformer="toolkit:not" targetTransformer="toolkit:not"/>
                </box:aolCheckButton>
                <box:aolCheckButton label="&im.awayPanel.groupWhileAway;" s:margin="0" s:padding="0">
                    <box:binding targetProperty="collapsed" objectSource="primaryPrefs" path="imGroupIMs" />
                    <box:binding targetProperty="toggled" objectSource="primaryPrefs" path="imGroupWhileAway" method="twoWay"/>
                </box:aolCheckButton>
                <box:aolCheckButton label="&im.awayPanel.disableSounds;" s:margin="0" s:padding="0" >
                    <box:binding targetProperty="toggled" objectSource="primaryPrefs" path="soundMuteWhileAway" method="twoWay"/>
                </box:aolCheckButton>
                <box:aolCheckButton label="&im.awayPanel.disableNotifications;" s:margin="0" s:padding="0" >
                    <box:binding targetProperty="toggled" objectSource="primaryPrefs" path="toastersHideWhileAway" method="twoWay"/>
                </box:aolCheckButton>
            </box:vbox>
        </parts>    
    </gadget>
    
    <gadget id="awayStatusItem" type="box" language="JScript" script="awayStatusItem.js">
        <attributes awayMessage="" userName="" imCount="0" />
        <parts>
            <box:vbox id="awayStatus" s:flex="1">
                <box:binding targetProperty="collapsed" elementSource="_gadget" path="awayMessage" sourceTransformer="toolkit:empty" />
                <box:hbox id="iconAndMessage" s:vAlign="stretch" s:hAlign="stretch">
                    <box:image id="buddyIcon" inherits="src=iconUrl" />
                    <box:dhtml id="dhtml" inherits="html=awayMessage" s:minHeight="10" on:readyStateChanged="gadget:onDHTMLReadyStateChange();" />
                </box:hbox>
                <box:hflow id="statusArea" s:maxWidth="auto">
                    <box:hbox>
                        <box:aolLabel id="imCountHeader" value="&im.awayPanel.receivedHeader;" />
                        <box:aolLabel id="imCountLabel" inherits="value=imCount" />
                        <box:spacer s:width="5" />
                    </box:hbox>
                    <box:hbox>
                        <box:aolLabel id="lastImTimestampHeader" value="&im.awayPanel.timeStampHeader;">
                            <box:binding targetProperty="collapsed" elementSource="_gadget" path="lastImTimestamp" sourceTransformer="toolkit:empty" />
                        </box:aolLabel>
                        <box:aolLabel id="lastImTimestamp" inherits="value=lastImTimestamp" />
                        <box:spacer s:width="5" />
                    </box:hbox>
                    <box:hbox>
                        <box:aolLabel id="awaySinceHeader" value="&im.awayPanel.awayTimeHeader;" />
                        <box:aolLabel id="awaySinceLabel" inherits="value=awaySince" />
                    </box:hbox>
                </box:hflow>
            </box:vbox>
            <box:vbox id="onlineStatus">
                <box:binding targetProperty="collapsed" elementSource="_gadget" path="awayMessage" sourceTransformer="toolkit:notEmpty" />
                <box:aolLabel value="&im.awayPanel.statusOnline;" />
            </box:vbox>
        </parts>
    </gadget>

    <animation id="iconOpacityAnimate">
        <animate name="opacity" type="style" from="before" to="before" begin="0ms" end="400ms"/>
        <animate name="opacity" type="style" from="before" to="after" begin="400ms" end="900ms" dynamics="accelerate"/>
    </animation>
    <animation id="ani.growPanelY">
        <animate name="collapsed" type="attribute" from="true" to="false" begin="0ms" end="0ms"/>
        <animate name="height" type="style" from="before" to="after" begin="0ms" dur="300ms" dynamics="smoothSpline"/>
    </animation>
    <animation id="ani.shrinkPanelY">
        <animate name="height" type="style" from="before" to="after" begin="0ms" dur="300ms" dynamics="smoothSpline"/>
        <animate name="collapsed" type="attribute" from="false" to="true" begin="300ms" end="300ms"/>
    </animation>
    <animation id="ani.growPanelX">
        <set name="collapsed" type="attribute" to="false" begin="0ms" />
        <animate name="width" type="style" from="before" to="after" begin="0ms" dur="300ms" dynamics="smoothSpline"/>
    </animation>
    <animation id="ani.shrinkPanelX">
        <animate name="width" type="style" from="before" to="after" begin="0ms" dur="300ms" dynamics="smoothSpline"/>
        <set name="collapsed" type="attribute" to="true" begin="300ms"/>
    </animation>
    <animation id="expandKnockKnock">
      <set name="collapsed" type="attribute" to="false" begin="2ms" />
      <animate name="height" type="style" from="1" to="expandedHeight" begin="0ms" dur="350ms" dynamics="spring5"/>
      <animate name="maxHeight" type="style" from="1" to="expandedHeight" begin="0ms" dur="350ms" dynamics="spring5"/>
      <set name="overflow" type="style" to="scroll" begin="350ms" />
    </animation>
    <animation id="shrinkKnockKnock">
      <set name="overflow" type="style" to="hidden" begin="0ms" />
      <animate name="height" type="style" from="before" to="1" begin="0ms" dur="200ms" dynamics="smoothSpline"/>
      <animate name="maxHeight" type="style" from="before" to="1" begin="0ms" dur="200ms" dynamics="smoothSpline"/>
      <set name="collapsed" type="attribute" to="true" begin="200ms" />
    </animation>    
    
    <animation id="hideFileStatusPanel">
        <set name="overflow" type="style" to="hidden" begin="0ms" />
        <animate name="maxHeight" type="style" from="before" to="1" begin="0ms" end="65ms" dynamics="accelerate"/>
        <animate name="height" type="style" from="before" to="1" begin="0ms" end="65ms" dynamics="accelerate"/>
        <set name="hideAnimateComplete" type="attribute" to="true" begin="200ms" />
    </animation>
</library>
