
	/*
		Kezeli a fĂĽles program bĂ¶ngĂ©szĹ‘t
	*/
	
	function tabBrowser()
	{
		// fĂĽl, ahova a tartalmat tĂ¶lteni kell
		
		this.obj = '';
		
		// elindĂ­tja az xhr-t
		
		this.getContent = function(obj)
		{
			this.obj = obj;
			
			this.obj.setContent(dict['loading']);

			// eldĂ¶ntjĂĽk, hogy mit hĂ­vunk meg
			
			switch (obj.id)
			{
				case "r_1": u = "limit=2010&tab=region"; break;
				case "p_1": u = "limit=2010&tab=pecs"; break;
				case "r_2": u = "tab=region"; break;
				case "p_2": u = "tab=pecs"; break;
				default: return;
			}

			var url = "programs/ajax.php?xhr=tabbrowser&languageID=" + languageID + "&" + u;
			var post = dojo.xhrPost(
			{
				url: url,
				sync: false,
				mimetype: "text/json-comment-filtered",
				encoding: "utf-8",
				load: function (data) { tB.parseResponse(data); },
		        error: function(data) { this.obj.setContent(dict['xhrError']); }
			});
		}
		
		// feldolgozza a kĂ©rĂ©st
		
		this.parseResponse = function(data)
		{
			var pData = eval(data); // json adattĂ¶mb
			
			// console.debug(this.obj);
			this.obj.innerHTML = ""; // kiĂĽrĂ­tjĂĽk a tartalmat...
			var temp = '';
			
			if (pData.length > 0)
			{
				for (var i = 0; i < pData.length; i++) // feltĂ¶ltjĂĽk a cuccal
				{
					// console.debug(pData[i]['name']);
					temp += "<table class=\"mprograms strip\">\n";
					temp += "<tr>\n";
					
					
					if (pData[i]['imageUrl'] != '')
					{
						temp += "\t<td rowspan=\"3\" class=\"image\">";
						temp += "<img src=\"" + pData[i]['imageUrl'] + "\" alt=\"\" />";
						temp += "\t</td>\n";
					}
					
					temp += "\t<td class=\"title\">" + pData[i]['name'] + "</td>\n";
					temp += "\t<td class=\"date\">";
					
					// kis trĂĽkk a dĂˇtum kiĂ­ratĂˇsra
					
					var c1 = pData[i]['fYear'] + pData[i]['fMonth'];
					var c2 = pData[i]['sYear'] + pData[i]['sMonth'];
					
					if (pData[i]['fYear'] == '0000' || pData[i]['starting'] == pData[i]['finishing']) // nincs vĂ©ge, csak kezdĂ©s, vagy egy napos
					{
						temp += pData[i]['sYear'] + '. ' + monthsShort[pData[i]['sMonth']-1] + ' ' + pData[i]['sDay'] + '.';
					} else if (c1 == c2) // egy hĂłnapos a program
					{
						temp += pData[i]['sYear'] + '. ' + monthsShort[pData[i]['sMonth']-1] + ' ' + pData[i]['sDay'] + '-' + pData[i]['fDay'] + '.';
					} else if (pData[i]['fYear'] == pData[i]['sYear']) // egy Ă©vben kezdĹ‘dik Ă©s Ă©r vĂ©get
					{
						temp += pData[i]['sYear'] + '.' + monthsShort[pData[i]['sMonth']-1] + ' ' + pData[i]['sDay'] + '-' + monthsShort[pData[i]['fMonth']-1] + ' ' + pData[i]['fDay'] + '.';
					} else 
					{
						temp += pData[i]['sYear'] + '. ' + monthsShort[pData[i]['sMonth']-1] + ' ' + pData[i]['sDay'] + ' ';
						temp += pData[i]['fYear'] + '. ' + monthsShort[pData[i]['fMonth']-1] + ' ' + pData[i]['fDay'] + '.';
					}
					
					temp +="</td>\n";
					temp += "</tr>\n";
					temp += "<tr>\n";
					temp += "\t<td colspan=\"2\" class=\"text\">";
					
					if (pData[i]['city'] != '')
					{
						temp += pData[i]['city'];
					}
					
					if (pData[i]['city'] != '' && pData[i]['location'] != '')
					{
						temp += ", ";
					}
					
					if (pData[i]['location'] != '')
					{
						temp += pData[i]['location'];
					}
					
					temp += "<br />" + pData[i]['description'];
					
					temp += "</td>\n";
					temp += "</tr>\n";
					temp += "<tr>\n";
					temp += "\t<td></td>\n";
					temp += "\t<td class=\"rmorange\"><a href=\"" + pData[i]['link'] + "\">" + dict['more'] + "</a></td>\n";
					temp += "</tr>\n";
					temp += "<tr>\n";
					temp += "\t<td colspan=\"3\" class=\"sep\"></td>\n";
					temp += "</tr>\n";
					temp += "</table>\n";
				}
			} else 
			{
				temp += "<table class=\"mprograms strip\">\n";
				temp += "<tr>\n";
				temp += "\t<th>" + dict['noresult'] + "</th>\n";
				temp += "</tr>\n";
				temp += "</table>\n";
			}
			
			temp += "<table class=\"mprograms strip\">\n";
			temp += "<tr>\n";
			temp += "\t<td class=\"rmred\"><a href=\"" + programUri + "\">" + dict['moreprograms'] + "</a></td>\n";
			temp += "</tr>\n";
			temp += "</table>\n";
			
			this.obj.setContent(temp);
		}
	}
	

