function ActivityRunTimeInteraction (
			Id,
			Type, 
			TimestampUtc,
			Timestamp, 
			Weighting,
			Result,
			Latency, 
			Description, 
			LearnerResponse, 
			CorrectResponses,
			Objectives){
	this.Id = Id;
	
	//TODO: documentation note: these values that have if=="" the = null....those are vocabulary elements that can be null...
	//those are fairly unique and difficult to handle on the server side
	
	if (Type === ""){
		Type = "";
	}
	this.Type = Type; 
	
	this.TimestampUtc = TimestampUtc; 
	this.Timestamp = Timestamp; 
	this.Weighting = Weighting;
	
	if (Result === ""){
		Result = null;
	}
	this.Result = Result;
	
	if (Latency === ""){
		Latency = null;
	}
	this.Latency = Latency; 
	
	this.Description = Description; 
	this.LearnerResponse = LearnerResponse; 
	this.CorrectResponses = CorrectResponses;
	this.Objectives = Objectives;
}
			
			
ActivityRunTimeInteraction.prototype.GetXml = ActivityRunTimeInteraction_GetXml;
ActivityRunTimeInteraction.prototype.toString = ActivityRunTimeInteraction_toString;


function ActivityRunTimeInteraction_GetXml(activityId, index){
	
	var ServerFormat = new ServerFormater();
	
	var xml = new XmlElement("ActivityRunTimeInteraction");
	
	xml.AddAttribute("ActivityId", activityId);
	xml.AddAttribute("Index", index);
	
	xml.AddAttribute("Id", ServerFormat.TrimToLength(this.Id, 4000));
	
	if (this.Type !== null){
		xml.AddAttribute("Type", ServerFormat.ConvertInteractionType(this.Type));
	}
	if (this.Timestamp !== null){
		xml.AddAttribute("TimestampUtc", ServerFormat.ConvertTime(this.Timestamp));
		xml.AddAttribute("Timestamp", this.Timestamp);
	}
	if (this.Weighting !== null){
		xml.AddAttribute("Weighting", this.Weighting);
	}
	if (this.Result !== null && this.Result !== ""){
		if (IsValidCMIDecimal(this.Result)){
			xml.AddAttribute("Result", ServerFormat.GetNumericInteractionResultId());
			xml.AddAttribute("ResultNumeric", this.Result);
		}
		else{
			xml.AddAttribute("Result", ServerFormat.ConvertInteractionResult(this.Result));
		}
	
	}
	if (this.Latency !== null){
		xml.AddAttribute("Latency", ServerFormat.ConvertTimeSpan(this.Latency));
	}
	if (this.Description !== null){
		xml.AddAttribute("Description", ServerFormat.TrimToLength(this.Description, 500));
	}
	if (this.LearnerResponse !== null){
		xml.AddAttribute("LearnerResponse", ServerFormat.TrimToLength(this.LearnerResponse, 7800));
	}
	
	var tempCorrectResponseXml;
	var i;
	for (i=0; i < this.CorrectResponses.length; i++){
		tempCorrectResponseXml = new XmlElement("CorrectResponse");
		
		tempCorrectResponseXml.AddAttribute("ActivityId", activityId);
		tempCorrectResponseXml.AddAttribute("InteractionIndex", index);
		tempCorrectResponseXml.AddAttribute("Index", i);
		
		tempCorrectResponseXml.AddAttribute("value", ServerFormat.TrimToLength(this.CorrectResponses[i], 7800));
		xml.AddElement(tempCorrectResponseXml.toString());
	}

	var tempObjectiveXml;
	for (i=0; i < this.Objectives.length; i++){
		tempObjectiveXml = new XmlElement("Objective");
		
		tempObjectiveXml.AddAttribute("ActivityId", activityId);
		tempObjectiveXml.AddAttribute("InteractionIndex", index);
		tempObjectiveXml.AddAttribute("Index", i);
		
		tempObjectiveXml.AddAttribute("Id", ServerFormat.TrimToLength(this.Objectives[i], 4000));
		xml.AddElement(tempObjectiveXml.toString());
	}
	
	return xml.toString();
}

function ActivityRunTimeInteraction_toString(){
	return "ActivityRunTimeInteraction";
}
