var drag=false;
var ie5=document.all&&document.getElementById;
var ns6=document.getElementById&&!document.all;

function fechaId(nom_id) {document.getElementById(nom_id).style.display="none";}
function AbrirPopup(imagem, link, w, h, t, l, num,tempo) {
	d = document;
	h = h + 36; w = w + 5;
	d.write('<div id="n'+num+'" style="position:absolute; cursor: move; width:'+w+'px; height:'+h+'px; top:'+t+'px; left:'+l+'px; overflow:hidden; z-index:999;">');
	h = h - 16; w = w - 5;
	d.write('<div style="position:absolute; top:16px; left:5px; width:'+w+'px; height:'+h+'px;background-image:url(http://www.hospedageminteligente.com/site25/pop/sombra.gif)"></div>');
	h = h - 20;
	d.write('<div style="position:absolute; top:0; left:0; width:'+w+'px; height:31px;">');
	d.write('<table cellpadding="0" cellspacing="0" border="0" height="31px" width="100%" style="background-image:url(http://www.hospedageminteligente.com/site25/pop/bg.gif)">');
	d.write('<tr><td width="33%"></td><td width="34%" valign="top"><img src="http://www.hospedageminteligente.com/site25/pop/pin.gif" border="0" /></td>');
	d.write('<td align="right" width="33%" valign="top"><a href=javascript:fechaId("n'+num+'");>');
	d.write('<img src="http://www.hospedageminteligente.com/site25/pop/bt_fechar.gif" border="0" align="right" /> </a></td></tr></table></div>');
	
	d.write('<div style="position:absolute; width:'+w+'px; height:'+h+'px; top:31px; left:0; overflow:hidden;">');
	d.write('<a href="'+link+'"><img src="'+imagem+'" border="0" width="'+w+'px" height="'+h+'px" /></a></div></div>');

	d.getElementById("n"+num).onmousedown=inicia;
	d.getElementById("n"+num).onmouseup=stopPop
	function inicia(e) {
		offsetx=ie5 ? event.clientX : e.clientX;
		offsety=ie5 ? event.clientY : e.clientY;
		tempx = parseInt(document.getElementById("n"+num).style.left);
		tempy = parseInt(document.getElementById("n"+num).style.top);

		drag=true;
		document.getElementById("n"+num).onmousemove=movePop;
	}
	function movePop(e) {
			if (ie5 && drag && event.button==1) {
				document.getElementById("n"+num).style.left = tempx + event.clientX - offsetx + "px";
				document.getElementById("n"+num).style.top = tempy + event.clientY - offsety + "px";
			}
			else if (ns6 && drag) {
				document.getElementById("n"+num).style.left = tempx + e.clientX - offsetx + "px"
				document.getElementById("n"+num).style.top = tempy + e.clientY - offsety + "px"
			}
	}
	function stopPop(e) {
		drag=false;
		document.getElementById("n"+num).onmousemove=null;
	}
	setTimeout(fechaPop = function() { fechaId("n"+num); }, tempo);
}


function AbrirPopupFlash(filme, w, h, t, l, num) {
	d = document;
	h = h + 36; w = w + 5;
	d.write('<div id="n'+num+'" style="position:absolute; cursor: move; width:'+w+'px; height:'+h+'px; top:'+t+'px; left:'+l+'px;');
	d.write('overflow:hidden;">');

	h = h - 16; w = w - 5;
	d.write('<div style="position:absolute; top:16; left:5; width:'+w+'px; height:'+h+'px;');
	d.write('background-image:url(pop/sombra.gif)"></div>');

	h = h - 20;
	s = '<div style="position:absolute; top:0; left:0; width:'+w+'px; height:31px;">';
	s += '<table cellpadding="0" cellspacing="0" border="0" height="31px" width="100%"';
	s += 'style="background-image:url(pop/bg.gif)">';
	s += '<tr><td width="33%"></td><td width="34%" valign="top"><img src="pop/pin.gif" border="0" /></td>';
	s += '<td align="right" width="33%" valign="top"><a href=javascript:fechaId("n'+num+'");>';
	s += '<img src="pop/bt_fechar.gif" border="0" /> </a></td></tr></table></div>';
	d.write(s);
	
	d.write('<div style="position:absolute; width:'+w+'px; height:'+h+'px; top:31px; left:0;');
	d.write('overflow:hidden;">');

	d.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" id="flash_version" align="middle">');
	d.write('<param name="movie" value="'+filme+'" />');
	d.write('<param name="menu" value="false" />');
	d.write('<param name="wmode" value="opaque" />');
	d.write('<param name="quality" value="high" />');
	d.write('<param name="scale" value="noscale" />');
	d.write('<embed src="'+filme+'" menu="false" quality="high" scale="noscale" width="'+w+'" height="'+h+'" name="flash_version" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	d.write('</object>');

	d.write('	</div>');
	d.write('</div>');

	d.getElementById("n"+num).onmousedown=inicia;
	d.getElementById("n"+num).onmouseup=stopPop
	function inicia(e) {
		offsetx=ie5 ? event.clientX : e.clientX;
		offsety=ie5 ? event.clientY : e.clientY;
		tempx = parseInt(document.getElementById("n"+num).style.left);
		tempy = parseInt(document.getElementById("n"+num).style.top);

		drag=true;
		document.getElementById("n"+num).onmousemove=movePop;
	}
	function movePop(e) {
			if (ie5 && drag && event.button==1) {
				document.getElementById("n"+num).style.left = tempx + event.clientX - offsetx + "px";
				document.getElementById("n"+num).style.top = tempy + event.clientY - offsety + "px";
			}
			else if (ns6 && drag) {
				document.getElementById("n"+num).style.left = tempx + e.clientX - offsetx + "px"
				document.getElementById("n"+num).style.top = tempy + e.clientY - offsety + "px"
			}
	}
	function stopPop(e) {
		drag=false;
		document.getElementById("n"+num).onmousemove=null;
	}
	setTimeout(fechaPop = function() { fechaId("n"+num); }, 15000);
}

