var selected = null;
var showing = null;
var categories = new Array();
var interval = null;
var iData = "0";

function rollcategory(cat,roll)
{
    if(selected != cat)
    {
        if(0 == roll)
        {
            document.getElementById("left" + cat).style.backgroundColor = "#8B827E";
            document.getElementById("right" + cat).style.backgroundColor = "#8B827E";
            document.getElementById("top" + cat).style.backgroundColor = "#8B827E";
            document.getElementById("bottom" + cat).style.backgroundColor = "#8B827E";
            document.getElementById("category" + cat).style.backgroundColor = "#8B827E";
            //document.getElementById("category" + cat).style.color = "#ffffff";
        }
        else if(1 == roll)
        {
            document.getElementById("left" + cat).style.backgroundColor = "#BCB6B2";
            document.getElementById("right" + cat).style.backgroundColor = "#BCB6B2";
            document.getElementById("top" + cat).style.backgroundColor = "#BCB6B2";
            document.getElementById("bottom" + cat).style.backgroundColor = "#BCB6B2";
            document.getElementById("category" + cat).style.backgroundColor = "#BCB6B2";
            //document.getElementById("category" + cat).style.color = "#A1816C";
        }
    }
}
function showcoffee(cat)
{
    if(selected != cat)
    {
        
        selected = cat;
    }
}
function getcategory()
{
    var query = "";
    serverCallBack(query);
    interval = setTimeout("setcategory()", 100);
}
function setcategory()
{
    if("0" != iData)
    {
        clearInterval(interval);
        
        iData = "0";
    }
}
function serverCallBack(query)
{
    // for non-IE browsers
    if(window.XMLHttpRequest)
    {
        http_req = new XMLHttpRequest();
    }
    // IE
    else if(window.ActiveXObject)
    {
        try
        {
	        http_req = new ActiveXObject("Msxml12.XMLHTTP");
        }
        catch(e)
        {
	        try
	        {
		        http_req = new ActiveXObject("Microsoft.XMLHTTP");
	        }
	        catch(e)
	        {
	        }
        }
    }
    // verify the request variable is set
    if(!http_req)
    {
        return false;
    }
    else
    {
        // continue processing
        http_req.onreadystatechange = function()
        {
	        if(http_req.readyState == 4)
	        {
		        if(http_req.status == 200)
		        {
			        iData = http_req.responseText;	
		        }
		        else
		        {
			        return false;
		        }
	        }
        }
        http_req.open('GET', query, true);
        http_req.send(null);
    }	
}
