// JavaScript Document
jQuery(document).ready(function(){ 
    jQuery("#pagewrapper").css('opacity', '0');
	jQuery("#pagewrapper").animate({"opacity": "0"}, {queue:true, duration: 100})
	jQuery("#pagewrapper").animate({"opacity": "1"}, {queue:true, duration: 500})
	jQuery("#newsletter_form").css('width', '0px');
    jQuery("#newsletter_form").css('height', '0px');
	jQuery("#newsletter_form").css('border', 'none');
	jQuery("#newsletter_form").animate({"opacity": "0"}, "slow");
	jQuery("img.newsletter_button").css('opacity', '0');
	jQuery("img.newsletter_closebutton").css('opacity', '0');
	jQuery("img.newsletter_button").animate({"opacity": "1"}, {queue:true, duration: 3000})
	jQuery("img.side_button").css('opacity', '0');
	jQuery("img.side_button").animate({"opacity": "1"}, {queue:true, duration: 3000})
	


	jQuery("a.newsletter_link").toggle(
		function () {
            jQuery("#amail").show();
			//jQuery("#newsletter").css('z-index','101');
 			jQuery("#newsletter_form").animate({width: "400px", height: "200px"}, {queue:false, duration: 1000, easing: 'jswing'})
			jQuery("#newsletter_form").css('border', '2px solid black');
			jQuery("#newsletter_form").animate({"opacity": "0.9"}, "slow")
			jQuery("img.newsletter_button").stop().animate({"opacity": "0"}, {queue:false, duration: 500})
			jQuery("img.newsletter_closebutton").stop().animate({"opacity": "0"}, {queue:true, duration: 1000})
			jQuery("img.newsletter_closebutton").animate({"opacity": "1"}, {queue:true, duration: 1000})
                },
                function () {
			
			jQuery("#newsletter_form").animate({width: "0px", height: "0px"}, {queue:false, duration: 1000, easing: 'jswing'})
			jQuery("#newsletter_form").animate({"opacity": "0"}, {queue:false, duration: 1000})
			jQuery("#newsletter_form").css('border', 'none');
			jQuery("img.newsletter_closebutton").animate({"opacity": "0"}, {queue:false, duration: 500})
			jQuery("img.newsletter_button").stop().animate({"opacity": "0"}, {queue:true, duration: 1000})
			jQuery("img.newsletter_button").animate({"opacity": "1"}, {queue:true, duration: 2000})
			//jQuery("#newsletter").css('z-index','0');
            jQuery("#amail").hide();
            jQuery("#confirmation").hide();
		}
	); 

});

