anchor.diff:   		
    	});
   
  -	function checkSubmittedAEs(event){
  -		var reportIdArray = new Array();
  -		var totalReportIdCount = 0;
  -		var listOfAEIndexes = $$('.submittedAERow');
  -		for(var i = 0 ; i < listOfAEIndexes.length ; i++)
  -		{
  -			var signature = createSignature(listOfAEIndexes[i].value);
  -			var oldSignatureId = 'ae-section-' + listOfAEIndexes[i].value + '-signature';
  -			var oldSignature = document.getElementById(oldSignatureId).value;
  -			if(signature != oldSignature){
  -				// The ae was modified.
  -				var reportElementId = 'ae-section-' + listOfAEIndexes[i].value + '-reportID';
  -				reportIdArray[totalReportIdCount++] = document.getElementById(reportElementId).value;
  -			}
  -		}
  -		if(totalReportIdCount != 0){
  -			var form = document.getElementById('command');
  -			form._action.value = 'amendmentRequired';
  -			displayAmendPopup(event, reportIdArray);
  -		}
  -		document.getElementById('command')._amendReportIds.value = reportIdArray;
  -	}
  -	
  -	function createSignature(index){
  +    // ----------------------------------------------------------------------------------------------------------------
  +
  +    function getSignatures(cssIdentifier) {
  +        var arr = new Array();
  +        var listOfAEIndexes = $$(cssIdentifier);
  +        for (var i = 0; i < listOfAEIndexes.length; i++) {
  +            var signature = createSignature(i);
  +            arr[i] = signature;
  +        }
  +        return arr;
  +    }
  +
  +    // ----------------------------------------------------------------------------------------------------------------
  +
  +    function checkSubmittedAEs(event) {
  +
  +        var newSignatures = new Array();
  +        newSignatures = getSignatures('.ae-section');
  +
  +        if (oldSignatures.length != newSignatures.length) hasChanges = true;
  +        
  +        for (var i = 0; i < oldSignatures.length; i++) {
  +            if (oldSignatures[i] != newSignatures[i]) hasChanges = true;
  +        }
  +
  +        var reportIdArray = new Array();
  +        var totalReportIdCount = 0;
  +        var listOfAEIndexes = $$('.submittedAERow');
  +
  +        for (var i = 0; i < listOfAEIndexes.length; i++) {
  +            var signature = createSignature(listOfAEIndexes[i].value);
  +            var oldSignatureId = 'ae-section-' + listOfAEIndexes[i].value + '-signature';
  +            var oldSignature = document.getElementById(oldSignatureId).value;
  +            if (signature != oldSignature) {
  +                hasChanges = true;
  +
  +                // The ae was modified.
  +                var reportElementId = 'ae-section-' + listOfAEIndexes[i].value + '-reportID';
  +                reportIdArray[totalReportIdCount++] = document.getElementById(reportElementId).value;
  +            }
  +        }
  +
  +        if (totalReportIdCount != 0) {
  +            var form = document.getElementById('command');
  +            form._action.value = 'amendmentRequired';
  +            displayAmendPopup(event, reportIdArray);
  +        }
  +        document.getElementById('command')._amendReportIds.value = reportIdArray;
  +    }
  +
  +    // ----------------------------------------------------------------------------------------------------------------
  +    
  +    function createSignature(index){
   		var signature = '';
  -		var otherMeddraId = 'adverseEvents[' + index + '].lowLevelTerm-input';
  +
  +        var otherMeddraId = 'adverseEvents[' + index + '].lowLevelTerm-input';
   		var verbatimId = 'adverseEvents[' + index + '].detailsForOther';
   		var gradeId = 'adverseEvents[' + index + '].grade';
   		var attributionId = 'adverseEvents[' + index + '].attributionSummary';
   		var hospitalizationId = 'adverseEvents[' + index + '].hospitalization';
   		var expectedId = 'adverseEvents[' + index + '].expected';
   		var seriousId = 'adverseEvents[' + index + '].serious';
  -		signature = document.getElementById(verbatimId).value + '$$' + // verbatim input
  +
  +		signature = $(verbatimId).value + '$$' + // verbatim input
   					document.getElementById(gradeId).value + '$$' + // grade input
   					document.getElementById(attributionId).value + '$$' + // attribution input
   					document.getElementById(hospitalizationId).value + '$$' + // hospitalization input
   					document.getElementById(expectedId).value; // expected input
  -					 
  -		// If otherMeddraId element exists append otherMeddra Value to the signature.
  +
  +        // If otherMeddraId element exists append otherMeddra Value to the signature.
   		if(document.getElementById(otherMeddraId) != null)
   			signature = signature + '$$' + document.getElementById(otherMeddraId).value;// otherMeddra input
   		else
  
positive.code:       				}
        			}
        		}
        		Windows.addObserver(popupObserver);
        		
  	}
   	
  
   --></script>
   
  </head>
   <body>
  
negative.code: 			signature = signature + '$$' + document.getElementById(seriousId).value;
  		else
  			signature = signature + '$$';	
  
          return signature;
  	}
  
      // ----------------------------------------------------------------------------------------------------------------
      
      function deleteOrAmendAndSubmit(){
  		Windows.close('amend-popup-id');
  		var form = document.getElementById('command');
  		if(form._action.value == 'amendmentRequired'){
  