 $(document).ready(function(){
home_link();
about_link();
latest_link();
market_link();
feedback_link();
find_link();
email_link();

//apply lightbox behaviour to all links with images and class of "gallery"
$('a.gallery').css("display","inline").lightBox({fixedNavigation:true,
	imageBtnClose: 'images/lightbox-btn-close.gif',
	imageBtnPrev: 'images/lightbox-btn-prev.gif',
	imageBtnNext: 'images/lightbox-btn-next.gif',
	txtImage: 'Post Office advert series: image'}
); // Select all links with gallery class
	
//This is the behaviour found in newsBehav.js to control article show/hide function
newsBehav();

});

 
 
function home_link(){
	var image1_obj = document.getElementById('image1');
	$("#link1").hover(function(){
		$(image1_obj).attr("src", "images/home2.jpg").mousedown(function(){$(this).attr("src", "images/home3.jpg")});;
	},function(){
		$(image1_obj).attr("src", "images/home1.jpg");
	});
}

function about_link(){
	var image2_obj = document.getElementById('image2');
	$('#link2').hover(function(){
		$(image2_obj).attr("src", "images/about2.jpg").mousedown(function(){$(this).attr("src", "images/about3.jpg")});
	},function(){
		$(image2_obj).attr("src", "images/about1.jpg");
	});
}

function latest_link(){
	var image3_obj = document.getElementById('image3');
	$('#link3').hover(function(){
		$(image3_obj).attr("src", "images/latest2.jpg").mousedown(function(){$(this).attr("src", "images/latest3.jpg")});
	},function(){
		$(image3_obj).attr("src", "images/latest1.jpg");
	});
}

function market_link(){
	var image4_obj = document.getElementById('image4');
	$('#link4').hover(function(){
		$(image4_obj).attr("src", "images/markets2.jpg").mousedown(function(){$(this).attr("src", "images/markets3.jpg")});
	},function(){
		$(image4_obj).attr("src", "images/markets1.jpg");
	});
}

function feedback_link(){
	var image5_obj = document.getElementById('image5');
	$('#link5').hover(function(){
		$(image5_obj).attr("src", "images/feedback2.jpg").mousedown(function(){$(this).attr("src", "images/feedback3.jpg")});
	},function(){
		$(image5_obj).attr("src", "images/feedback1.jpg");
	});
}

function find_link(){
	var image6_obj = document.getElementById('image6');
	$('#link6').hover(function(){
		$(image6_obj).attr("src", "images/find2.jpg").mousedown(function(){$(this).attr("src", "images/find3.jpg")});
	},function(){
		$(image6_obj).attr("src", "images/find1.jpg");
	});
}

function email_link(){
	var image7_obj = document.getElementById('image7');
	$('#link7').hover(function(){
		$(image7_obj).attr("src", "images/email2.jpg").mousedown(function(){$(this).attr("src", "images/email3.jpg")});
	},function(){
		$(image7_obj).attr("src", "images/email1.jpg");
	});
}