
	$(function(){

		$('.overs').hover(function() {

			$(this).addClass('over');

		}, function() {

			$(this).removeClass('over');

		});

		$(".kontakt input, .kontakt textarea").labelify();

		$('#input_6, .contact_form textarea').elastic();

	});

	function rep_ea(mea,dea,hla,par)
	{

		document.writeln('<a href="mailto&#58;'+mea+'&#64;'+dea+'.'+hla+'" '+par+'>'+mea+'&#64;'+dea+'.'+hla+'</a>');

	}

	function top()
	{

		$('html,body').animate({scrollTop: 0}, 500);

	}

	var counter = 0;

	function initmenu(id)
	{

		$('.ida').each(function(index) {

			var active = $(this).hasClass("active");

			if(active==true)
			counter++;			

		});

		if(counter==0)
		{

			$('#'+id).animate({
			height: "106px"
			}, 250, function() {

				$(this).addClass("active");

				var mmparent = $('#'+id).parent();

				$(mmparent).children("ul").slideDown(250);

			});

		}else{

			$('.left_panel .main_navigation ul').each(function(index) {

				var visible = $(this).css("display");

				var mparent = $(this).parent();

				if(visible=="block")
				{

					$('html,body').animate({scrollTop: 0}, 250, function() {

						$(mparent).children("ul").slideUp(250, function() {

							$(mparent).children(".active").animate({
							height: "17px"
							}, 250, function() {

								$(this).removeClass("active");

								$('#'+id).animate({
								height: "106px"
								}, 250, function() {

									$(this).addClass("active");

									var mmparent = $('#'+id).parent();

									$(mmparent).children("ul").slideDown(250);

								});

							});

						});

					});

				}

			});

		}

		counter = 0;

	}

	function search()
	{

		if (self.document.forms.ssearch.search.value !== "")
		{

			self.document.forms.ssearch.submit();

		}

	}

	function aktualizujOdkazy()
	{

		if(!document.getElementsByTagName)
		return false;

		var links = document.getElementsByTagName("a");

		for (var i=0; i < links.length; i++)
		{

			if(links[i].className.match("popup"))
			{

				links[i].onclick = function ()
				{

					return !window.open(this.href);

				}

			}

		}

	}

	window.onload=aktualizujOdkazy;


	function openwindow()
	{

		iMyWidth = (window.screen.width / 2) - (275 + 14); iMyHeight = (window.screen.height / 2) - (175 + 50);
		Okno = window.open("", "win", "width=550, height=350, left=" + iMyWidth + ", top=" + iMyHeight + ", screenX=" + iMyWidth + ", screenY=" + iMyHeight + ", resizable=no, scrollbars=no");
		Okno.focus();

	}
