String.prototype.trim = function () {
    return this.replace(/^\s*/,'')
                     .replace(/\s*$/,'');
};

$(document).ready(function() {

		$('a[href^=\'http\']').attr('target','_blank');

		var curLocation = document.location.toString().split("/");

		var realLocation = curLocation[3];
 		if (realLocation == "events")
		{
			$('#subMenu').show();
		}
		if (realLocation == "") {
				var style = 'homeactive'; 
				var selector = 'home'
		} 
		else 
		{
				var style = realLocation+'active'; 
				var selector = realLocation;
		}	
		$('a#' + selector).addClass(style);
	
		if (curLocation[4] != undefined)
		{
			 var style = curLocation[4]+'active'; 
			 var selector = curLocation[4];
			$('a#' + selector).addClass(style);
		}

	$("#speakerLink1").click(function () {
		$('div.speakers').hide(); 
		$('div#speaker1').show();
	});
	$("#speakerLink2").click(function () {
		$('div.speakers').hide(); 
		$('div#speaker2').show(); 
	});
	$("#speakerLink3").click(function () {
		$('div.speakers').hide(); 
		$('div#speaker3').show(); 
	});
	$("#speakerLink4").click(function () {
		$('div.speakers').hide(); 
		$('div#speaker4').show(); 
	});
	$("#speakerLink5").click(function () {
		$('div.speakers').hide(); 
		$('div#speaker5').show(); 
	});
	$("#speakerLink6").click(function () {
		$('div.speakers').hide(); 
		$('div#speaker6').show(); 
	});
	$("#speakerLink7").click(function () {
		$('div.speakers').hide(); 
		$('div#speaker7').show(); 
	});

	$('div#speaker1').show();

	$("#programmeLink").click(function () {
		$('div#programme').show();
		$('#closeProgram').show();
		$('#programmeLink').hide();
	});
	$("#closeProgrammeLink").click(function () {
		$('div#programme').hide();
		$('#closeProgram').hide();
		$('#programmeLink').show();
	});
});

