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"><a href="http://betterlooks.co.cr/app/reqinfo.php?affid=57"><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="http://www.betterlooks.co.cr/mesotherapy-cellulite.htm">Mesotherapy Treatment</a></strong>' +
		' for as low <strong> <font color="#CC3300">$27 USD per session (package of 4 sessions)</font></strong> with our <a href="http://betterlooks.co.cr/app/reqinfo.php?affid=57">Clinic ' +
		'Dr. Francisco Garcia </a>. Consultation Fee - $20</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>' +
		' Breast Augmentation</strong> (Implants) for just<strong> <font color="#CC3300">$3.400 USD</font></strong> with our board certifitied surgeon <a href="http://betterlooks.co.cr/app/reqinfo.php?affid=32">Dr. ' +
		'Gustavo Chavarria Leon</a>. Consultation Fee - $50</p>' +
		
		'<p class="ContenidoInside"><a href="http://betterlooks.co.cr/app/reqinfo.php?affid=83"><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="http://www.betterlooks.co.cr/dental-whitening.htm">ZOOM Teeth Whitening</a></strong>' +
		' Laser Treatment for as low <strong> <font color="#CC3300">$500 USD 2 X 1 </font></strong> ' +
		' with our board certifitied dentist <a href="http://betterlooks.co.cr/app/reqinfo.php?affid=83">Dr. ' +
		' Fabian Lopez</a>. Consultation Fee - FREE</p>' +
		' <p class="ContenidoInside"><a href="http://www.betterlooks.co.cr/surgery-promotions.html">BETTERLOOKS PROMOTION</a></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");
