//####################################//

// opatreni proti kolizi s prototype.js (pouze podstranka aktuality jednota)
(function($){
	$(document).ready(function()
	{
	
	// menu - 2nd level
	//$('.2nd-level').hide();
	
	/*
	$('li.headlink').hover(
		function () {
			$('ul', this).slideDown('fast');
			//$('a', this).addClass('sel');
		},
		function () {
			$('ul', this).slideUp('fast');
			//$('a', this).removeClass('sel');
		}
	);
	*/
	/*
	$('li.headlink').mouseover(
		function()
		{
			$('ul', this).show(); //.slideDown('fast');
			$('a', this).addClass('sel');
		}	
	); 
	$('li.headlink').mouseleave(
		function()
		{
			$('ul', this).hide(); //*.slideUp('fast');
			$('a', this).removeClass('sel');
		}
	);
	
	*/
	
	if(($("#mapa2").length) || ($("#mapa1").length))
	{
		$(".dot.slide a").each(function(){
			
			$(this).click(
				function()
				{	
					
					var target = $(this).attr('href');
					
					$(target).parent().siblings().children().css({'background-color' : '#fff', 'font-weight' : 'normal'});
					
					$(target).css({'background-color' : '#fff2f3', 'font-weight' : 'bold'});
					$(target).siblings().css({'background-color' : '#fff2f3', 'font-weight' : 'bold'});
					
				}
			);
		});
	}
	
	$.localScroll();
	});
})(jQuery);




//####################################//


function checkInputData(type)
{
	if(type == 'int')
	{
		if((event.keyCode < 48) || (event.keyCode > 57) && event.keyCode != 13)
			event.returnValue = false;
	}
	else
	if(type == 'float')
	{
		if((event.keyCode < 48 || event.keyCode > 57)
			 && event.keyCode != 46 && event.keyCode != 44 && event.keyCode != 13)
			event.returnValue = false;
	}
}


//####################################//


function newWnd(obj, wWidth, wHeight, wName)
{
	if(obj == null)
		return false;

	var name = (wName == null) ? "newWnd" + Math.ceil( Math.random() * 3000 ) : wName;
	var width = (wWidth == null) ? 500 : parseInt(wWidth);
	var height = (wHeight == null) ? 400 : parseInt(wHeight);
	var loc = null;
	
	if(obj.tagName == "A" & obj.getAttribute("href") != null)
	{
		loc = obj.getAttribute("href");
	}
	
	if(loc != null)
	{
		wnd = window.open(loc , name, 'toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resizable=yes,status=no,width='+width+',height='+height);
		wnd.focus();
		return false;
	}
	else
	{
		return true;
	}
}


//####################################//


var wndMargin = 0;
var screenW, screenH;

screenW = window.screen.availWidth;
screenH = window.screen.availHeight;

function closeWnd()
{
	if(window.opener != null)
		window.opener.focus();
		
	this.window.close();
}

function resizeWnd(w, h)
{
	var wndW, wndH = 0;
	var posX, posY = 0;
	w += wndMargin;
	h += wndMargin;
	
	if(w >= screenW)
		wndW = screenW;
	else
		wndW = w;
	if(h >= screenH)
		wndH = screenH;
	else
		wndH = h;

	posX = Math.ceil((screenW / 2) - (wndW / 2));
	posY = Math.ceil((screenH / 2) - (wndH / 2));
	if(posX < 0)
		posX = 0;
	if(posY < 0)
		posY = 0;
	
	window.resizeTo(wndW, wndH);
	window.moveTo(posX, posY);
}


//####################################//


function display(id, doDisplay)
{
	var layer = document.getElementById(id);
	
	if(layer == null)
		return;

	if(doDisplay == null)
		layer.style.display = (layer.style.display == 'none') ? 'block' : 'none';
	else
		layer.style.display = (doDisplay == true) ? 'block' : 'none';

}


//####################################//



