$(function() {
	$('.activator').click(function(){
		$.ajax({
			url: '/module/elements/renderblock/id/23/',
			success: function(msg) {
				$('iframe').hide();
				$('body').append(msg);
				$('#overlay').fadeIn('fast',function(){
					$('#box').animate({'top':'160px'},500);
		            });
		            $('#boxclose').click(function(){
	                $('#box').animate({'top':'-500px'},500,function(){
						$('iframe').show();
                       $('#overlay').fadeOut('fast', function() {
							$('#overlay').remove()
							$('#box').remove();
                       });
                   	});
				});
				_gaq.push(['_trackPageview', '/open-popup']);
				
        	}
    	});    
	});

	$('#activator_newsletter').click(function(){
		$.ajax({
			url: '/module/elements/renderblock/id/25/',
			success: function(msg) {
				$('body').append(msg);
				
				$('#overlay_newsletter').fadeIn('fast',function(){
					
					$('#box_newsletter').animate({'top':'160px'},500);
		            });
		            
		            $('#boxclose_newsletter').click(function(){
		            
                    $('#box_newsletter').animate({'top':'-500px'},500,function(){
                       $('#overlay_newsletter').fadeOut('fast', function() {
							$('#overlay_newsletter').remove()
							$('#box_newsletter').remove();
                       });
                   	});
				});
			}
		});    
	});
	
	$('.silverpartner').click(function(){ /* wtf  */
		
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: 0}, 500, 'swing');
		$.ajax({
			url: '/module/elements/renderblock/id/29/',
			success: function(msg) {
				$('body').append(msg);
				
				$('#overlay_newsletter').fadeIn('fast',function(){
					
					$('#box_newsletter').animate({'top':'160px'},500);
		            });
		            
		            $('#boxclose').click(function(){
		            
                    $('#partner-overlay').animate({'top':'-500px'},500,function(){
                       $('#overlay_newsletter').fadeOut('fast', function() {
							$('#overlay_newsletter').remove()
							$('#partner-overlay').remove();
                       });
                   	});
				});
			}
		});    
	});
});
