function include(d){var e=window.document.createElement('script');d = (d.toLowerCase().indexOf("://") > -1) ? d : "/static/js/"+d+".js";e.setAttribute('src',d);document.getElementsByTagName('head').item(0).appendChild(e);}

include('vend/jquery');
include('vend/jquery.ui');

window.onload = function () {
	var growbox = $('.growbox');
	var growcontent = $('.growbox_inner', growbox);
	var growloading = $('.growbox-loading', growbox);
	
	$('.gridbutton').hover(
		//On mouse over
		function() { $(this).addClass('gridhover'); },
		
		//On mouse out
		function() { $(this).removeClass('gridhover'); }
	);
	
	$('.gridbutton a').click(
		function(e) {
			growbox.css('visibility','visible');
			growbox.animate({width:960, height:490},"slow");
			
			growcontent.load($(this).attr('href').split('.')[0] + ".ajax",'',function() { growloading.hide(); });
			
			e.stopPropagation();
			return false; //Kill bubbling
		}
	);
	
	$('.closebutton a',growbox).click(
		function(e) { 
			growbox.animate({width:0, height:0},'slow','linear',function(){
				growbox.css('visibility','hidden');
				growcontent.empty();
				growcontent.append(growloading);
				growloading.show();
			}); 
			
			e.stopPropagation();
			return false; //Kill bubbles
		}
	);
};
