﻿/**
* Gui-Parser for Starcraft II Gui-Script
* by peq
**/

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function in_array(item,arr) {
	for(p=0;p<arr.length;p++) 
		if (item == arr[p]) 
			return true;
	return false;
}
 

function GuiParser(symbols) {
	this.picStyle = 
		"background: url('"+symbols+"') no-repeat top left;"
		+"width:16px;"
		+"height:16px;"
		+"margin:0px;"
		+"padding:0px;"
		+"display:block;"
		+"float:left;"
		+"position:relative;";
	this.textStyle = "float:left; clear:both; white-space:pre-wrap; line-height:16px;";
	this.maxHeight = 400;
	this.symbols = {	
		
		"LocalVariables" : "LocalVariables",
		"LokaleVariablen" : "LocalVariables",
		"Ereignisse" : "events",
		"Events" : "events",
		"Bedingungen" : "cond",
		"Conditions" : "cond",
		"Wenn,Dann,Sonst" : "actions",
		"IfThenElse" : "actions",
		"Wenn" : "actions",
		"Aktionen" : "actions",
		"Actions" : "actions",
		"Foreach" : "struct",
		"Schleifen-Aktionen" : "actions",
		"Loop-Actions" : "actions",
		"'IF'" : "cond",
		"If" : "cond",
		"Falls" : "cond",
		"If-Conditions" : "cond",
		"'THEN'" : "actions",
		"Then" : "actions",
		"Dann" : "actions",
		"Then-Actions" : "actions",
		"'ELSE'" : "actions",
		"Else" : "actions",
		"Sonst" : "actions",
		"Else-Actions" : "actions",
		"If" : "cond",
		"Spielergruppe" : "force",
		"PlayerGroup" : "force",
		"Spieler" : "player",
		"Player" : "player",
		"Einheitengruppe" : "group",
		"UnitGroup" : "group" ,
		'Akteur' : "Actor" ,
		'Actor' : "Actor" ,
		'KI' : "AI" ,
		'AI' : "AI" ,
		'Animation' : "Animation" ,
		'Bank' : "Bank" ,
		'Kamera' : "Camera" ,
		'Camera' : "Camera" ,
		'Katalog' : "Catalog" ,
		'Catalog' : "Catalog" ,
		'Videosequenzen' : "Cinematics" ,
		'Cinematics' : "Cinematics" ,
		'Kommentar' : "Comment" ,
		'Comment' : "Comment" ,
		'-------' : "-------" ,
		'Gespr' : "Conversation" ,
		'Conversation' : "Conversation" ,
		'Datentabelle' : "DataTable" ,
		'DataTable' : "DataTable" ,
		'Debug' : "Debug" ,
		'Dialog' : "Dialog" ,
		'Umgebung' : "Environment" ,
		'Environment' : "Environment" ,
		'Spiel' : "Game" ,
		'Game' : "Game" ,
		'Allgemein' : "General" ,
		'General' : "General" ,
		'Rangliste' : "Leaderboard" ,
		'Leaderboard' : "Leaderboard" ,
		'Math' : "Math" ,
		'Melee' : "Melee" ,
		'Missionsziel' : "Objective" ,
		'Objective' : "Objective" ,
		'Ping' : "Ping" ,
		'Spieler' : "Player" ,
		'Player' : "Player" ,
		'Spielergruppe' : "PlayerGroup" ,
		'PlayerGroup' : "PlayerGroup" ,
		'Punkt' : "Point" ,
		'Point' : "Point" ,
		'Portr' : "Portrait" ,
		'Portrait' : "Portrait" ,
		'Region' : "Region" ,
		'Sound' : "Sound" ,
		'Story' : "Story" ,
		'Technologiebaum' : "TechTree" ,
		'TechTree' : "TechTree" ,
		'Textmarkierung' : "TextTag" ,
		'TextTag' : "TextTag" ,
		'Timer' : "Timer" ,
		'bertragung' : "Transmission" ,
		'Transmission' : "Transmission" ,
		'Ausl' : "Trigger" ,
		'Trigger' : "Trigger" ,
		'UI' : "UI" ,
		'Einheitengruppe' : "UnitGroup" ,
		'UnitGroup' : "UnitGroup" ,
		'Einheiten-Auswahl' : "UnitSelection" ,
		'UnitSelection' : "UnitSelection" ,
		'Einheit' : "Unit" ,		
		'Unit' : "Unit" ,		
		'Variable' : "Variable" ,
		'Sichtbarkeit' : "Visibility" ,
		'Visibility' : "Visibility" ,
};
	this.symbolstyles = {
		'conditem' : "background-position: 0 -48px; ",
		'line' : "background-position: 0 -768px; ",
		'joinbottom' : "background-position: 0 -784px; ",
		'join' : "background-position: 0 -800px; ",
		'cond' : "background-position: 0 -64px; ",
		'events' : "background-position: 0 -16px; ",
		'base' : "background-position: 0 -912px; ",
		'joinbottomplus' : "background-position: 0 -704px; ",
		'joinminus' : "background-position: 0 -720px; ",
		'actions' : "background-position: 0 -832px; ",
		'joinplus' : "background-position: 0 -736px; ",
		'empty' : "background-position: 0 -864px; ",
		'symbol1' : "background-position: 0 -64px; ",
		'page' : "background-position: 0 0px; ",
		'joinbottomminus' : "background-position: 0 -752px; ",
		'comment' : "background-position: 0 -208px; ", 
		'Actor' :	"background-position: 0 -80px;",
		'AI' :	"background-position: 0 -96px;",
		'Animation' :	"background-position: 0 -112px;",
		'Bank' :	"background-position: 0 -128px;",
		'Camera' :	"background-position: 0 -144px;",
		'Catalog' :	"background-position: 0 -160px;",
		'Cinematics' :	"background-position: 0 -176px;",
		'Comment' :	"background-position: 0 -192px;",
		'-------' :	"background-position: 0 -208px;",
		'Conversation' :	"background-position: 0 -224px;",
		'DataTable' :	"background-position: 0 -240px;",
		'Debug' :	"background-position: 0 -256px;",
		'Dialog' :	"background-position: 0 -272px;",
		'Environment' :	"background-position: 0 -288px;",
		'Game' :	"background-position: 0 -304px;",
		'General' :	"background-position: 0 -320px;",
		'Leaderboard' :	"background-position: 0 -336px;",
		'Math' :	"background-position: 0 -352px;",
		'Melee' :	"background-position: 0 -368px;",
		'Objective' :	"background-position: 0 -384px;",
		'Ping' :	"background-position: 0 -400px;",
		'Player' :	"background-position: 0 -416px;",
		'PlayerGroup' :	"background-position: 0 -432px;",
		'Point' :	"background-position: 0 -448px;",
		'Portrait' :	"background-position: 0 -464px;",
		'Region' :	"background-position: 0 -480px;",
		'Sound' :	"background-position: 0 -496px;",
		'Story' :	"background-position: 0 -512px;",
		'TechTree' :	"background-position: 0 -528px;",
		'TextTag' :	"background-position: 0 -544px;",
		'Timer' :	"background-position: 0 -560px;",
		'Transmission' :	"background-position: 0 -576px;",
		'Trigger' :	"background-position: 0 -592px;",
		'UI' :	"background-position: 0 -608px;",
		'Unit' :	"background-position: 0 -624px;",
		'UnitGroup' :	"background-position: 0 -640px;",
		'UnitSelection' :	"background-position: 0 -656px;",
		'Variable' :	"background-position: 0 -672px;",
		'Visibility' :	"background-position: 0 -688px;",
		'LocalVariables' : "background-position: 0 -32px;",
		'actionhead' : "background-position: 0 -880px;",
		'actionparam' : "background-position: 0 -896px;",
		'struct' : "background-position: 0 -848px;",
		'structitem' : "background-position: 0 -32px;",
};
	this.types = {
		'Ereignisse' : 1,
		'Events' : 1,
		'Bedingungen' : 2,
		'Conditions' : 2,
		'Wenn,dann,sonst' : 3,
		'IfThenElse' : 3,
		'Aktionen' : 3,
		'Actions' : 3,
		'Forach' : 4,
		'Wenn' : 5,
		'Schleifen-Aktionen' : 5,
		'Loop-Actions' : 5,
		"'IF'" : 7,
		"If" : 7,
		"ElseIf" : 7,
		"Wenn" : 7,
		"Falls" : 7,
		"If-Conditions" : 7,
		"'Then'" : 8,
		"Then-Actions" : 8,
		"'ELSE'" : 9,
		"Else-Aktionen" : 9,
		//"If" : 6,
		"Spielergruppe" : 10,
		"PlayerGroup" : 10,
		"Einheitengruppe": 11,
		"UnitGroup" : 11	,	
		"LokaleVariablen" : 12,		
		"LocalVariables" : 12		
	};
	
	this.lines = new Array();
	this.tabs = new Array();
}

