403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Program Files (x86)/Mail Enable/Bin/NETWebMail/Mondo/lang/sys/Forms/MAI/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Program Files (x86)/Mail Enable/Bin/NETWebMail/Mondo/lang/sys/Forms/MAI/Compose.aspx
<%@ Page Language="vb" validateRequest="false" AutoEventWireup="false" Codebehind="Compose.aspx.vb" Inherits="MailEnable.Clients.WebMail.Mondo.Compose" %>
<%@ Register TagPrefix="uc1" TagName="uscStyleHeader" Src="../../../Controls/uscStyleHeader.ascx" %>
<%@ Register TagPrefix="RapidSpellWeb" Namespace="Keyoti.RapidSpell" Assembly="Keyoti.RapidSpellWeb" %>
<%@ Register TagPrefix="uc2" TagName="uscPageBorder_Start" Src="../../../Controls/uscPageBorder_Start.ascx" %>
<%@ Register TagPrefix="uc3" TagName="uscPageBorder_End" Src="../../../Controls/uscPageBorder_End.ascx" %>
<%@ Register TagPrefix="uc4" TagName="uscScriptsInclude" Src="../../../Controls/ScriptsInclude.ascx" %>
<%@ Register TagPrefix="uc5" TagName="uscLanguageTokenMondo" Src="../../../Controls/uscLanguageToken.ascx" %>
<uc5:uscLanguageTokenMondo id="uscToken" runat="server"></uc5:uscLanguageTokenMondo>
<!DOCTYPE html>
<html>
    <head>
		<title><asp:Literal id="litWindowTitle" runat="server"></asp:Literal></title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<uc1:uscstyleheader id="UscStyleHeader1" runat="server"></uc1:uscstyleheader>
		<uc4:uscScriptsInclude id="ScriptsInclude" runat="server"></uc4:uscScriptsInclude>
		
		<%=MailEnable.WebMail.Configuration.Editor_ScriptIncludes(SelectedEditor, GetVirtualApplicationPath())%>
		<script type="text/javascript" language="javascript">
		<!--
		    var ModalDialogWindow;
		    var ModalDialogInterval;
		    var ModalDialog = new Object;
		    var TextChanged = false;
		    var SavedAsDraft = false;
		    var NeedCheckForChange = true;	// denotes whether we need to check for changes
		    var gIsNewWindow = false;       // whether or not this page is in a new (separate) window
            var oTimeoutDialog = null;
            var gUploadInProgress = false;
            var ME_ADDRESS_AUTOCOMPLETE_DELAY = 1000;
            var addressAutocompleteTimeout = null;
            var gPageMode = '<%= gPageMode %>';
		    var sMode = '<%= ParseRequestArgument("Mode") %>';
		    var sFolder = '<%= ParseRequestArgument("Folder") %>';
		    var bAllowNewWindows = '<%= bAllowNewWindows %>';        
		    var sCurrMsgID = '<%=MessageID%>';
		    var gBrowserType = GetBrowserType();
		    var gDoSig = '<%= gDoSig %>';
            var gUploadSizeInKB = <%=GetMaximumUploadSize%>;

            var gAutoSignature='';
            var tempsig='';
		    ModalDialog.value = '';
		    ModalDialog.eventhandler='';
    		
		    var oConfirmDialog = null;
		    var oAlertDialog = null;
    		
    		var gAutoSaveInterval = null;
    		var gAutoSaveFreq = <%= gAutoSaveFrequency %>;  // how often to check for autosave (in milliseconds)
    		
		    var SkinRoot = '<%=Session("skin")%>';
		    
		    var gSpellcheckDone = false;
    		
    		var oToAddressTextbox;
    		var oCCAddressTextbox;
    		var oBCCAddressTextbox;
    		
		    var gUserText = '';
            var MailboxIdentities = new Array();
            var SelectedIdentity = null;   // Identity object
            		
            var bSendRMail = false;

            var g_opt={};
		    g_opt['ME_VALIDATIONTOKEN'] = '<% =Session.item("ME_VALIDATIONTOKEN") %>';

            <%=Editor_PageVariableInitialisation()%>    
            
    		<% If bIdentitiesEnabled Then %>
    		$(document).ready(function() 
            {
                $('#ddlMsgFrom').on('change', function() { IdentityChanged(); } );
                
                // page has finished loading and editor/textbox loaded
                window.setTimeout("MessageLoaded();", 1000);
            });
            <% End If %>
    		
		    function HookResizeEvent()
		    {
			    if (gBrowserType == BROWSER_TYPE_SAFARI)
			    {
				    addEvent(getTopAppWindow(), 'resize', ResizeBody, true);
			    }
			    else
			    {
				    addEvent(window, 'resize', ResizeBody, true);
			    }
		    }
    		
		    function UnhookResizeEvent()
		    {
			    if (gBrowserType == BROWSER_TYPE_SAFARI)
			    {
				    removeEvent(getTopAppWindow(), 'resize', ResizeBody, true);
			    }
			    else
			    {
				    removeEvent(window, 'resize', ResizeBody, true);
			    }
		    }
    					
		    HookResizeEvent();

    		
	        function ServerRequest(sCommand, sData, bUseCallback, sFrameName)
	        {
			    return LIBAjax_ServerRequest(sCommand, sData, bUseCallback, sFrameName);
	        }
    	    
	        function ServerPost(sCommand, sData, bUseCallback, sFrameName)
	        {
		        return LIBAjax_ServerPost(sCommand, sData, bUseCallback, sFrameName);
	        }
    		
		    function ShowResolveDialog(addressList,Policy)
		    {
			    var oDiag;
			    var oTableResolve;
			    var oTableAddressList;
			    var oRow;
			    var oCell;
			    var i;
			    var iNumAddresses;
			    var iNumRows;
    			
			    if (addressList)
			    {
				    iNumAddresses = GetFieldCount(addressList, ";");
			    }
			    else
			    {
				    iNumAddresses = 0;
			    }
    			
			    oDiag = window.document.getElementById('divResolve');
			    if (oDiag)
			    {
				    oTableResolve = window.document.getElementById("tblResolve").getElementsByTagName("tbody")[0];
    				
				    if ( oTableResolve )
				    {
					    if ( iNumAddresses > 0 )
					    {
						    oTableAddressList = window.document.getElementById("tblAddressList").getElementsByTagName("tbody")[0];

						    if ( oTableAddressList && (oTableAddressList.rows.length > 0))
						    {
							    iNumRows =  oTableAddressList.rows.length;
							    for (i = 0; i < iNumRows; i++)
							    {
								    oTableAddressList.deleteRow(0);
							    }
						    }
    						
						    if ( oTableAddressList )
						    {
							    oRow = window.document.createElement("TR");
							    oRow.className = "dataTable_table_head_shell";
							    oCell = window.document.createElement("TD");
							    oCell.style.fontWeight = "bold";
							    oCell.style.textAlign = "left";
							    SetElementText(oCell, t_("[ME_TXT-Address]") + ":");
							    oRow.appendChild(oCell);
    							
							    oCell = window.document.createElement("TD");
							    oCell.style.fontWeight = "bold";
							    oCell.style.textAlign = "left";
							    SetElementText(oCell, t_("[ME_TXT-Reason]") + ":");
							    oRow.appendChild(oCell);
    							
							    oTableAddressList.appendChild(oRow);
    							
							    if (Policy=='1')
							    {
								    sReason = t_("[ME_TXT-AuthenticationFailed]") + " "
							    }
							    else
							    {
								    sReason = t_("[ME_TXT-AddressFormatIsInvalid.]")
							    }
    							
							    for (i = 0; i < iNumAddresses; i++)
							    {
								    oRow = window.document.createElement("TR");
								    
								    if ((i%2) != 0)
								        oRow.style.background = "#F0F0F0";  // alternating row color
								        
								    oCell = window.document.createElement("TD");
								    oCell.style.textAlign = "left";
								    SetElementText(oCell, GetListItem(addressList, ";", i));
								    oRow.appendChild(oCell);
    								
								    oCell = window.document.createElement("TD");
								    oCell.style.textAlign = "left";
								    SetElementText(oCell, sReason);
								    oRow.appendChild(oCell);
								    oTableAddressList.appendChild(oRow);
							    }
    							
						    }
    						
						    oTableResolve.rows[0].style.display = '';  // show address list
						    oTableResolve.rows[1].style.display = 'none';
					    }
					    else
					    {
						    oTableResolve.rows[0].style.display = 'none';  // hide the address list
						    oTableResolve.rows[1].style.display = '';
					    }
				    }
    				
				    oDiag.style.zIndex = '10001';
				    oDiag.style.visibility = "visible";
				    oDiag.style.display = "block";
				    
				    oDiag.style.top = (window.document.body.clientHeight/2 - $(oDiag).outerHeight()/2) + "px";
				    oDiag.style.left = (window.document.body.clientWidth/2 - $(oDiag).outerWidth()/2) + "px";
			    }
		    }
    		
		    function HideResolveDialog()
		    {
			    var oDiag;
    			
			    oDiag = window.document.getElementById('divResolve');
			    if ( oDiag )
			    {
				    oDiag.style.zIndex = '-1';
				    oDiag.style.visibility = 'hidden';
				    oDiag.style.display = "none";
			    }
		    }
    		
		    function ProcessSendResult(BaseNode)
		    {
			    var Result = GetXMLValue(BaseNode.getElementsByTagName("RETURNVALUE")[0]);
			    var ErrorValue;
			    var ErrorDetails;
			    var UnresolvedRecipients;
			    var Policy;
    			
			    var oParent = getParent();

			    if ( Result == '1' )  // Success...
                {
                    //show the notification so we know that the actual message has been sent
				    if (oParent.ShowNotification) {
					    oParent.ShowNotification(t_('[ME_TXT-Messagesentsuccessfully]'));
					}
				    NeedCheckForChange = false;
				    if (oParent.getTopAppWindow().GetOptionValue('WebMail-AddNewContactsOnSend'))
				    {
				        // do a Server.Transfer() to AddRecipients page (if option is turned on)
				        __doPostBack('', '');
				    }
				    else
				    {
				        ClearContents();
			            CloseWindow(false);
			        }    			
			    }
			    else if ( Result == '0' )  // Failed...
			    {
				    Policy = GetXMLValue(BaseNode.getElementsByTagName("POLICY")[0]);
				    ErrorValue = GetXMLValue(BaseNode.getElementsByTagName("ERROR")[0].getElementsByTagName("ERROR_VALUE")[0]);
				    ErrorDescription = GetXMLValue(BaseNode.getElementsByTagName("ERROR")[0].getElementsByTagName("ERROR_DESCRIPTION")[0]);
    				
				    if ( ErrorValue == '1' )  // Authorisation error
				    {
					    ShowAlert(t_("[ME_TXT-Error]"), ErrorDescription, true);
				    }
    				
				    if ( ErrorValue == '2' )  // Address resolving error
				    {
					    UnresolvedRecipients = GetXMLValue(BaseNode.getElementsByTagName("ERROR")[0].getElementsByTagName("UNRESOLVEDRECIPIENTS")[0]);
					    ShowResolveDialog(UnresolvedRecipients,Policy);
				    }
    				
				    if ( ErrorValue == '3' )  // Send error
				    {
					    ShowAlert(t_("[ME_TXT-Error]"), ErrorDescription, true);
				    }
    				
				    if ( ErrorValue == '5' )  // Session timeout
				    {
					    if (oParent.SetPageContextMode) 
						    oParent.SetPageContextMode(oParent.CONTEXT_TIMEOUT);  // timeout mode
				    }
			    }
    			
                EnableToolbarButton('btnSend', function() { Send(); });
                
			    return false;
		    }
    		
		    function ProcessContextSwitchResult(BaseNode)
		    {
			    var Result = GetXMLValue(BaseNode.getElementsByTagName("RETURNVALUE")[0]);
			    var ErrorValue;
			    var ErrorDetails;
			    var UnresolvedRecipients;
    						
			    if ( Result == '1' )  // Success...
			    {
				    TextChanged = false;
				    SavedAsDraft = false;
				    var sMessageID = GetXMLValue(BaseNode.getElementsByTagName("MESSAGEID")[0]);
				    SetComposeID(sMessageID);				
				    window.location = 'ListAttachments.aspx?Mode=Compose&ID=' + sMessageID + '&MsgFormat=<%=MsgFormat%>&FormAction=Send&ComposeMode=General&Folder=/Drafts&Page=<%=ParseRequestArgument("Page")%>&WindowContext=<%=ParseRequestArgument("WindowContext")%>';			
    				
			    }
			    else if ( Result == '0' )  // Failed...
			    {
				    ShowAlert(t_("[ME_TXT-Error]"), t_("[ME_TXT-FailedtosavemessagetotheDraftsfolder]") + ".", true);
			    }
		    }
    		
    		
		    function ProcessSaveResult(BaseNode)
		    {
			    var Result = GetXMLValue(BaseNode.getElementsByTagName("RETURNVALUE")[0]);
			    var ErrorValue;
			    var ErrorDetails;
			    var UnresolvedRecipients;
    			
			    var oParent = getParent();
    			
			    if ( Result == '1' )  // Success...
			    {
				    var sMessageID = GetXMLValue(BaseNode.getElementsByTagName("MESSAGEID")[0]);
				    SetComposeID(sMessageID);
				    
				    if (oParent.ShowNotification)
					    oParent.ShowNotification(t_("[ME_TXT-MessagesuccessfullysavedtotheDraftsfolder]"));
					    
				    TextChanged = false;
				    SavedAsDraft = true;
				    NeedCheckForChange = false;
			    }
			    else if ( Result == '0' )  // Failed...
			    {
				    NeedCheckForChange = true;
				    ShowAlert(t_("[ME_TXT-Error]"), t_("[ME_TXT-FailedtosavemessagetotheDraftsfolder]") + ".", true);
			    }
		    }
    		
		    function ProcessAutoSignatureResult(BaseNode)
		    {
			    gAutoSignature = '\n\n' + GetXMLValue(BaseNode.getElementsByTagName("SIGNATURE")[0]);
			    SetAutoSignature();
		    }
    		
		    function ProcessXMLResult(responseXML)
		    {
		        if (responseXML == undefined)
		        {
		            alert('responseXML == undefined');
		            return false;
		        }
			    var BaseNode = responseXML.getElementsByTagName("BASEELEMENT")[0];
    			
			    if (BaseNode)  // valid response XML
			    {
				    var Schema = GetXMLValue(BaseNode.attributes.getNamedItem('SCHEMA'));
				    var Command = GetXMLValue(BaseNode.attributes.getNamedItem('METHOD'));
    				
				    if (Schema == 'RESULT')
				    {
					    if (Command == 'CHECK-ADDRESSLIST')
					    {
						    ProcessAddressLookUp(BaseNode);
					    }
    					
					    if (Command == 'SEND-MESSAGE')
					    {
						    ProcessSendResult(BaseNode);
					    }
    					
					    if (Command == 'SAVE-DRAFT')
					    {
						    ProcessSaveResult(BaseNode);
					    }					
					    if (Command == 'CONTEXT-SWITCH')
					    {
						    ProcessContextSwitchResult(BaseNode);
					    }
					    if (Command == 'GET-AUTOSIGNATURE')
					    {
						    ProcessAutoSignatureResult(BaseNode);
					    }
					    if (Command == 'GET-MBX-IDENTITY')
					    {
					        ProcessIdentityGet(BaseNode);
					    }
					    if (Command == 'GET-MBX-IDENTITY-SIGNATURE-TEXT')
					    {
					        ProcessGetIdentitySignatureText(BaseNode);
					    }
					    if (Command == 'GET-MBX-SIGNATURE-TEXT')
					    {
					        UpdateSignatureText(BaseNode);
					    }
    					
					    return true;
				    }    				
			    }
			    return true;			    
		    }
		    

            function getScreenWidth()
            {		    
                var screenwidth = 0;
	            if (self.innerWidth) 
	            {
		            screenwidth = self.innerWidth;
	            }
	            else if (window.document.documentElement && window.document.documentElement.clientWidth)
	            {
		            screenwidth = window.document.documentElement.clientWidth;
	            }
	            else if (window.document.body)
	            {
		            screenwidth = window.document.body.clientWidth;
	            }			        
	            return screenwidth;	        
	        }
		    

            function getScreenHeight()
            {		    
                var screenheight = 0;
	            if (self.innerHeight) 
	            {
		            screenheight = self.innerHeight;
	            }
	            else if (window.document.documentElement && window.document.documentElement.clientHeight)
	            {
		            screenheight = window.document.documentElement.clientHeight;
	            }
	            else if (window.document.body)
	            {
		            screenheight = window.document.body.clientHeight;
	            }			        
	            if (gBrowserType==BROWSER_TYPE_SAFARI) screenheight = window.innerHeight;
	            return screenheight;	        
	        }
		    
            function GetMaxHeight(element, topoffset, bottomoffset)		    
		    {
		        var offset_b = 0;
		        var offset_t = 0;
		        var offset_l = 0;
		        var offset_r = 0;

		        if (element==null) return;
		        
		        if (topoffset)
		        {
		            offset_t = parseInt(topoffset);
		            if (isNaN(offset_t)) offset_t=0;
		        }
		        if (bottomoffset)
		        {
		            offset_b = parseInt(bottomoffset);
		            if (isNaN(offset_b)) offset_b=0;
		        }
    		    
		        var screenheight = getScreenHeight();

    			var heightAvailable = screenheight - (offset_t + offset_b);
		        heightAvailable -= getElementUltimateOffsetTop(element);	
    			
			    return heightAvailable;
		    }
    			
		    function MaximiseElement(element, source, topoffset, bottomoffset, leftoffset, rightoffset)		    
		    {
		        var offset_b = 0;
		        var offset_t = 0;
		        var offset_l = 0;
		        var offset_r = 0;
		        if (element==null) return;
		        
		        if (topoffset)
		        {
		            offset_t = parseInt(topoffset);
		            if (isNaN(offset_t)) offset_t=0;
		        }
		        if (bottomoffset)
		        {
		            offset_b = parseInt(bottomoffset);
		            if (isNaN(offset_b)) offset_b=0;
		        }
		        if (leftoffset)
		        {
		            offset_l = parseInt(leftoffset);
		            if (isNaN(offset_l)) offset_l=0;
		        }
		        if (rightoffset)
		        {
		            offset_r = parseInt(rightoffset);
		            if (isNaN(offset_r)) offset_r=0;
		        }
		            		    
    		    
		        var screenwidth = getScreenWidth();
		        var screenheight = getScreenHeight();
		        if (source)
		        {
		            screenheight = source.offsetHeight;
		            screenwidth = source.offsetWidth;		            
		        }

			    var widthAvailable = screenwidth - (offset_l + offset_r);
			    if (!leftoffset)
			    {
			        widthAvailable -= getElementUltimateOffsetLeft(element);
			    }
    			    			
    			var heightAvailable = screenheight - (offset_t + offset_b);
		        if (!source)
		        {
		            heightAvailable -= getElementUltimateOffsetTop(element);	
		        }
    			
    			if (widthAvailable > 0)
    			{
                    SetElementOffsetWidth(element, widthAvailable);    			
    			}
			     
    			
			    if (heightAvailable > 0)
			    {
			        //alert(element.id + ':' + heightAvailable);
				    SetElementOffsetHeight(element, heightAvailable);
			    }
		    }
    				
    	    
    	    function getNextSiblingObject(currentNode)
    	    {
    	        if (currentNode)
    	        {
                    var n = currentNode; 
                    do currentNode = currentNode.nextSibling; 
                    while (currentNode && currentNode.nodeType != 1); 
                    return currentNode;  
                }   	    
    	    }
    	    
 
		    function ResizeBody()
		    {
		        var container = document.getElementById('divEditor');
	            // size the container, but hide the control to make sure its sized properly
		       // container.style.display = 'none';
			   // MaximiseElement(document.getElementById('tdCompose'));		        
		       // container.style.display = 'block';    
	            
                var rightMargin = 0;
                var editorBottomMargin = 5;
                
               <%Select Case SelectedEditor%>
	            
                    <%  Case MailEnable.WebMail.Configuration.EditorSelection.TinyMCE%> 

                        var editor = tinymce.get('txtMsgBody');
                       
                         var nonEditHeight = 0;
                           $('.mce-edit-area').siblings().each(function()
                           {
                            nonEditHeight += $(this).outerHeight();
                          });
                         var newheight = GetMaxHeight(container,0,0) - nonEditHeight - 8;

                         if (editor.theme) editor.theme.resizeTo('100%',newheight);

                    <%  Case Else%>
			            // maximise the container
			            MaximiseElement(container,null,0,5,0,rightMargin);
    			        
				        // maximise the textarea (message body)
				        MaximiseElement(window.document.getElementById('txtMsgBody'), container, 10, editorBottomMargin, null, 7);
                     
               <%End Select%>
		    }
		    
		    function IsVisibleTarget(focusTarget)
		    {
			    return (focusTarget && focusTarget.style.display != 'none' &&
			            focusTarget.style.visibility != 'hidden' && focusTarget.offsetWidth > 0);
		    }
    		    		
		    function SetPageFocusByID(sID)
		    {
			    if (sID=='txtMsgBody_ifr')
			    {
	                setTimeout("tinymce.execCommand('mceFocus',false,'txtMsgBody');", 2000);
			    }
			    else if (sID == 'txtMsgBody')
			    {
			        // needs to be positioned at the top of existing reply text and/or signature insert
                    if (navigator.userAgent.match(/MSIE/))
                    {
                        var d =  $('#' + sID)[0].createTextRange();
                        d.collapse(true);
                        d.moveStart("character", 0);
                        d.moveEnd("character", 0);
                        d.select();
                    }
                    else
                    {
                        $('#' + sID)[0].selectionStart = 0;
                        $('#' + sID)[0].selectionEnd = 0;
                    }
                    $('#' + sID)[0].focus();
			    }
			    else
			    {
			        var oTarget = window.document.getElementById(sID);			
			        try
			        {
				        oTarget.focus();
			        }
			        catch(ex){};
				}
			    return;
		    }
    		    		
		    function ModalDialogMaintainFocus()
		    {
			    try
			    {
				    if (ModalDialogWindow.closed)
				    {
					    window.clearInterval(ModalDialogInterval);
					    eval(ModalDialog.eventhandler);
					    return;
				    }
				    ModalDialogWindow.focus(); 
			    }
			    catch (everything) {   }
		    }
    		        
		    function ModalDialogRemoveWatch()
		    {
			    ModalDialog.value = '';
			    ModalDialog.eventhandler = '';
		    }

    		
		    function ModalDialogShow(URL,Title,Features)
		    {
			    ModalDialogRemoveWatch();
    			
			    ModalDialogWindow=window.open(URL,Title,Features);
			    ModalDialogWindow.focus(); 
			    ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus()",5);
		    }
    				
		    function ShowAddressBook()
		    {
		        var curToAddresses = window.document.getElementById('txtMsgTo').value;
		        var curCcAddresses = window.document.getElementById('txtMsgCc').value;
		        var curBccAddresses = window.document.getElementById('txtMsgBcc').value;
    		    
		        var sURL = '<%= MailEnable.WebPath.GetVirtualDirectoryName(Request, "Mondo", Application("MEWebPath")) %>/Mondo/lang/sys/Forms/AddressBook.aspx?FieldTo=txtMsgTo&FieldCc=txtMsgCc&FieldBcc=txtMsgBcc&Source=0' + '&AddressesTo=' + curToAddresses + '&AddressesCc=' + curCcAddresses + '&AddressesBcc=' + curBccAddresses + '&Account=' + '<% =Session("AUTH_ACCOUNT") %>' + '&Username=' + '<% =Session("AUTH_USERNAME") %>' + '&Skin=' + '<% =Session("skin") %>';
    		    
 			    var sFeatures = new String("left=" + (window.screen.availWidth/2 - 700/2) + ",top=" + (window.screen.availHeight/2 - 450/2) + ",height=450,width=700,status=0,location=0,directories=0,toolbar=no,menubar=0,scrollbars=0,resizable=1");
 			    window.open(sURL, 'AddressBook', sFeatures);
     			
 			    // center=yes
 			    return true;
		    }
    		
		    function RSCustomInterface(tbElementName)
		    {
			    this.tbName = tbElementName;
			    this.getText = getText;
			    this.setText = setText;
    			
			    function getText()
			    {  
				    var ifr = window.document.getElementById(this.tbName);
				    if(ifr.contentWindow)
					    return ifr.contentWindow.document.body.innerHTML;
				    else
					    return ifr.window.document.body.innerHTML;
			    }
    			
			    function setText(text)
			    {
				    var ifr = window.document.getElementById(this.tbName);
				    if(ifr.contentWindow)
					    ifr.contentWindow.document.body.innerHTML = text;
				    else
					    ifr.window.document.body.innerHTML = text;
			    }
		    }
    		
		    function CheckFieldsForChanges()
		    {
			    var oTo = window.document.getElementById('txtMsgTo');
			    var oCc = window.document.getElementById('txtMsgCc');
			    var oBcc = window.document.getElementById('txtMsgBcc');
			    var oSubject = window.document.getElementById('txtMsgSubject');
    			
			    if (oTo && oCc && oBcc && oSubject)
			    {
				    if (oTo.value.length > 0 || oCc.value.length > 0 || oBcc.value.length > 0 || oSubject.value.length > 0)
				    {
					    TextChanged = true;
					    EnableToolbarButton("btnSaveDraft", function() { SaveAsDraft(); });
				    }
			    }
		    }
    		
		    function CheckForAttachments()
		    {
			    var ddlAttachments = window.document.getElementById('ddlAttachments');
    			
			    if (ddlAttachments)
			    {
				    if ((ddlAttachments.disabled == false) && (ddlAttachments.length > 0))
				    {
					    TextChanged = true;
					    EnableToolbarButton("btnSaveDraft", function() { SaveAsDraft(); });
				    }
			    }
		    }
    		
		    function DiscardAndClose()
		    {
			    // Close page without saving
			    SetComposeID('');
    			
			    ClearContents();            // clear for next time
			    NeedCheckForChange = true;  // reset it
			    CloseWindow(false);         // return to the message list
		    }
    		
		    function CheckForAnyChanges()
		    {
			    CheckFieldsForChanges();	// check the address and subject fields
			    CheckForAttachments();
		    }
    		
		    function ConfirmCancel()
		    {
		        oConfirmDialog.Confirm(t_("[ME_TXT-Confirm]"), t_("[ME_TXT-YouhaveunsavedchangesDoyouwishtodiscardthem?]"), function (){ DiscardAndClose(); });
		    }
    		
		    function Cancel()
		    {
			    if (!SavedAsDraft) {    // not yet saved
			        CheckForAnyChanges();
			    }
			    else
			    {
			        TextChanged = false;
			    }
    			
			    // If there are unsaved changes prompt the user about it
			    if (TextChanged == true)
			    {
				    ConfirmCancel();
			    }
			    else
			    {
				    // cancel the compose buffer so that next time they click on it, they get a new message
				    DiscardAndClose();
			    }
		    }
		    
		    function MessageLoaded()
		    {
		        // disable the dropdown list for now until we get the selected signature text
		        $('#ddlMsgFrom').attr('disabled', true);
			    var sOptions = '';
			    <% If MailEnable.WebMail.Configuration.EditorIsHTMLCapable(SelectedEditor) Then %>
				    sOptions = 'HTMLFormat=1';
			    <% End If %>
		        
		        // get the initial signature text and cache it
		        ServerRequest('GET-MBX-IDENTITY-SIGNATURE-TEXT', 'IdentityID=' + GetSelectedIdentityID()  + '&' + sOptions, false, 'Compose');
		    }
		    
		    function ProcessIdentityGet(BaseNode)
		    {
		        var Success = GetXMLValue(BaseNode.getElementsByTagName('RETURNVALUE')[0]) == '1'
		        if (Success)
                {
                    var Identities = BaseNode.getElementsByTagName('IDENTITY');
                    if (Identities.length > 0)
                    {
                        var IdentityNode = Identities[0];
                        var _IdentityID = GetXMLValue(IdentityNode.attributes.getNamedItem('ID'));
                        
                        var NameNode = IdentityNode.getElementsByTagName('NAME')[0];
                        var EmailNode = IdentityNode.getElementsByTagName('EMAIL')[0];
                        var ReplyToAddrNode = IdentityNode.getElementsByTagName('REPLY_TO_ADDRESS')[0];
                        var SignatureIDNode = IdentityNode.getElementsByTagName('SIGNATURE_ID')[0];
                        
                        MailboxIdentities[_IdentityID] =
                        {
                            IdentityID: _IdentityID,
                            Name: GetXMLValue(NameNode),
                            Email: GetXMLValue(EmailNode),
                            ReplyToAddr: GetXMLValue(ReplyToAddrNode),
                            SignatureID: GetXMLValue(SignatureIDNode)
                        };
		                
		                SelectedIdentity = MailboxIdentities[_IdentityID];
		                GetMailboxSignatureText(SelectedIdentity.SignatureID);
                    }
                }
		    }
		    
		    function GetMailboxSignatureText(SignatureID)
		    {
		        ServerRequest('GET-MBX-SIGNATURE-TEXT', 'SignatureID=' + SignatureID, false, 'Compose');
		    }
		    
		    function GetSignatureBody(sigText)
		    {
		        if ((sigText == undefined) || !sigText)
		            return "";
		            
		        var result = sigText;
		        var re = /^\s*\<div\>([\s\S]+)\<\/div\>\s*$/;
                var match = sigText.match(re);
                
                if (match)
                {
                    result = match[1];
                }
                
                return result;
		    }
		    
		    function ProcessGetIdentitySignatureText(BaseNode)
		    {
		        var Success = GetXMLValue(BaseNode.getElementsByTagName('RETURNVALUE')[0]) == '1'
		        
		        if (Success)
		        {
                    gAutoSignature = GetSignatureBody(GetXMLValue(BaseNode.getElementsByTagName('TEXT')[0]));
		        }
		        
		        // only now do we enable the 'From' dropdown list to be selectable
		        $('#ddlMsgFrom').attr('disabled', false);
		    }
		    
		    function UpdateSignatureText(BaseNode)
		    {
		        var sMsgBody = "";
		        var Success = (GetXMLValue(BaseNode.getElementsByTagName('RETURNVALUE')[0]) == '1');
		        var sSigText = "";
		        var reset = false;
                
                sMsgBody = GetMessageBody(false);
                
                if (Success)
                {
                    sSigText = GetXMLValue(BaseNode.getElementsByTagName('TEXT')[0]);
                    
                    //alert(sMsgBody);
                    //alert(sSigText);
                    
                    if (sMsgBody.length > 0)
                    {
                        sSigText = GetSignatureBody(sSigText);  // just get the guts of it
                        if (sMsgBody.indexOf(gAutoSignature) != -1)
                        {
                            sMsgBody = sMsgBody.replace(gAutoSignature, sSigText);
                        }
                        else
                        {
                            reset = true;
                        }
                    }
                    else    // text editor has been cleared by the previous Cancel action
                    {
                        reset = true;
                    }
                    
                    if (reset)
                    {
                        <% If MailEnable.WebMail.Configuration.EditorIsHTMLCapable(SelectedEditor) Then %>
			                sMsgBody = "<br/>";
			            <% Else %>
				            // Text area
			                sMsgBody = "\n";
			            <% End If %>
                        sMsgBody += sSigText;
                    }
                    
                    gAutoSignature = sSigText;  // update the cached signature
                }
                <%=MailEnable.WebMail.Configuration.Editor_SetValue(SelectedEditor, "sMsgBody") %>                
		    }
		    
		    function GetSelectedIdentityID()
		    {
		        var sIdentityID = "";
		        var ddlFrom = document.getElementById('ddlMsgFrom');
		        
		        if (ddlFrom && ddlFrom.selectedIndex > -1)
		        {
		            sIdentityID = ddlFrom.options[ddlFrom.selectedIndex].value;
		        }
		        
		        return sIdentityID;
		    }
		    
		    function GetSelectedIdentitySignature()
		    {
		        ServerRequest('GET-MBX-IDENTITY', 'IdentityID=' + GetSelectedIdentityID(), false, 'Compose');
		    }
		    
		    function IdentityChanged()
		    {
		        // we need to save the existing text entered by the user before we go off to fetch the signature
		        // associated with the Identity.
		        var sMsgBody = GetMessageBody(false);
		        var index = sMsgBody.indexOf(gAutoSignature);
		        
		        gUserText = sMsgBody.substr(0, index);
		        
		        GetSelectedIdentitySignature();
		    }
    		
		    function ResetAutoSignature()
		    {
			    if (getTopAppWindow().GetOption)
			    {
			      var GetSig = true;
				    <% If Not bIdentitiesEnabled Then %>
				    GetSig = (getTopAppWindow().GetOption('MailBox-AutoSignatureEnabled') == true);
				    <% End If %>
			      
				    if (GetSig)
				    {
				        var sOptions = '';
				        <% If MailEnable.WebMail.Configuration.EditorIsHTMLCapable(SelectedEditor) Then %>
				            sOptions = 'HTMLFormat=1';
				        <% End If %>
				        
				        <% If bIdentitiesEnabled Then %>
				            GetSelectedIdentitySignature();
			            <% Else %>
				            ServerRequest('GET-AUTOSIGNATURE', sOptions, false, 'Compose');
				        <% End If %>
				    }
				    else
				    {
					    ClearMessageBody();
				    }
			    }
			    <% If gAutoSaveEnabled Then %>
                    // initialize the autosave
                    InitAutoSaveInt();
                <% End If %>
		    }
    		
		    function ClearMessageBody()
		    {
			    try
			    {
                    <%=MailEnable.WebMail.Configuration.Editor_SetValue(SelectedEditor, "") %>			    
			    } catch (e) { return true; }
		    }
    		
		    function ClearHeaderFields()
		    {
			    var oMsgTo = window.document.getElementById('txtMsgTo');
			    var oMsgCc = window.document.getElementById('txtMsgCc');
			    var oMsgBcc = window.document.getElementById('txtMsgBcc');
			    var oMsgSubject = window.document.getElementById('txtMsgSubject');
			    var oDDLAttachments = window.document.getElementById('ddlAttachments');
			    if (oMsgTo && oMsgCc && oMsgBcc && oMsgSubject && oDDLAttachments)
			    {
				    oMsgTo.value = '';
				    oMsgCc.value = '';
				    oMsgBcc.value = '';
				    oMsgSubject.value = '';
    				
				    // Attachments drop-down list...
				    if (oDDLAttachments.disabled == true)
					    oDDLAttachments.disabled = false;
    				
				    while (oDDLAttachments.length > 0)
				    {
					    oDDLAttachments.removeChild(oDDLAttachments.childNodes[0]);
				    }
				    AddItemToList(oDDLAttachments, t_('[ME_TXT-NoAttachmentsAvailable]'), t_('[ME_TXT-NoAttachmentsAvailable]'));
				    oDDLAttachments.disabled = true;
    				
				    // changing the contents of the dropdown seems to be causing it to
				    // reappear, even tho the frame it is on is hidden... setting the
				    // visibility to hidden and then back to visible seems to fix it...
				    oDDLAttachments.style.visibility = 'hidden';
				    oDDLAttachments.style.visibility = 'visible';
				    
                    $("#ddlMsgFrom").prop("selectedIndex", 0);
			    }
		    }
    		
		    // Sets the message body to have just the auto-signature
		    function SetAutoSignature()
		    {
			    try
			    {
			        tempsig = gAutoSignature;
			    
				    <% If MailEnable.WebMail.Configuration.EditorIsHTMLCapable(SelectedEditor) Then %>  
					    if (gAutoSignature.indexOf("<") == 0)
					    {
					        // only replace the auto signature's lf, if the sig isn't already in HTML format
					        tempsig = gAutoSignature.replace(/\n/g, "<br>");
					    }					    
					    tempsig = "<br>" + tempsig;
				    <% End If %>
				    
				    <%=MailEnable.WebMail.Configuration.Editor_SetValue(SelectedEditor, "tempsig")%>
				    
			    } catch (e) {  return true; }
		    }
    		
		    function ClearContents()
		    {
			    ClearHeaderFields();
			    TextChanged = false;
			    SavedAsDraft = false;
			    NeedCheckForChange = true;		// need to check for changes from this point onwards
			    gSpellcheckDone = false;
			    SetCursorFocusToField();
			    SetComposeID('');
			    ClearAutoSaveInt();
			    gUserText = '';
    			
			    <%=MailEnable.WebMail.Configuration.Editor_SetValue(SelectedEditor, "")%>
			    
                SetSendBtnText();
		    }
    
	        
		    function SetCursorFocusToField()
		    {
			    var oTarget = window.document.getElementById('txtMsgTo');
			    try
			    {
				    oTarget.focus();
			    } catch(ex) {};
		    }
    			
		    function CloseWindow(bAutosaveDraft)
		    {
			    if (bAutosaveDraft == undefined)
			    {
				    bAutosaveDraft = true;
			    }
    			
			    var oParentWindow;
    			
			    if (gIsNewWindow)
			    {
			        oParentWindow = window.opener;
			    }
			    else
			    {
			        oParentWindow = window.parent;
			    }
    			
			    TextChanged = false;
		        SavedAsDraft = false;
		        gSpellcheckDone = false;
    		    
		        if (oParentWindow)
		        {
	                try
	                {
	                    // we just want to return to the message list (at the last position)
	                    oParentWindow.SetCurrentView(oParentWindow.VIEW_PERSONAL);
		                oParentWindow.SetPageContextMode(oParentWindow.CONTEXT_AUTODETECT);
	                    oParentWindow.HideComposePane();
		            }
		            catch (ex) { }
			    }
    			
		        if (gIsNewWindow) {
		            window.close();
		        }
		    }
		    
		    function HandleKeyDown(ev)
		    {
		        ev = ev || window.event;
		        var key = ev.keyCode || ev.which;
		        
		        switch (key)
		        {
		            case BACKSPACE_KEYCODE:
		            case DELETE_KEYCODE:
		                NotifyTextChanged();
		                break;
		        }
		    }
    		
		    function NotifyTextChanged(ftbElement)
		    {
		        if (TextChanged) return;
		        
			    if (ftbElement)
			    {
				    // FreeTextBox fired event
				    var sHTML = ftbElement.GetHtml();
				    sHTML = sHTML.replace(/<BR>/g, "");
    				
				    if (sHTML.length > 0)
				    {
					    TextChanged = true;
					    SetSendBtnText();
					    EnableToolbarButton("btnSaveDraft", function() { SaveAsDraft(); });
				    }
			    }
			    else
			    {

				    TextChanged = true;
					SetSendBtnText();
				    EnableToolbarButton("btnSaveDraft", function() { SaveAsDraft(); });
			    }
		    }
    		
		    // This function returns the message body text from the relevant editor (i.e Plain Text, Lightweight or Heavyweight).
		    function GetMessageBody(URIEncode)
		    {
			    var sBody = "";
    			
                <%=MailEnable.WebMail.Configuration.Editor_GetValue(SelectedEditor, "sBody") %>                

    			if (URIEncode)
    			{
			        // We need to URI encode the data before we send it
			        sBody = encodeURIComponent(sBody);
			    }
    			
			    return sBody;
		    }
    		
		    function GetDataString(sMessageID)
		    {
			    var sData;
			    var HTMLFormat;
    			
			    <% If MailEnable.WebMail.Configuration.EditorIsHTMLCapable(SelectedEditor) Then%>
				    HTMLFormat = 1;
			    <% Else %>
				    HTMLFormat = 0;
			    <% End If %>						
			    if (sMessageID == undefined)
			    {			
				    sMessageID = "<% =GetMessageID() %>";
			    }			
			    sData = "ID=" + sMessageID;
			    sData += '&Folder=' + '<% =Server.UrlEncode(Session.Item("RelativeFolderPath")) %>';
			    sData += "&MsgBody=" + GetMessageBody(true) + "&HTMLFormat=" + HTMLFormat;
			    sData += "&FromRecipients=" + encodeURIComponent(document.getElementById('ddlMsgFrom').value);
			    sData += "&ToRecipients=" + encodeURIComponent(document.getElementById('txtMsgTo').value);
			    sData += "&CCRecipients=" + encodeURIComponent(document.getElementById('txtMsgCc').value);
			    sData += "&BCCRecipients=" + encodeURIComponent(document.getElementById('txtMsgBcc').value);
			    sData += "&Subject=" + encodeURIComponent(document.getElementById('txtMsgSubject').value);
			    sData += "&Priority=" + document.getElementById('ddlPriority').value;
			    sData += "&Notify=" + document.getElementById('chkNotify').checked;
    			
			    sData += "&PostOffice=" + '<%=Session("POSTOFFICE")%>';
			    sData += "&Mailbox=" + '<%=Session("AUTH_USERNAME")%>';
			    sData += "&SessionKey=" + '<%=GetSessionKey()%>';
			    
			    <% If bIdentitiesEnabled Then %>
			    sData += "&IdentityID=" + GetSelectedIdentityID();
			    <% End If %>

			    return sData;
		    }
    		
		    function ToggleMsgOptions()
		    {
		        var divOptions = document.getElementById('divMsgOptions');
    		    
		        if (divOptions)
		        {
		            if (divOptions.style.display == "none")
		                divOptions.style.display = "";
		            else
		                divOptions.style.display = "none";
		        }
		        
		        ResizeBody();
		    }
    				
		    function ServerCall(Command)
		    {
			    var sData;
    			
			    sData = GetDataString("<% =GetMessageID() %>");
    			
			    ServerPost(Command, sData, true, 'Compose');
		    }
    		
		    function getParent()
		    {
			    var oParent;
			    if (gIsNewWindow)
			    {
				    oParent = window.opener;
			    }
			    else
			    {
				    oParent = window.parent;
			    }
			    if (!oParent)
			    {
				    oParent = window.parent;
			    }
			    return oParent;		
		    }
    		
		    function ServerCallEx(Command,DataString,bUseCallback)
		    {
		        if (bUseCallback==undefined) bUseCallback = true;
			    if (DataString)
			    {
				    var sData;			
				    if ((sCurrMsgID == undefined) || (!sCurrMsgID) || (sCurrMsgID == ''))
				    {
					    sCurrMsgID = GetComposeID();
				    }				
				    sData = GetDataString(sCurrMsgID);
				    sData += '&' + DataString;
				    ServerPost(Command, sData, bUseCallback, 'Compose');			
			    }
			    else
			    {
				    return ServerCall(Command);
			    }			
		    }
    				
		    function AutosaveDraft()
		    {
                if (!gUploadInProgress)
                {
			        if (NeedCheckForChange == true)
			        {
				        CheckForAnyChanges();
			        }
			   
			        if (TextChanged == true)
			        {
				        ServerCallEx('SAVE-DRAFT','CS=AutoSave');
			        }
                }
		    }
    		
		    function AttachmentsContextSwitch()
		    {
			    ServerCallEx('CONTEXT-SWITCH','CS=Attachment',false);
		    }
    		
    		
		    function escapeXML(content) 
		    {
			    if (content == undefined)
				    return "";
			    if (!content.length || !content.charAt)
				    content = new String(content);
			    var result = "";
			    var length = content.length;
			    for (var i = 0; i < length; i++) {
				    var ch = content.charAt(i);
				    switch (ch) {
					    case '&':
						    result += "&";
						    break;
					    case '<':
						    result += "<";
						    break;
					    case '>':
						    result += ">";
						    break;
					    case '"':
						    result += "\"";
						    break;
					    case '\'':
						    result += "&apos;";
						    break;
					    default:
						    result += ch;
				    }
			    }
			    return result;
		    }
    		
		    function GetComposeID()
		    {
			    var taw = getTopAppWindow();
			    if ((taw == undefined) || (!taw)) 
			    {
				    taw = getParent();
			    }		
			    return taw.gComposeMsgID;
		    }
    		
		    function SetComposeID(sComposeID)
		    {		
			    var taw = getTopAppWindow();
			    if ((taw == undefined) || (!taw)) 
			    {
				    taw = getParent();
			    }		
			    taw.gComposeMsgID  = sComposeID;	
			    // also have to clear current msgid
			    sCurrMsgID = '';
		    }
    		
		    function LogOff()
		    {
			    // This function is called by the Timeout library.
    			
			    if (bAllowNewWindows == 'True')
			    {
				    window.opener.LogOff();
				    window.close()
			    }
			    else
			    {
				    window.parent.LogOff();
			    }
		    }
    		
		    function ShowHideMessageOptions()
		    {
			    var msgOptions = document.getElementById('tblMsgOptions');
			    msgOptions.style.display = msgOptions.style.display == 'none' ? '' : 'none';
			    ResizeBody();
		    }
    		
		    function ListAttachments()
		    {
			    // we want to save the message and then redir to the attachments page
			    AttachmentsContextSwitch();
		    }
    		
		    function SaveAsDraft()
		    {
		        if (ToolbarButtonEnabled("btnSaveDraft"))
		        {
		            DisableToolbarButton("btnSaveDraft");
			        ServerCallEx("SAVE-DRAFT","CS=AutoSave");
			        SavedAsDraft = true;
			    }
		    }
    		
		    function ShowAlert(Title, Message, IsWarning)
		    {
			    if (oAlertDialog != null) {
				    oAlertDialog.Alert(Title, Message, IsWarning);
			    }
			    else {
				    alert(Message);
			    }
		    }
		    
		    function ForceSpellcheckBeforeSend()
		    {
		        var oParent = getParent();
		        var bForceSpellcheck = false;
		        
		        bForceSpellcheck = (oParent.getTopAppWindow().GetOptionValue('WebMail-SpellcheckEmailsBeforeSending') == 1);
		        
		        return bForceSpellcheck;
		    }
		    
		    function SetSendBtnText(ForceSpellcheck)
            {
		        if (ForceSpellcheckBeforeSend())
                {
                    SetToolbarButtonText("btnSend", t_("[ME_TXT-CheckSpelling]"));
                    gSpellcheckDone = false;
                }
                else
                {
                    SetToolbarButtonText("btnSend", t_("[ME_TXT-Send]"));
                    gSpellcheckDone = true;
                }
                return 1;
		    }
		    
		    function CancelAuto()
		    {
		        //oToAddressTextbox.abort();
		    }
		    
		    function SpellcheckDone()
		    {
		        gSpellcheckDone = true;
		        
		        if (ForceSpellcheckBeforeSend())
		        {
                    SetToolbarButtonText("btnSend", t_("[ME_TXT-Send]"));
                }
		    }
		    
		    function Send()
		    {

		        if (ToolbarButtonEnabled('btnSend'))
		        {
		            if (ForceSpellcheckBeforeSend())
		            {
		                var rsc = <%= SpellCheck_GetJSObjectName() %>;
    		            
		                if (rsc && !gSpellcheckDone)
		                {
		                    rsc.OnSpellButtonClicked();
		                }
		                else
		                {
		                    CancelAuto();
		                    DisableToolbarButton('btnSend');
		                    ServerCallEx('SEND-MESSAGE','CS=Send');
		                }
		            }
		            else
		            {
		                CancelAuto();
		                DisableToolbarButton('btnSend');
		                ServerCallEx('SEND-MESSAGE','CS=Send');
		            }
		        }
		    }
		    
    		
		    function SetAddrToField(Addresses)
		    {
	            document.getElementById('txtMsgTo').value = Addresses;
		    }
		    
		    function ClearAutoSaveInt()
		    {
		        if (gAutoSaveInterval)
		        {
		            clearInterval(gAutoSaveInterval);
		        }
		    }


              function supportFormData() {
                 return !! window.FormData;
              }
		    
		    function InitAutoSaveInt()
		    {
		        gAutoSaveInterval = setInterval('AutosaveDraft();', gAutoSaveFreq);
		    }
    				
		    function PageLoad()
		    {
	            		    
		        document.getElementById('divEditor').style.visibility = 'visible';  // show the editor control now that page has finished loading
    		    	
		        // keycodes sux for odd chars like semi-colon and comma.  see http://www.unixpapa.com/js/key.html
		        var aDelimiterKeyCodes = new Array();
		        aDelimiterKeyCodes.push(59);	// colon/semi-colon key in Mozilla/Opera
			    aDelimiterKeyCodes.push(186);	// colon/semi-colon key in IE
			    aDelimiterKeyCodes.push(188);	// comma/less-than key in IE
			    aDelimiterKeyCodes.push(44);	// comma/less-than key in Opera

			    if (getParent().GetOption)
			    {
			        if (getParent().gAutoCompleteMode !=0)
			        {
				        oToAddressTextbox = new AutoSuggestControl(document.getElementById('txtMsgTo'),
					        new EmailAddressSuggestionsProvider(), ME_ADDRESS_AUTOCOMPLETE_DELAY,
					        ';,', true, aDelimiterKeyCodes, '; ', 1, 200, 400);
				        oCCAddressTextbox = new AutoSuggestControl(document.getElementById('txtMsgCc'),
					        new EmailAddressSuggestionsProvider(), ME_ADDRESS_AUTOCOMPLETE_DELAY,
					        ';,', true, aDelimiterKeyCodes, '; ', 1, 200, 400);
				        oBCCAddressTextbox = new AutoSuggestControl(document.getElementById('txtMsgBcc'),
					        new EmailAddressSuggestionsProvider(), ME_ADDRESS_AUTOCOMPLETE_DELAY,
					        ';,', true, aDelimiterKeyCodes, '; ', 1, 200, 400);
			        }
			    }
    			
			    //we want to set the composing message id to the generated id returned by the server
			    SetComposeID(sCurrMsgID);			
    			
			    var focusTargetID = '<%=GetPageFocusTargetID()%>';			
    			
                if (supportFormData())
                {
                    //enable upload button
                    $('#btn_FileBrowse').show();
                }

			    if (focusTargetID == 'txtMsgTo')
			    {
				    var oTarget = document.getElementById(focusTargetID);
				    try
				    {
					    oTarget.value = "<%= Server.HtmlEncode(FrmMsgTo) %>";	// so that the cursor is at the end of the address
				    } catch(ex) {};				
			    }			
    			
			    if (sMode.toLowerCase() == 'compose')
			    {
				    if (sFolder && (sFolder.toLowerCase() != '/drafts' && sFolder.toLowerCase() != 'drafts')) 
				    {
					    ResetAutoSignature();
				    }
				    else{
				        if (gDoSig=='1')
				        {
				            ResetAutoSignature();
				        }
				    }
			    }
			    
			    var addressTo = '<%=ParseRequestArgument("AddressTo")%>';
			    
			    if (addressTo && (addressTo.length > 0))
			    {
			        // populate the address field with the addresses passed to us
			        document.getElementById('txtMsgTo').value = addressTo;
			    }
    			
			    // We only want to initialize a separate timeout diaglog for this compose page if it has
			    // been opened as a new window, since we already have a timeout dialog initialised for
			    // the main parent page.
			    
			    if ((window.opener != undefined) && (window.opener != null))
			    {
                    oTimeoutDialog = new TimeoutDialog("TimeoutDialog", '<% =sTimeOutPagePath %>', '<% =sReconnectPage %>',
                        {
                            TimeoutMins: <% =GetSessionTimeOut() %>,
                            AlertSound: '<%=sSkinPath %>notify.wav'
                        });
			    }
		        ResizeBody();
                SetPageFocusByID(focusTargetID);
		    }
		    
            $(document).ready(function() 
            {
	            window.onload = PageLoad;
                if (getTopAppWindow().gShowComposePageOnLoad == true)
                {
                    getTopAppWindow().SetPageContextMode(getTopAppWindow().CONTEXT_COMPOSE);    // show the compose page
                    getTopAppWindow().gShowComposePageOnLoad = false;
                    getTopAppWindow().HideWait();
                }	            
                
                
                if ('<%=WindowContext%>' != 'Embedded') {
				    gIsNewWindow = true;
			    }
                
                oConfirmDialog = new MessageDialog("ComposeConfirmCancel");
                oAlertDialog = new MessageDialog("AlertDialog");
                
                <% If gAutoSaveEnabled Then %>
                    // initialize the autosave
                    InitAutoSaveInt();
                <% End If %>
                
                SetSendBtnText();
                
                if (bAllowNewWindows == 'True'){
                    $(".toolbar_primary_table").addClass("popupWin");
                }

                var $form = $('#drago');

                $form.on('drag dragend dragenter dragleave dragover dragstart drop', function(e) {
                    e.preventDefault();
                    e.stopPropagation();
                  })

                .on('dragenter dragover', function() {$form.addClass('ddbox');})
                .on('dragend dragleave drop', function() {$form.removeClass('ddbox');})
                .on('drop', function(e) { UploadFiles(e.originalEvent.dataTransfer.files);});
            });		

            function UploadFiles(oFiles, bDropped)
            {
                var tSize=0;

                $.each(oFiles, function(i, file) {tSize += file.size;});

                if ((gUploadSizeInKB > 0) && (tSize > (gUploadSizeInKB * 1024)))
                {
                    alert(t_("[ME_TXT-MaximumUploadSizeIs]") + ' ' + gUploadSizeInKB + ' ' + t_("[ME_TXT-KB]"));
                    return;
                }

                gUploadInProgress = true;
	            DisableToolbarButton('btnSend');
                $("#prgUpload").val("0"); //reset it
                $('#prgUpload').show();
                var sComposeId = GetComposeID();
		        if ((sComposeId == undefined) || (!sComposeId) || (sComposeId == ''))
		        {
                    sComposeId = createGuid().toUpperCase() + '.MAI';
                    SetComposeID(sComposeId);
		        }				

                var ajaxData = new FormData();

                $.each(oFiles, function(i, file) {ajaxData.append(file.name, file);});

                $.ajax({
                    url: getAppServletURL() + '?Cmd=ATTACH-FILES&ID=' + sComposeId + '&TD=' + (new Date()).getTime() + '&ME_VALIDATIONTOKEN=<% =Session.Item("ME_VALIDATIONTOKEN") %>',
                    data: ajaxData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    type: 'POST',
                    success: function (data) {
                        if (data && (data.length > 0))
                        {
                            var attr =$('#ddlAttachments').attr('disabled');
                            if (typeof attr !== typeof undefined && attr !== false) {
                                $('#ddlAttachments').empty().removeAttr('disabled');
                            }
                        }
                        $.each(data, function(i, item) {
                            $('#ddlAttachments').append($("<option></option>").attr("value",item['FileName']).text(item['DisplayFilename']));
                        });
                    },
                    error: function (request, error) { 
                        alert("An error occured uploading: " + error); 
                        },
                    complete: function (jqXHR, sTextstatus) {
                        $('#prgUpload').hide();
                        $('#uploader').hide(); 
                        gUploadInProgress = false;
			            EnableToolbarButton('btnSend', function() { Send(); });
                        if (typeof clearUploadSelector !== 'undefined') {
                            clearUploadSelector();
                        }
                    },
                    processData: false,
                    xhr: function() {
                        var myXhr = $.ajaxSettings.xhr();
                        if (myXhr.upload) {
                            myXhr.upload.addEventListener('progress', function(e) {
                                if (e.lengthComputable) {
                                    $('progress').prop({
                                        value: e.loaded,
                                        max: e.total
                                    });
                                }
                            } , false);
                        }
                        return myXhr;
                    }
               })
            }

		// -->
		</script>
		
		<!--[if lte IE 7]>
        <style type="text/css">
            .bttn_toolbar_primary_left       {float:left;}
            .bttn_toolbar_primary_right      {float:left;}
            .bttn_right                      {float:left;}
            .compose_input_table_left        {margin:0;padding:0;}
            .compose_input_table_right       {margin:0;padding:0;}
            .compose_input_table_right input {margin:0;padding:0;}
        </style>
        <![endif]-->
        
        <!--[if IE 7]>
        <style type="text/css">
            .compose_shell_inner             {overflow:hidden;}
        </style>
        <![endif]-->
        <style type="text/css">
        .ddbox {
            outline-width: 2px;
            outline-style: dashed;
        }
