﻿// RM3STag Class

RM3STag = function(id, time, title, description, duration, slide) 
{
  this.id = id;
  this.time = time;
  this.title = title;
  this.description = description;
  this.duration = duration;
  this.slide = slide;
}

RM3STag.prototype = {
	loadFromXML: function(xml) {
	  if(xml == null) return;
	  var _x = getTextXmlNodeValue(xml, "tag");
	  if(_x != null) xml = _x;
	  this.id = getTextXmlNodeValue(xml, "id");
	  this.time = parseFloat(getTextXmlNodeValue(xml, "time"));
	  this.title = getTextXmlNodeValue(xml, "title");
	  this.description = getTextXmlNodeValue(xml, "description");
	  this.duration = parseFloat(getTextXmlNodeValue(xml, "duration"));
	  this.slide = getTextXmlNodeValue(xml, "slide");
	  if(this.id == null) this.id = "";
	  if(isNaN(this.time)) this.time = 0.0;
	  if(this.title == null) this.title = "";
	  if(this.description == null) this.description = "";
	  if(this.slide == null) this.slide = "";
	},
	
	saveToXML: function() {
	  if(this.id == null) this.id = "";
	  if(isNaN(this.time)) this.time = 0.0;
	  if(this.title == null) this.title = "";
	  if(this.description == null) this.description = "";
	  if(this.slide == null) this.slide = "";
		return '<tag>' + 
						'<id>' + this.id + '</id>' + 
						'<time>' + this.time + '</time>' + 
						'<title>' + this.title + '</title>' + 
						'<description>' + this.description + '</description>' + 
						'<slide>' + this.slide + '</slide>' + 
						'</tag>';
	}
}