function IMG_onclick(x) 
{
  	document.getElementById("picture").src = document.getElementById(x).src;
}
function setRandomimg ()
{
	var r= Math.floor(Math.random() * 17);
	if (r>9)
		x="img" + r;
		else x="img0" + r;
		IMG_onclick(x) 
}

// Determine browser and version.
function Browser()
{
  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0)
  {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0)
  {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0)
  {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Temporary variables to hold mouse x-y pos.s

var tempX = 0;
var tempY = 0;

function showimagex(e)
{
    var targ;
    if (!e)
    {
        var e=window.event;
    }
	if (e.target)
	{
	    targ=e.target;
	}
	else if (e.srcElement)
	{
	    targ=e.srcElement;
	}
	if (targ.nodeType==3) // defeat Safari bug
	{
	    targ = targ.parentNode;
	}
	var tname, tid;
	tname=targ.tagName;
	tid = targ.id;

  if (browser.isIE)
  { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.documentElement.scrollLeft;
    tempY = event.clientY + document.documentElement.scrollTop;
  }
  if (browser.isNS)
  {  // 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;



    if (tempX < 0){tempX = 0;}
    if (tempY < 0){tempY = 0;}  
	
	if ((tname.toLowerCase() =="img")&&(tid != "picture" ))
		refresh_hint(tname, tid, tempX, tempY);
	else {document.getElementById('hintdiv').style.display = 'none';}
}
