$(document).ready(function() {

	//
	//	NAVIGATION
	//
	
	$('#navigation > li').hover(function(e) {
		$(this).find('ul').show().hide();
		$(this).find('ul').fadeIn('fast');
	},function() {
		$(this).find('ul').fadeOut('fast');
	
	});
	//
	//	HIGHLIGHT CURRENT LINKS
	//
	
	// highlight tab function
	var path = location.pathname;
	var home = "/";
	
	//	apply active tab
	$("a[href='" + [path || home] + "']").each(function() {   
			$(this).addClass("active");
	});
	
	//
	//	DROPDOWN NAVIGATION
	//
		
	var $select = $('<select>').appendTo('#header .nav');
	
	//	add options
    $('#navigation li').each(function() {
        var $li    = $(this),
            $a     = $li.find('> a'),
            $p     = $li.parents('li'),
            prefix = new Array($p.length + 1).join('-');

        var $option = $('<option>')
            .text(prefix + ' ' + $a.text())
            .val($a.attr('href'))                       
            .appendTo($select);

        if ($li.find('a').hasClass('active')) {
            $option.attr('selected', 'selected');
        }
    });
	
	//	set change event
	$select.change(function() {
	  window.location = $select.find("option:selected").val();
	});		
			
	//
	//	HOMEPAGE SLIDER
	//
	
	//	start slideshow
	$('.slideshow').cycle({
		fx: 'fade',
		timeout: 3000,
		pause: 1,
		random: 1
	});


});
