 /*  var stat=activitiesByCAM[cp_node_id];  if (stat.exit!="suspend") {  for (var k in Runtime.models.cmi.cmi) {  } } */ 
function setAPI(cp_node_id, api) {	function setAPIWalk (model, data, api) 	{		var k, i;		if (!model.children) return;		for (k in model.children) 		{			var mod = model.children[k];			var ap = api[k];			if (mod.type===Object) // activity.SCORE.max			{				for (var i=mod.mapping.length; i--;)				{					setItemValue(mod.mapping[i], data, ap);				}			}			else if (mod.type===Array) 			{				var map = mod.mapping || {name : k.substr(0, k.length-1)};				map.dbtable = map.name + "s"; 				map.dbname = 'cmi_'+ map.name + '_id';				map.clsname = map.name.charAt().toUpperCase() + map.name.substr(1);				for (i in ap) 				{					var dat = data[map.dbtable];					var row = ap[i];					if (map.refunc)  					{						var remap = map.refunc(dat[i]);						row[remap[0]] = remap[1];					}					if (!row[map.dbname]) row[map.dbname] = '$'+(remoteInsertId++);					var id = row[mod.unique] || row[map.dbname];					var cls = this[map.clsname] || Object;					if (!dat[id]) 					{						dat[id] = new cls;					}					setAPIWalk(mod, dat[id], row);				}			}			else 			{				setItemValue(k, data, api);			}		}	}			/*	//check for suspend	var stat=activitiesByCAM[cp_node_id];	if (stat.exit!="suspend") {		//virginize tracking data		for (var k in Runtime.models.cmi.cmi) {					}	}		*/	// reference to live data	var data = activitiesByCAM[cp_node_id];	// start recursive process to add current cmi subelements	setAPIWalk(Runtime.models.cmi.cmi, data, api.cmi);		data.dirty = 2;		return true;	}
6251	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/6251/28e562aa21b57add869615f49b662b0b2b960b1c/main.js/clean/Modules/Scorm2004/scripts/main.js