// JavaScript Document
$(document).ready(function(){
	
	podskazka();
	podskazka_timer();
	
	var bodu_h = document.getElementById("body").offsetHeight;
	var bodu_h_2 = document.getElementById("body").offsetHeight-300;
	var w_elem_h = document.getElementById("top_bot").offsetHeight;
	var w_elem = document.getElementById("top_bot").offsetHeight-bodu_h/2;
	
	if(w_elem_h<bodu_h_2){  $(".strelka_bot").hide(); $(".strelka_top").hide(); }
	else{ $(".strelka_top").hide();}
	
	$(".strelka_bot").mouseover(function(){
			$("#top_bot").animate({ top: '-'+w_elem}, 2000, function(){ $(".strelka_bot").hide();});
			$(".strelka_top").show();
	});
	$(".strelka_top").mouseover(function(){
		$("#top_bot").animate({ top: '45px'}, 2000, function(){ $(".strelka_top").hide(); });
		$(".strelka_bot").show();
	});
	$(".strelka_top, .strelka_bot").mouseout(function(){
		$("#top_bot").stop();
	});

});

function navigation(){
	$(".menu_nav, .menu_nav_2").css({ 'display':'block' });
	$(".menu_nav, .menu_nav_2").hover(function(){},function(){$(this).hide()})
}

function ArrowNaw(event){
if (window.event) event = window.event;
if (event.ctrlKey)
	{
		var link = null;
		switch (event.keyCode ? event.keyCode : event.which ? event.which : null){
			case 0x25:
				link = document.getElementById ('LeftURL');
				break;
			case 0x26:
				link = document.getElementById ('TopURL');
				break;
			case 0x27:
				link = document.getElementById ('RightURL');
				break;
			case 0x28:
				link = document.getElementById ('BotmURL');
				break;
			}
		if (link && link.href) document.location = link.href;
		}
	}

document.onkeydown = ArrowNaw;

function podskazka() {
	$("#ctrl").empty();
	if(window.opera)
	$("#ctrl").append('Ctrl + Shift'); else
	$("#ctrl").append('Ctrl');
	$(".podskazka").mouseover(function(){
		$(".podskazka").fadeOut(500);
	});
}
function podskazka_timer() {
	$(".podskazka").fadeIn(1000);
}
setTimeout('$(".podskazka").fadeOut(1000);',6000);

/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});


