/* -------------------------------------------------------------------------------------------------------
*	
Function:	If the Customers also exist as partners than on selecting a Customer in Child Off
Field, sets Partner Field to the Partner with same name as Customer. 

Functionality:
Sets the Partner Field to the partner with the name similar to that of Customer selected
in the Child Off Field.

Deployment:
The script can be deployed on Customer Form .

Event triggering the script:
It is called on the field change evant of Child off Field .( Field Change function )

Custom Fields:
+------------------------------------------------------------------------------------------------------+
| S. No.|		Id			|	  Type			|	Level	|		Description							
+------------------------------------------------------------------------------------------------------+
No custom fields Required																					
*-----------------------------------------------------------------------------------------------------------
*/

// Global Variables
{
	var debugFieldChange = false ;
}

function fieldChanged(type,name)
{	
	    if(name == 'parent')
		{
			if ( debugFieldChange ) alert("parent changed");
			var partner2 = nlapiGetFieldText('parent');
			if ( debugFieldChange ) alert("Setting Partner:" + partner2);
			nlapiSetFieldText('partner', partner2);
		}

		return true;
}
