// Falling Objects Generator created by your friends at glitter-graphics.com
//
// Please don't rip this script (it's copyrighted), but if you do
// then don't forget to add a link to our site!

var highlighted_icon_label;
var selected_icon_label;

function update_graphicID(graphicID)
{
    var ob = document.getElementById("graphicID");
    ob.value = graphicID;

    clear_other_fields("graphicID");

    label = "gr" + graphicID;
    set_selected_icon_label(label);
}

function clear_other_fields(except)
{
    if(except != "own_code")
    {
        var ob = document.getElementById("own_code");
        ob.value = "";
    }

    if(except != "graphicID")
    {
        var ob = document.getElementById("graphicID");
        ob.value = "";
    }

    if(except != "html_symbol")
    {
        var ob = document.getElementById("html_symbol");
        ob.selectedIndex = 0;
    }

    remove_existing_highlight();
    if(selected_icon_label)
    {
        var ob = document.getElementById(selected_icon_label);
        ob.style.backgroundColor = "";
    }
}

function set_selected_icon_label(label)
{
    if(selected_icon_label && selected_icon_label != label)
    {
        var ob = document.getElementById(selected_icon_label);
        ob.style.backgroundColor = "";
    }

    var ob = document.getElementById(label);
    ob.style.backgroundColor = "#ffffff";

    selected_icon_label = label;
}

function remove_existing_highlight()
{
    if(highlighted_icon_label && highlighted_icon_label != selected_icon_label)
    {
        var ob = document.getElementById(highlighted_icon_label);
        ob.style.backgroundColor = "";
        highlighted_icon_label = 0;
    }
}

function highlight_icon(label)
{
    remove_existing_highlight();

    if(label != selected_icon_label)
    {
        var ob = document.getElementById(label);
        ob.style.backgroundColor = "#eceffb";
    }

    highlighted_icon_label = label;
}
