Hi
CRM Lookup support an array that has the following predefined properties i.e. id, name, type and typename. Here is an example on how it works [OnChange of your lookup attribute]
var lookupItem = new Array;
// This will get the lookup for the attribute primarycontactid on the Account form.
lookupItem = crmForm.all.primarycontactid.DataValue;
// If there is data in the field, show it in a series of alerts.
if (lookupItem[0] != null)
{
// The text value of the lookup.
alert(lookupItem[0].name);
// The GUID of the lookup.
alert(lookupItem[0].id);
// The entity type name.
alert(lookupItem[0].typename);
// The entity type code of the lookup: 1=account, 2= contact.
// This attribute is deprecated. Use typename instead.
alert(lookupItem[0].type);
}
More on how to use lookup here
http://technet.microsoft.com/en-us/library/aa681853.aspx
Hope this helps. Amar