anchor.diff: -<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
  -<%@taglib prefix="tags" tagdir="/WEB-INF/tags"%>
  -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  -<%@taglib prefix="chrome" tagdir="/WEB-INF/tags/chrome"%>
  -
  -
  -<%@ page contentType="text/html;charset=UTF-8" language="java" %>
  -<html>
  -<head>
  -    <tags:stylesheetLink name="ae"/>
  -    <tags:includeScriptaculous/>
  -    <tags:dwrJavascriptLink objects="authorRule"/>
  -    <tags:dwrJavascriptLink objects="createAE"/>
  -
  -    <script type="text/javascript">
  -      
  -      Event.observe(window, "load", function() {
  -				destroyLineItemSortables();
  -				createLineItemSortables();
  -				createRuleSortable();
  -				//Event.observe("add-condition-image", "click", function() { fetchCondition() } );
  -			});
  -			
  -			function createLineItemSortables() {
  -				for(var i = 0; i < sections.length; i++) {
  -					Sortable.create(sections[i],{tag:'div',dropOnEmpty: true, containment: sections,only:'lineitem'});
  -				}
  -			}
  -
  -			function destroyLineItemSortables() {
  -				for(var i = 0; i < sections.length; i++) {
  -					Sortable.destroy(sections[i]);
  -				}
  -			}
  -
  -			function createRuleSortable() {
  -				Sortable.create('allRules', {tag:'div',only:'section',handle:'handle'});
  -			}
  -			
  -	</script>
  -
  -  <title>Specify Rules for Trigger</title>
  -
  -<style>
  -
  -
  -	div.section,div#createNew {
  -		border: 1px solid #CCCCCC;
  -		margin: 30px 5px;
  -		padding: 0px 0px 10px 0px;
  -		background-color: #EFEFEF;
  -	}
  -
  -	div#createNew input { margin-left: 5px; }
  -
  -	div#createNew h3, div.section h3{
  -		font-size: 14px;
  -		padding: 2px 5px;
  -		margin: 0 0 10px 0;
  -
  -		background: url("/caaers/images/rule/window_titlebar.png");
  -
  -		background-color: #6E81A6;
  -		display: block;
  -		color: #FFFFFF;
  -	}
  -
  -
  -</style>
  -
  -<script type="text/javascript">
  -
  -		var sections = new Array();
  -		var callback = false;
  -		var newNode = 0;
  -		var domainObject = null;
  -		
  -		function addRule() {
  -				try {
  -
  -					authorRule.addRule(name, function (html) {
  -						sections.push('rule-' + (sections.length + 1));
  -						var columnHolder = getElementHolderDiv();
  -						columnHolder.innerHTML = html;
  -						var newRule = columnHolder.childNodes[1].cloneNode(true);
  -						columnHolder.innerHTML = "";
  -						$('allRules').appendChild(newRule);
  -						Effect.Appear(newRule.id);
  -						createRuleSortable();
  -					});
  -
  -				} catch(e) {alert(e)}
  -		}
  -
  -
  -		function fetchCondition(ruleCount) {
  -				try {
  -					authorRule.addCondition(ruleCount, function(columnContent) {
  -
  -							
  -							var columns = $('rule-'+(ruleCount + 1)+'-columns');
  -							var columnHolder = getElementHolderDiv();
  -							columnHolder.innerHTML = columnContent;
  -							var newColumn = columnHolder.childNodes[1].cloneNode(true);	
  -							columnHolder.innerHTML = "";
  -							columns.appendChild(newColumn);
  -							var brElement = document.createElement("br");
  -							brElement.setAttribute("id", newColumn.id + '-br');
  -							columns.appendChild(brElement);
  -							Effect.Appear(newColumn.id);
  -							
  -							if (callback == true)
  -							{
  -							
  -								var domainObjectDropDownID = 'ruleSet.rule['+ ruleCount + '].condition.column[' + newNode + '].objectType'; 
  -								var domainObjectIdentifierID = 'ruleSet.rule['+ ruleCount + '].condition.column[' + newNode + '].identifier'; 
  -							
  -			                              		$(domainObjectDropDownID).value=domainObject.className;
  -						      		$(domainObjectIdentifierID).value=domainObject.identifier;
  -	
  -							
  -								var newColumnId = 'ruleSet.rule['+ ruleCount + '].condition.column[' + newNode + '].fieldConstraint[0].fieldName';
  -								var expressionID = 'ruleSet.rule['+ ruleCount + '].condition.column[' + newNode + '].expression';
  -								//alert(newColumnId);
  -
  -				 				$(newColumnId).options.length = 0;
  -				 				$(newColumnId).options.add(new Option("Please select Field", ""));
  -								
  -								// Set all the options
  -								domainObject.field.each(function(field)
  -								 		{
  -							 				$(newColumnId).options.add(new Option(field.displayUri, field.name));
  -										});
  -								
  -								$(newColumnId).value='term';
  -								
  -								var selectId =  newColumnId.substring(0,newColumnId.lastIndexOf(".")); 
  -								
  -								// Reset the operator
  -								
  -								domainObject.field.each(function(field)
  -										{
  -											if(field.name == 'term')
  -											{
  -												var operatorDropDownID = selectId + '.literalRestriction[0].evaluator';
  -												
  -												$(operatorDropDownID).options.length = 0;
  -												$(operatorDropDownID).options.add(new Option("Please select Operator",""));
  -
  -												field.operator.each(function(operator)
  -													{
  -														$(operatorDropDownID).options.add(new Option(operator.displayUri,operator.name));														
  -														
  -													});
  -													
  -												$(expressionID).value = field.expression;	
  -											}
  -										});
  -										
  -								var validValueField = document.getElementById(selectId + '.literalRestriction[0].value');
  -
  -								var newId = validValueField.id; 
  -								var spanId = newId + '.span';
  -								//Element.remove(validValueField);
  -								$(spanId).innerHTML="";
  -												
  -								var inputArea = '<input type="text" id="' + newId + '" name="' + newId +'" size="60"/>';
  -								inputArea += '<img alt="activity indicator" src="/caaers/images/indicator.white.gif" class="indicator" id="term-indicator"/>';
  -								$(spanId).innerHTML = inputArea + '<div id="' + newId + '-choices' + '" class="autocomplete"></div>';
  -								
  -								
  -								new Autocompleter.DWR(newId, newId + '-choices',
  -									                termPopulator, {
  -									                valueSelector: termValueSelector,
  -									                afterUpdateElement: function(inputElement, selectedElement, selectedChoice) {
  -									
  -												//alert(selectedChoice);
  -												$(newId).value=termValueSelector(selectedChoice);
  -									                },
  -						                indicator: "term-indicator"});
  -													                
  -
  -							}
  -							callback=false;
  -							
  -					});
  -				
  -				}catch (e) {
  -					//alert(e)
  -				}
  -		}
  -		
  -		function removeCondition(ruleCount, columnCount) {
  -				try {
  -					authorRule.removeCondition(ruleCount, columnCount, function(deleteStatus) {
  -							if(deleteStatus) {
  -								var columns = $('rule-'+(ruleCount+1)+'-columns');
  -								var column = $('rule-'+(ruleCount)+'-column-'+(columnCount));
  -								columns.removeChild($(column.id + '-br'));
  -								columns.removeChild(column);
  -							} else {
  -								alert("Delete failed on server " + values)
  -							}
  -					});
  -				
  -				}catch (e) {
  -					alert("Exception " + e)
  -				}		
  -		}
  -		
  -		
  -		function getElementHolderDiv() {
  -			var elementHolderDiv = $('element-holder');
  -			if(elementHolderDiv == null) {
  -				elementHolderDiv = document.createElement("div");
  -				elementHolderDiv.setAttribute("id", "element-holder");
  -			}
  -			
  -			return elementHolderDiv;
  -		}
  -		
  -
  -
  -
  -
  -	
  -	var toggleArray = new Array();
  -	
  -	function toggle(ruleCount) {
  -		var toggleStatus = toggleArray[ruleCount];
  -		var imageObj = $('toggle-image-'+ruleCount);
  -		if(!toggleStatus) {
  -			$('rule-condition-action-container-'+ruleCount).style.display="none";
  -			imageObj.src="/caaers/images/rule/window-maximize.gif"
  -			toggleArray[ruleCount] = true;
  -		} else {
  -			AE.slideAndShow($('rule-condition-action-container-'+ruleCount));
  -			imageObj.src="/caaers/images/rule/window-minimize.gif"
  -			toggleArray[ruleCount] = false;
  -		}
  -	}
  -	
  -	
  -	
  -	
  -				function termPopulator(autocompleter, text) 
  -				{
  -						
  -					var selectedColumnId = autocompleter.element.id;
  -					
  -					var startIndex = selectedColumnId.indexOf('[');
  -					var endIndex = selectedColumnId.indexOf(']', startIndex);
  -					
  -					var ruleCount = parseInt(selectedColumnId.substring(startIndex+1, endIndex));
  -
  -					// Check whether category exists
  -					var columns = $('rule-'+(ruleCount + 1)+'-columns');
  -				
  -				
  -					var divNodes = 0;
  -					
  -					for(var i=0; i < columns.childNodes.length; i++)
  -					{
  -						if (columns.childNodes[i].nodeName == 'DIV')
  -						{
  -							divNodes++;
  -						}
  -					}
  -							
  -					var category; 		
  -
  -					for (var i=0; i < divNodes; i++)
  -					{
  -						var columnId = 'ruleSet.rule['+ ruleCount + '].condition.column[' + i + '].fieldConstraint[0].fieldName';
  -					
  -						if($(columnId).value == 'category')
  -						{
  -							var selectId =  columnId.substring(0,columnId.lastIndexOf(".")); 
  -		
  -							var validValueField = document.getElementById(selectId + '.literalRestriction[0].value');
  -							
  -							category = validValueField.value;
  -						}
  -					}
  -					
  -					
  -
  -					
  -					createAE.matchTerms(text, 3, category, 10, function(values) {
  -						                    autocompleter.setChoices(values)
  -						                })
  -
  -				}
  -	
  -				function termValueSelector(term) 
  -				{
  -					//alert(term.fullName);
  -					return term.fullName;
  -				}
  -
  +<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
  +<%@taglib prefix="tags" tagdir="/WEB-INF/tags"%>
  +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  +<%@taglib prefix="chrome" tagdir="/WEB-INF/tags/chrome"%>
  +
  +
  +<%@ page contentType="text/html;charset=UTF-8" language="java"%>
  +<html>
  +<head>
  +<tags:stylesheetLink name="ae" />
  +<tags:includeScriptaculous />
  +<tags:dwrJavascriptLink objects="authorRule" />
  +<tags:dwrJavascriptLink objects="createAE" />
  +
  +<script type="text/javascript">
  +      
  +      Event.observe(window, "load", function() {
  +				destroyLineItemSortables();
  +				createLineItemSortables();
  +				createRuleSortable();
  +				//Event.observe("add-condition-image", "click", function() { fetchCondition() } );
  +			});
  +			
  +			function createLineItemSortables() {
  +				for(var i = 0; i < sections.length; i++) {
  +					Sortable.create(sections[i],{tag:'div',dropOnEmpty: true, containment: sections,only:'lineitem'});
  +				}
  +			}
  +
  +			function destroyLineItemSortables() {
  +				for(var i = 0; i < sections.length; i++) {
  +					Sortable.destroy(sections[i]);
  +				}
  +			}
  +
  +			function createRuleSortable() {
  +				Sortable.create('allRules', {tag:'div',only:'section',handle:'handle'});
  +			}
  +			
  +	</script>
  +
  +<title>Specify Rules for Trigger</title>
  +
  +<style>
  +
  +
  +	div.section,div#createNew {
  +		border: 1px solid #CCCCCC;
  +		margin: 30px 5px;
  +		padding: 0px 0px 10px 0px;
  +		background-color: #EFEFEF;
  +	}
  +
  +	div#createNew input { margin-left: 5px; }
  +
  +	div#createNew h3, div.section h3{
  +		font-size: 14px;
  +		padding: 2px 5px;
  +		margin: 0 0 10px 0;
  +
  +		background: url("/caaers/images/rule/window_titlebar.png");
  +
  +		background-color: #6E81A6;
  +		display: block;
  +		color: #FFFFFF;
  +	}
  +
  +
  +</style>
  +
  +<script type="text/javascript">
  +
  +		var sections = new Array();
  +		var callback = false;
  +		var newNode = 0;
  +		var domainObject = null;
  +		
  +		function addRule() {
  +				try {
  +
  +					authorRule.addRule(name, function (html) {
  +						sections.push('rule-' + (sections.length + 1));
  +						var columnHolder = getElementHolderDiv();
  +						columnHolder.innerHTML = html;
  +						var newRule = columnHolder.childNodes[1].cloneNode(true);
  +						columnHolder.innerHTML = "";
  +						$('allRules').appendChild(newRule);
  +						Effect.Appear(newRule.id);
  +						createRuleSortable();
  +					});
  +
  +				} catch(e) {alert(e)}
  +		}
  +
  +
  +		function fetchCondition(ruleCount) {
  +				try {
  +					authorRule.addCondition(ruleCount, function(columnContent) {
  +
  +							
  +							var columns = $('rule-'+(ruleCount + 1)+'-columns');
  +							var columnHolder = getElementHolderDiv();
  +							columnHolder.innerHTML = columnContent;
  +							var newColumn = columnHolder.childNodes[1].cloneNode(true);	
  +							columnHolder.innerHTML = "";
  +							columns.appendChild(newColumn);
  +							var brElement = document.createElement("br");
  +							brElement.setAttribute("id", newColumn.id + '-br');
  +							columns.appendChild(brElement);
  +							Effect.Appear(newColumn.id);
  +							
  +							if (callback == true)
  +							{
  +							
  +								var domainObjectDropDownID = 'ruleSet.rule['+ ruleCount + '].condition.column[' + newNode + '].objectType'; 
  +								var domainObjectIdentifierID = 'ruleSet.rule['+ ruleCount + '].condition.column[' + newNode + '].identifier'; 
  +							
  +			                              		$(domainObjectDropDownID).value=domainObject.className;
  +						      		$(domainObjectIdentifierID).value=domainObject.identifier;
  +	
  +							
  +								var newColumnId = 'ruleSet.rule['+ ruleCount + '].condition.column[' + newNode + '].fieldConstraint[0].fieldName';
  +								var expressionID = 'ruleSet.rule['+ ruleCount + '].condition.column[' + newNode + '].expression';
  +								//alert(newColumnId);
  +
  +				 				$(newColumnId).options.length = 0;
  +				 				$(newColumnId).options.add(new Option("Please select Field", ""));
  +								
  +								// Set all the options
  +								domainObject.field.each(function(field)
  +								 		{
  +							 				$(newColumnId).options.add(new Option(field.displayUri, field.name));
  +										});
  +								
  +								$(newColumnId).value='term';
  +								
  +								var selectId =  newColumnId.substring(0,newColumnId.lastIndexOf(".")); 
  +								
  +								// Reset the operator
  +								
  +								domainObject.field.each(function(field)
  +										{
  +											if(field.name == 'term')
  +											{
  +												var operatorDropDownID = selectId + '.literalRestriction[0].evaluator';
  +												
  +												$(operatorDropDownID).options.length = 0;
  +												$(operatorDropDownID).options.add(new Option("Please select Operator",""));
  +
  +												field.operator.each(function(operator)
  +													{
  +														$(operatorDropDownID).options.add(new Option(operator.displayUri,operator.name));														
  +														
  +													});
  +													
  +												$(expressionID).value = field.expression;	
  +											}
  +										});
  +										
  +								var validValueField = document.getElementById(selectId + '.literalRestriction[0].value');
  +
  +								var newId = validValueField.id; 
  +								var spanId = newId + '.span';
  +								//Element.remove(validValueField);
  +								$(spanId).innerHTML="";
  +								
  +								createAE.getTermsByCategory(0, function(terms) {
  +						                   
  +
  +							
  +										var selectArea = '<select id="' + newId + '" name="' + newId +'" multiple="multiple" size="3">';
  +													selectArea += '</select>';
  +				
  +							
  +										$(spanId).innerHTML = selectArea;
  +
  +										var sel = $(newId);	
  +				        		        
  +				                	    sel.options.length = 0
  +				                    
  +				                    
  +				                    	terms.each(function(term) {
  +
  +				                        	var opt = new Option(term.select, term.id)
  +				                        	sel.options.add(opt)
  +				                    	})
  +				                })
  +								
  +								
  +								/*				
  +								var inputArea = '<input type="text" id="' + newId + '" name="' + newId +'" size="60"/>';
  +								inputArea += '<img alt="activity indicator" src="/caaers/images/indicator.white.gif" class="indicator" id="term-indicator"/>';
  +								$(spanId).innerHTML = inputArea + '<div id="' + newId + '-choices' + '" class="autocomplete"></div>';
  +								
  +								
  +								new Autocompleter.DWR(newId, newId + '-choices',
  +									                termPopulator, {
  +									                valueSelector: termValueSelector,
  +									                afterUpdateElement: function(inputElement, selectedElement, selectedChoice) {
  +									
  +												//alert(selectedChoice);
  +												$(newId).value=termValueSelector(selectedChoice);
  +									                },
  +						                indicator: "term-indicator"});
  +								*/
  +								
  +													                
  +
  +							}
  +							callback=false;
  +							
  +					});
  +				
  +				}catch (e) {
  +					//alert(e)
  +				}
  +		}
  +		
  +		function removeCondition(ruleCount, columnCount) {
  +				try {
  +					authorRule.removeCondition(ruleCount, columnCount, function(deleteStatus) {
  +							if(deleteStatus) {
  +								var columns = $('rule-'+(ruleCount+1)+'-columns');
  +								var column = $('rule-'+(ruleCount)+'-column-'+(columnCount));
  +								columns.removeChild($(column.id + '-br'));
  +								columns.removeChild(column);
  +							} else {
  +								alert("Delete failed on server " + values)
  +							}
  +					});
  +				
  +				}catch (e) {
  +					alert("Exception " + e)
  +				}		
  +		}
  +		
  +		
  +		function getElementHolderDiv() {
  +			var elementHolderDiv = $('element-holder');
  +			if(elementHolderDiv == null) {
  +				elementHolderDiv = document.createElement("div");
  +				elementHolderDiv.setAttribute("id", "element-holder");
  +			}
  +			
  +			return elementHolderDiv;
  +		}
  +		
  +
  +
  +
  +
  +	
  +	var toggleArray = new Array();
  +	
  +	function toggle(ruleCount) {
  +		var toggleStatus = toggleArray[ruleCount];
  +		var imageObj = $('toggle-image-'+ruleCount);
  +		if(!toggleStatus) {
  +			$('rule-condition-action-container-'+ruleCount).style.display="none";
  +			imageObj.src="/caaers/images/rule/window-maximize.gif"
  +			toggleArray[ruleCount] = true;
  +		} else {
  +			AE.slideAndShow($('rule-condition-action-container-'+ruleCount));
  +			imageObj.src="/caaers/images/rule/window-minimize.gif"
  +			toggleArray[ruleCount] = false;
  +		}
  +	}
  +	
  +	
  +	
  +	
  +				function termPopulator(autocompleter, text) 
  +				{
  +						
  +					var selectedColumnId = autocompleter.element.id;
  +					
  +					var startIndex = selectedColumnId.indexOf('[');
  +					var endIndex = selectedColumnId.indexOf(']', startIndex);
  +					
  +					var ruleCount = parseInt(selectedColumnId.substring(startIndex+1, endIndex));
  +
  +					// Check whether category exists
  +					var columns = $('rule-'+(ruleCount + 1)+'-columns');
  +				
  +				
  +					var divNodes = 0;
  +					
  +					for(var i=0; i < columns.childNodes.length; i++)
  +					{
  +						if (columns.childNodes[i].nodeName == 'DIV')
  +						{
  +							divNodes++;
  +						}
  +					}
  +							
  +					var category; 		
  +
  +					for (var i=0; i < divNodes; i++)
  +					{
  +						var columnId = 'ruleSet.rule['+ ruleCount + '].condition.column[' + i + '].fieldConstraint[0].fieldName';
  +					
  +						if($(columnId).value == 'category')
  +						{
  +							var selectId =  columnId.substring(0,columnId.lastIndexOf(".")); 
  +		
  +							var validValueField = document.getElementById(selectId + '.literalRestriction[0].value');
  +							
  +							category = validValueField.value;
  +						}
  +					}
  +					
  +					
  +
  +					
  +					createAE.matchTerms(text, 3, category, 10, function(values) {
  +						                    autocompleter.setChoices(values)
  +						                })
  +
  +				}
  +	
  +				function termValueSelector(term) 
  +				{
  +					//alert(term.fullName);
  +					return term.fullName;
  +				}
  +
   	function isFieldExists(ruleCount, domainObjectName, fieldName)
   	{
   
  
positive.code: 			
  			
  			return;
  		}
  		
  		try 
  		{
  			// Get the domain object
  			
  			authorRule.getRulesDomainObject(domainObjectSelectedIndex - 1, function(object)
  		                              {
  		                              		domainObject = object;
  				
  								// Reset the operators
  								$(operatorDropDownID).options.length=0;
  								$(operatorDropDownID).options.add(new Option("Please select Operator", ""));
  			
  								domainObject.field[fieldDropDown.selectedIndex-1].operator.each(function(operator)
  										{
  											$(operatorDropDownID).options.add(new Option(operator.displayUri, operator.name));
  								                })
  
  								// Reset the expression
  								$(expressionID).value=domainObject.field[fieldDropDown.selectedIndex-1].expression;
  		                              })
  		
  			
  			if (selectedField.value == 'term')
  			{
  				// Check whether category exists
  				var columns = $('rule-'+(ruleCount + 1)+'-columns');
  				
  				//alert(columns.childNodes.length);
  				
  				
  				var divNodes = 0;
  				
  				for(var i=0; i < columns.childNodes.length; i++)
  				{
  					if (columns.childNodes[i].nodeName == 'DIV')
  					{
  						divNodes++;
  					}
  				}
  							
  				var categoryExist = false;
  				
  				for (var i=0; i < divNodes; i++)
  				{
  					var columnId = 'ruleSet.rule['+ ruleCount + '].condition.column[' + i + '].fieldConstraint[0].fieldName';
  					
  					if($(columnId).value == 'category')
  					{
  						categoryExist = true;
  						break;
  					}
  				}
  				
  				if (categoryExist == true)
  				{
  					var newId = validValueField.id; 
  					var spanId = newId + '.span';
  					//Element.remove(validValueField);
  					$(spanId).innerHTML="";
  				
  					var inputArea = '<input type="text" id="' + newId + '" name="' + newId +'" size="60"/>';
  					inputArea += '<img alt="activity indicator" src="/caaers/images/indicator.white.gif" class="indicator" id="term-indicator"/>';
  					$(spanId).innerHTML = inputArea + '<div id="' + newId + '-choices' + '" class="autocomplete"></div>';
  
  
  					new Autocompleter.DWR(newId, newId + '-choices',
  					                termPopulator, {
  					                valueSelector: termValueSelector,
  					                afterUpdateElement: function(inputElement, selectedElement, selectedChoice) {
  					
  											//alert(selectedChoice);
  											$(newId).value=termValueSelector(selectedChoice);
  					                },
  					                indicator: "term-indicator"});
  				}
  				else
  				{
  					fieldDropDown.value='category';
  					
  				                createAE.getCategories(3, function(categories) {
  
  							var newId = validValueField.id; 
  							var spanId = newId + '.span';
  
  							var selectArea = '<select id="' + newId + '" name="' + newId +'">';
  										selectArea += '</select>';
  				
  							//Element.remove(validValueField);
  
  							
  							$(spanId).innerHTML = selectArea;
  
  							var sel = $(newId);	
  				                
  				                    sel.options.length = 0
  				                    sel.options.add(new Option("Any", ""))
  				                    
  				                    categories.each(function(cat) {
  				                        var name = cat.name
  				                        if (name.length > 45) name = name.substring(0, 45) + "..."
  				                        var opt = new Option(name, cat.id)
  				                        sel.options.add(opt)
  				                    })
  				                })
  					
  					
  					// Add a new column for Term
  					
  					newNode = divNodes;
  					callback = true;
  					fetchCondition(ruleCount);
  					
  					// Reset all the dropdowns for 'term'
  					
  
  					
  				}
  	
  			}
  			else if (selectedField.value == 'category')
  			{
  				                createAE.getCategories(3, function(categories) {
  
  							var newId = validValueField.id; 
  							var spanId = newId + '.span';
  
  							var selectArea = '<select id="' + newId + '" name="' + newId +'" >';
  										selectArea += '</select>';
  				
  							//Element.remove(validValueField);
  
  							
  							$(spanId).innerHTML = selectArea;
  
  							var sel = $(newId);	
  				                
  				                    sel.options.length = 0
  				                    sel.options.add(new Option("Any", ""))
  				                    
  				                    categories.each(function(cat) {
  				                        var name = cat.name
  				                        if (name.length > 45) name = name.substring(0, 45) + "..."
  				                        var opt = new Option(name, cat.id)
  				                        sel.options.add(opt)
  				                    })
  				                })
  
  			}
  			else
  			{
  				
  				authorRule.getValidValues(domainObjectSelectedIndex-1, fieldDropDown.selectedIndex-1, 
  				                     		function (html) 
  			                   			{
  			                   				//alert(html);
  					                   		//validValueField.innerHTML = html;
  
  									var newId = validValueField.id; 
  									var spanId = newId + '.span';
  
  									var isMultiSelect=false;
  									
  									if (domainObject.field[fieldDropDown.selectedIndex-1].fieldValue.inputType == 'multiselect')
  									{
  										isMultiSelect=true;
  									}
  									
  									var selectArea = '';
  									
  									if (isMultiSelect)
  									{
  										selectArea = '<select id="' + newId + '" name="' + newId +'" multiple="multiple"  size="3">';
  									}
  									else
  									{
  										selectArea = '<select id="' + newId + '" name="' + newId +'" >';
  									}
  									
  									selectArea += html + '</select>';
  						
  
  									//Element.remove(validValueField);
  									$(spanId).innerHTML = selectArea;
  							   	});
  			}
  		
  		}
  		catch(e) 
  		{
  			alert('Exception');
  			alert(e);
  		}
  
  
  	}
  
  	function handleDomainObjectonChange(domainObjectDropDown, ruleCount)
  	{
  		
  		var domainObjectDropDownID = domainObjectDropDown.id;
  		
  		var prefixID = domainObjectDropDownID.substring(0,domainObjectDropDownID.lastIndexOf("."));
  		
  		var domainObjectIdentifierID = prefixID + '.identifier'; 
  		
  		var expressionID = prefixID + '.expression';
  		
  		var fieldDropDownID = prefixID + '.fieldConstraint[0].fieldName';
  		
  		var operatorDropDownID = prefixID + '.fieldConstraint[0].literalRestriction[0].evaluator';
  
  		var valueDropDownID = prefixID + '.fieldConstraint[0].literalRestriction[0].value';
  		
  		var valueDropDownSpanID = prefixID + '.fieldConstraint[0].literalRestriction[0].value.span';
  		
  		if (domainObjectDropDown.selectedIndex == 0)
  		{
  			// Set all the fields to null
  
negative.code: 				}
  				
  			return fieldExist;
  	}
  	
  	function resetDropDowns()
  	{
  	}
  	
  	function handleFieldOnchange(fieldDropDown, ruleCount) 
  	{
  		var selectedField = fieldDropDown.options[fieldDropDown.selectedIndex];
  		
  		var selectId =  fieldDropDown.id.substring(0,fieldDropDown.id.lastIndexOf(".")); 
  		
  		var validValueField = document.getElementById(selectId + '.literalRestriction[0].value');
  		
  		
  		// Get the index of Domain Object
  		var domainObjectDropDownID = selectId.substring(0,selectId.lastIndexOf("."))  + '.objectType';
  		var domainObjectSelectedIndex = $(domainObjectDropDownID).selectedIndex;
  		
  		var domainObjectIdentifierID = selectId.substring(0,selectId.lastIndexOf("."))  + '.identifier';
  
  		var expressionID = selectId.substring(0,selectId.lastIndexOf("."))  + '.expression';
  
  		// Get the index of Operator
  		var operatorDropDownID = selectId + '.literalRestriction[0].evaluator';
  
  		//var domainObject = null;
  		
  		// check whether the field already exists
  