function isIE() {
	return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}
if(isIE()) {
	$(document).ready(function(){
	$('#featured_nav').remove();
	var howmany = $('#slideshow ul li').size();
	var chooserandom = Math.floor(Math.random()*howmany+1);
	$('#slideshow li').not('#slideshow li:nth-child('+chooserandom+')').hide();
	
	
	
});
}
else {

// jQuery
function slideSwitch() {
    var $active = $('#slideshow .active');
	var $activenav = $('.navigation .active');
	

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

    var $next =  $active.next().length ? $active.next() : $('#slideshow ul li:first');
	var $nextnav = $activenav.next().length ? $activenav.next() : $('.navigation li:first');


    $active.addClass('last-active');
	$active.removeClass('active');
	
	$activenav.removeClass('active');
	$nextnav.addClass('active');
	
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('last-active');
			
        });
}
slideswitcher = setInterval( "slideSwitch()", 5000 );

function specialSlide(slide) {
	$('#slideshow .active').addClass('last-active').removeClass('active');
	$('.navigation .active').removeClass('active');
	$('.navigation li:nth-child('+slide+')').addClass('active');
	$('#slideshow li:nth-child('+slide+')').css({opacity: 1.0}).addClass('active');
	$('#slideshow .last-active').removeClass('last-active');
}


$(document).ready(function(){
	
	var featuredposts = $('#slideshow ul').find("li").size();
	if(featuredposts == 1) {
		$('.navigation').hide();
	}
	else if(featuredposts < 5) {
		$('.navigation').find("li").each(function(i) {
			if (i>=featuredposts){
				$(this).remove();
			}
		});
	}
	$('.navigation #bg-01').click(function(event) {
		event.preventDefault();
		specialSlide(1);
		clearInterval(slideswitcher);
		slideswitcher = setInterval( "slideSwitch()", 5000 );
	});
	$('.navigation #bg-02').click(function(event) {
		event.preventDefault();
		specialSlide(2);
		clearInterval(slideswitcher);
		slideswitcher = setInterval( "slideSwitch()", 5000 );
	});
	$('.navigation #bg-03').click(function(event) {
		event.preventDefault();
		specialSlide(3);
		clearInterval(slideswitcher);
		slideswitcher = setInterval( "slideSwitch()", 5000 );
	});
	$('.navigation #bg-04').click(function(event) {
		event.preventDefault();
		specialSlide(4);
		clearInterval(slideswitcher);
		slideswitcher = setInterval( "slideSwitch()", 5000 );
	});
	$('.navigation #bg-05').click(function(event) {
		event.preventDefault();
		specialSlide(5);
		clearInterval(slideswitcher);
		slideswitcher = setInterval( "slideSwitch()", 5000 );
	});
	
	
	
	
$('#footer .menu li ul').hide();
$('#footer .menu li a.link').toggle(function(event) {
	event.preventDefault();
	$(this).addClass('active');
	jQuery(this).next('ul').slideToggle('fast');
},
function(event) {
	event.preventDefault();
	$(this).removeClass('active');
	jQuery(this).next('ul').slideToggle('fast');
});

// $(function() {
//     go = $.cookie('lagop-splash');
//     if (go == null) {
//         $.cookie('lagop-splash', '1', { path: '/', expires: 60 });
//         tb_show('', '/splash.php?KeepThis=true&TB_iframe=true&height=488&width=900', '');
//     }
// });

});}