$(function(){
	$('#tree').click(function(){popup('/images/fyi-certificate.jpg', '600', '849');});
	$('#newsletter').click(function(){popup('/mailchimp.php', 250, 300);});
	
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-8621697-8']);
	_gaq.push(['_trackPageview']);
	
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
});
 
function popup(href, height, width) { 
	$('.popup').fadeOut(function(){$(this).remove()});
	
	var overlay = $('<div></div>').addClass('popup').css({background:'#000',left:0,top:0,opacity:0.5,position:'fixed',height:'100%',width:'100%'})
		.click(function(){$('.popup').fadeOut(function(){$(this).remove();})});
		
	var popup = $('<div></div>').addClass('popup ui-corner-all').append($('<iframe></iframe>').attr({border:0,src:href,allowtransparency:'true',frameborder:'0',scrolling:'no',height:height,width:width}))
		.css({background:'#111',border:'2px solid #333','border-radius':'5px',left:'50%',top:'50%',margin:'-'+(height/2)+'px 0px 0px -'+(width/2)+'px',position:'fixed',height:height,width:width});
			
	$('body').append($(overlay).fadeIn()).append($(popup).fadeIn());
}
