/*
* Bisher nichts bekannt
*/

function FR() {

	this.abbreviation = new Array("St.", "bzw.", "Bzw.");
	this.splitExpr = /[;,\.\?!:\-]|(^et\w)|(^ou\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,2) == "et" || str.trim().substr(pos,2) == "ou") ) {
					// 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(/\./, ". point. ");
		str = str.replace(/,/, ". 	virgule. ");
		str = str.replace(/"/, ". guillemet. ");
		str = str.replace(/-/, ". 	tiret. ");
		str = str.replace(/!/, ". 	point d'exclamation. ");
		str = str.replace(/\?/, ". point d'interrogation. ");
		return str;
	}
	
	this.dictationIntro = "Au début toute la dictée est récitée une fois.";
	this.dictationStart = "La dictée commence.";
	this.dictationRead = "La dictée est récitée encore une fois, à fin de contrôler les résultats.";
	
	this.pause = "  !!   !!  ";
}