Every MS CRM implementation requires lot’s of JS code to implement validation and business logic using client side. As you know we can call MS CRM web services in JS to retrieve MS CRM data and insert ms crm data. But in MS CRM 4.0 there was no way to share JS code indifferent entities forms in supported way. You can create JS library in and load it in different ms crm entities forms, but it is unsupported in MS CRM 4.0. I have faced many issues while using external JS files in one of my MS CRM 4.0 implementations.
But now no need to worry about external JS files, MS CRM 2011 provide provides you OOB facility to use Common JS libraries in term of web resources. You can load your JS files using web resource, once loaded you can call your JS functions that are available in JS files. You can configure ms crm entity and attributes events to call this function and also you can pass parameter to that function. Thanks to Ayaz Ahmad, he has written a wonderful Post to demonstrate, how to use JS libraries in MS Dynamics 2011.
And If you are worried about how to convert your existing MS CRM 4.0 JS code to Dynamics 2011 JS code then here is a wonderful tool that you can use to upgrade your MS CRM 4.0 JS code to MS CRM 2011.
You can download MS CRM 2011 SDK for more Client-Side Programming Reference