GuiParser.prototype.MakeClean = function (p_strMod) {
	var strMod = p_strMod; 
	strMod = strMod.replace(/<\/?(?!\!)[^>]*>/gi, '');	
	strMod = strMod.replace(/&nbsp;/gi, ' ');	
	strMod = strMod.replace(/ÃŸ/gi, 'ß');	
	strMod = strMod.replace(/Ã¶/gi, 'ö');	
    return strMod.replace(/\n|\r/gi, '');
}

GuiParser.prototype.make_picture = function (whichpic) {
	var style = this.symbolstyles[whichpic];
	var alt = "";
	if (in_array(whichpic, ["empty","line","joinbottom","join","joinbottomplus","joinminus","joinbottomminus"])) {
		alt="&nbsp;&nbsp;&nbsp;&nbsp;";
	}
	return '<span style="'+ this.picStyle + style + '">'+alt+'</span>';
}
 

GuiParser.prototype.make_finish_line = function(line) {
	return '<div style="'+this.textStyle+'">'+line+'</div>\n';
}


GuiParser.prototype.make_linebreak = function() {
	return '\n';
	//return '<br />';
}

GuiParser.prototype.make_end_text = function(code, height) {
	return '<div style="margin: 5px 20px 20px;">' 
		+ '<div style="font-family:Tahoma,Arial;font-size:11px;color:#000000;'
		+ 'background-color:#FFFFFF; margin-top:0px; margin-bottom:0px; border:1px solid #999999;white-space: nowrap;'
		+ 'width: 97%;overflow:auto; line-height:10px; height:'
		+ height
		+ 'px;">'
		+ code 
		+ '</div></div>';
}

