// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// get width/height

var myWidth = 0
var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }



// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}

  return true
}



  function showsub(x,y,i){
    var sp=document.getElementById('popup');
    sp.style.display="none";

    x=tempX;
    y=tempY;

    var sii=document.getElementById('image');
    sii.src=i;

    //while(si.complete==false){}
    wait(2000);

    var si=document.getElementById('image');

    sw=si.width;
    sh=si.height;

    if (sw<100){sw=800;}
    if (sh<100){sh=800;}

    sp.style.display="";

    txl=x-(sw/2);
    tyt=y-(sh/2);
    txr=x+(sw/2);
    tyb=y+(sh/2);

    //alert("txl="+txl+" txr="+txr+"\ntyt="+tyt+" tyb="+tyb+"\nmyWidth="+myWidth+" myHeight="+myHeight);

    myHeight=document.body.Height;

    if (txr>myWidth){txl=myWidth-sw;}
    if (tyb>myHeight){tyt=myHeight-sh;}
    if (txl<1){txl=1;}
    if (tyt<1){tyt=1;}

    sp.style.left= txl;
    sp.style.top= tyt;

    sp.style.zIndex=100;

    //var fl=document.getElementById('flash');
    //fl.style.visibility="hidden";
    //fl.style.zIndex=1;
    //window.alert("mx"+x+" my"+y+" - "+txl+","+tyt+"\nmyWidth="+myWidth+" myHeight="+myHeight);

  }


  function hidepopup(){
    var s=document.getElementById('popup');
    s.style.display="none";
  //  var fl=document.getElementById('flash');
  //  fl.style.visibility="";

  }

function wait(msecs)
{
var start = new Date().getTime();
var cur = start
while(cur - start < msecs)
{
cur = new Date().getTime();
}
}

