/* (c) 2003 krcmarik (www.avocado.cz) */

var x, y;
window.onload = init;

function init() {
  if (window.Event) {
    document.captureEvents(Event.MOUSEMOVE);
  }
  moveRunning = false;
  document.onmousemove = picZoomXY;
}

var moveRunning;
var xa = new Array (0, 83, 167, 262);
var ya = new Array (0, 62, 125, 188);

function picZoomXY(e) 
{
    if (moveRunning)
    {
	window.status = "zoom running";
	return;
    }
    
    moveRunning = true;
    x = (window.Event) ? e.pageX : event.clientX;
    y = (window.Event) ? e.pageY : event.clientY;

/*    window.status = "x="+x+" y="+y; */

    if (x > 262 || y > 188)
    {
	picZoomDiv (0);
	moveRunning = false;
	return;
    }
/*    alert ("x="+x+", y="+y);*/


    xs = 0;
    for (i=0; i<3; i++)
    {
/*	alert ("i="+i+", x="+x+" ,xa[i]="+xa[i]+", xa[i+1]="+xa[i+1]);*/
	if ((xa[i] < x) && (xa[i+1] >= x))
	{
	    xs = i+1;
	    break;
	}
    }

    ys = 0;
    for (i=0; i<3; i++)
    {
/*	alert ("i="+i+", y="+y+", ya[i]="+ya[i]+", ya[i+1]="+ya[i+1]);*/
	if ((ya[i] < y) && (ya[i+1] >= y))
	{
	    ys = i+1;
	    break;
	}
    }

/*    alert ("x="+x+", y="+y+" - xs="+xs+", ys="+ys);*/
    pic = 3 * (ys - 1) + xs;
    picZoomDiv (pic);
    moveRunning = false;
}


function getObj(name)
{
    if (document.getElementById)
        return document.getElementById(name)

    else if (document.all)
        return document.all[name];

    else if (document.layers)
        return document.layers[name];

    else
        return (0);
}


function picZoomDiv (num)
{
    for (i=1; i<=9; i++)
    {
	obj = getObj ("pic"+i);
	if (i == num)
    	    obj.style.visibility = "visible";
	else
    	    obj.style.visibility = "hidden";
    }
    return (true);
}

function picHide (num)
{
    obj = getObj ("pic"+num);
    obj.style.visibility = "hidden";
    return (true);
}

function picHideAll ()
{
    for (i=1; i<=9; i++)
    {
	obj = getObj ("pic"+i);
	obj.style.visibility = "hidden";
    }
}