GuiParser.prototype.fill_line_array = function(text) {
	var text_ar = text.split("<br>");

	for (var i = 0; i < text_ar.length; i++) {
		this.lines[i] = this.MakeClean(text_ar[i]);
	}
}

GuiParser.prototype.get_tabs = function(text) {
	var pos = 0;
	var tabs = 0;
	while (text.substr(pos,4) == "    ") {
		pos+=4;
		tabs++;
	}
	return tabs;
}

GuiParser.prototype.fill_tabs_array = function(lines) {
	for (var i = 0; i < lines.length; i++) {
		this.tabs[i] = this.get_tabs(lines[i]);
		
		//alert(this.tabs[i] + " -- " + lines[i])
	}
}

GuiParser.prototype.get_intended = function(lineNr, offset) {
	return this.tabs[lineNr] - this.tabs[lineNr + offset];
}

GuiParser.prototype.get_type = function(intext) {
		if (typeof intext == "undefined") {
			return 0;
		}
		var text = intext.replace(/[^a-zA-Z0-9\-\,]/g,"");
		for (var tag in this.types) {		
			var start = text.substr(0, tag.length);
			if (start == tag) {
				return this.types[tag];
			}
		}
		return 0;
}

GuiParser.prototype.get_symbol = function(_text) {
		var text = _text.replace(/ /g,"");
		for (var tag in this.symbols) {
			
			if (text.substr(0, tag.length) == tag) {
				return this.symbols[tag];
			}
		}
		return "page";
}


