$(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(){
	if ($(this).val() == $(this)[0].title){
		$(this).removeClass("TextActive");
		$(this).val("");
	}
});
$("#searchstring").blur(function(){
	if ($(this).val() == ""){
		$(this).addClass("TextActive");
		$(this).val($(this)[0].title);
	}
});
$(".Text").blur();        

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

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

// Antispam
if($('.antispamblock').length){
    $('.antispam').val('777');
    $('.antispamblock').hide();
}

});//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 );
});
