if ($dostup_clan == 2) {
             $str_query = "SELECT DISTINCT game_items_factsheet.type FROM game_items,game_items_factsheet where game_items.user_id={$user_id} and game_items.priznak=1 and game_items.town='{$town}' and game_items_factsheet.type<=97 and game_items.sell_time>'{$time_for_check}' AND game_items.post_to=0 AND game_items.item_id = game_items_factsheet.id and game_items_factsheet.type=" . $Item->fact['type'] . "";
         } else {
             $str_query = "SELECT DISTINCT game_items_factsheet.type FROM game_items,game_items_factsheet where game_items.priznak=1 and game_items.town='{$town}' and game_items_factsheet.type<=97 and game_items.sell_time>'{$time_for_check}' AND game_items.post_to=0 AND game_items.item_id = game_items_factsheet.id and game_items_factsheet.type=" . $Item->fact['type'] . "";
         }
         $test = myquery($str_query);
         if (mysql_num_rows($test) > 0) {
             echo '<meta http-equiv="refresh" content="1;url=town.php?option=' . $option . '&do=viewtype&type=' . $Item->fact['type'] . '">';
         } else {
             echo '<meta http-equiv="refresh" content="1;url=town.php?option=' . $option . '">';
         }
         break;
     case 'purchase_res':
         $it = (int) $_GET['it'];
         $Res = new Res();
         $Res->buy_market(0, $it, $dostup_clan);
         echo $Res->message;
         if ($dostup_clan == 2) {
             $sct = "select * from craft_resource_market where priznak=0 AND town='{$town}' and user_id={$user_id}";
         } else {
             $sct = "select * from craft_resource_market where priznak=0 AND town='{$town}'";
         }
         $test = myquery($sct);
         if (mysql_num_rows($test) > 0) {
             $url = '<meta http-equiv="refresh" content="1;url=town.php?option=' . $option . '&do=res">';
         } else {
             $url = '<meta http-equiv="refresh" content="1;url=town.php?option=' . $option . '">';
         }
         echo $url;
         break;
 }