$(document).ready(function(){
						   
	// initialise menu
	$("ul.sf-menu").superfish();
	
	// dynamically set banner images based on breadcrumb
	if($("#breadcrumbs:contains('about us')").length > 0){
		$("#banner").addClass("about-us");
	}
	if($("#breadcrumbs:contains('services')").length > 0){
		$("#banner").addClass("services");
	}
	if($("#breadcrumbs:contains('knowledge')").length > 0){
		$("#banner").addClass("knowledge");
	}
	if($("#breadcrumbs:contains('news')").length > 0){
		$("#banner").addClass("news");
	}
	if($("#breadcrumbs:contains('events')").length > 0){
		$("#banner").addClass("events");
	}
	if($("#breadcrumbs:contains('privacy')").length > 0){
		$("#banner").addClass("home-banner");
	}
	
	
	// Lets make a small attempt to prevent email spam
	$('.convert-to-email').each(function() {
		var $email = $(this);
		var address = $email.text().replace(/\s*\[domain\]\s*/, '@').replace(/\s*\[separator\]\s*/g, '.');
		$email.html('<a href="mailto:' + address + '">' + address +'</a>');
	});
	
	setColHeight();
	
});

function setColHeight(){
	// set content column heights dynamically to avoid extra markup and clunky CSS
	var cMainHeight = $("#content-main").height();
	var cRelatedHeight = $("#content-related").height();
	var cRelatedTwoHeight = $("#content-related-2").height();
	if(cMainHeight > cRelatedHeight && cMainHeight > cRelatedTwoHeight){
		$("#content-related").height(cMainHeight);
		$("#content-related-2").height(cMainHeight);
	}
	if(cRelatedHeight > cMainHeight && cRelatedHeight > cRelatedTwoHeight){
		$("#content-main").height(cRelatedHeight);
		$("#content-related-2").height(cRelatedHeight);
	}
	if(cRelatedTwoHeight > cMainHeight && cRelatedTwoHeight > cRelatedHeight){
		$("#content-main").height(cRelatedTwoHeight);
		$("#content-related").height(cRelatedTwoHeight);
	}
}