function getAPI(cp_node_id) {	function getAPISet (k, dat, api) 	{		if (dat!=undefined && dat!==null) 		{			api[k] = dat.toString();		}	}		function getAPIWalk (model, data, api) 	{		var k, i;		if (!model.children) return;		for (k in model.children) 		{			var mod = model.children[k];			var dat = data[k];			if (mod.type===Object) 			{				api[k] = {};				for (var i=mod.mapping.length; i--;)				{					getAPISet(mod.mapping[i], dat, api[k]);				}			}			else if (mod.type===Array) 			{								api[k] = [];							//	sclogdump(dat);				if (mod.mapping) 				{				//TODO-this needs a fix!!!				//	dat = data[mod.mapping.name];				}				for (i in dat) 				{					if (mod.mapping && !mod.mapping.func(dat[i])) continue;					var d = getAPIWalk(mod, dat[i], {});					var idname = 'cmi_'+ k.substr(0, k.length-1) + '_id';					if (dat[i]['objectiveID']) {						d['id'] = dat[i]['objectiveID'];					} else {						d[idname] = dat[i][idname];					}						api[k].push(d);														}			}			else 			{				getAPISet(k, dat, api);			}		}		return api;	}		// create api data element with some starting values	var api = {cmi:{}, adl:{}};		// reference to live data	var data = activitiesByCAM[cp_node_id];	// start recursive process to add current cmi subelements	getAPIWalk(Runtime.models.cmi.cmi, data, api.cmi);	return api;	}
6251	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/6251/7324104d70bdd7e381a9461080cc90b8709273bd/main.js/clean/Modules/Scorm2004/scripts/main.js