GuiParser.prototype.isFunctionCall = function(text) {
	lines = text.split(/\n?<br>/ig);
	if (lines.length < 3) {
		return false;
	}
	
	
	for (i=1; i<lines.length; i++) {
		if (lines[i].length == 0) {
			continue;
		}
	
		if (lines[i].indexOf(':') < 0) {
			//hat keinen doppelpunkt -> fertig
			return false;
		}
	}
	return true;
	/*
	alert(text);
	var reg = /^[^@]+(@[^@:]+:[^@]+)+$/;
	alert((text.match(reg)) ? 'yes' : 'no');
	return text.match(reg);*/
}

GuiParser.prototype.isStructDelaration = function(text) {
	
	var reg = /^[^\n]+\n\s*<br>\s*Variables.*/;
		//alert(((text.match(reg)) ? 'yes' : 'no') + text);
	return text.match(reg);
}

GuiParser.prototype.ParseGuiFunctionCall = function(text) {
	this.fill_line_array(text);
	this.fill_tabs_array(this.lines);
	var intend_line = new Array();
	for (var i = 0; i <= 10; i++)	
		intend_line[i]=0;
	
	ausgabe = "";
	for (var lineNr = 0; lineNr < this.lines.length; lineNr++) {
		var line = trim(this.lines[lineNr]);
		var tabs = this.tabs[lineNr];
		var ausgabe_line = '';
		var lineType = this.get_type(line)
		
		if (line == "") {
			continue;
		}
		
		if (tabs == 0) {
			ausgabe_line+= this.make_picture('actionhead');
		} else {
			
			
			for (var i = 2; i <= tabs; i++)	
			{
				//Einrückungen
				if (intend_line[i])	{
					ausgabe_line+= this.make_picture('line');
				}
				else {
					ausgabe_line+= this.make_picture('empty');
				}
			}	
			
			
			
			if (this.get_intended(lineNr, 1) == 0)
			{
				//keine Einrückungen
				ausgabe_line+=this.make_picture('join');				
			} else if (this.get_intended(lineNr, 1) == -1) {
				//Einrüclung nach rechts
				var a = 1;
				var intended_lines = 0;
				while (this.get_intended(lineNr, a) < 0) {
					a++;
				}
				
				if ((this.get_intended(lineNr, a)==0) && (this.lines[a]!="") ) {
					intended_lines++;
					intend_line[tabs+1]=1;
				} else {
					intend_line[tabs+1]=0;
				}
				if (intended_lines > 0) {
					ausgabe_line+= this.make_picture('joinminus');
				} else {
					ausgabe_line+= this.make_picture('joinbottomminus');
				}
			} 
			else
			{
				//Ende einer Einrückung
				ausgabe_line+=this.make_picture('joinbottom');
				intend_line[tabs]=0;
				//# blocks2close = this->get_intended(this->text_line_array,lineNr,1);				
				//ausgabe_line.=blocks2close;
			}
			ausgabe_line+= this.make_picture('actionparam');
			
		}
		ausgabe_line+=" &nbsp;"+line;
		ausgabe+=this.make_finish_line(ausgabe_line);
	}
	
	var height = 16*(this.lines.length);
	//fÃ¼r den Internet-Explorer:
	height += 25; 
	if (height>this.maxHeight) {
		height = this.maxHeight;
	}
	
	
	
		
	ausgabe = this.make_end_text(ausgabe, height);
	
	
	return ausgabe;
	
	return ausgabe;
		
}


