function Preload() {
   // code to preload images
   document.getElementById('theLayer').style.visibility="visible";
}

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

function getCode(){
	return '<DIV id=theLayer style="LEFT: 325px; VISIBILITY: hidden; WIDTH: 321px; POSITION: absolute; TOP: 200px; z-index:1">' +
		'<table width="270" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" bordercolor="#CCCCCC">' +
		'<tr><td width="270" class="ContenidoInside" id="titleBar" style="cursor:move ">' +
		'<ILAYER onselectstart="return false width="100%"><LAYER onmouseover="isHot=true;if (isN4) ddN4(theLayer)" onmouseout=isHot=false width="100%"><img src="../img/promo-bar.jpg" width="324" height="33"></td>' +
		'<td align="left"><a href="#" onclick="hideMe();return false"><img src="../img/promo-bar-close.jpg" width="34" height="34" border="0"></a></td></tr>' +
		'<tr><td colspan="2">' +
		'<p>.</p>' +
		'<p class="ContenidoInside"><strong><a href="http://betterlooks.co.cr/app/reqinfo.php?affid=32"><img src="http://www.betterlooks.co.cr/img/B-CONTACTUS.jpg" alt="Contact Us!" width="52" height="53" hspace="10" vspace="1" border="0" align="right"></a>Implantes de Senos' +
		' por solo<strong> <font color="#CC3300">$2.650 USD</font></strong> con nuestro cirujano certificado <a href="http://betterlooks.co.cr/app/reqinfo.php?affid=32">Dr. ' +
		'Gustavo Chavarria Leon</a>. Para Consultas - $50</p>' +
		'<p class="ContenidoInside"><a href="http://betterlooks.co.cr/app/reqinfo.php?affid=20"><img src="http://www.betterlooks.co.cr/img/B-CONTACTUS.jpg" alt="Contact Us!" width="52" height="53" hspace="10" vspace="1" border="0" align="right"></a><strong><a href="../vibroliposuction.htm">Cirugía Vibrolipo</a></strong>' +
		' por solo <strong> <font color="#CC3300">$3.500 USD</font></strong> (2 zonas) con nuestro cirujano certificado <a href="http://betterlooks.co.cr/app/reqinfo.php?affid=20">Dr. ' +
		'Christian Rivera Paniaqua</a>. Para Consultas - $50</p>' +
		'<p class="ContenidoInside"><a href="http://betterlooks.co.cr/app/reqinfo.php?affid=60"><img src="http://www.betterlooks.co.cr/img/B-CONTACTUS.jpg" alt="Contact Us!" width="52" height="53" hspace="10" vspace="1" border="0" align="right"></a> ' +
		'<p class="ContenidoInside"><strong><a href="../dental-crowns.htm">Capas de Porcelana</strong></a> with <a href="http://betterlooks.co.cr/app/reqinfo.php?affid=60">Dr. Alejandro Mora Lasso</a>. Por solo<font color="#CC3300"><strong>$300 USD cada una</strong></font>' +
		'<p class="ContenidoInside"><strong><a href="http://betterlooks.co.cr/app/reqinfo.php?affid=5"><img src="http://www.betterlooks.co.cr/img/B-CONTACTUS.jpg" alt="Contact Us!" width="52" height="53" hspace="10" vspace="1" border="0" align="right"></a>Blanqueamiento Dental' +
		'con Laser</strong> por solo <font color="#CC3300"><strong>$230 USD</strong></font>' +
		'con nuestro cirujano oral <a href="http://betterlooks.co.cr/app/reqinfo.php?affid=5">Dr. ' +
		'Alvaro Lopez</a>. Para Consultas - $25</p>' +
		'<p class="ContenidoInside">&nbsp;</p>' +
		'</td></tr></table>' +
		'</div>';
}


function getCode2(){
return '<DIV id=theLayer style="LEFT: 325px; VISIBILITY: hidden; WIDTH: 321px; POSITION: absolute; TOP: 200px; z-index:1">' 
    + '<table border="0" cellpadding="0" cellspacing="0" width="321" align="center"><tr>'
	+ '<td id="titleBar" style="cursor:move "><ILAYER onselectstart="return false width="100%"><LAYER onmouseover="isHot=true;if (isN4) ddN4(theLayer)" onmouseout=isHot=false width="100%"><img src="../img/popup/popup-winfrm_a.gif" width="286" height="30" border="0" alt="" /></td>'
	+ '<td><a href="#" onclick="hideMe();return false"><img src="../img/popup/popup-winfrm_b.gif" width="35" height="30" border="0" alt="" /></a></td>'
	+ '</tr><tr>'
	+ '<td colspan="2"><a href="http://www.red54.org/grupo/viewforum.php?f=18"><img src="../img/popup/popup-bolsalay_b.gif" width="321" height="159" border="0" alt="" /></a></td>'
	+ '</tr><tr>'
	+ '<td colspan="2"><a href="http://www.red54.org/grupo/viewforum.php?f=18"><img name="popupbolsalay_c" src="../img/popup/popup-bolsalay_c.jpg" width="321" height="110" border="0" alt="" /></a></td>'
	+ '</tr><tr>'
	+ '<td colspan="2"><a href="http://www.red54.org/grupo/viewforum.php?f=18"><img name="popupbolsalay_d" src="../img/popup/popup-bolsalay_d.jpg" width="321" height="82" border="0" alt="" /></a></td>'
+ '</tr></table></div>';
		
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");
