Hi,
in CRM 2011 the correct code for set the lookup is "entityType" so the code will be:
lookupValue[0].entityType = entityType;
"typename" is from CRM 4.0 syntax and is not compatible after UR12
If the value is not saved when you set the value by javascript means that probably the id doesn't exist.