$(document).ready(function()
{
	$('a').focus(function(){ $(this).blur() });
	$('#nav li').each(function(){ $(this).find('a').attr('title', '') });
	$('img.logo').click(function(){ document.location.href='/' });
	
	( $(window).height() > $('#wrapper').height()-30 ) ? $('#wrapper').addClass('wrapper-liquid') : $('#wrapper').addClass('wrapper-fixed');
	
	//	Quotes
	
	var quoteinterval = setInterval(get_quote, 8000);
	get_quote();
	
	//	Welcome

	var date = new Date();
	var hour = date.getHours();
	
	if 		( hour > 0 && hour < 12 ) 	$('h3#welcome').addClass('morning').text('Good Morning!');
	else if ( hour >= 12 && hour < 18 )	$('h3#welcome').addClass('afternoon').text('Good Afternoon!');
	else if ( hour >= 18 && hour < 24 )	$('h3#welcome').addClass('evening').text('Good Evening!');
	
	//	Twitter widget
	
	$('#twitter-widget').append('<iframe src="/ajax/twitter-widget.html" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>');
	
	//	Home videos
	
	$('#home-videos li:nth-child(3)').css('clear','left');
	
	$('#home-videos li').each(function(index, value)
	{
		$(this).css('visibility','visible').animate({opacity: 0}, 0).delay(1000+(index*100)).animate({opacity: 1}, 'slow');
		$(this).find('a')
			.data('title',$(this).attr('title'))
			.removeAttr('title')
			.addClass('item-'+index)
			.append('<span>'+$(this).find('a').text()+'</span>')
			.animate({opacity:0},0)
			.hover(
				function(){
					$(this).animate({opacity: 1}, 'fast');
					$(this).find('span').animate({opacity: 1}, 'fast');
				},
				function(){
					$(this).animate({opacity: 0}, 'fast');
					$(this).find('span').animate({opacity: 0}, 'fast');
				}
			);
			
		$(this).find('a span').animate({opacity:0},0);
	});
});
