function Input (text)
{
 	
	this.Data = new Array();
	this.ErrorTexts = new Array();
	this.Errors = new Array();
	this.Answers = new Array();
	this.Status = false;
	this.RecordCount = 0;
	this.ErrorCount = 0;
	this.AnswerCount = 0;	

	this.getInput = function()
	{
		return this.Input;	
	}
	
	this.Process = function ()
	{
		var lines = this.Input.split("\n");
		
		/*
		for (var key in lines)
		{  
			lines[key] = trim (lines[key]);   		                    		                  
		}
		*/

		//Kontrola tri povinnych radku
		if (lines.length < 4) {return 0; alert ("CHYBA < 4 RADKU");}

		if (lines[0] == 'OK') {this.Status = true;}
						else {this.status = false;}

		//Hlavicka
		this.RecordCount = parseInt (lines[1]);
		this.ErrorCount = parseInt (lines[2]);
		this.AnswerCount = parseInt (lines[3]);

		//Kontrola poctu vsech radku
		if (lines.length < 4 + this.RecordCount + this.ErrorCount + this.AnswerCount) {return 0; alert ("CHYBA SUMY RADKU");}
										
		//Predane hodnoty
		for (var i=4;
				i <= 3 + parseInt (this.RecordCount); i++)
		{
			var line_parts = lines[i].split(":");
			var arr = new Array();
			
			for (var key in line_parts)
			{
				if (key == "toJSONString") continue;
				if (Object.isFunction(line_parts[key])) continue;
				if (key != 0)
				{
					arr[arr.length] = Base64.decode(line_parts[key]);								
				}
			}									
			
			if (arr.length < 2) this.Data[line_parts[0]] = arr[0];
			else this.Data[line_parts[0]] = arr;
			
			this.Errors[line_parts[0]] = 0;
		}
		
		//Chybove hlasky
		for (var i=4 + parseInt (this.RecordCount);
				i <= 3 + parseInt (this.RecordCount) + parseInt (this.ErrorCount); i++)
		{
			var line_parts = lines[i].split(":");
			this.ErrorTexts[line_parts[0]] = Base64.decode(line_parts[1]);
			this.Errors[line_parts[0]] = 1;
		}

		//Dodatecne hlasky
		for (var i=4 + parseInt (this.RecordCount) + parseInt (this.ErrorCount);
				i <= 3 + parseInt (this.RecordCount) + parseInt (this.ErrorCount) + parseInt (this.AnswerCount); i++)
		{
			var line_parts = lines[i].split(":");
			this.Answers[line_parts[0]] = Base64.decode(line_parts[1]);
		}				
	}
	
	this.ToString = function ()
	{
		var out = '';
		
		out += 'STATUS: ' + this.Status + "\n";
		out += 'COUNT: ' + this.RecordCount + "/" + this.ErrorCount + "\n";
		
		out += 'DATA: (';
		for (var key in this.Data)
		{  
			if (key == "toJSONString") continue;
			if (Object.isFunction(this.Data[key])) continue;
			out += key + ' => ' + this.Data[key] + '; ';  		                    		                  
		}
		out += ")\n";

		out += 'ERRORTEXTS: (';
		for (var key in this.ErrorTexts)
		{  
			if (key == "toJSONString") continue;
			if (Object.isFunction(this.ErrorTexts[key])) continue;
			out += key + ' => ' + this.ErrorTexts[key] + '; ';  		                    		                  
		}
		out += ")\n";
		
		out += 'ANSWERS: (';
		for (var key in this.Answers)
		{  
			if (key == "toJSONString") continue;
			if (Object.isFunction(this.Answers[key])) continue;
			out += key + ' => ' + this.Answers[key] + '; ';  		                    		                  
		}
		out += ")\n";
	
		return out;
	}
	
	//Konstruktor
	{
		this.Input = text;
		this.Process();	
	}	
}

/*
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
*/

