$(document).ready(function() {
	main.init();

	if (window.console == undefined) { window.console = {log:function(){}}; }

	objects = document.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++) {objects[i].outerHTML = objects[i].outerHTML;}
});




var main = {
	init: function() {
		main.UI.init();
	},

	UI: {
		init: function() {
			// Let's open all external links in new window
//,
			$('a[@href^=http]').not('[@href*=www.gore-ljudje.net]').click(function(event) {
				if (!$(this).is('a[@href$=jpg], a[@href$=gif], a[@href$=png], a[@href$=JPG], a[@href$=GIF], a[@href$=PNG]')) {
					window.open(this.href);
				}

				return false;
			});

			// Make thickbox magick for all linked images
			$('a[@href$=jpg] > img, a[@href$=gif] > img, a[@href$=png] > img, a[@href$=JPG] > img, a[@href$=GIF] > img, a[@href$=PNG] > img').parent().click(function(event) {
				if (event.ctrlKey || event.shiftKey) {
					window.open(this.href);
				} else {
					tb_show(this.title || this.name || null, this.href || this.alt, this.rel || false);
					this.blur();
				}

				return false;
			});

			var n = 've'+'ri'+'fi'+'cat'+'ion';
			$('form input[@name='+n+']').parent().submit(function() {
				$(this).find('input[@name='+n+']').val(n);
			});

			$('button[@rel]').click(function() {
				window.location = $(this).attr('rel');
			});


			$('a.addRedir').each(function() {
				$(this).attr('href', $(this).attr('href') + '?redir=' + $(this).attr('rel'));
			})

			if ('msie' == $.browser) {
				// IE does not support disabled options... shame..
				$('option:disabled').each(function() {
					$(this).remove();
				});
			}
		}
	}
}