function SmoothScroll() {
	$('.scroll').click(function() {
	  if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	  && location.hostname == this.hostname) {
		var $target = $(this.hash);
		$target = $target.length && $target
		|| $('[name=' + this.hash.slice(1) +']');
		if ($target.length) {
		  var targetOffset = $target.offset().top;
		  $('html,body')
		  .animate({scrollTop: targetOffset}, 1000);
		 return false;
		}
	  }
	});
}

function Accordian() {
	var togglers = $('.reportList li h3');
	var elements = ".reportList li div";
	$(elements).hide();
	togglers.click(
	function() {
		var checkElement = $(this).next();
			if((checkElement.is(elements)) && (checkElement.is(':visible'))) {
			checkElement.slideUp(500);
			return false;
		}
		if((checkElement.is(elements)) && (!checkElement.is(':visible'))) {
			$(elements + ':visible').slideUp(500);
			checkElement.slideDown(500);
			return false;
		}
	});
}

$(document).ready(function(){
	
	$(document).pngFix();
	SmoothScroll();
	Accordian();
	Shadowbox.init();
	
    $("a[rel*='external']").attr({ target: "_blank" });

	var volatile = $(".field input")
	volatile.focus(function(event){
        if ($(this).val() == $(this).attr("title") ){        
            $(this).val("");
        }}, volatile.blur(function(event){
            if ($(this).val() == "" ){        
                $(this).val($(this).attr("title"));
            }
        }
    ));
	
	// Now get the font changed: http://cufon.shoqolate.com/generate/
	Cufon.replace('h1, h2, #content .reportDates li .date, #content .reportDates li .from, #content .reportList h3', { fontFamily: 'Clarendon', hover: true });


    //Change border colour of focused input	
    $('.contact input[type="text"], .contact textarea').focus(function() {
        $(this).css("border-color", "#cedea3");
    });

    $('.contact input[type="text"], .contact textarea').blur(function() {
        $(this).css("border-color", "#e2e2e2");
    });
	
	










});