</style>
	</head>
	<body id="body" onload="PageLoad();" scrolling="YES" style="background-color:Transparent;">
    <div id="uploader" style="position:absolute; top:200px; left:200px;">
        <!-- HTML V5 -->
        <br/>
        <form id="fmUpload" enctype="multipart/form-data" action="">
        <input id="file" name="file" type="file" style="display: none;" multiple="true" />
        </form>
    </div>
<script type="text/javascript" language="javascript">

function clearUploadSelector() 
{
    var control = $("#file");
    control.replaceWith(control = control.clone(true));
}

function createGuid()
{
    return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);
        return v.toString(16);
    });
}

$(':file').on('change', function () {
    if (this.files) {
        UploadFiles(this.files);
    }
    else {
        alert('no support');
    }
});

</script>

		<form id="FrmCompose" method="post" runat="server"><%WriteFormValidationField()%>
		    <table class="body_shell_table pane-iframe" border="0" cellspacing="0" cellpadding="0">
		    <tr>
		        <td id="tdCompose" class="bodyCol_message compose_content_td">
                    <div class="toolbar_primary">
                        <table class="toolbar_primary_table iframe" width="100" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td class="toolbar_primary_table_left" onselectstart="return false;">
                        	    <div class="toolbar_primary_bttns_td_shell">
                                    <!-- Bttn Send -->
                                    <div id="btnSend" class="bttn_toolbar_primary_shell blue priority" onclick="Send()" title="<%=uscToken.GetText("[ME_TXT-Send]")%>">
                                        <div class="bttn_toolbar_primary_left">
                                            <div class="toolbar_icon_send"></div>
                                            <div class="bttn_toolbar_primary_text"><%=uscToken.GetText("[ME_TXT-Send]")%></div>
                                        </div>
                                        <div class="bttn_toolbar_primary_right"></div>
                                    </div>
                                    <div class="bttn_toolbar_primary_divider"></div>

                                    <!-- Bttn Cancel -->
                                    <div id="btnCancel" class="bttn_toolbar_primary_shell grey" onclick="Cancel()" title="<%=uscToken.GetText("[ME_TXT-Cancel]")%>">
                                        <div class="bttn_toolbar_primary_left">
                                            <div class="toolbar_icon_delete"></div>
                                            <div class="bttn_toolbar_primary_text"><%=uscToken.GetText("[ME_TXT-Cancel]")%></div>
                                        </div>
                                        <div class="bttn_toolbar_primary_right"></div>
                                    </div>
                                    <div class="bttn_toolbar_primary_divider"></div>
                                    <!-- Bttn Save as Draft -->
                                    <div id="btnSaveDraft" class="bttn_toolbar_primary_shell" onclick="SaveAsDraft()" title="<%=uscToken.GetText("[ME_TXT-SaveAsDraft]")%>">
                                        <div class="bttn_toolbar_primary_left">
                                            <div class="toolbar_icon_save"></div>
                                            <div class="bttn_toolbar_primary_text"><%=uscToken.GetText("[ME_TXT-SaveAsDraft]")%></div>
                                        </div>
                                        <div class="bttn_toolbar_primary_right"></div>
                                    </div>
                                    <div class="bttn_toolbar_primary_divider"></div>
                                    <!-- Bttn Attachments -->
                                    <div class="bttn_toolbar_primary_shell" title="<%=uscToken.GetText("[ME_TXT-Attachments]")%>" onclick="ListAttachments()">
                                        <div class="bttn_toolbar_primary_left">
                                            <div class="toolbar_icon_attachments"></div>
                                            <div class="bttn_toolbar_primary_text"><%=uscToken.GetText("[ME_TXT-Attachments]")%></div>
                                        </div>
                                        <div class="bttn_toolbar_primary_right"></div>
                                    </div>
                                    <div class="bttn_toolbar_primary_divider"></div>
                                    <!-- Bttn Message Options -->
                                    <div class="bttn_toolbar_primary_shell" title="<%=uscToken.GetText("[ME_TXT-ViewSendOptions]")%>" onclick="ToggleMsgOptions()">
                                        <div class="bttn_toolbar_primary_left">
                                            <div class="toolbar_icon_options"></div>
                                            <div class="bttn_toolbar_primary_text"><%=uscToken.GetText("[ME_TXT-Options]")%></div>
                                        </div>
                                        <div class="bttn_toolbar_primary_right"></div>
                                    </div>
                                    <div class="bttn_toolbar_primary_divider"></div>
                                    <% If AdvertiseSpellButton() Then%>
                                    <!-- Bttn Check Spelling -->
                                    <div class="bttn_toolbar_primary_shell" title="<%=uscToken.GetText("[ME_TXT-CheckSpelling]")%>" onclick="RSWL_rapidSpellWebLauncher.OnSpellButtonClicked();">
                                        <div class="bttn_toolbar_primary_left">
                                            <div class="toolbar_icon_spellCheck"></div>
                                            <div class="bttn_toolbar_primary_text"><%=uscToken.GetText("[ME_TXT-CheckSpelling]")%></div>
                                        </div>
                                        <div class="bttn_toolbar_primary_right"></div>
                                    </div>
                                    <div class="bttn_toolbar_primary_divider"></div>
                                    <%End If%>
                                </div>
                                <!-- toolbar_primary_bttns_td_shell -->
                            </td>
                          </tr>
                        </table><!--toolbar_primary_table -->
                    </div><!-- toolbar_primary -->
                    
                    <div id="divMsgOptions" class="compose_msgOptions_shell" style="display:none;" onselectstart="return false;" <%= MailEnable.Clients.WebMail.Mondo.Request.CheckForRTL(Session("lang"))%>>
                      <table class="options_form_table" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td class="options_table_minWidth"><div class="compose_msgOptions_label"><%=uscToken.GetText("[ME_TXT-MessagePriority]")%>:</div></td>
                          <td class="options_table_minWidth">
                            <asp:DropDownList ID="ddlPriority" Runat="server" Style="width:100px"></asp:DropDownList>
                          </td>
                          <td class="calendar_shared_table_checkbox"><input id="chkNotify" class="checkbox" type="checkbox"/></td>
                          <td><%=uscToken.GetText("[ME_TXT-Notifymewhenthismessageisread.]")%></td>
                        </tr>
                      </table>
                    </div>
                    <div class="compose_shell" style="width:100%;">
                	    <div class="compose_shell_inner" id="bodyCol_shell_msgList">
                    	    <div class="compose_input_table_shell" id="compose_input_table_shell_js" style="width:100%;height:auto">
                                <table class="compose_input_table" border="0" cellspacing="0" cellpadding="0" <%= MailEnable.Clients.WebMail.Mondo.Request.CheckForRTL(Session("lang"))%>>
                                  <tr>
                                    <td class="compose_input_table_left" onselectstart="return false;"><%=uscToken.GetText("[ME_TXT-From]")%>:</td>
                                    <td class="compose_input_table_right" onselectstart="return false;"><asp:dropdownlist id="ddlMsgFrom" runat="server" Style="width:50%" TabIndex="1"></asp:dropdownlist></td>
                                  </tr>
                                  <tr>
                                    <td class="compose_input_table_left" onselectstart="return false;">
                                        <div class="bttn_float_left" onclick="ShowAddressBook();NotifyTextChanged();" title="<%=uscToken.GetText("[ME_TXT-SelectFromAddressBook]")%>">
                                           <div class="bttn_left"><div class="compose_bttn_txt"><%=uscToken.GetText("[ME_TXT-To]")%>...</div></div>
                                           <div class="bttn_right"></div>
                                        </div>
                                    </td>
                                    <td class="compose_input_table_right"><asp:textbox id="txtMsgTo" runat="server" CssClass="textfield" onChange="NotifyTextChanged();" onKeyPress="NotifyTextChanged()"></asp:textbox></td>
                                  </tr>
                                  <tr>
                                    <td class="compose_input_table_left" onselectstart="return false;">
                                        <div class="bttn_float_left" onclick="ShowAddressBook();NotifyTextChanged();" title="<%=uscToken.GetText("[ME_TXT-SelectFromAddressBook]")%>">
                                           <div class="bttn_left" ><div class="compose_bttn_txt"><%=uscToken.GetText("[ME_TXT-CC]")%>...</div></div>
                                           <div class="bttn_right"></div>
                                        </div>
                                    </td>
                                    <td class="compose_input_table_right"><asp:textbox id="txtMsgCc" runat="server" CssClass="textfield" onChange="NotifyTextChanged();" onKeyPress="NotifyTextChanged()"></asp:textbox></td>
                                  </tr>
                                  <tr>
                                    <td class="compose_input_table_left" onselectstart="return false;">
                                        <div class="bttn_float_left" onclick="ShowAddressBook();NotifyTextChanged();" title="<%=uscToken.GetText("[ME_TXT-SelectFromAddressBook]")%>">
                                           <div class="bttn_left"><div class="compose_bttn_txt"><%=uscToken.GetText("[ME_TXT-Bcc]")%>...</div></div>
                                           <div class="bttn_right"></div>
                                        </div>
                                    </td>
                                    <td class="compose_input_table_right"><asp:textbox id="txtMsgBcc" runat="server" CssClass="textfield" onChange="NotifyTextChanged();" onKeyPress="NotifyTextChanged()"></asp:textbox></td>
                                  </tr>
                                  <tr>
                                    <td class="compose_input_table_left" onselectstart="return false;"><%=uscToken.GetText("[ME_TXT-Subject]")%>:</td>
                                    <td class="compose_input_table_right"><asp:TextBox id="txtMsgSubject" runat="server" CssClass="textfield" onChange="NotifyTextChanged();" onKeyPress="NotifyTextChanged()"></asp:TextBox></td>
                                  </tr>
                                  <tr id="drago" class="box">
                                    <td class="compose_input_table_left" onselectstart="return false;"><a href="javascript:ListAttachments();" title="<%=uscToken.GetText("[ME_TXT-ViewAttachments]")%>"><%=uscToken.GetText("[ME_TXT-Attachments]")%>:</a></td>
                                    <td class="compose_input_table_right" onselectstart="return false;">
                                    <table width="100%" border="0"><tr><td width="50">
                                    <asp:DropDownList ID="ddlAttachments" runat="server" style="width:100%"></asp:DropDownList>
                                    </td><td style="width:50%">
                                    <table style="padding-top: 2px;">
                                    <tr>
                                    <td>
                                        <div id="btn_FileBrowse" class="bttn_float_left" style="display:none" onclick="document.getElementById('file').click();">
                                            <div class="bttn_left">
                                            <div class="compose_bttn_txt"><%=uscToken.GetText("[ME_TXT-Browse]")%>...</div>
                                            </div>
                                            <div class="bttn_right"></div>
                                        </div>                                    
                                        </td>
                                        <td width="*">
                                        <progress id="prgUpload" style="display:none;height: 16px"></progress>
                                        </td>
                                    </tr>
                                    </table>
                                    </td></tr></table>
                                    </td>
                                  </tr>
                                </table>
                            </div><!-- compose_input_table_shell -->
                            
                            <div id="divEditor" class="compose_editor_shell" style="width:100%;visibility:hidden;overflow:visible">
			                   <%Select Case SelectedEditor%>                     
                                    <%  Case Else%> 
				                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="ME_MessageBodyBlock tinymce">
				                        <tr>
					                        <td>
						                        <RapidSpellWeb:RapidSpellWebLauncher id="rapidSpellWebLauncher" runat="server" Style="display:none"
							                        RapidSpellWebPage="SpellCheckPopUp.aspx" TextComponentName="txtMsgBody" TabIndex="11" FinishedListener="SpellcheckDone">
						                        </RapidSpellWeb:RapidSpellWebLauncher>
					                        </td>
				                        </tr>
				                        <tr>
					                        <td>
				                                <asp:textbox id="txtMsgBody" Runat="server" style="width:100%;height:300px;" TextMode="MultiLine" TabIndex="12" onChange="NotifyTextChanged();" onKeyPress="NotifyTextChanged();" onKeyDown="HandleKeyDown();"></asp:textbox>                                        
					                        </td>
				                        </tr>
				                        </table>
			                   <%End Select%>
			                </div>
                        </div><!-- bodyCol_shell_inner -->
                    </div><!-- bodyCol_shell -->
                </td>
            </tr>
		    </table>
		    
			<input name="ME_POSTOFFICE" type="hidden" value="<%=Session("POSTOFFICE")%>"/>
			<input name="ME_MAILBOX" type="hidden" value="<%=Session("AUTH_USERNAME")%>"/>
			<input name="ME_SESSION" type="hidden" value="<%=GetSessionKey()%>"/>
			
			<!-- 
			We need the LinkButton below so that the javascript function '__doPostBack()'
            is written out on the client page. 
            -->
            <asp:LinkButton ID="LinkBtn1" runat="server" style="display:none"></asp:LinkButton>
		
		<div id="divResolve" class="frameless_popup" style="z-index:-1;position:absolute;visibility:hidden;display:none;">
		    <uc2:uscPageBorder_Start ID="addrResHeader" runat="server" HeaderAlign="center"></uc2:uscPageBorder_Start>
			    <center>
			        <table id="tblResolve" cellpadding="4" cellspacing="0" border="0">
			        <tr>
				        <td>
					        <table border="0" cellpadding="0" cellspacing="0">
					        <tr>
						        <td style="text-align:left">
							        <%=uscToken.GetText("[ME_TXT-Therewasaproblemresolvingsome(orall)oftherecipientsofthismailmessage.]")%><br/>
							        <%=uscToken.GetText("[ME_TXT-ThefollowingRecipientscouldnotberesolvedbecauseofambiguity]")%>:<br/>
						        </td>
					        </tr>
					        <tr>
						        <td>&nbsp;</td>
					        </tr>
					        <tr>
						        <td>
						            <div style="padding:5px 20px;">
							            <table id="tblAddressList" width="100%" cellpadding="0" cellspacing="0" border="0">
							                <tbody></tbody>
							            </table>
							        </div>
						        </td>
					        </tr>
					        <tr>
						        <td style="text-align:left">
							        <br/>
							        <b><%=uscToken.GetText("[ME_TXT-NOTE]")%>: </b><%=uscToken.GetText("[ME_TXT-Recipientaddressmustbedelimitedbysemicolons...]")%><br/>
							        <b><%=uscToken.GetText("[ME_TXT-Examples]")%>:</b> <blockquote>
								        <span>user@example.com</span><br/>
								        <u>Or</u><br/>
								        <span>other@example.com;example@example.com</span><br/>
							        </blockquote>
						        </td>
					        </tr>		
					        </table>
				        </td>
			        </tr>
			        <tr>
				        <td>
					        <%=uscToken.GetText("[ME_TXT-Themessageyouattemptedtosenddidnothaveanyvalidrecipients.]")%>
					        <br/>
					        <%=uscToken.GetText("[ME_TXT-Youmustspecifyatleastonerecipienttoamailmessage.]")%>
				        </td>
			        </tr>
			        <tr align="center">
				        <td>
					        <%=uscToken.GetText("[ME_TXT-Pleaseclickonthe'Continue'buttontomodifytherecipientsofthemessage.]")%>
				        </td>
			        </tr>
			        <tr align="center">
				        <td><input id="btnContinue" name="btnContinue" type="button" value="<%=uscToken.GetText("[ME_TXT-Continue..]")%>" class="ME_Button" style="cursor:pointer" onclick="HideResolveDialog()" /></td>
			        </tr>
			        </table>
    			
			    </center>
		    <uc3:uscPageBorder_End ID="addrResFooter" runat="server"></uc3:uscPageBorder_End>
		</div>

        </form>
	</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit