$(function() {initPage()});

function initPage() {
	
	$('a.popUp').click(function(){showPopup(this.id);return false;});
	$('.closeWidget').click(function(){hidePopup(this.parentNode);return false;});
	
	$('#twitter_div li:gt(0)').hide();
	
	$('#twitter_div .listToggle').click(function(){$("li:gt(0)", this.parent).fadeIn('fast');});
}

function showPopup(trigger) {
	$('div.popUpper#' + trigger + 'Panel').fadeIn('fast');
	
	// A horrible hack to allow the gmap iframe to initialise on page load AND resize correctly. ugh.
 	
	var srcRefresh = document.getElementById('mapBox').src
	document.getElementById('mapBox').src = ''
	document.getElementById('mapBox').src = srcRefresh;
}

function hidePopup(box) {
	$(box).fadeOut('fast');
}
