function _FORM_ITEM_SHOP($SA, $RealmID, $DBUser, $DBPassword, $GUID, $ItemID, $MinPrice, $PriceX, $DisplayPrice, $ITEM_DISCOUNT_MODE, $DISCOUNT_CONF, $REALSON = "")
{
    global $L, $AccountDBHost, $AccountDB, $PageListRecordsAmmount;
    echo "\n        <fieldset>\n            <div class = 'text-center'>" . $REALSON . "\n                <h2>" . $L[82] . "</h2>";
    _FORM_CHAR_BLOCK($SA, null, true);
    echo "</fieldset>";
    $connection = _MySQLConnect(_HostDBSwitch($RealmID), $DBUser, $DBPassword, _WorldDBSwitch($RealmID));
    // -----------------------------------------------------------------
    if (isset($ItemID)) {
        $query = mysql_query("\n                SELECT\n                  `entry` AS `id`,\n                  `class`,\n                  `subclass`,\n                  `ItemLevel`,\n                  `RequiredLevel`,\n                  `Quality`,\n                  `name`\n                FROM `item_template`\n            WHERE `entry` = " . $ItemID . ";", $connection) or die(mysql_error());
        $QueryResult = mysql_fetch_array($query);
        if (!empty($QueryResult['id'])) {
            $PRICE = _CalculatePrise($QueryResult, $MinPrice, $PriceX);
            $DISCOUNT = null;
            if ($PRICE > 1 && $ITEM_DISCOUNT_MODE) {
                $DISCOUNT = round($PRICE - $PRICE * $DISCOUNT_CONF);
            }
            $_SESSION['TCA']['SItemPrice'] = isset($DISCOUNT) ? $DISCOUNT : $PRICE;
            $_SESSION['TCA']['SItemName'] = $QueryResult['name'];
            echo "\n                <fieldset class = 'text-center'>\n                <div style = 'width: 800px;' class = 'alert service alert-success'>\n                    <div class = 'service_icon'></div>\n                    <h4><a href = 'http://old.wowhead.com/item=" . $QueryResult['id'] . "' target = '_blank'></a></h4>\n                    <div class = 'service_desc'>" . _PRICE_STR($PRICE, true, isset($DISCOUNT) && $PRICE > $DISCOUNT ? $DISCOUNT : null) . "</div>\n                </div>\n                </fieldset></br>";
        }
    }
    // -----------------------------------------------------------------
    $ITEM_CLASS = _refleshSessionValue(isset($_SESSION['TCA']['ItemClass']) ? $_SESSION['TCA']['ItemClass'] : null, isset($_GET['C']) ? (int) $_GET['C'] : null, 2);
    if (!isset($_SESSION['TCA']['ItemClass']) || $_SESSION['TCA']['ItemClass'] != $ITEM_CLASS) {
        unset($_GET['page']);
        unset($_SESSION['TCA']['P']);
    }
    $_SESSION['TCA']['ItemClass'] = $ITEM_CLASS;
    $PAGE_INDEX = _refleshSessionValue(isset($_SESSION['TCA']['P']) ? $_SESSION['TCA']['P'] : null, isset($_GET['page']) ? (int) $_GET['page'] : null, 1);
    $PAGE_INDEX = $PAGE_INDEX < 1 ? 1 : $PAGE_INDEX;
    $_SESSION['TCA']['P'] = $PAGE_INDEX;
    if (isset($ITEM_CLASS) && $ITEM_CLASS === 7) {
        $ITEM_CLASS_Q_STR = isset($ITEM_CLASS) ? "WHERE `class` IN (5, 6, 7) ORDER BY `class`,`itemlevel`" : null;
    } else {
        $ITEM_CLASS_Q_STR = isset($ITEM_CLASS) ? "WHERE `class` = " . $ITEM_CLASS . " ORDER BY `itemlevel`" : null;
    }
    $query = mysql_query("\n            SELECT\n              `entry` AS `id`,\n              `class`,\n              `subclass`,\n              `ItemLevel`,\n              `RequiredLevel`,\n              `Quality`,\n              `name`\n            FROM `item_template` " . $ITEM_CLASS_Q_STR . "\n        DESC LIMIT " . ($PAGE_INDEX * $PageListRecordsAmmount - $PageListRecordsAmmount) . ", " . $PageListRecordsAmmount . ";", $connection) or die(mysql_error());
    mysql_close($connection);
    echo "\n            <fieldset class = 'text-center'>\n            <form action = " . $_SERVER['PHP_SELF'] . " method = 'POST'>\n            <div class = 'clearfix'>";
    if (isset($ItemID)) {
        echo "     \n                <input name = 'itemID' type = 'text' placeholder = '" . $L[19] . "'>\n            </div>\n            <p>\n                <button class = 'btn btn-primary' type = 'submit'>" . _getPriceButtonSTR(11) . "</button>\n            </p>\n            <input type = 'hidden' name = 'isItemSame' value = '" . $ItemID . "'/>";
    } else {
        echo "\n                <input name = 'itemID' type = 'text' placeholder = '" . $L[49] . "'>\n            </div>\n            <p>\n                <button class = 'btn btn-primary' type = 'submit'>" . $L[48] . "</button>\n            </p>";
    }
    echo "\n            </form>\n            </fieldset>\n            <ul class = 'nav nav-tabs'>\n                <li" . _getBISelector(2, $ITEM_CLASS) . "><a href = '?C=2'>" . $L[282] . "</a></li> <!-- Weapon -->\n                <li" . _getBISelector(4, $ITEM_CLASS) . "><a href = '?C=4'>" . $L[284] . "</a></li> <!-- Armor -->\n                <li" . _getBISelector(16, $ITEM_CLASS) . "><a href = '?C=16'>" . $L[296] . "</a></li> <!-- Glyph -->\n                <li" . _getBISelector(3, $ITEM_CLASS) . "><a href = '?C=3'>" . $L[283] . "</a></li> <!-- Gem -->\n                <li" . _getBISelector(9, $ITEM_CLASS) . "><a href = '?C=9'>" . $L[289] . "</a></li> <!-- Recipe -->\n\n                <li" . _getBISelector(0, $ITEM_CLASS) . "><a href = '?C=0'>" . $L[280] . "</a></li> <!-- Consumable -->\n                <li" . _getBISelector(1, $ITEM_CLASS) . "><a href = '?C=1'>" . $L[281] . "</a></li> <!-- Container --> \n                <li" . _getBISelector(7, $ITEM_CLASS, "title = '" . $L[285] . ", " . $L[286] . ", " . $L[287] . "' ") . "><a href = '?C=7'>" . $L[287] . "</a></li> <!-- Trade Goods -->\n                <li" . _getBISelector(12, $ITEM_CLASS) . "><a href = '?C=12'>" . $L[292] . "</a></li> <!-- Quest -->\n                <li" . _getBISelector(13, $ITEM_CLASS) . "><a href = '?C=13'>" . $L[293] . "</a></li> <!-- Key -->\n                <li" . _getBISelector(15, $ITEM_CLASS) . "><a href = '?C=15'>" . $L[295] . "</a></li> <!-- Miscellaneous -->\n            </ul>\n            " . _pushPageNav($PAGE_INDEX) . "\n            <table class = 'table table-condensed'>\n                <tr class = 'menuBar'>\n                    <td>" . $L[275] . "</td>\n                    <td>" . $L[64] . "</td>\n                    <td></td>\n                </tr>";
    while ($QueryResult = mysql_fetch_array($query)) {
        $PRICE = _CalculatePrise($QueryResult, $MinPrice, $PriceX);
        $DISCOUNT = null;
        if ($PRICE > 1 && $ITEM_DISCOUNT_MODE) {
            $DISCOUNT = round($PRICE - $PRICE * 0.1);
        }
        $class = isset($DISCOUNT) && $PRICE > $DISCOUNT ? "success" : "info";
        echo "\n                <tr class = '" . $class . "'>\n                <td><a href = 'http://" . _getWHLanguage() . "wowhead.com/item=" . $QueryResult['id'] . "' target = '_blank'></a></td>";
        if (isset($DISCOUNT) && $PRICE > $DISCOUNT) {
            echo "<td>" . _PRICE_STR($PRICE, true, $DISCOUNT) . "</td>";
        } else {
            echo "\n                <td>" . _PRICE_STR($PRICE, true) . "</td>";
        }
        echo "<td><a href = '" . _AddGETAtributeToURL("itemID", $QueryResult['id']) . "'>" . $L[299] . "</a></td>\n            </tr>";
    }
    echo "\n            </table>" . _pushPageNav($PAGE_INDEX);
}
function _AH_FORM($connection, $ADMIN_MODE = false)
{
    global $L;
    $RealmID = isset($_GET['R']) ? (int) $_GET['R'] : null;
    $PostQuery = isset($_POST['U']) ? trim($_POST['U']) : null;
    if (isset($PostQuery)) {
        $PostQuery = !empty($PostQuery) ? $PostQuery : null;
    }
    $Done = null;
    $H = $ADMIN_MODE ? $L[221] : $L[95];
    $Q_STR = "SELECT DATE(`whenItDone`),`action`,`text`,`realmName`,`charName`,`myth_coins_spend`,`myth_coins_balance`,`IP`\n                                    FROM `account_billing_history` ";
    _getRealmArray($connection);
    echo "\n            <div class = 'text-center'>\n                <h2>" . $H . "</h2>";
    if ($ADMIN_MODE) {
        if (isset($PostQuery) && isset($_SESSION['R']['Username']) && $PostQuery === $_SESSION['R']['Username']) {
            $Done = true;
        } else {
            if (!isset($PostQuery) && isset($_SESSION['R']['Username'])) {
                $Done = true;
            } else {
                $_SESSION['R']['Username'] = isset($PostQuery) ? $PostQuery : null;
            }
        }
        if (!isset($Done) && isset($_SESSION['R']['Username'])) {
            $_SESSION['R']['ID'] = _lookForAccount($connection, $_SESSION['R']['Username']);
        }
        $PLACEHOLDER = isset($_SESSION['R']['ID']) ? $_SESSION['R']['Username'] : $L[219];
        if (isset($_SESSION['R']['ID'])) {
            $InfoAccountQuery = mysql_query("SELECT\n                `t2`.`myth_coins`,`t1`.`id`,`t1`.`email`,`t1`.`last_ip`,DATE(`t1`.`joindate`) AS `joindate`,DATE(`t1`.`last_login`) AS `last_login`\n                FROM `account` `t1` LEFT JOIN `account_details` `t2` ON `t1`.`id` = `t2`.`id` WHERE `t1`.`id` = " . $_SESSION['R']['ID'] . ";", $connection) or die(mysql_error());
            $InfoAccountResult = mysql_fetch_array($InfoAccountQuery);
            echo "\n                <div class = 'modal hide' id = 'ModifyFirePoints'>\n                    <div class = 'modal-header'>\n                        <button type = 'button' class = 'close' data-dismiss = 'modal'>×</button>\n                        <h3>" . $_SESSION['R']['Username'] . "</h3>\n                    </div>\n                    <form action = " . $_SERVER['PHP_SELF'] . " method = 'POST'>\n                        <div class = 'modal-body'>\n                        <p class = 'text-center'>" . $L[253] . "</p>\n                            <input name = 'HowMuch' type = 'text' size = '60' placeholder = '" . $L[255] . "'>\n                            <input name = 'HowMuchReason' type = 'text' size = '100' placeholder = '" . $L[256] . "'>\n                        </div>\n                        <div class = 'modal-footer'>\n                            <a href = '#' class = 'btn' data-dismiss = 'modal'>" . $L[254] . "</a>\n                            <input class = 'btn' type = 'submit' value = '" . $L[146] . "' />\n                        </div>\n                    </form>\n                </div>\n                <div class = 'modal hide' id = 'AccountInfo'>\n                    <div class = 'modal-header'>\n                        <button type = 'button' class = 'close' data-dismiss = 'modal'>×</button>\n                        <h3>" . $_SESSION['R']['Username'] . "</h3>\n                    </div>\n                    <div class = 'modal-body'>\n                        <table class = 'table table-hover'>\n                            <tr class = 'menuBar'>\n                                <td>#</td>\n                                <td>" . $_SESSION['R']['ID'] . "</td>\n                            </tr><tr>\n                                <td>" . $L[271] . "</td>\n                                <td>" . $InfoAccountResult['email'] . "</td>\n                            </tr><tr>\n                                <td>" . $L[272] . "</td>\n                                <td>" . $InfoAccountResult['joindate'] . "</td>\n                            </tr><tr>\n                                <td>" . $L[273] . "</td>\n                                <td>" . $InfoAccountResult['last_login'] . "</td>\n                            </tr><tr>\n                                <td>" . $L[274] . "</td>\n                                <td>" . $InfoAccountResult['last_ip'] . "</td>\n                            </tr>\n                            </tr><tr>\n                                <td><i class = 'icon-fire'></i></td>\n                                <td>" . $InfoAccountResult['myth_coins'] . "</td>\n                            </tr>\n                        </table>\n                    </div>\n                </div>\n                <script>\n                \$('ModifyFirePoints').click(function() {\n                    \$('#ModifyFirePoints').modal('toggle');\n                })\n                \$('AccountInfo').click(function() {\n                    \$('#AccountInfo').modal('toggle');\n                })\n                </script>";
        }
        $D = !isset($_SESSION['R']['Username']) ? "disabled = 'disabled'" : "";
        echo "\n            <form action = " . $_SERVER['PHP_SELF'] . " method = 'POST'>\n                <input name = 'U' type = 'text' size = '60' placeholder = '" . $PLACEHOLDER . "'>\n                <input class = 'btn btn-info BillingB' type = 'submit' value = '" . $L[220] . "' />\n                <a href = '?CL'><input class = 'btn btn-inverse BillingB' " . $D . " value = '" . $L[251] . "'/></a>\n                <a class = 'btn BillingB' data-toggle = 'modal' href = '#ModifyFirePoints' " . $D . ">" . $L[252] . "<i class = 'icon-fire'></i></a>\n                <a class = 'btn BillingB' data-toggle = 'modal' href = '#AccountInfo' " . $D . ">" . $L[261] . "</a>\n            </form>";
        $STR_P1 = isset($_SESSION['R']['ID']) ? "`id` = " . (int) $_SESSION['R']['ID'] : "";
        $STR_P2 = _AH_REALMID(isset($RealmID) ? $RealmID : -1);
        if (!empty($STR_P1) || !empty($STR_P2)) {
            $Q_STR .= " WHERE ";
        }
        $Q_STR .= $STR_P1;
        if (!empty($STR_P1) && !empty($STR_P2)) {
            $Q_STR .= " AND ";
        }
        $Q_STR .= $STR_P2;
    } else {
        $Q_STR .= " WHERE `id` = " . (int) _getAccountID();
        if (isset($RealmID)) {
            $Q_STR .= " AND ";
        }
        $Q_STR .= _AH_REALMID(isset($RealmID) ? $RealmID : -1);
    }
    $Q_STR .= " ORDER BY `whenItDone` DESC;";
    echo "\n            </div>\n            <ul class = 'nav nav-tabs'>";
    echo !isset($RealmID) ? "<li class = 'active'>" : "<li>";
    echo "<a href = '?ALL'>" . $L[110] . "</a></li>";
    foreach ($_SESSION['R']['W'] as $ID => $NA) {
        echo $RealmID === (int) $ID ? "<li class = 'active'>" : "<li>";
        echo "<a href = '?R=" . $ID . "'>" . $NA['N'] . "</a></li>";
    }
    echo "</ul>";
    $query = mysql_query($Q_STR, $connection) or die(mysql_error());
    $row_num = mysql_num_rows($query);
    if ($row_num < 1) {
        echo _getAlreadyEffectSTR("<h2>" . $L[163] . "</h2>");
    } else {
        echo "\n            <fieldset>\n            <table class = 'table table-hover'>\n                <tr class = 'menuBar'>\n                    <td>" . $L[140] . "</td>\n                    <td>" . $L[141] . "</td>\n                    <td>" . $L[119] . "</td>\n                    <td>" . $L[142] . "</td>\n                    <td>" . $L[64] . "</td>\n                    <td>" . $L[260] . "</td>\n                    <td>" . $L[143] . "</td>\n                </tr>";
        while ($result = mysql_fetch_array($query)) {
            if ($result['action'] === 14 && _isset($result['text'])) {
                $STR = explode('_REPLACE_', $result['text']);
                $result['text'] = $STR[0] . _getWHLanguage() . $STR[1];
            }
            echo "<tr class = '" . _AH_TR_STR($result, $result['action']) . "'>\n                            <td>" . $result[0] . "</td>\n                            <td>" . _AH_STR($result['action'], !empty($result['text']) ? $result['text'] : "") . "</td>\n                            <td>" . $result['realmName'] . "</td>\n                            <td>" . $result['charName'] . "</td>\n                            <td>" . _AH_PRICE_STR($result['myth_coins_spend']) . "</td>\n                            <td>" . $result['myth_coins_balance'] . " <i class = 'icon-fire'></i></td>\n                            <td>" . $result['IP'] . "</td>\n                        </tr>";
        }
        echo "\n            </table>\n            </fieldset>";
    }
}