/* PRINT */
function pageprint() {
document.write('\074a href=\"javascript:printout();\" class=\"print\" title=\"Vytisknout tuto stránku\"\076Vytisknout stránku\074/a\076 <span>&bull;</span>');
}
function printout() {
window.print();
}


/* BACK - ZPET */
function back() {
document.write('\074a href=\"javascript:undo();\" title=\"Zpět na předchozí stránku\"\076&larr;&nbsp;Zpět\074/a\076');
}
function undo() {
javascript:history.back(-1);
}


/* OTAZKA */
function otazka() {
document.write('<input type=\"hidden\" name=\"otazka\" value=\"2\" /><br />');
}


/* K OBLIBENYM */
function AddFavorite(linkObj,addUrl,addTitle)
    {
      if (document.all && !window.opera)
      {
        window.external.AddFavorite(addUrl,addTitle);
        return false;
      }
      else if (window.opera && window.print)
      {
        linkObj.title = addTitle;
        return true;
      }
      else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
      {
        window.sidebar.addPanel(addTitle,addUrl,'');
        return false;
      }
    }


/* KONTROLA FORMULARE */
function Kontrola(ident)
{
  if(control(ident.jmeno.value)=="")
  {
    alert('Promiňte, vyplňte prosím své jméno!');
    ident.jmeno.focus();
    return false;
  }
  if(control(ident.email.value)=="")
  {
    alert('Promiňte, vyplňte prosím svou funkční e-mailovou adresu!');
    ident.email.focus();
    return false;
  }
  if(control(ident.email.value)!="" && !KontrolaEmailu(ident.email.value))
  {
    alert("Promiňte, ale Vaše e-mailová adresa není správně vyplněna!");
    ident.email.focus();
    return false;
  }
  if(control(ident.vzkaz.value)=="")
  {
    alert('Promiňte, opravdu chcete poslat zprávu bez jakéhokoliv textu?');
    ident.vzkaz.focus();
    return false;
  }
  return true;
}

function control(dlh)
{
  dlh=dlh.replace(/^[\s]+/g,"");
  dlh=dlh.replace(/[\s]+$/g,"");
  return dlh;
}
function KontrolaEmailu(email)
{
  var MailControl=new RegExp("^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$");
  return MailControl.test(email);
}


/* HOVER EFEKT PRUHLEDNY */

$().ready(function() {
  $('a.prev, a.next').css('opacity', 0.5);
  $('a.prev, a.next').each(function() {
    $(this).hover(function() {
    	$(this).stop().animate({ opacity: 1.0 }, 400);
    },
    function() {
    	$(this).stop().animate({ opacity: 0.5 }, 400);
    });
  });
});

/* // VYLEPSENY TITLE
 * 	Easy Tooltip 1.0 - jQuery plugin
 *	written by Alen Grakalic	
 *	http://cssglobe.com/post/4380/easy-tooltip--jquery-plugin
 *	Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *	Built for jQuery library
 *	http://jquery.com
 */
 
(function($) {

	$.fn.easyTooltip = function(options){
	  
		// default configuration properties
		var defaults = {	
			xOffset: 10,		
			yOffset: 25,
			tooltipId: "easyTooltip",
			clickRemove: false,
			content: "",
			useElement: ""
		}; 
			
		var options = $.extend(defaults, options);  
		var content;
				
		this.each(function() {  				
			var title = $(this).attr("title");				
			$(this).hover(function(e){											 							   
				content = (options.content != "") ? options.content : title;
				content = (options.useElement != "") ? $("#" + options.useElement).html() : content;
				$(this).attr("title","");									  				
				if (content != "" && content != undefined){			
					$("body").append("<div id='"+ options.tooltipId +"'>"+ content +"</div>");		
					$("#" + options.tooltipId)
						.css("position","absolute")
						.css("top",(e.pageY - options.yOffset) + "px")
						.css("left",(e.pageX + options.xOffset) + "px")						
						.css("display","none")
						.fadeIn("fast")
				}
			},
			function(){	
				$("#" + options.tooltipId).remove();
				$(this).attr("title",title);
			});	
			$(this).mousemove(function(e){
				$("#" + options.tooltipId)
					.css("top",(e.pageY - options.yOffset) + "px")
					.css("left",(e.pageX + options.xOffset) + "px")					
			});	
			if(options.clickRemove){
				$(this).mousedown(function(e){
					$("#" + options.tooltipId).remove();
					$(this).attr("title",title);
				});				
			}
		});
	  
	};

})(jQuery);


/* VYLEPSENY TITLE - kterych elementu se tyka */

$(document).ready(function(){	
		$("#head a, #foot a, #foot-effect a, h1 span, p.button input, a.prev span, a.next span, a.title, #ufo").easyTooltip();
	});
	

