$(document).ready(function () {
//open links in a new window - rel=external
$("a[rel=external]").attr("target","_blank").each(function(n) {
	$(this).attr("title") !='' ? this.title=$(this).attr("title")+'. Opens in a new browser window.' : this.title='Opens in a new browser window.';
});

//contact form
$("form input.plain").hover(highlight_btn2,restore_btn2);
function highlight_btn2(event) {$(this).addClass('plain_f2');}
function restore_btn2(event) {$(this).removeClass('plain_f2');}

$("form input.plain").focus(highlight_btn2);
$("form input.plain").blur(restore_btn2);
function restore_btn2(event) {$(this).removeClass('plain_f2');}

//New Consumer hide/reveals
if ( $("div.newconsumer").length > 0 ) {
	$('div.newconsumer div.unit div.revealer').hide();
	
	$("div.newconsumer div.unit h3").bind("mouseenter",function(){
		$(this).toggleClass('lit');
		//change image src to _f2 version
		var imgPath = $("img", this).attr("src");
		$("img", this).attr("src", imgPath.substr(0, imgPath.length - 4) + "_f2.gif");
		
	}).bind("mouseleave",function(){
		$(this).toggleClass('lit');
		var imgPath = $("img", this).attr("src");
		$("img", this).attr("src", imgPath.substr(0, imgPath.length - 7) + ".gif");
	});
	
	
	$('div.newconsumer div.unit h3').click(function() {
		$(this).next('.revealer').slideToggle('slow');
		return false;
	});
}

//Media centre
if ( $("div.media").length > 0 ) {

$("div.entry a").bind("mouseenter",function(){
	$(this).css({
		'background-color' : '#e5dee8',
		'cursor' : 'pointer',
		'text-decoration' : 'none'
	});
	$("span.second", this).css({
		'background-image' : 'url(images/buttons/btn_sm_arrowblue_down_pinkbg.gif)',
		'text-decoration' : 'underline'
	});		
}).bind("mouseleave",function(){
	$(this).css({
		'background-color' : 'transparent',
		'cursor' : 'auto'
	});
	$("span.second", this).css({
		'background-image' : 'url(images/buttons/btn_sm_arrowblue_down.gif)',
		'text-decoration' : 'none'
	});
});

}


}); //document ready end
