$(document).ready(function(){
	/*
	 * Dropdowns
	 */
    $("ul#menu li ul").css({
		'display' : 'none',
		'position' : 'absolute',
		'top' : '0',	
		'left' : '208px' /* Sidebar width */
	});
    
    function showSub(){
        $(this).addClass('active').find('ul').slideDown('fast');
    }
    
    function hideSub(){
		$("ul#menu li:has(ul) ul").slideUp('fast').parent().removeClass('active');      
    }
    
    var config = {
        sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
        interval: 100, // number = milliseconds for onMouseOver polling interval    
        over: showSub, // function = onMouseOver callback (REQUIRED)    
        timeout: 500, // number = milliseconds delay before onMouseOut    
        out: hideSub // function = onMouseOut callback (REQUIRED)    
    };
    
    $("ul#menu li:has(ul)").hoverIntent(config)
	
	
	
	
	/*
	 * Form effects
	 */
	$('input[type=text], input[type=password], textarea').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	})			
	
	$('input[type=text], input[type=password], textarea').focus(function(){
		$(this).addClass('selected');
	})
	$('input[type=text], input[type=password], textarea').blur(function(){
		$(this).removeClass('selected');
	})	
	
	$('input[type=submit]').hover(function(){
		$(this).addClass('submit-hover');
	}, function(){
		$(this).removeClass('submit-hover');
	})		
	
	
	/*
	 * Content slideshows
	 */
	$("ul.content-slideshow").cycle({
	}); 	
	
	
	
	/*
	 * Front Page effects
	 */
	$("ul#slideshow").cycle({ timeout: 8000, before: start_animation });	
	
	function start_animation()
	{
		$("ul.six-list li").each(function(index){
			var el = $(this);
			setTimeout(function(){
				el.animate({ fontSize: 21 }, 300, function(){
					el.animate({ fontSize: 16 }, 300);
				});													
			}, index * 350);
		})		
	}
	
})
