function SmsAnim () {

	this.addText = function (country, eId, text, charDelay, nextDelay) {
		var c;
		c = this.texts[country];
		if ( (typeof(c) == "undefined") || (c == null) ) {
			c = new Array ();
			this.texts[country] = c;
		}

		var eIds;
		eIds = eId.split(",");
		for (var i=0; i<eIds.length; i++) {
			var o = new Object();
			o["eId"] = eIds[i];
			o["text"] = text;
			o["charDelay"] = charDelay;
			o["nextDelay"] = nextDelay;
			c[c.length] = o;
		}
	}

	this.init = function (country) {
		this.texts = new Object();
		this.textsIndex = 0;
		this.textPosition = 0;
		this.country = country;
	}

	this.doAnim = function () {
		var c = this.texts[this.country];
		var delay = c[this.textsIndex]["charDelay"];
		if (delay == 0) {
			this.textPosition = c[this.textsIndex]["text"].length;
		}
		if ( (typeof(document.getElementById(c[this.textsIndex]["eId"])) == "undefined") || (document.getElementById(c[this.textsIndex]["eId"]) == null) ){
			alert ("Could not find Element "+c[this.textsIndex]["eId"]);
		}
		document.getElementById(c[this.textsIndex]["eId"]).innerHTML =
			c[this.textsIndex]["text"].substr(0, this.textPosition);
		this.textPosition++;
		if (this.textPosition > c[this.textsIndex]["text"].length) {
			this.textPosition = 0;
			delay = c[this.textsIndex]["nextDelay"]
			this.textsIndex++;
			if (this.textsIndex >= c.length) {
				this.textsIndex = 0;
			}
			nextDelay = true;
		}
		setTimeout("smsAnim.doAnim()", delay);
	}

	this.chCty = function(country) {
		this.country = country;
		this.textsIndex = 0;
		this.textPosition = 0;
		
		var c = this.texts[this.country];
		for (var i=0; i<c.length; i++) {
			document.getElementById(c[i]["eId"]).innerHTML = "";
		}
	}
}
