function iitems_giftstation_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "village":
            tlschema($args['schemas']['marketnav']);
            addnav($args['marketnav']);
            tlschema();
            addnav("Gifting Station", "runmodule.php?module=iitems_giftstation&op=start");
            break;
        case "iitems-superuser":
            output("`n`bIItems: Gifting Station`b`n");
            output("`bgiftable`b: Allows the item to be gifted from one player to another.`n");
            break;
        case "newday":
            require_once "modules/iitems/lib/lib.php";
            //transfer items from gift inventory to main inventory
            $inventory = iitems_get_player_inventory();
            $giftgiven = 0;
            $gifts = array();
            foreach ($inventory as $key => $details) {
                if ($details['inventorylocation'] == "giftstation") {
                    $giftgiven = 1;
                    iitems_transfer_item($key, "main");
                    $gifts[$details['verbosename']]++;
                }
            }
            if ($giftgiven) {
                output("`0`c`bSomething Awesome!`b`cYou wake up to find a shoebox-sized box by your feet.  Curious, and perhaps a little nervous - knowing that it could very well be full of spiders or something else awful - you open it.  Inside, you find:`n");
                foreach ($gifts as $giftname => $val) {
                    output("%s x %s`n", $giftname, $val);
                }
                output("How awesome!`n`n");
            }
            break;
        case "iitems_inventory_from":
            if (httpget('from') == "giftstation") {
                addnav("Return to the Gifting Station", "runmodule.php?module=iitems_giftstation");
            }
            break;
    }
    return $args;
}
function iitems_run()
{
    global $session;
    $op = httpget('op');
    $from = httpget('from');
    $key = httpget('key');
    $transferto = httpget('transferto');
    $invloc = httpget('invloc');
    page_header("Your Inventory");
    switch ($op) {
        case "superuser":
            require_once "modules/iitems/lib/superuser.php";
            iitems_superuser();
            break;
        case "useitem":
            iitems_use_item($key, false, $invloc);
            break;
        case "transferitem":
            iitems_transfer_item($key, $transferto);
            break;
        case "discarditem":
            iitems_discard_item($key);
            break;
    }
    modulehook("iitems-show-inventory");
    // iitems_show_inventory($from,"main");
    // if (get_module_setting("fightinventory")){
    // output_notl("`n`n");
    // iitems_show_inventory($from,"fight");
    // }
    iitems_show_inventory_new($from);
    switch ($from) {
        case "village":
            addnav("Return");
            addnav("Return to the Outpost", "village.php");
            break;
        case "forest":
            addnav("Return");
            addnav("Return to the Jungle", "forest.php");
            break;
        case "worldnav":
            addnav("Return");
            addnav("Return to the World Map", "runmodule.php?module=worldmapen&op=continue");
            break;
        case "lodge":
            addnav("Return");
            addnav("Return to the Hunter's Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
    }
    modulehook("iitems_inventory_from");
    page_footer();
    return true;
}