jQuery(function( $ ){
  $.localScroll({
    duration:500,
    offset:-30,
    hash:true
  });
  
	// Form hinting
  $('.hinted input.text, .hinted textarea').each(function() {
			$(this)
				.val($(this).attr('title'))
				.data('default', $(this).val())
				.addClass('inactive')
				.focus(function() {
					$(this).removeClass('inactive').next('.help').fadeIn('fast');
					if($(this).val() == $(this).data('default') || '') {
						$(this).val('');
					}
				})
				.blur(function() {
					$(this).next('.help').fadeOut('fast');
					var default_val = $(this).data('default');
					if($(this).val() == '') {
						$(this).addClass('inactive');
						$(this).val($(this).data('default'));
					}
				});
  });
  
  
  // ie6 and below branching 
  if (less_than_ie7 == false) {
  
		// Anchor highlighting
		function highlight(elemId){
				var elem = $(elemId);
				elem.css("backgroundColor", "#ffffff"); // hack for Safari
				elem.animate({ backgroundColor: '#b5f461' }, 1500);
				setTimeout(function(){$(elemId).animate({ backgroundColor: "#ffffff" }, 3000)},1000);
		}
			 
		if (document.location.hash) {
				highlight(document.location.hash);
		}
		$('#content a[href*=#]').click(function(){
				var elemId = '#' + $(this).attr('href').split('#')[1];
				highlight(elemId);
		});
	
		// image rounded corners: http://www.bram.us/sandbox/roundedcorners
		$('#people img,#person img').wrap(function() {
			return '<span style="background-image:url(' + $(this).attr('src') + '); height: '+ $(this).height() + 'px; width: '+ $(this).width() + 'px;" class="rounded" />';
		});
	}
	
	else {
		$('.column:first-child').addClass('first_column');
		$('*:first-child').addClass('first_child');
		
		var alert_txt = '<div id="lt_ie7" class="alert">Your version of Internet Explorer is <strong>more than 9 years old</strong>. We are continuing to try and improve things here for your current browser but if you can <a href="http://www.microsoft.com/uk/windows/products/winfamily/ie/default.mspx" target="_blank" title="Internet Explorer home page will open in a new window"><strong>upgrade it</strong></a> this site will work much better for you.</strong></div>';
		
		$('#top .section').before(alert_txt);
	}  
	
});

