(function () {	// main object for OVSR project	var lk2OVSR = {		version : "1.0",		init : function () {			return this;		},		RenderArticles : function (data) {			// TODO remove			var a, key, age;			document.write("<ul>");			for (key in data) {				if (data.hasOwnProperty(key)) {					a = data[key];					age = 1; // planovane zvyraznenie aktualnych zaznamov (napr.								// <3 mesiace					document.write('<li class="age' + age + '">dňa ' +							this.DayURL(a.d) + " bol zverejnený článok " +							this.ArticleURL(a.d, a.a) + " v súbore " +							this.PdfURL(a.d, a.f) + " na strane " + a.p +							", jedná sa o <strong>" + this.DecodeArticleCode(a.a) +							"</strong></li>");				}			}			document.write("</ul>");			$('a.aricle').click(function () {				alert('You did something, woo hoo!');			});		},		DecodeArticleCode : function (article) {			// TODO remove			var ret, codes;			codes = {				"R" : "záznam v obchodnom registry",				"L" : "výzvu likvidátorov",				"O" : "oznámenie",				"Š" : "špecifikáciu prijatého podielu zaplatenej dane z príjmov",				"K" : "konkurz alebo reštrukturalizáciu, konkurz alebo vyrovnanie",				"X" : "dražbu, predaj majetku",				"Z" : "účtovnú závierku"			};			ret = codes[article[0]];			if (ret === undefined) {				return "neznámy typ záznamu";			} else {				return ret;			}		},		ArticleURL : function (date, article) {						var year = date.split(".");			year = year[2];			return '<a class="a" href="/clanok/' + year + '/' + article + '">' + article + '</a>';		},		ArticleRecURL : function (url) {			var l, year, code;			url = decodeURIComponent(url);			l = url.split("/");			year = l[l.length - 2];			code = l[l.length - 1];			return "http://data.struix.com/" + year + "/" +					code.substring(0, 1) + "/" + code.substring(1, 3) + "/" +					code.substring(3, 5) + "/" + code + ".txt";		},		PdfURL : function (date, filename) {			var year, fn;			year = date.split(".");			year = year[2];			fn = filename.split(".");			return '<a class="pdf" href="/original/' + year + '/' + fn[0] +					'">' + filename + '</a>';		},		DayURL : function (date) {			var day = date.replace(/\./g, "-");			return '<a class="d" href="/cislo/' + day + '">' + date + '</a>';		},		ovsrOpenArticle : function (event) {			event.preventDefault();			$("#clanok").html("");			$.getScript(k2OVSR.ArticleRecURL(this.href));			window					.setTimeout(							function () {								if ($("#clanok").text().length < 100) {									alert("Ľutujem, požadovaný článok nie je v našej databáze.");								}							}, 5000);		},		IsNumeric : function (input) {			return (input - 0) === input && input.length > 0;		},		NameAutocomplete : function (obj, multiple) {			if (multiple) {				return obj;			}			obj.autocomplete("http://data.struix.com/orsr_suggest.php", {				multipleSeparator : "\n",				multiple : multiple,				width : 225,				minChars : 3,				max : 0,				scrollHeight : 300,				cacheLength : 10,				jsonp : "jc",				dataType : "jsonp",				beforeQuery : function (name) {					name = name.replace(/[\.\/ ]/g, "");					return !k2OVSR.IsNumeric(name);				}			});			return obj;		}	};	window.k2OVSR = lk2OVSR;	var k2OVSR = window.k2OVSR;	$(document).ready(function () {		/* $("div[id=obsah] ul").each( function () {*/		/*		 * $("ul.vydanie_obsah").each( function () {		 * $(this).columnizeList({cols:2,constrainWidth:true}); });		 */	});	$(document).ready(function () {		$('#clanok').dialog({			bgiframe : true,			width : $(window).width() * 0.9,			height : $(window).height() * 0.8,			modal : true,			autoOpen : false		});		$('a[href*=/clanok]').click(k2OVSR.ovsrOpenArticle);	});})();function ovsrArticle(a) {	if (a === undefined) {		alert("Ľutujem, požadovaný článok nie je v našej databáze.");	} else {		$("#clanok").attr({			title : a.section		});		$("#clanok").html(a.text);	}	// TODO neotvori sa po zatvoreni	$('#clanok').dialog('open');}
