
		function setSmile(add,where)
		{
			add = '<img src="' + add + '" alt="smile" />&nbsp;';
			inst = tinyMCE.getInstanceById(where);
			inst.execCommand('mceInsertContent',false, add);
		}

		function openPopup(file,width,height)
		{
			var param = "width=" + width + ",height=" + height + ",statusbar=0,menubar=0";
			newwin = window.open(file, "preview", param);
			newwin.moveTo(screen.width/2 - width/2, 200);
			return false;
		}

		function openprint(idecko, formPrint, formUserId)
		{
			var screenW = 640;
			if (parseInt(navigator.appVersion) > 3)
			{
			 screenW = screen.width;
			}
			else if (navigator.appName == "Netscape"
			    && parseInt(navigator.appVersion)==3
			    && navigator.javaEnabled()
			   )
			{
			 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
			 var jScreenSize = jToolkit.getScreenSize();
			 screenW = jScreenSize.width;
			}


			var param = "width=700,height=700,statusbar=0,menubar=0,scrollbars=1";
			var file = "";
			if(formPrint != 1)
			{
				file = "http://www.unicode.sk/print.php?id=" + idecko;
			}
			else
			{
				file = "http://www.unicode.sk/print.php?id=" + idecko + "&formPrint=1&formUserId=" + formUserId;
			}
			newwin = window.open(file, "print", param);
			newwin.moveTo(screenW.width/2 - screenW/2, 200);
			return false;
		}

		function uncheckAllRadios(whichForm, otazkaId)
		{

			var otazka = 'radio_answer_' + otazkaId;
			radios = document.getElementsByName(otazka);
			for (var i = 0; i < radios.length; i++)
			{
  				radios[i].checked = false;
  			}
		}

			// custom in-content slide toogle
	function toogleContentById(byId)
	{
		var c = '#' + byId;
		if($(c).css('display') == 'none')
		{
			$(c).slideDown(400);
		}
		else
		{
			$(c).slideUp(400);
		}
		return false;
	}

	// custom UI dialog
	function openViaDialog(dialogText, dialogTitle)
	{
		$('body').append('<div id="inlineDialogHiddenContent" style="display:none;">' + dialogText + '</div>');

		$('#inlineDialogHiddenContent').dialog(
		{
			modal: true,
			title: dialogTitle,
			buttons: { "zatvoriť": function()
							 {
							 	$(this).dialog("close");
							 }
					 },
			close: function(event, ui)
				   {
						$('#inlineDialogHiddenContent').remove();
				   }
		});

		return false;
	}


	$(document).ready(pageLoaded);


		function pageLoaded()
		{

			// pridanie class="dotted" - ajax pre vsetky odkazy bez platneho href
			$("a[href=''], a[href='javascript:void(0);'], a[href='javascript:void(0)'], a[rel*='openSmoothPopup'], a[rel*='loadAjaxContent']").addClass("dotted");
			$("a:has(img)").removeClass("dotted");

			//animacia infoBox
			$("*[class='infoBox']").animate({backgroundColor: "#fce6c7"}, 1000);

			$("a[href*='http://docs.google.com/gview']").each(function()
			{
				var pdfFile = $(this).attr('href').replace("http://docs.google.com/gview?url=", "").replace("&embedded=true&iframe", "").replace("&iframe&embedded=true", "");
				$(this).after("&nbsp;(<a href='" + pdfFile  + "' title='stiahnuť súbor'>stiahnuť súbor</a>)")
			});

			$('a[rel*="external"]').click( function()
			{
				window.open($(this).attr('href'));
				return false;
			});

			$("a[rel='openLoginForm']").click( function()
			{
				var lstr = '<form method="post" action="http://www.unicode.sk/" name="loginFormer" class="marginZero paddingZero"><input type="hidden" name="login" value="1" /><input type="hidden" name="goLogin" value="1" /><label for="inputName">PRIHLASOVACIE MENO</label><span class="roundedInput"><input type="text" name="inputName" id="inputName" value="" size="70" /></span><label for="inputPass">HESLO</label><span class="roundedInput"><input type="password" name="inputPass" id="inputPass" value="" size="70" /></span><span class="roundedButton"><input name="formLoginSubmit" type="submit" value="prihlásiť" /></span><br /><input type="checkbox" name="rememberUser" id="rememberUser" />&nbsp;<label for="rememberUser">pamätať</label><div class="logged">stratené heslo:&nbsp;<a href="http://www.unicode.sk/?go=13" title="stratené heslo">kliknite sem</a></div></form>';

				openViaDialog(lstr, 'prihlásiť');

				return false;
			});

			jQuery(function($){
				$.datepicker.regional['sk'] = {
					closeText: 'Zavrieť',
					prevText: 'Predchádzajúci',
					nextText: 'Nasledujúci',
					currentText: 'Dnes',
					monthNames: ['Január','Február','Marec','Apríl','Máj','Jún','Júl','August','September','Október','November','December'],
					monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún','Júl','Aug','Sep','Okt','Nov','Dec'],
					dayNames: ['Nedeľa','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota'],
					dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'],
					dayNamesMin: ['Ne','Po','Ut','St','Št','Pi','So'],
					weekHeader: 'Ty',
					dateFormat: 'dd.mm.yy',
					firstDay: 1,
					isRTL: false,
					showMonthAfterYear: false,
					yearSuffix: ''};
				$.datepicker.setDefaults($.datepicker.regional['sk']);
			});
			$(".calendar").datepicker({
				changeMonth: true,
				changeYear: true,
				showOtherMonths: true,
				showOn: 'both',
				buttonImage: 'http://www.unicode.sk/styles/Default_Style/design/icons/calendar.gif',
				buttonImageOnly: true
			});

			$('#newsSlider').cycle({
				cleartypeNoBg: true
			});

			//openSmoothPopup = fancybox()
			$('a[rel*="openSmoothPopup"]').fancybox();

			//load custom data via ajax
			$('a[rel*="loadAjaxContent"]').click(loadAjaxContentCall);

			function loadAjaxContentCall(e)
			{
				var thisHref = $(this).attr('href');
				var thisRel = $(this).attr("rel").split(',');
				if(thisRel.length > 1)
				{
					var targetId = '#' + thisRel[1];
				}
				else
				{
					var targetId = '#contentWrapper';
				}

				$(targetId).animate({opacity: 0}, function()
													 {
														//ajax content loading
														$.ajax(
																{
																	url: thisHref,
																	data: "ajax=1",
																	async: false,
																	beforeSend : function(XMLHttpRequest)
																				{
																					$.fancybox.showActivity();
																				},
																	complete: function(XMLHttpRequest, status)
																				{
																					$("#ajaxLoading").remove();
																				 	$(targetId).animate({opacity: 1}, function()
																								 						{
																								 							$.fancybox.hideActivity();
																															pageLoaded();
																														}
																									  );
																				 },
																	success: function(html, status)
																			 {
																				$(targetId).html(html);
																			 }
																}
															  );
													 }
								    );

				return false;
			}


		} /* pageLoaded */

