var mouse_x = 0;
var mouse_y = 0;
var timer;
var up = -1;

document.onmousemove = getMousePos;

function item_over(num) {
    clearTimeout(timer);
    var obj;
    if(num != -1) {
	var cnt = "<table cellspacing=\"10\" cellpadding=\"0\" width=\"100%\" border=\"0\"><tr>";
	for(var i = 0; i < images_list.length; i++)
	    if(images_list[i][0] == num)
		cnt += "<td width=\"1px\"><img src=\"" + images_list[i][1] + "\" height=\"150\"></td>";
	cnt += "</tr></table>";
	document.getElementById('item_info_div').innerHTML = cnt;
    }
    
    obj = document.getElementById('item_img_' + num);
    if(up != num) {
	if(up < 0)
	    pos = getElementPos(obj);
	show_item_info(pos.left, pos.top);
    }
    up = num;
}

function item_out() {
    timer = setTimeout('hide_item_info()',100);
}

function show_item_info(pos_x, pos_y) {
    obj = document.getElementById('item_info_div');

    obj.style.left = pos_x + 'px';
    obj.style.top = pos_y - obj.offsetHeight + 'px';
    obj.style.visibility = 'visible';
}

function hide_item_info() {
    document.getElementById('item_info_div').style.visibility = 'hidden';
    up = -1;
}

function getMousePos(e) {
    if (document.all) 
        e = event;
    mouse_x = e.clientX;
    mouse_y = e.clientY;
}

function getElementPos(obj) {
    var le = 0;
    var to = 0;
    
    //if(up == 0)
	if(obj.offsetParent)
	    do {
		le += obj.offsetLeft;
		to += obj.offsetTop;
	    } while(obj = obj.offsetParent);
	
    return {left:le, top:to};
}