echo "wait {$i} -> " . time() . "n";
            }
        }
        echo "Endn";
    }
}
$sitemapGenerator = new SitemapGenerator();
$currentCount = 0;
$pageCateBrand = 0;
$pageYMM = 0;
$hasmore = false;
$filename = "";
if (isset($_POST['actionType']) && $_POST['actionType'] != '') {
    switch ($_POST['actionType']) {
        case 'CategoryBrand':
            $categoryBrandURLs = $sitemapGenerator->GetCategoryBrandURLs();
            $sitemapGenerator->GenerateAction(array('category-brand' => $categoryBrandURLs));
            break;
        case 'MixCategoryBrand':
            $mixCategoryBrandURLs = $sitemapGenerator->GetMixCategoryBrandURLs();
            $sitemapGenerator->GenerateAction(array('mix-category-brand' => $mixCategoryBrandURLs));
            break;
        case 'ProductBrand':
            $productBrandURLs = $sitemapGenerator->GetProductBrandURLs();
            $chunkArr = array_chunk($productBrandURLs, 3, true);
            $sitemapGenerator->GenerateAction($chunkArr[$_POST['currentCount']]);
            $currentCount = $_POST['currentCount'] + 1;
            $remainCount = count($chunkArr) - $currentCount;
            echo "Remaining: {$remainCount}<br/>";
            break;
        case 'DynamicPage':