var imgSrc  = 'http://www.best-family-photography-tips.com/images/400_sample_poses.jpg';
var imgHref = 'http://www.best-family-photography-tips.com/photography-poses.html';
var imgText = 'Click to close&nbsp;&nbsp;';
var divWidth = 360; 
var divHeight = 565;  /* Picture plus something for the [X] */
var secsOnScreen = 40; // how long to show 
var secsBeforeShow = 5; // how long wait before showing
var slidingDiv=null;
var stopPosition = 500; // default - will be calculated

document.write('<style>#slideDiv { position: absolute; display:none; z-index: 10; text-align: center; border: 1px solid black; padding:0; margin:0; color: white; width:'+divWidth+'px; height:'+divHeight+'px;}</style>'); 
var tId1="";
var tId2="";

function getTop() {
if (document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop;
// IE6 +4.01 and user has scrolled
else if (document.body && document.body.scrollTop) return document.body.scrollTop;
// IE5 or DTD 3.2
}
var initialPos = 0;
function slideIt() { 
  if (parseInt(slidingDiv.style.left) <= stopPosition ) {
    tId2=setTimeout("hide()",1000*secsOnScreen)
    return; 
  } 
  slidingDiv.style.top=(initialPos+getTop())+'px'
//  document.getElementById('xxyy').innerHTML=getTop()+'/'+initialPos; debugging

  slidingDiv.style.left = (parseInt(slidingDiv.style.left) - 2) + "px";
  tId1=setTimeout("slideIt()", 10); 
}
var saveonload = window.onload;
window.onload=function() {
  slidingDiv = document.getElementById("slideDiv");  
  stopPosition = (document.body.clientWidth-divWidth)/2; // half through the page
  slidingDiv.style.left = document.body.clientWidth+"px"; // outside the page
  var clientHeight = 600; // default
  if (document.documentElement && !document.documentElement.scrollTop) clientHeight = document.documentElement.clientHeight;
  else if (document.body && document.body.clientHeight) clientHeight = document.body.clientHeight
  initialPos = ((clientHeight-divHeight)/2);
  if (initialPos==0) initialPos=divHeight/2
  slidingDiv.style.top = initialPos+"px"
  slidingDiv.style.display='block';
  tid2=setTimeout("slideIt()",secsBeforeShow*1000);
  saveonload();
  window.onscroll=function() {
  	var pos = (initialPos+getTop());
  	slidingDiv.style.top=pos+'px'
  }
}
function hide() {
  clearTimeout(tId1);
  slidingDiv.style.display="none";
} 
document.write('<div style="display: none;" id="slideDiv" onclick="hide()"><div id="xxyy" style="background-color: darkblue; width: '+divWidth+'px; text-align: right;">'+imgText+'</div><a href="'+imgHref+'" target="_blank"><img src="'+imgSrc+'" border="0"></a></div>')

