anchor.diff:  			showDiv("relationshipTable");
   		}
   	}
  -	
  +	function handleNewRelationship() {		
  +		if(document.getElementById('find_person').style.visibility=='hidden')
  +			{
  +		var starterDateString = $j("#add_birth_start_date").val();
  +	var birthdate = parseSimpleDate(starterDateString, '<openmrs:datePattern />');
  +	var age=getAge(birthdate);
  +	 DWRPersonService.createPerson(document.getElementById('first_name').value, document.getElementById('middle_name').value,document.getElementById('family_name').value,starterDateString , "dd/mm/yyyy", age,
  +			 prefIdentifierElementId,{callback:function(personObject) {
  +				 personA=personObject.personId;				
  +				 handleAddRelationship();}});
  +	 
  +	 clearNewPerson();
  +			}
  +		else
  +			{
  +			personA=$j("#add_rel_target_id").val();
  +	 		handleAddRelationship();
  +	 		
  +			}
  +	}
   	function handleAddRelationship() {
  -		var personIdB = ${model.personId};
  -		var personIdA = $j("#add_rel_target_id").val();
  -		
  +		
  +		var personIdB = ${model.personId};	
  +		var personIdA=personA;
   		if (personIdA == personIdB) {
   			window.alert('<spring:message code="Relationship.error.same" javaScriptEscape="true"/>');
   			return;
  
positive.code: 		document.getElementById('add_relationship_name').innerHTML = label;
  		showDiv('add_rel_details');
  	}
  
  </script>
  
  <div id="patientRelationshipPortlet">
  
negative.code: 		clearAddRelationship();	
  		DWRRelationshipService.createRelationship(personIdA, personIdB, relType, startDateString, refreshRelationships);
  	}
  	
  
  	function clearAddRelationship() {
  		$j("#add_rel_target_id").val("");
  