// get the window height
function getWindowHeight() {
	var windowHeight = 0;
	windowHeight = $(window).height();
	return windowHeight;
}


// set the footer size
function setFooter() {
		
	var windowHeight = getWindowHeight();
	
	if (windowHeight > 0) {
	
		var wrapperHeight = $('#wrapper').outerHeight();
		var footerHeight = $('#footer').outerHeight();
		
		if (windowHeight - (wrapperHeight+footerHeight) >= 0) {
		
			$("#wrapper").css('height', (windowHeight - (wrapperHeight+footerHeight)) + wrapperHeight + "px");
		
		} else {
			
			$("#wrapper").css('height', 'auto');

		}
		
	}
}

// place footer
$(window).resize(function(){
	setFooter();
});


$(document).ready( function() {
	setFooter();
});



// hook up home page links
$(document).ready( function(){
	
	var fe_link = $('#fe_cta p a').attr('href');
	$('#fe_cta').click(function(){
		window.open(fe_link, '_self');
	});
	
	var vol_link = $('#vol_cta p a').attr('href');
	$('#vol_cta').click(function(){
		window.open(vol_link, '_self');
	});
	
});


// replace images from home page
$(document).ready(function(){
	
	var event_src = $('.event_img:eq(0)').attr('src');
	$('#fe_cta').css({'background-image' : 'url(' + event_src + ')'});
	$('.event_img:eq(0)').parent().remove();
	
	var volunteer_src = $('.volunteer_img:eq(0)').attr('src');
	$('#vol_cta').css({'background-image' : 'url(' + volunteer_src + ')'});
	$('.volunteer_img:eq(0)').parent().remove();
	
});


// popup window
$(document).ready(function(){
	$('a.popup').click(function(){
		window.open(this.href);
		return false;
	});
});











