$(function() {
	$.ajax({
		url: 'index.php',
		data: 'action=buscaImagemModalPromocao',
		success : function(res){
			res = res.split('|');
			if ($.browser.msie && parseInt($.browser.version.substr(0,1)) < 7){
				if (res != 0){
					window.open('index.php?action=popup&amp;miniatura.php?src='+ res[0] +'&amp;x='+ res[1] + '&amp;y='+res[2]+'&amp;q=85;&amp;link='+res[3]+ '', 'width='+ res[1]+', height='+res[2]);
				}
			} else {
				if (res != 0){
					if((res[3] !='') && (res[3] !=undefined) && (res[3] != null)){
						$.fn.nyroModalManual({
							content: '<a href="'+ res[3] +'" target="_blank"><img id="closeModal" src="miniatura.php?src='+ res[0] +'" border=0 /></a>',
							width : parseInt(res[1]) +20,
							height: res[2],
							closeButton: '<a href="#" class="nyroModalClose" id="closeBut" style="position: absolute;outline: 0;display: block;top: -20px;right: 19px;width: 20px;height: 20px;text-indent: -9999em;background: url(imagens/closeLogin.png) no-repeat;" title="Fechar">Fechar</a>'
						});
					}else{
						$.fn.nyroModalManual({
							content: '<img id="closeModal" src="miniatura.php?src=acapedPopup.jpg" border=0 />',
							width : parseInt(res[1]) +20,
							height: res[2],
							closeButton: '<a href="#" class="nyroModalClose" id="closeBut" style="position: absolute;outline: 0;display: block;top: -20px;right: 19px;width: 20px;height: 20px;text-indent: -9999em;background: url(imagens/closeLogin.png) no-repeat;" title="Fechar">Fechar</a>'
						});
					}
				}
				$('#closeModal').click(function(){
					$.nyroModalRemove();
				});
			}
		}
	});
});