GuiParser.prototype.ParseGuiStuctDelatation = function(text) {
	this.fill_line_array(text);
	this.fill_tabs_array(this.lines);
	var intend_line = new Array();
	for (var i = 0; i <= 10; i++)	
		intend_line[i]=0;
	
	ausgabe = "";
	for (var lineNr = 0; lineNr < this.lines.length; lineNr++) {
		var line = trim(this.lines[lineNr]);
		var tabs = this.tabs[lineNr];
		var ausgabe_line = '';
		var lineType = this.get_type(line)
		
		if (line == "") {
			continue;
		}
		
		if (tabs == 0) {
			ausgabe_line+= this.make_picture('struct');
		} else {
			
			
			for (var i = 2; i <= tabs; i++)	
			{
				//Einrückungen
				if (intend_line[i])	{
					ausgabe_line+= this.make_picture('line');
				}
				else {
					ausgabe_line+= this.make_picture('empty');
				}
			}	
			
			
			
			if (this.get_intended(lineNr, 1) == 0)
			{
				//keine Einrückungen
				ausgabe_line+=this.make_picture('join');				
			} else if (this.get_intended(lineNr, 1) == -1) {
				//Einrüclung nach rechts
				var a = 1;
				var intended_lines = 0;
				while (this.get_intended(lineNr, a) < 0) {
					a++;
				}
				
				if ((this.get_intended(lineNr, a)==0) && (this.lines[a]!="") ) {
					intended_lines++;
					intend_line[tabs+1]=1;
				} else {
					intend_line[tabs+1]=0;
				}
				if (intended_lines > 0) {
					ausgabe_line+= this.make_picture('joinminus');
				} else {
					ausgabe_line+= this.make_picture('joinbottomminus');
				}
			} 
			else
			{
				//Ende einer Einrückung
				ausgabe_line+=this.make_picture('joinbottom');
				intend_line[tabs]=0;
				//# blocks2close = this->get_intended(this->text_line_array,lineNr,1);				
				//ausgabe_line.=blocks2close;
			}
			ausgabe_line+= this.make_picture('structitem');
			
		}
		ausgabe_line+=" &nbsp;"+line;
		ausgabe+=this.make_finish_line(ausgabe_line);
	}
	
	var height = 16*(this.lines.length);
	//fÃ¼r den Internet-Explorer:
	height += 25; 
	if (height>this.maxHeight) {
		height = this.maxHeight;
	}
	
	
	
		
	ausgabe = this.make_end_text(ausgabe, height);
	
	
	return ausgabe;
	
	return ausgabe;
		
}


