function slideNow() {
  var active = $('.slideshow img.active');
  $(active).fadeOut(900).removeClass('active');

  var next;
  if ($(active).next('img').length > 0) {
    next = $(active).next('img');
  } else {
    next = $('.slideshow img:first');
  }

  $(next).fadeIn(900).addClass('active');
}


$(function(){
            if ($('.slideshow.small').length == 0) {
              window.setInterval("slideNow()", 8000); //start slideshow
            }

	    $('.toggle_container').hide();
	    $('.trigger').click( function() {
		var trig = $(this);
		if ( trig.hasClass('trigger_active') ) {
			trig.next('.toggle_container').slideToggle('slow');
			trig.removeClass('trigger_active');
		} else {
			$('.trigger_active').next('.toggle_container').slideToggle('slow');
			$('.trigger_active').removeClass('trigger_active');
			trig.next('.toggle_container').slideToggle('slow');
			trig.addClass('trigger_active');
		}

	    });

            $('#navi>ul>li>a').hover(function(){
              $('#navi>ul>li>a.active').removeClass('active');
              var id = $(this).addClass('active').attr('rel');
              $('.subnavi:not(#'+id+')').hide();
              $('#'+id).show();
            }).mouseleave(function(event){
              if ($(event.relatedTarget).has('.subnavi').length > 0) {
                var id = $(this).removeClass('active').attr('rel');
                $('#'+id).hide();
              }
            });
            $('.subnavi').mouseleave(function(event){
              if ($(event.relatedTarget).attr('rel') != $(this).attr('id')) {
                var id = $(this).attr('id');
                $(this).hide();
                $('a[rel='+id+']').removeClass('active');
              }
            });

	    $('.searchbox form :input[title]').each(function() {
  		var $this = $(this);
 	 	if($this.val() === '') {
 		   $this.val($this.attr('title'));
 		 }
 		 $this.focus(function() {
 		   if($this.val() === $this.attr('title')) {
  		    $this.val('');
 		   }
 		 });
		  $this.blur(function() {
 		   if($this.val() === '') {
 		     $this.val($this.attr('title'));
  	 	 }
 		 });
	    });
          });
