$(document).ready(function(){
	// Blinking Fields
	$('.blink').
	    focus(function() {
	        if(this.title==this.value) {
	            this.value = '';
	        }
	    }).
	    blur(function(){
	        if(this.value=='') {
	            this.value = this.title;
	        }
	    });
	    
	$('#navigation ul.main li').hover(function(){
		var idx = $(this).index();
		
		$(this).addClass('hover');
		$('#navigation .drop-downs').slideDown();
		$('#navigation .drop-downs li.main').eq(idx).addClass('hover');
	}, function(){
		$('#navigation ul.main li').removeClass('hover');
		$('#navigation .drop-downs li.main').removeClass('hover');
	});
	
	$('#navigation .drop-downs li.main').hover(function(){
		var idx  = $(this).index();
		$(this).addClass('hover');
		
		$('#navigation ul.main li').eq(idx).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
		$('#navigation ul.main li').removeClass('hover');
	});
	
	$('#navigation').mouseleave(function(){
		$('.drop-downs').stop(true,true).slideUp();
	})
	    
	    
	//$('#navigation .shell > ul > li').hover(function(){
	//	var idx = $(this).index();
	//	$(this).addClass('hover');
	//	$('.drop-downs').fadeIn();
	//	
	//	$('.drop-downs li.main').eq(idx).addClass('hover');
	//	
	//}, function(){
	//	$(this).removeClass('hover');
	//	$('.drop-downs li.main').removeClass('hover');
	//});
	
	//$('.drop-downs li.main').hover(function(){
	//	var idx = $(this).index();
	//	$(this).addClass('hover');
	//	$('#navigation li').eq(idx).addClass('hover');
	//}, function(){
	//	$('.drop-downs li.main').removeClass('hover');
	//	$('#navigation li').removeClass('hover');
	//});
	
	//$('.drop-downs').mouseleave(function(){
	//	$(this).fadeOut();
	//});
	
	//$('#navigation').mouseleave(function(){
	//	$('.drop-downs').fadeOut();
	//});
	
	//Fader
	var fader;
	$('#home-fader .image').simpleFade({
		init : function () {
			fader = this;
		},
		onFade : function (index) {
			$('#home-fader .nav a').removeClass('active').eq(index).addClass('active');
		}
	});
	
	$('#home-fader .nav a').click(function () {
		fader.fadeTo($('#home-fader .nav a').index(this));
		return false;
	});
	
	
	//Fader
	var fader2;
	$('#home-content .column-1 .articles').simpleFade({
		init : function () {
			fader2 = this;
		},
		onFade : function (index) {
			$('#home-content .column-1 .nav a').removeClass('active').eq(index).addClass('active');
		}
	});
	
	$('#home-content .column-1 .nav a').click(function () {
		fader2.fadeTo($('#home-content .column-1 .nav a').index(this));
		return false;
	});
	
	//Fader
	var fader3;
	$('#top-content .item').simpleFade({
		init : function () {
			fader3 = this;
		},
		onFade : function (index) {
			$('#top-content .nav a').removeClass('active').eq(index).addClass('active');
		}
	});
	
	$('#top-content .nav a').click(function () {
		fader3.fadeTo($('#top-content .nav a').index(this));
		return false;
	});
	
});
