// send CC email if needed
   if (@mail($cfg['ccaddress'], $subj, $body, $headers)) $succ++;
   else $fail++;
 }
 $f = openfile($cfg['listfile']);
 if ($startnum > 0) {
   // skip to specified record and start there.
   skiptoitem($f, $startnum);
 }
 if ($startpos > 0) {
   // startpos is used for resuming. It will override any startnum value.
   fseek($f, $startpos);
 }
 if ($cfg['savemail'] && !$_POST['resume']) {
   // save this email only if it's not a resume and it is configured for.
   if (($mfile = savemail($from, $subj, $body, $startid, $ashtml)) === false) $err = 'Could not save email. Check directory exists and permissions are set correctly.';
 }
 if (!isset($err)) {
   // create temp file for resume data
   if ($cfg['enableresume'] && $cfg['savemail']) {
     if ($_POST['resume']) {
       $fr = @fopen($cfg['savemailto'].'/tmp_'.substr($_POST['resume'],4), 'wb');
     }
     else {
       $fr = @fopen($cfg['savemailto'].'/tmp_'.$mfile.'.txt', 'wb');
     }
     if ($fr === false) $err = 'Could not create or open temp file. Check directory permissions.';
   }
   if (!isset($err)) {
     // WE'RE READY TO SEND!!!
     $cnt = 0;
    case 'savecategory':
        savecategory($option, $task);
        break;
    case 'showcss':
        showcss($option);
        break;
    case "savecss":
        $file = JRequest::getVar('file', 1);
        $csscontent = JRequest::getVar('csscontent', 1);
        saveCss($file, $csscontent, $option);
        break;
    case 'email':
        email($option);
        break;
    case 'savemail':
        savemail($option);
        break;
    default:
        showClassifieds($option);
        break;
}
function email($option)
{
    $db =& JFactory::getDBO();
    $row =& JTable::getInstance('email', 'Table');
    $cid = JRequest::getVar('cid', array(0), '', 'array');
    $id = $cid[0];
    $row->load(1);
    HTML_classifieds::email($row, $option);
}
function savemail($option)