$(document).ready(function(){
	 /* Posunovací banner */
   $("#akcni-obsah").jCarouselLite({
		//btnNext: "#a-next",
		//btnPrev: "#a-prev",
		auto: 4000,
		speed: 350,
		visible: 1,
		mouseWheel: true
	});

	$(function(){
	  $("a[rel^='lightbox']").lightbox();
	});
	
	/* ukaz/schovej zakroky */
	$("#seznam").click(function() {
		$("#seznam-vypis-obal").slideToggle("fast");
		return false;
	});
	/* ukaz/schovej ceník */
	$("#cenik").click(function() {
		$("#show-cenik").slideToggle("fast");
		return false;
	});
	/* ukaz/schovej form poradna */
	$("#showformporadna").click(function() {
		$("#napiste-obal2").slideToggle("fast");
		return false;
	});

	/* jquery UI */
	$(".accordion").accordion({
		active: false,
		autoHeight: false,
		header: '.title',
		alwaysOpen: false
	});
	$("#tabs").tabs();
	/* jquery UI - konec */
	
	/* menu hover 
	$("#topmenu ul li div").fadeTo (0.8, 1);
  $("#topmenu ul li div").hover(
	function () {
	  $(this).fadeTo("fast", 0.8);
	},
	function () {
	  $(this).fadeTo("slow", 1);
	}
  );*/

	
});

/* slideshow Zidkova */
function slideSwitch() {
	var $active = $('#slideshow li.active');

	if ( $active.length == 0 ) $active = $('#slideshow li:last');

	// use this to pull the divs in the order they appear in the markup
	var $next =  $active.next().length ? $active.next()
		: $('#slideshow li:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('active last-active');
		});
}
	
$(function() {
	setInterval( "slideSwitch()", 5000 );
});
/* slideshow Zidkova - konec */

re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;

/* konrola formuláře pro vložení dotazu do odborné poradny */
function kontrolaporadna()
{
 if (document.poradna.email.value==""){
			alert("Prosím, vložte svůj e-mail.");
    document.poradna.email.focus();
    document.poradna.email.select();
			return false;
 		}
 if ( document.poradna.email.value !="" ) {
		if (re.test(document.poradna.email.value) == 0) {
			alert ("E-mailová adresa není správná.");
			document.poradna.email.focus();
			document.poradna.email.select();
			return false;
		}
	 }
	 if (document.poradna.jmeno.value==""){
		alert("Prosím, vyplňte své jméno.");
    document.poradna.jmeno.focus();
    document.poradna.jmeno.select();
		return false;
		}
	 if (document.poradna.dotaz.value== ""){
		alert("Prosím, vložte dotaz.");
    document.poradna.dotaz.focus();
    document.poradna.dotaz.select();
		return false;
		}
}
/* kontrola formuláře pro poslání emailu z www */
function kontrolamailer()
{
 if (document.napiste.email.value==""){
			alert("Prosím, vložte svůj e-mail.");
    document.napiste.email.focus();
    document.napiste.email.select();
			return false;
 		}
 if ( document.napiste.email.value !="" ) {
		if (re.test(document.napiste.email.value) == 0) {
			alert ("E-mailová adresa není správná.");
			document.napiste.email.focus();
			document.napiste.email.select();
			return false;
		}
	 }
	 if (document.napiste.obsah.value==""){
		alert("Prosím, vyplňte text emailu.");
    document.napiste.obsah.focus();
    document.napiste.obsah.select();
		return false;
		}
}
function kontrolasearch() {

	co=document.hledat.co.value;

if (co == "" || co.length < 3){
			alert("Prosím, vložte minimálně 3 znaky");
		  document.hledat.co.focus();
  		document.hledat.co.select();
			return false;
}
}
