$(document).ready(function() { 
	//Give items z-index for IE to keep popup boxes on top.
	if ($.browser.msie) {
		var numberofitems = $("#whatwedoframe li").length;
		numberofitems += 50;
		for (i=numberofitems;i>=50;i--)
		{
			var li = numberofitems - i;
			$("#whatwedoframe li").eq(li).css("z-index", i);
		}
	}
	
	//Event listener for h4
    $("#whatwedoframe li h4").mousedown(function () {
		if ($(this).parent("li").children("div").hasClass("active")) {
			closeBoxes();
		}
		else {
			closeBoxes();
			$(this).parent("li").children("div").addClass("active");
			$(this).parent("li").children("h4").addClass("active");	
			$(this).parent("li").children("div").animate({
			   "width": "toggle",
			   "height": "toggle",
			   "fontSize": "toggle"
			}, 500  );
		}
    });
	
	//Event listener for close buttons
    $("#whatwedoframe .closebutton").mousedown(function () {
		closeBoxes();
    });
	
	function closeBoxes() {
		$("#whatwedoframe div.active").animate({
		   "width": "toggle",
		   "height": "toggle",
		   "fontSize": "toggle"
		}, 200  );
		$("#whatwedoframe div.active").removeClass("active");
		$("#whatwedoframe h4.active").removeClass("active");
	}
});