Thank you for the response.
The problem I have is that at runtime the javascript cannot see the Resources[] object. So any call to it returns an error. What you can do however is:
TW.Runtime.Session.SetSessionValue(<session parameter>,<value>);
However for my purposes I think using a Mashup Parameter is easier to implement. To set the value of a mashup parameter on the current mashup:
TW.Runtime.Workspace.Mashups.Current.setParameter(<mashup parameter name>,<);
The custom widget I created is based off the shape widget and sets the Mashup Parameter value specified in it's properties to the value specified in it's properties.