var eventCount = 0;

function writeExpandable(url, normalWidth, normalHeight, expandWidth, expandHeight, cssposition){
  document.write("<div id='cxtadvert' style='position:relative;width:"+normalWidth+"px; height:"+normalHeight+"px; z-index:500'>");
  document.write("<div  style='position:absolute; "+cssposition+" z-index:510'>");
  document.write("  <iframe src='"+url+"' width='"+normalWidth+"' height='"+normalHeight+"' scrolling='no' frameborder='0' style='border-width:0' onMouseOver='delayedExpand(this,"+expandWidth+","+expandHeight+");' onMouseOut='delayedShrink(this,"+normalWidth+","+normalHeight+");'></iframe>");
  document.write("</div>");
  document.write("</div>");
  
  myAdvertParent = document.getElementById("cxtadvert").parentNode;
  if (myAdvertParent != null){
    myAdvertParent.style.overflow = "visible";
    myAdvertParent.style.zIndex = "100";
  }
}


function delayedExpand(anIframe, expandedWidth, expandedHeight){
  theIframe = anIframe;
  eventCount++;
  setTimeout("expandIframe("+eventCount+","+expandedWidth+","+expandedHeight+")",500);
}

function delayedShrink(anIframe, normalWidth, normalHeight){
  theIframe = anIframe;
  eventCount++;
  setTimeout("shrinkIframe("+eventCount+","+normalWidth+","+normalHeight+")", 500);
}

function expandIframe(currEventCount, expandedWidth, expandedHeight){
  if (eventCount == currEventCount){
	theIframe.width = expandedWidth;
  	theIframe.height = expandedHeight;
  }
}

function shrinkIframe(currEventCount, normalWidth, normalHeight){
  if (eventCount == currEventCount){
	theIframe.width = normalWidth;
  	theIframe.height = normalHeight;
  }
}