  var addrbook = "<!--IMAIL.GetAddresses-->";


    function showStatus(form)
    {
      if (form.status.value == 1)
      {
        alert("Maximum Limit exceeded for attachments, File could not be attached");
        return;
      }
      else if ( form.status.value == 2 )
      {
        alert("User selected a non existent file, cannot attach file");
        return;
      }
    }

  function applyFocus()
  {
     var data = document.SendMail.to.value;
     if(data == ""){
	    document.SendMail.to.focus();
		return;
	 }
	 else{
	    document.SendMail.textBody.focus();
		return;
	 }
  }

    function validate1(selectTitle)
    {
      var i, index, address, j,len,flag=0;
      
      i = document.SendMail.lstAddr.selectedIndex;
      
      if (i == -1)
         return;
      if ((addrbook.search('@') == -1) || document.SendMail.lstAddr.options[i].text == "" || document.SendMail.lstAddr.options[i].text == selectTitle)
         return;
	    if (document.SendMail.to.value == "")
      {
        document.SendMail.to.value = document.SendMail.lstAddr.options[i].text;
      }
      
      address = document.SendMail.to.value;
      index = address.indexOf(document.SendMail.lstAddr.options[i].text, 0);
      
      if (index == -1)
        document.SendMail.to.value = document.SendMail.to.value + ',' + ' ' + document.SendMail.lstAddr.options[i].text;
      return;
    } //  validate1

    function validate2(selectTitle)
    {
      var i, index, address, j;
      
      i = document.SendMail.lstAddr.selectedIndex;

      if (i == -1)
         return;
      if ((addrbook.search('@') == -1) || document.SendMail.lstAddr.options[i].text == "" || document.SendMail.lstAddr.options[i].text == selectTitle)
         return;
      if (document.SendMail.cc.value == "")
      {
        document.SendMail.cc.value = document.SendMail.lstAddr.options[i].text;
      }

      address = document.SendMail.cc.value;
      index = address.indexOf(document.SendMail.lstAddr.options[i].text, 0);

      if ( index == -1 )
        document.SendMail.cc.value = document.SendMail.cc.value + ',' + ' ' + document.SendMail.lstAddr.options[i].text;
	    return;
    } //  validate2

    function validate3(selectTitle)
    {
      var i, index, address, j;
  
      i = document.SendMail.lstAddr.selectedIndex;

      if (i == -1)
        return;
      if ((addrbook.search('@') == -1) || document.SendMail.lstAddr.options[i].text == "" || document.SendMail.lstAddr.options[i].text == selectTitle)
         return;
      if (document.SendMail.bcc.value == "")
      {
        document.SendMail.bcc.value = document.SendMail.lstAddr.options[i].text;
      }

      address = document.SendMail.bcc.value;
      index = address.indexOf(document.SendMail.lstAddr.options[i].text, 0);
  
      if (index == -1)
        document.SendMail.bcc.value = document.SendMail.bcc.value + ',' + ' ' + document.SendMail.lstAddr.options[i].text;
    	return;
    } //  validate3

    function valsb()
    { 
      var address = "";  
      var sendto = ""
      var sendcc = ""
      var sendbcc = ""
      var j=0, k, n;    
     
      if ((document.SendMail.to.value == "0") || (document.SendMail.to.value.length < 3))
      {
        alert("Destination address should be atleast 3 characters long");       
        return;    
      } else if (((document.SendMail.sbj.value  == "0") || (document.SendMail.sbj.value.length  <= 0)) &&
                 ((document.SendMail.textBody.value == "0") || (document.SendMail.textBody.value.length <= 0)))  
      {    
        alert("Subject and Body both should not be blank");       
        return;    
      }   
      <!--IMAIL.BeginAttachmentSupport-->
      	if (document.SendMail.userfile1.value != "")
      	{
      		alert("Please attach the selected file and then press Send");
      		return;
        }
      <!--IMAIL.EndBeginAttachmentSupport-->
      document.SendMail.button.value="<!--IMAIL.SendButton-->";
      document.SendMail.submit();
      return;
    } //  valsb

    function valsbsave()
    { 
      <!--IMAIL.BeginAttachmentSupport-->
        if ( document.SendMail.userfile1.value != "" )
        {
          alert("Please attach the selected file and then press Send.  You may do so by clicking the 'Attach' link.");
          return;
        }
      <!--IMAIL.EndBeginAttachmentSupport-->
      
      document.SendMail.button.value="<!--IMAIL.SaveButton-->";
      
      document.SendMail.submit();
      return;
    }

    function addattach()
    {
      var ch1;
      
      if (document.SendMail.userfile1.value == "")
      {
        alert("Please enter the filename of the file that you would like to attach.  You may do so by clicking the 'Browse' button.");
        return;
      }
      
      document.SendMail.button.value="<!--IMAIL.AttachButton-->";
      
      document.SendMail.submit();
      return;
    }

    function removeattach()
    {
      var i, length, count;
      
      i = document.SendMail.attachlist.selectedIndex;
      
      if (i == -1)
      {  
        alert("Please Select FileName.");
        return;
      }
      if (document.SendMail.attachlist.options[i].text == "--No Files Attached--")
      {
        alert("No files are attached");
        return;
      }
      
      length = document.SendMail.attachlist.options.length;
      
      for(count = 0;count < length;count++)
      {
        if (document.SendMail.attachlist.options[count].selected == true)
          document.SendMail.index.value = document.SendMail.index.value + count + ',';
      }
      
      document.SendMail.button.value="<!--IMAIL.RemoveButton-->";
      
      document.SendMail.submit();
      return;
    }

	<!--IMAIL.BeginIfUserSpellCheckEnable-->

	function vaxSpell()
    { 
	  var dictCheck = "<!--IMAIL.GetDictionaries-->";
	  if(dictCheck=="")
	  {
	    alert("Spell check is not enabled for this domain.");
		return;
	  }
	  if((document.SendMail.textBody.value == "0") || (document.SendMail.textBody.value.length <= 0))
      {    
        alert("Message is not entered ");       
        return;    
      }
	  
	  document.SendMail.button.value="<!--IMAIL.SpellCheckButton-->";


	  var lex, count = 0;
	  i = document.SendMail.lexicons.selectedIndex;

	  if(i==-1)
      {
	    alert("Please, select a dictionary from list box.");
	    return;
	  }

	  lex = document.SendMail.lexicons.options[i].text;
	  for( i = 0; i < document.SendMail.lexicons.length; i ++ )
      {
        if(document.SendMail.lexicons.options[i].selected == true)
            count++;
      }

      if(count>32)
      {
        alert("Only 32 Dictionaries are allowed to select ");
        return;
      }

      document.SendMail.submit();
      return;
    }


   //  This function checks whether the spell checker is in use or not

	var flg_splchk = <!--IMAIL.SpellCheckerOn-->;
	
	function getStatusForSplChkr()
	{
		if(!flg_splchk)
		{
		  document.SendMail.SpellCheckOn.value = 1;
		  <!--IMAIL.BeginSSL-->
            <!--IMAIL.BeginIfSSLEnable-->
			if(confirm("Spell Check is currently unable to transmit your message securely.  Do you wish to run Spell Check anyway?"))
			{
			  vaxSpell();
			}
			<!--IMAIL.ElseBeginIfSSLEnable-->
			  vaxSpell();
		    <!--IMAIL.EndBeginIfSSLEnable-->
	      <!--IMAIL.ElseBeginSSL-->
		    vaxSpell();
		  <!--IMAIL.EndBeginSSL-->
		}
		else
		{
			alert("Spell checker is in use for this user.\nCannot create other instance of spell checker, please try after some time!");
			flg_splchk = 0;
		}
	}

	function renameDict()
	{
	  if(is_nav3)
	   return;  // Netscape 3.0 does not handle this operate very well

	  // LABEL SP1: ADDING DICTIONARY FILENAMES TO THE LIST
	  // --------------------------------------------------
	  // To add a new dictionary to the list, simply add the filename of the dictionary as an element of
	  // the dictList array.  This can be done by adding another parmeter to the Array function.
	  // Only the filenames listed in the dictList array will be replaced with a descriptive name.
	  
	  var dictList = new Array("UserDict.tlx", "ssceam2.clx", "sscebr2.clx", "accent.tlx", "correct.tlx",
	                           "html.tlx", "ssceam.tlx", "sscebr.tlx", "sscela2.clx", "sscema2.clx",
                             "sscepb2.clx", "sscelb2.clx", "sscemb2.clx", "ssceda2.clx", "sscedu2.clx",
                             "sscefi2.clx", "sscefr2.clx", "sscege2.clx", "ssceit2.clx", "sscenb2.clx",
                             "sscepo2.clx", "sscesp2.clx", "sscesw2.clx");
	  var dictDescript = new Array (dictList.length);
	 
	  var tempStr2;
	  for (var num2=0; num2 < dictList.length; num2++)
	  {
	    tempStr2=dictList[num2];
	    dictList[tempStr2]=num2;
	    dictDescript[num2] = new Array();
	  }

	  // LABEL SP2: RENAMING THE DICTIONARY FILENAMES
	  // --------------------------------------------
	  // At this point, the elements of the dictList are being assigned to a more descriptive name.
	  // Note that only elements defined in the dictList array can be assigned a descriptive name.  To
	  // add a filename as an element of the dictList array, see LABEL SP1: ADDING DICTIONARY FILENAMES TO THE LIST.
	  // To assign a more descriptive name to a new element of the dictList arrary, simply follow the
	  // examples below by placing the filename as an argument for the dictList array with the
	  // dictList array as an argument for the dictDescript array.  Use the Array function to create
	  // a multi-dim array with one element being the descriptive name.
	  
	  dictDescript[dictList["UserDict.tlx"]] = new Array("User Defined Dictionary");
	  dictDescript[dictList["ssceam2.clx"]] = new Array("American English Dictionary (compressed)");
	  dictDescript[dictList["sscebr2.clx"]] = new Array("British English Dictionary (compressed)");
	  dictDescript[dictList["accent.tlx"]] = new Array("Phonetic Dictionary");
	  dictDescript[dictList["correct.tlx"]] = new Array("Commonly Misspelled Words");
	  dictDescript[dictList["html.tlx"]] = new Array("Html Dictionary");
	  dictDescript[dictList["ssceam.tlx"]] = new Array("American English Dictionary");
	  dictDescript[dictList["sscebr.tlx"]] = new Array("British English Dictionary");
    dictDescript[dictList["sscela2.clx"]] = new Array("American Legal Dictionary");
    dictDescript[dictList["sscema2.clx"]] = new Array("American Medical Dictionary");
    dictDescript[dictList["sscepb2.clx"]] = new Array("Brazilian Portuguese Dictionary");
    dictDescript[dictList["sscelb2.clx"]] = new Array("British Legal Dictionary");
    dictDescript[dictList["sscemb2.clx"]] = new Array("British Medical Dictionary");
    dictDescript[dictList["ssceda2.clx"]] = new Array("Danish Dictionary");
    dictDescript[dictList["sscedu2.clx"]] = new Array("Dutch Dictionary");
    dictDescript[dictList["sscefi2.clx"]] = new Array("Finnish Dictionary");
    dictDescript[dictList["sscefr2.clx"]] = new Array("French Dictionary");
    dictDescript[dictList["sscege2.clx"]] = new Array("German Dictionary");
    dictDescript[dictList["ssceit2.clx"]] = new Array("Italian Dictionary");
    dictDescript[dictList["sscenb2.clx"]] = new Array("Norwegian Bokmål Dictionary");
    dictDescript[dictList["sscepo2.clx"]] = new Array("Portuguese Dictionary");
    dictDescript[dictList["sscesp2.clx"]] = new Array("Spanish Dictionary");
    dictDescript[dictList["sscesw2.clx"]] = new Array("Swedish Dictionary");


	  
	  var maxlength;
	  maxlength = document.SendMail.lexicons.options.length;
	  
	  for(var numCount=0; numCount < maxlength; numCount++)
	  {
	    optName = document.SendMail.lexicons.options[numCount].text
		for(var i=0; i < dictList.length; i++)
		{
		  if((optName.search(dictList[i]) != -1))
		  {
			document.SendMail.lexicons.options[numCount].text = dictDescript[i];
			
			// LABEL SP3: AUTOMATICALLY SELECTING A DICTIONARY FILE
			// ----------------------------------------------------
			// To automatically select a dictionary file, include the file's
			// array index in the following IF condition's expression.  This will
			// cause the dictionary to automatically be selected in the list box.
			
			if(i==0||i==1)
			{
			  document.SendMail.lexicons.options[numCount].selected=1;
			}
			break;
		  }
		}
	  }	  
	  return;
	}
	<!--IMAIL.EndBeginIfUserSpellCheckEnable-->