jQuery(document).ready(function($) {
	
	var $w = 480;
	var $h = 560;
	var $s = 'wp-content/banners/topmovel-janeiro-2012.swf';
	var $t = $h + 20;
	
	var $style = {
			'width'       : $w + 'px',
			'height'      : $t + 'px',
			'position'    : 'fixed',
			'top'         : '50%',
			'left'        : '50%',
			'margin-left' : '-' + parseInt($w/2) + 'px',
			'margin-top'  : '-' + parseInt($t/2) + 'px',
			'z-index'     : 998
	}
	
	var $div = $('<div></div>').css($style).css({ cursor: 'pointer' });
	var $ifr = $('<iframe frameborder="0"></iframe>').css($style).css('z-index', 997).fadeTo(0.1);
	
	$div.append(
			'<div align="right">' + 
			'<p style="color:#3366ff;display:block;margin:2px;font-size:12px;height:20px;">' + 
			'<strong>[X] FECHAR</strong>' + 
			'</div>' + 
			'<object type="application/x-shockwave-flash" width="' + $w + '" height="' + $h + '" data="' + $s + '">' +
			'<param name="movie" value="' + $s + '"/>' +
			'<param name="allowScriptAccess" value="sameDomain" />' +
			'<param name="wmode" value="transparent"/>' +
			'<p><a href="http://www.adobe.com/go/getflash">Instalar Flash Player</a></p>' +
			'</object>' +
			'</div>'
		);
	
	$(document.body).append($ifr).append($div);
	
	var $remove = function() {
		$($ifr).remove();
		$($div).fadeOut(function() { $(this).remove() });		
	};
	
	$('p', $div).click($remove);

	setTimeout(function() { $remove(); }, 1000 * 30);
	
});
