jQuery(document).ready(function($) {
	$('input.blink').each(function() { if ($(this).val() == "" ) {$(this).val($(this).attr('title')) }; });
	
	$('.blink').focus(function () {
		if ($(this).val() == $(this).attr('title')) {
			$(this).val('');
		}
	}).blur(function () {
		if ($(this).val() == '') {
			$(this).val($(this).attr('title'));
		}
	});
	
	$('.footer-nav li:last span').hide();
	
	$("#sidebar ul.sections li a").click(function(){
		$("#sidebar ul.sections li a").removeClass("active");
		$(this).addClass("active");
	});
	
	Cufon.replace('h1, h2, h3, h4, h5, h6, #footer', { fontFamily: 'garamond be regular' });
	Cufon.replace('#navigation ul li a', { fontFamily: 'garamond be regular', hover: true });
	Cufon.replace('h2#slogan, #banner-content .image-holder .text i', { fontFamily: 'garamond be italic' });
	Cufon.replace('#content #faqs h4', { fontFamily: 'garamond be italic' });
	Cufon.replace('#clients #content h4', { fontFamily: 'garamond be italic' });
	
	// the sidebar needs to move with page scroll(if it's taller than content)
	if ($('#sidebar').length && $('#sidebar').height() < $('#content').height()) {
		var sidebar_top_offset = $('.sideline').offset().top;
		
		$(window).scroll(function(e) {
			var diff = Math.max($(document).scrollTop() - sidebar_top_offset, 0);
			if (inting) {
				$('#sidebar').css({'marginTop': diff + 'px'});
			} else {
				$('#sidebar').stop().animate({'marginTop': diff + 'px'});
			}
			
		});
		var inting = true;
		$(window).scroll(); // Trigger scroll event -- this is needed when the page is loaded with anchor
		inting = false;
	}
});
