/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


    function ajaxReq(div,params,actionPage) {
        var url = actionPage;
        var ajax = new Ajax.Updater
        (
            {success: div},
            url,{method: 'post', parameters: params}
        );
    }

    function ajaxReq2(div,params,actionPage)
    {
        var url = actionPage;
        var divMsg = div;
        var ajax = new Ajax.Updater({success: div}, url,{

                    onLoading: function(transport) {
                        $(divMsg).className="loading_visible";
                    },
                    onComplete: function(transport) {
                        $(divMsg).className="loading_invisible";
                    },
                    method: 'post',
                    parameters: params
                }
        );
    }

function updateTheDivs(id,idCat)
{
    if($("addCraftAsItem").checked)
    {
        ajaxReq('itemCats','id='+id,'/home/ajax/craft2itemCats');

        if(id > 0)
        {
            ajaxReq('itemsSubCats','cat='+id+'&id='+idCat,'/home/ajax/craft2itemSubCats');
        }
    }
    else
    {
        ajaxReq('itemCats','halt=1','/home/ajax/craft2itemCats');
        ajaxReq('itemsSubCats','halt=1','/home/ajax/craft2itemSubCats');
    }
}

function changeView(id)
{
    $(id).toggle();
}

function ashow(id)
{
    document.getElementById(id).style.display='block'
}

function ahide(id) {
    document.getElementById(id).style.display='none'
}

function turnOn(id)
{
    $(id).setStyle({'background': '#dedede'});
}

function turnOff(id)
{
    $(id).setStyle({'background': 'none'});
}