$pos = strrpos($file, '.');
        if ($pos == false) {
            continue;
        }
    }
    if ($questions != '') {
        $questions .= ', ';
    }
    if ($words != '') {
        $words .= ', ';
    }
    $questions .= '"' . $line->question . '"';
    $words .= '"' . base64_encode($answer) . '"';
    if ($html->type == 'hangmanp') {
        $file = $line->id . substr($file, $pos);
        game_export_javame_smartcopyimage($src, $destdir . '/' . $file, $html->maxpicturewidth, $html->maxpictureheight);
        if ($images != '') {
            $images .= ', ';
        }
        $images .= '"' . $file . '"';
    }
}
echo "var questions = new Array({$questions});\r";
echo "var words = new Array({$words});\r";
if ($html->type == 'hangmanp') {
    echo "var images = new Array({$images});\r";
}
?>

var to_guess = "";
var display_word = "";
function game_exportjavame_exportdata_hangmanp($src, $destmobiledir, $destdir, $game, $map, $maxwidth, $maxheight)
{
    global $CFG;
    $fp = fopen($destdir . "/{$destmobiledir}/{$destmobiledir}.txt", "w");
    fputs($fp, "01=01\r\n");
    fclose($fp);
    $destdirphoto = $destdir . '/' . $destmobiledir . '/01';
    mkdir($destdirphoto);
    $fp = fopen($destdirphoto . '/photo.txt', "w");
    foreach ($map as $line) {
        $file = $line->attachment;
        $pos = strrpos($file, '.');
        if ($pos != false) {
            $file = $line->id . substr($file, $pos);
            $src = $CFG->dataroot . '/' . $game->course . '/moddata/' . $line->attachment;
            game_export_javame_smartcopyimage($src, $destdirphoto . '/' . $file, $maxwidth, $maxheight);
            $s = $file . '=' . game_upper($line->answer);
            fputs($fp, "{$s}\r\n");
        }
    }
    fclose($fp);
}