$rs = db_query($strSQL, $conn);
     db_pageseek($rs, $nPageSize, $mypage);
 } else {
     $rs = db_query($strSQL, $conn);
 }
 if (!ini_get("safe_mode")) {
     set_time_limit(300);
 }
 if (substr(@$_REQUEST["type"], 0, 5) == "excel") {
     //	remove grouping
     $locale_info["LOCALE_SGROUPING"] = "0";
     $locale_info["LOCALE_SMONGROUPING"] = "0";
     ExportToExcel();
 } else {
     if (@$_REQUEST["type"] == "word") {
         ExportToWord();
     } else {
         if (@$_REQUEST["type"] == "xml") {
             ExportToXML();
         } else {
             if (@$_REQUEST["type"] == "csv") {
                 $locale_info["LOCALE_SGROUPING"] = "0";
                 $locale_info["LOCALE_SDECIMAL"] = ".";
                 $locale_info["LOCALE_SMONGROUPING"] = "0";
                 $locale_info["LOCALE_SMONDECIMALSEP"] = ".";
                 ExportToCSV();
             }
         }
     }
 }
 db_close($conn);
 }
 if (!ini_get("safe_mode")) {
     set_time_limit(300);
 }
 if (substr(@$_REQUEST["type"], 0, 5) == "excel") {
     //	remove grouping
     $locale_info["LOCALE_SGROUPING"] = "0";
     $locale_info["LOCALE_SMONGROUPING"] = "0";
     if ($phpVersion > 4) {
         ExportToExcel($cipherer, $pageObject);
     } else {
         ExportToExcel_old($cipherer);
     }
 } else {
     if (@$_REQUEST["type"] == "word") {
         ExportToWord($cipherer);
     } else {
         if (@$_REQUEST["type"] == "xml") {
             ExportToXML($cipherer);
         } else {
             if (@$_REQUEST["type"] == "csv") {
                 $locale_info["LOCALE_SGROUPING"] = "0";
                 $locale_info["LOCALE_SDECIMAL"] = ".";
                 $locale_info["LOCALE_SMONGROUPING"] = "0";
                 $locale_info["LOCALE_SMONDECIMALSEP"] = ".";
                 ExportToCSV($cipherer);
             }
         }
     }
 }
 db_close($conn);
	if(!ini_get("safe_mode"))
		set_time_limit(300);
	
	if(substr(@$_REQUEST["type"],0,5)=="excel")
	{
//	remove grouping
		$locale_info["LOCALE_SGROUPING"]="0";
		$locale_info["LOCALE_SMONGROUPING"]="0";
				if($phpVersion > 4)
			ExportToExcel($rs, $nPageSize, $eventObj, $cipherer, $pageObject);
		else
			ExportToExcel_old($rs, $nPageSize, $strTableName, $eventObj, $cipherer, $pageObject);
	}
	else if(@$_REQUEST["type"]=="word")
	{
		ExportToWord($rs, $nPageSize, $strTableName, $eventObj, $cipherer, $pageObject);
	}
	else if(@$_REQUEST["type"]=="xml")
	{
		ExportToXML($rs, $nPageSize, $strTableName, $eventObj, $cipherer, $pageObject);
	}
	else if(@$_REQUEST["type"]=="csv")
	{
		$locale_info["LOCALE_SGROUPING"]="0";
		$locale_info["LOCALE_SDECIMAL"]=".";
		$locale_info["LOCALE_SMONGROUPING"]="0";
		$locale_info["LOCALE_SMONDECIMALSEP"]=".";
		ExportToCSV($rs, $nPageSize, $strTableName, $eventObj, $cipherer, $pageObject);
	}
	db_close($conn);
	return;