$(document).ready(function(){

	/* aktivace CSS HOVER funkce pro IE6 -> pro vsechny elementy */
	$.ie6CSSHover();
	
	/* Hover & click funkce na HP -> hlavni box v sekci "vystrizky" */
	$('.vystrizky-main').hover(function(){
		$(this).addClass("news-bg2"); 
		$(this).css({cursor:"pointer"});
		var title = $("a:first",this).attr("title");
		window.status = title;
		$(this).click(function(){
			var odkaz = $("a:first",this).attr("href");							   
			top.location = odkaz;
		});
	},function(){
		$(this).removeClass("news-bg2");
		window.status = '';
	});

	/* Hover & click funkce na HP -> mensi boxy v sekci "vystrizky" */	
	$('.vystrizky-next').hover(function(){
		$(this).addClass("news-bg2"); 
		$(this).css({cursor:"pointer"});
		var title = $("a:first",this).attr("title");
		window.status = title;
		$(this).click(function(){
			var odkaz = $("a:first",this).attr("href");							   
			top.location = odkaz;
		});
	},function(){
		$(this).removeClass("news-bg2");
		window.status = '';
	});
		
	/* Hover & click funkce na HP -> oramovany banner v levem sloupci */
	$('.banner-strihni-si610').hover(function(){
		$(this).css({cursor:"pointer"});
		var title = $("a:first",this).attr("title");
		window.status = title;
		$(this).click(function(){
			var odkaz = $("a:first",this).attr("href");							   
			top.location = odkaz;
		});
	},function(){
		window.status = '';
	});
	
	/* Hover & click funkce na HP -> banner vpravo dole */	
	$('.banner-casting').hover(function(){
		$(this).css({cursor:"pointer"});
		var title = $("a:first",this).attr("title");
		window.status = title;
		$(this).click(function(){
			var odkaz = $("a:first",this).attr("href");							   
			top.location = odkaz;
		});
	},function(){
		window.status = '';
	});
	
	$('.banner-casting-square').hover(function(){
		$(this).css({cursor:"pointer"});
		var title = $("a:first",this).attr("title");
		window.status = title;
		$(this).click(function(){
			var odkaz = $("a:first",this).attr("href");							   
			top.location = odkaz;
		});
	},function(){
		window.status = '';
	});
	
	/* Hover & click funkce na HP -> banner bez oramovani v levem sloupci */	
	$('.banner-strihni-si590').hover(function(){
		$(this).css({cursor:"pointer"});
		var title = $("a:first",this).attr("title");
		window.status = title;
		$(this).click(function(){
			var odkaz = $("a:first",this).attr("href");							   
			top.location = odkaz;
		});
	},function(){
		window.status = '';
	});
	
	/* Schovani TAGU pomoci JS */
	$('.js-hide').css({display:"none"});

	$(".show_rules").click(
		function () {$("#rules").slideToggle("slow");}
	);
	
	$(".show_hints").click(
		function () {$("#hints").slideToggle("slow");}
	);
	
	$(".posli-emailem a").click(
		function () {$(".posli-top").slideToggle("slow");}
	);
	
	//$('.info-videosoutez, .info-fotosoutez').hide();
	/*$('.h2-videosoutez').toggle(function(){
      $('.info-videosoutez').hide();
    },function(){
      $('.info-videosoutez').show();
    });
  $('.h2-fotosoutez').toggle(function(){
      $('.info-fotosoutez').hide();
    },function(){
      $('.info-fotosoutez').show();
    });
  */
	
	$('.description').css({display:"none"});
	$(".show_desc a").click(
		function () {
			if ( ($(".show_desc a").html() == "Rozbalit podrobnosti") ) { 
				$(".show_desc a").html("Skr&yacute;t podrobnosti"); 
			} else  {	
				$(".show_desc a").html("Rozbalit podrobnosti"); 
			}
			$(".description").slideToggle("slow");
		}
	);
	
	
	
	/* Vysouvani a zasouvani v soutezich  */
	
	$(".active-box a.span").html("&laquo; Sbalit");
	$(".inactive-box a.span").html("&laquo; Rozbalit");
	$(".active-box a.span").attr("title","Schovat info");
	$(".inactive-box a.span").attr("title","Zobrazit info");
	
	$(".inactive-box .content").hide(); // schova neaktivni
	
	$(".active-box h3 a.h3").click(function () {
		rodic = $(this).parent().parent();
		vymenTridu(rodic);
	});
	$(".inactive-box h3 a.h3").click(function () {
		rodic = $(this).parent().parent();
		vymenTridu(rodic);
	});
	
	
	$(".active-box h3 span a.span").click(function () {
		rodic = $(this).parent().parent().parent();
		vymenTridu(rodic);
	});
	$(".inactive-box h3 span a.span").click(function () {
		rodic = $(this).parent().parent().parent();
		vymenTridu(rodic);
	});
	
	
	function vymenTridu (rodic) {
		rodic.toggleClass("active-box");
		rodic.toggleClass("inactive-box");
		$(".active-box a.span").html("&laquo; Sbalit");
		$(".inactive-box a.span").html("&laquo; Rozbalit");
		$(".active-box a.span").attr("title","Schovat info");
		$(".inactive-box a.span").attr("title","Zobrazit info");
		$(".active-box .content").show();
		$(".inactive-box .content").hide();
	}
	
	/* Hover funkce na miniboxy "do souboje" */
  $('.minibox').hover(function(){
    $(this).addClass('hover');
  },function(){
    $(this).removeClass('hover');
  });

  /* google search box */
  defval=$('#searchinput').attr('value');
  if(defval){
    $('#searchinput').removeClass('search-bg');
    $('#searchinput').addClass('search-nobg');
  }else{
    $('#searchinput').removeClass('search-nobg');
    $('#searchinput').addClass('search-bg');
  }
  $('#searchinput').focus(function(){
    $(this).removeClass('search-bg');
    $(this).addClass('search-nobg');
  });
  $('#searchinput').blur(function(){
    val=$(this).attr('value');
    if(!val){
      $(this).removeClass('search-nobg');
      $(this).addClass('search-bg');
    }else{
      $(this).removeClass('search-bg');
      $(this).addClass('search-nobg');
    }
  });

});




/*

function toggleRules(){
  el=document.getElementById('rules');
  if(el.style.display=="none" || el.style.display==""){
    el.style.display="block";
		return false;
  }else{
    el.style.display="none";
		return false;
  }
}
*/

function toggleHints(){
  el=document.getElementById('hints');
  if(el.style.display=="none" || el.style.display==""){
    el.style.display="block";
		return false;
  }else{
    el.style.display="none";
		return false;
  }
}










