//jQuery.noConflict();

/*jQuery(document).ready(function(){
	$('#popout').fadeIn(2000);
	
	$('#popout').click(function(){
		$(this).fadeOut(1000);
	});
	
	$('#close').click(function(){
		$(this).fadeOut(1000);
	});
});*/

jQuery(document).ready(function() {
   var popOut = "#popout"; // Name of the popout container.
   var adBox = "#adbox"; // Name of the animated bit of the ad.
   var adWidth = jQuery(adBox).width() + jQuery("#cap").width() + 700; // Width of the ad container.

   function openAd() {
      jQuery(popOut).width(adWidth+"px");
      jQuery(adBox).animate({marginLeft: "150px"},1200);
   }
   
   function closeAd() {
     // jQuery(adBox).animate({marginLeft: "-"+adWidth+"px"},1200,"linear",
      jQuery(adBox).animate({marginLeft: "-700px"},1200,"linear",	  
         function(){ jQuery(popOut).width(jQuery("#cap").width() + "px"); }
      );
   }

   jQuery("#open").click(function() {
      openAd();
      return false; 
   });
   jQuery("#close").click(function() {
      closeAd();
      return false;
   });   
   
   jQuery(popOut).animate({opacity: 1.0}, 2000, "linear", openAd);
   setTimeout(function(){closeAd()},9000);

});