GuiParser.prototype.ParseGui = function(text) {
	text = trim(text);
	text = text.replace(/\n?(<BR>|<br \/>|<br\/>)/ig, "\n<br>");
	
	text = text.replace(new RegExp("^([\w]|<[^>]*>| |\n)+", "g"), "");
	
	
	if (this.isFunctionCall(text)) {
		return this.ParseGuiFunctionCall(text);
	}
	
	if (this.isStructDelaration(text)) {
		return this.ParseGuiStuctDelatation(text);
	}

	
	this.fill_line_array(text);
	this.fill_tabs_array(this.lines);
	
	var ausgabe = '';
	
	var noheader = 0;
	var triggername = "";
	var bedingungen = -1;
	var variables = -1;
	
	//ist die zweite Zeile == "Ereignisse" ::: dann haben wir höchstwahrscheinlich einen ganzen Trigger

	
	if (this.get_type(this.lines[1]) == 1) {
		noheader = 2;
	}
	
	var header = (noheader == 0) ? 1 : 0;
	
	
	var intend_line = new Array();
	for (var i = 0; i <= 10; i++)	
		intend_line[i]=0;
	
	
	for (var lineNr = 0; lineNr < this.lines.length; lineNr++) {
		var line = trim(this.lines[lineNr]);
		var tabs = this.tabs[lineNr];
		var ausgabe_line = '';
		var lineType = this.get_type(line)
		
		if (line == "") {
			continue;
		}
		
		//echo line;
		/*
		if (nextlinecode != '') {
			ausgabe+=nextlinecode;
			nextlinecode='';
		}
		*/
		
		
		
		
		if (bedingungen != -1)
		{
			if (tabs <= bedingungen)
			{
				bedingungen = -1;
			}
		}
		
		if (variables != -1) {
			if (tabs <= variables) {
				variables = -1;
			}
		}
		
		
		if ((tabs == 0) && (header == 0)  )	{
			if (!in_array(lineType, [1,2,3])) {
				ausgabe_line+= this.make_picture('base'); 
				ausgabe_line+=" &nbsp;"+line;
				triggername = line;
			} else {
				if (lineType == 2) { //Bedingungen
					bedingungen=tabs;	
				}
				if (lineType == 12) {
					variables = tabs;
				}
				lineNr--;
				
			}	
			header++;			
		} else {
			for (var i = 1 + (triggername != "" ? 1 : 0 ); i <= tabs; i++)	
			{
				//Einrückungen
				if (intend_line[i])	{
					ausgabe_line+= this.make_picture('line');
				}
				else {
					ausgabe_line+= this.make_picture('empty');
				}
			}	
			
			
			
			if (this.get_intended(lineNr, 1) == 0)
			{
				//keine Einrückungen
				ausgabe_line+=this.make_picture('join');				
			} else if (this.get_intended(lineNr, 1) == -1) {
				//Einrüclung nach rechts
				var a = 1;
				var intended_lines = 0;
				while (this.get_intended(lineNr, a) < 0) {
					a++;
				}
				
				if ((this.get_intended(lineNr, a)==0) && (this.lines[a]!="") ) {
					intended_lines++;
					intend_line[tabs+1]=1;
				} else {
					intend_line[tabs+1]=0;
				}
				/*if (intended_lines > 0) {
					//ausgabe_line.='<img style="border: 0px;vertical-align: middle;" src="'.symbolpath.'joinminus.gif">';
					div_id = uniqid("block_") ;
					src1 = ''.symbolpath.'joinminus.gif';
					src2 = ''.symbolpath.'joinplus.gif';
					ausgabe_line.=this->make_aufklapp_picture(div_id,src1,src2);
					nextlinecode.=this->make_block(div_id);//'<div id="'.div_id.'">';
					open_divs++;
				}
				else
				{
					//ausgabe_line.='<img style="border: 0px;vertical-align: middle;" src="'.symbolpath.'joinbottomminus.gif">';
					div_id = uniqid("block_") ;
					src1 = ''.symbolpath.'joinbottomminus.gif';
					src2 = ''.symbolpath.'joinbottomplus.gif';
					ausgabe_line.=this->make_aufklapp_picture(div_id,src1,src2);
					nextlinecode.=this->make_block(div_id);//'<div id="'.div_id.'">';
					open_divs++;
				}*/
				if (intended_lines > 0) {
					ausgabe_line+= this.make_picture('joinminus');
				} else {
					ausgabe_line+= this.make_picture('joinbottomminus');
				}
			} 
			else
			{
				//Ende einer Einrückung
				ausgabe_line+=this.make_picture('joinbottom');
				intend_line[tabs]=0;
				//# blocks2close = this->get_intended(this->text_line_array,lineNr,1);				
				//ausgabe_line.=blocks2close;
			}
			
			

			if (lineType == 2 )
			{
				ausgabe_line+=this.make_picture('cond');
				if (bedingungen == -1) {
					bedingungen=tabs;
				}
			} else if (lineType == 12 ) {
				ausgabe_line+=this.make_picture('LocalVariables');
				if (variables == -1) {
					variables=tabs;
				}
			} else if (lineType == 7 ) {
				ausgabe_line+=this.make_picture('cond');
				if (bedingungen == -1) {
					bedingungen=tabs;
				}
			}
			else 
			{
				//Aktion
				if (this.get_symbol(line) == 'comment') {
					ausgabe_line+=this.make_picture('comment');	
				} else if (bedingungen >= 0) {
					ausgabe_line+=this.make_picture('conditem');
				} else if (variables >= 0) {
					ausgabe_line+=this.make_picture('LocalVariables');
				} else {
					ausgabe_line+=this.make_picture(this.get_symbol(line));
				}
				
				/*
				if (bedingungen == -1) {
					ausgabe_line+=this.make_picture(this.get_symbol(line));
				} else {
					ausgabe_line+=this.make_picture('struct');
				}
				*/				
			}
			ausgabe_line+=" &nbsp;"+line;
		}
		ausgabe+=this.make_finish_line(ausgabe_line);
		
		if (((lineNr != 0) && (noheader==1)) || (noheader!=1))
		{
			ausgabe+=this.make_linebreak();//"<br />";
		}
		
		
		ausgabe+='\n';
		
		/*
		for (c=0;c<blocks2close;c++)
		{
			if (open_divs > 0)
			{
				//ausgabe.="\r\n</div>";
				ausgabe.=this->make_endblock();//"</div>";
				open_divs--;
			}
		}
		blocks2close = 0;
		*/
		
		//lineNr++;
		
	}
	//fixed the Unicode-Bug with german letters
	//egal, was ich mache - wenn ich einen AuslÃ¶ser aus dem Editor irgendwo hin kopiere werden die Sonderzeichen falsch angezeigt
	//ich nehm den Teil deshalb wieder rein, damit man nicht jedes mal von Hand die Umlaute Ã¤ndern muss
	//da wohl kaum einer in nem Trigger "Ãƒâ€ž" schreibt, wird es auch keinen stÃ¶ren
	//AuÃŸerdem denk ich, dass das Problem nicht nur bei mir auftritt, da man auch im inWarcraft-Forum immer wirder diese Zeichen sieht.
	// mfg peq
	
	/*
	ausgabe = str_replace("Ã¤","&auml;",ausgabe);
	ausgabe = str_replace("Ã¶","&ouml;",ausgabe);
	ausgabe = str_replace("Ã¼","&uuml;",ausgabe);

	ausgabe = str_replace("Ã&amp;#8222;","&Auml;",ausgabe);
	ausgabe = str_replace("Ã&amp;#8211;","&Ouml;",ausgabe);
	ausgabe = str_replace("Ã&amp;#339;","&Uuml;",ausgabe);
	ausgabe = str_replace("Ã&amp;#376;","&szlig;",ausgabe);
	
	ausgabe = str_replace("Ã„","&Auml;",ausgabe);
	ausgabe = str_replace("Ã–","&Ouml;",ausgabe);
	ausgabe = str_replace("Ãœ","&Uuml;",ausgabe);
	ausgabe = str_replace("ÃŸ","&szlig;",ausgabe);
	*/
	//ausgabe = str_replace("\r","",ausgabe);
	//ausgabe = str_replace("\n","",ausgabe);
	//ausgabe = str_replace("<br />","<br />\n",ausgabe);
	
	//HÃ¶he :
	
	
	var height = 16*(this.lines.length - ((noheader==0) ? 0 : 1));
	//fÃ¼r den Internet-Explorer:
	height += 25; 
	if (height>this.maxHeight) {
		height = this.maxHeight;
	}
	
	
	
		
	ausgabe = this.make_end_text(ausgabe, height);
	
	
	return ausgabe;
}



if (window.GuiParserDone == undefined) {

	$(function() {
		$(".GuiCode").each(function() {
			var input = $(this).html();
			var parser = new GuiParser("http://starcraftmapping.de/js/symbols_sc2.png");//http://peeeq.de/GuiParserPics/symbols.png
			//var parser = new GuiParser("file:///C:/Users/Peter/Desktop/js/symbols_sc2.png");//http://peeeq.de/GuiParserPics/symbols.png
			var output = parser.ParseGui(input);
			$(this).html(output);
			
		});
	});

}
GuiParserDone = true;

