$(document).ready(function() {

// Open links in new window
$("a[rel='external']").click(function(){window.open(this.href); return false;});

/*
// Focus text for searchbox
$("#searchstring").focus(function(){
    //alert($(this).val());
    //alert($(this)[0].title);
	if ($(this).val() == $(this)[0].title){
		//$(this).removeClass("text");
		$(this).val("");
	}
});
$("#searchstring").blur(function(){
	if ($(this).val() == ""){
		//$(this).addClass("text");
		$(this).val($(this)[0].title);
	}
});
$(".Text").blur();
*/

//Vyhledavaci formular
if($('#searchform').length){
    $('#searchform').click(function(){
	$('#search_form').submit();
    });
}

//Kalendar
if($('#calendar').length){
    $('#calendar .arrow.left').live('click', function(){
	var year = $('#calendar #prevYear').val();
	var month = $('#calendar #prevMonth').val();
	document.location.href = "?year="+year+"&month="+month;
    });

    $('#calendar .arrow.right').live('click', function(){
	var year = $('#calendar #nextYear').val();
	var month = $('#calendar #nextMonth').val();
	document.location.href = "?year="+year+"&month="+month;
    });
}

/*
// Navigation
$('#nav li').hover(
	function () {
		$('ul', this).fadeIn(500);
	}, 
	function () {
		$('ul', this).fadeOut(100);			
	}
);
*/

/*
// Activate Selectbox
$(function() {
	$('select').selectbox();
});

*/
/*
if($('#searchform').length){
    $('#searchform').mouseover(function() {
	$(this).attr({
	    'src': 'img/searchform-image-over.png'
	});
    });
    $('#searchform').mouseout(function() {
	$(this).attr({
	    'src': 'img/searchform-image.png'
	});
    });
}
*/

});//End document ready

/*
// Hover #nav li for IE6
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

*/
/*
// Slideshow
function slideSwitch() {
    var $active = $('#ilustration img.active');

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


    var $next =  $active.next().length ? $active.next()
        : $('#ilustration img: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 );
});

*/

