Yeah I mean something like...
function SpawnByName(name,layer,imgpt){
var obj = name.type; //I know there is not property that would allow me to //do this but I do know there is a runtime.type_by_index property that I //can use and that there is a certain property type.index that would come //in handy too for this
var ins = this.runtime.createInstance(obj, layer, this.getImagePoint(imgpt, true), this.getImagePoint(imgpt, false));
/*
...
...
..
*/
}