function olc_expire_specials()
{
    $specials_query = olc_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
    if (olc_db_num_rows($specials_query)) {
        while ($specials = olc_db_fetch_array($specials_query)) {
            olc_set_specials_status($specials['specials_id'], '0');
        }
    }
}
$expires_date = $_POST['expires_date'];
$products_price_text = 'products_price';
$post_products_price_text = $_POST[$products_price_text];
$specials_price_text = 'specials_price';
$post_specials_price_text = $_POST[$specials_price_text];
//W. Kaiser - Use german date
if ($expires_date) {
    if (!(strpos($expires_date, DOT) === false)) {
        //Convert german date to american date
        $expires_date = substr($expires_date, 6, 4) . "-" . substr($expires_date, 3, 2) . "-" . substr($expires_date, 0, 2);
    }
}
$is_brutto = PRICE_IS_BRUTTO == TRUE_STRING_S;
switch ($action) {
    case 'setflag':
        olc_set_specials_status($_GET['id'], $_GET['flag']);
        break;
    case 'insert':
        // insert a product on special
        if (substr($post_specials_price_text, -1) == '%') {
            $new_special_insert_query = olc_db_query("select products_id,products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int) $_POST['products_id'] . APOS);
            $new_special_insert = olc_db_fetch_array($new_special_insert_query);
            $post_products_price_text = $new_special_insert[$products_price_text];
            $post_specials_price_text = $post_products_price_text - $post_specials_price_text / 100 * $post_products_price_text + 5000;
        } else {
            if ($is_brutto) {
                $sql = "select tr.tax_rate from " . TABLE_TAX_RATES . " tr, " . TABLE_PRODUCTS . " p\n\t\t\t\twhere tr.tax_class_id = p. products_tax_class_id  and p.products_id = '" . $_POST['products_id'] . "' ";
                $tax_query = olc_db_query($sql);
                $tax = olc_db_fetch_array($tax_query);
                $post_specials_price_text = $post_specials_price_text / ($tax[tax_rate] + 100) * 100;
            }