//initiate dropdown menu
jQuery(function(){
	jQuery('ul.nav').superfish();
});

$(function() { 
	//show / hide default input values on select 
	var active_color = '#000000'; // Colour of user provided text
	var inactive_color = '#1b1b1b'; // Colour of default text
	$("input.default").css("color", inactive_color);
	var default_values = new Array();
	$("input.default").focus(function() {
		if (!default_values[this.id]) {
			default_values[this.id] = this.value;
		}
		if (this.value == default_values[this.id]) {
			this.value = '';
			this.style.color = active_color;
		}
		$(this).blur(function() {
			if (this.value == '') {
				this.style.color = inactive_color;
				this.value = default_values[this.id];
			}
		});
	});
	//hover over news blocks
	$('#content .block a.news').hover( function() {
		$(this).css({'background':'none'});
		$(this).parent().find('h3').addClass('highlight').removeClass('lowlight');
		$(this).parent().find('p.author').addClass('highlight').removeClass('lowlight');
		$(this).parent().find('p.date').addClass('highlight').removeClass('lowlight');
	}, 
	function (){
		$(this).css({'background':'transparent url("http://www.theodin.co.uk/tools/dropbox/shutter.png") repeat'});	
		$(this).parent().find('h3').addClass('lowlight').removeClass('highlight');
		$(this).parent().find('p.author').addClass('lowlight').removeClass('highlight');
		$(this).parent().find('p.date').addClass('lowlight').removeClass('highlight');
	});
	
	//apply a hover for the titles of news blocks
	$('#content .lowlight').hover( function() {
		$(this).parent().find('a.news').css({'background':'none'});
		$(this).parent().find('h3').addClass('highlight').removeClass('lowlight');
		$(this).parent().find('p.author').addClass('highlight').removeClass('lowlight');
		$(this).parent().find('p.date').addClass('highlight').removeClass('lowlight');
	}, 
	function (){
		$(this).parent().find('a.news').css({'background':'transparent url("http://www.theodin.co.uk/tools/dropbox/shutter.png") repeat'});
		$(this).parent().find('h3').addClass('lowlight').removeClass('highlight');
		$(this).parent().find('p.author').addClass('lowlight').removeClass('highlight');
		$(this).parent().find('p.date').addClass('lowlight').removeClass('highlight');
	});	
 
	//initiate tool tip plugin
	$('.tip').tipsy({gravity: 'n'});
 
	//initiate the fancybox lightbox
	$("a.fancy").fancybox();
	 
});
