var cur_cat=null;
var timeoutid_cat=null;
var cat=null;
var ivalue = 0;
var selector = null;
var oclr = null;
var dclr = null;

function mouseoncat(tmp, clr1, clr2)
{
	cat = tmp;
	oclr = clr1;
	dclr = clr2;
	timeoutid_cat = setTimeout("selcat()", 800);
}
function selcat()
{
    var index = 0;
    index = cat.id.substr(cat.id.indexOf('_') + 1);
    if (cur_cat != null)
    {
       cur_index = cur_cat.id.substr(cur_cat.id.indexOf('_') + 1);
       cur_product = document.getElementById("lists_" + cur_index.toString());
       cur_img = document.getElementById("img_" + cur_index.toString());
    }

	clearTimeout(timeoutid_cat);

    product = document.getElementById("lists_" + index.toString());
    img = document.getElementById("img_" + index.toString());
    
    if (product == null) return;

    if (cur_cat != null)
	{
       cat.style.backgroundColor = dclr;;
       product.style.display = "block";
       img.src = "/images/sub.jpg";    
       cur_product.style.display = "none";
       cur_cat.style.backgroundColor = oclr;
       cur_img.src = "/images/add.jpg";    
	}
    else
    {
       cat.style.backgroundColor = dclr;
       product.style.display = "block";
       img.src = "/images/sub.jpg";    
    }

    if (cur_cat == cat)
        cur_cat = null
    else
        cur_cat = cat;
}
