﻿function ClearUserQuery(url)
{
    var userQuery = document.getElementById("userquery");
    if(userQuery != null)
    {
        userQuery.value = '';
    }
    return true;
}

function SwitchFloatingBox(imageid, contentid)
{
    var floatingObj = document.getElementById(contentid);    
    if (floatingObj)
    {
        var imageObj = document.getElementById(imageid);
        if (imageObj && imageObj.className == "FloatingBoxShowContent_on")
        {
            slide(contentid, -1);
            if (imageObj) imageObj.className = "FloatingBoxShowContent_off";
        }
        else
        {
            slide(contentid, 1);
            if (imageObj) imageObj.className = "FloatingBoxShowContent_on";
        }
    }
}

var speed = 40;	// Higher value = faster
var timer = 5;	// Lower value = faster
var x=1;
function slide(id, dir) 
{
    var maxsize = 480;
    if (typeof (MAXSIZE_CAT_DROPDOWN) != "undefined")
    {
        maxsize = MAXSIZE_CAT_DROPDOWN;
    }
    
    var contentObj = document.getElementById(id);
    contentObj.style.display = "block"
    contentObj.style.height = x + 'px';
    contentObj.style.top = (x - maxsize) + 'px';
    if (dir == 1 && x > maxsize) 
    { 
        clearTimeout(t);
        return;
    }
    if (dir == -1 && x <= 1)
    {
        clearTimeout(t);
        contentObj.style.display = "none"
        return;
    }
    x = x + (dir * speed);
    t=setTimeout('slide(\"' + id + '\",' + dir + ')',timer); 
}
