/*
* Bisher nichts bekannt
*/

function IT() {

	this.abbreviation = new Array("St.", "bzw.", "Bzw.");
	this.splitExpr = /[;,\.\?!:\-]|(^e\w)|(^o\w)|(^od\w)|(^ed\w)/;
	/**
	* Funktion doe Überprüft ob ein String mit einem Element des Arrays endet
	*/
	this.abbreviation.inArrayEndsWith = function (str) {
		for (var i=0; i < this.length; i++)	{
			if (this[i] === str.substr(str.length - this[i].length)) {
				return true;
			}
		}
	}
	/**
	* Gibt eine Expression zurück um einen Text in Sätze, bzw. Satzteile zurück, 
	* so dass diese möglichst Sinnvoll vorgelesen werden können
	*/
	this.splitText = function(str) {
		str = str.trim();
		var parts = new Array();
		pos = str.search(this.splitExpr);
		var tmp = "";
		
		while (pos >= 0 ) {
			// Punkte in Abkürzungen werden ignoriert
			if (this.abbreviation.inArrayEndsWith(str.substr(0,pos+1).trim())) {
				// String wird für den nächsten Part zwischengespeichert
				pos++;
				tmp += str.substr(0, pos).trim();
			}
			else {
				// und oder werden erkannt
				var weight = 0.3;
				if (!(str.trim().substr(pos,1) == "\"" || str.trim().substr(pos,1) == "e" || str.trim().substr(pos,1) == "o") || str.trim().substr(pos,2) == "od" || str.trim().substr(pos,2) == "ed") {
					// Satzzeichen werden mitgenommen
					if (str.trim().substr(pos,1) == ".") {
						weight = 1;
					}
					else {
						weight = 0.6;
					}
					pos++;
				}
				
				parts.push(new Part(tmp + " " +str.substr(0,pos), weight));
				// tmp string wird zurückgesetzt
				tmp = "";
			}
			// String wird weiter verarbeitet
			str = str.substr(pos).trim();
			pos = str.search(this.splitExpr);
		}
		if (tmp != "") {
			parts.push(new Part(tmp), 1);
		}
		return parts;
	}
	
	/**
	* Ersetzt die Satzzeichen durch die entsprechenden ausgesprochenen Wörter
	*
	*/
	this.toPunctuationString = function(str) {
		str = str.replace(/\./, ". punto. ");
		str = str.replace(/,/, ". virgola. ");
		str = str.replace(/"/, ". 	virgoletta. ");
		str = str.replace(/-/, ".  trattino. ");
		str = str.replace(/!/, ".  punto esclamativo. ");
		str = str.replace(/\?/, ". punto interrogativo. ");
		return str;
	}
	
	this.dictationIntro = "Il dettato verrà letto completamente una prima volta in italiano.";
	this.dictationStart = "Inizio del dettato.";
	this.dictationRead = "Il dettato verrà letto una secodna volta.";
	
	this.pause = "  !!   !!  ";
}
