function popOut(adOptions) {
	var adContainer = (adOptions.adContainer) ? adOptions.adContainer : "#ad"; // The ID of the outermost ad container div.
	var adBox = (adOptions.adBox) ? adOptions.adBox : "#adbox"; // The inner ad div (the one that should move).
	var adCookie = (adOptions.adCookie) ? adOptions.adCookie :  "popout"; // The name of the cookie associated with this ad.
	var openLink = (adOptions.openLink) ? adOptions.openLink : "#open1"; // The open button (i.e., cap, toggler) for this ad.
	var closeLink = (adOptions.closeLink) ? adOptions.closeLink : "#close1"; // The close button.
	var adWidth = ''; // This will be set at runtime to ensure we get an accurate number.

	function openAd() {
		$(adContainer).width(adWidth+"px");
		$(adBox).animate({marginLeft: "0"},1200);
		$.cookie(adCookie, null, {expires: 0, path: '/'});
	}
	
	function closeAd() {
		$(adBox).animate({marginLeft: "-"+adWidth+"px"},1200,"linear",
			function(){ $(adContainer).width($(adContainer+" .cap").width() + "px"); }
		);
		$.cookie(adCookie,'closed',{expires: 30, path: '/'});
	}
	
	adWidth = $(adBox).width() + $(adContainer+" .cap").width();
	$(openLink).click(function() {
		if($.cookie(adCookie) != "closed") {
			closeAd();
		} else {
			openAd();
		}
		return false;
	});	
	$(closeLink).click(function() {
		closeAd();
		return false;
	});	
	
	$(adContainer).width($(adContainer+" .cap").width() + "px");
	if($.cookie(adCookie) != "closed") {
		$(adContainer).animate({opacity: 1.0}, 2000, "linear", openAd);
	}
}
