Index: /trunk/Ohana/src/perl/src/dads.detrend
===================================================================
--- /trunk/Ohana/src/perl/src/dads.detrend	(revision 2445)
+++ /trunk/Ohana/src/perl/src/dads.detrend	(revision 2446)
@@ -11,4 +11,5 @@
 @opt = ();
 @tARGV = ();
+$LIMITMODES = "";
 for (; @ARGV > 0; ) {
     if ($ARGV[0] eq "-c") {
@@ -27,4 +28,8 @@
 	$CLEANUP = 0;
         shift; next;
+    }
+    if ($ARGV[0] eq "-limitmodes") {
+	$LIMITMODES = "-limitmodes $ARGV[1]";
+        shift; shift; next;
     }
     @tARGV = (@tARGV, $ARGV[0]);
@@ -110,4 +115,6 @@
     }
 }
+$camera = `gconfig CAMERA`; chop $camera;
+if ($camera eq "meganorth") { $DO_DEMODE = 0; }
 
 # check the GEOMETRY:
@@ -151,11 +158,11 @@
 
 # create output lists:
+@detlist = ();
+@deflist = ();
+@demlist = ();
 @fitlist = ();
-@detlist = ();
-@demlist = ();
 foreach $ccd (@ccdn) {
     push @fitlist, "$outdir/$base$ccd.fits";
     push @detlist, "$workdir/$base$ccd.det";
-    push @demlist, "$workdir/$base$ccd.dem";
     push @deflist, "$workdir/$base$ccd.def";
 }
@@ -163,15 +170,34 @@
 $phufile = "$outdir/$base.phu";
 
-# final output   is    @fitlist
 # detrend  $input[ccd] @detlist
-# demode   @detlist    @demlist
-# defringe @demlist    @deflist
-# if we skip a step, re-assign list as needed:
-
-# assign input / output lists
-if ( $DO_DEFRINGE &&  $DO_DEMODE) { @deflist = @fitlist; }
-if ( $DO_DEFRINGE && !$DO_DEMODE) { @deflist = @fitlist; @demlist = @detlist; }
-if (!$DO_DEFRINGE &&  $DO_DEMODE) { @demlist = @fitlist; }
-if (!$DO_DEFRINGE && !$DO_DEMODE) { @detlist = @fitlist; }
+# defringe @detlist    @deflist
+# demode   @deflist    @demlist
+# output               @fitlist
+
+#* flatten.flips input fitlist
+
+#* flatten.flips input detlist
+#* demode detlist fitlist
+
+# flatten.flips input detlist
+# defringe detlist deflist
+
+#* flatten.flips input detlist
+#* defringe detlist deflist
+#* demode deflist fitlist
+
+#            @demlist = @fitlist
+# !demode:   @deflist = @demlist
+# !defringe: @detlist = @deflist
+
+if ($DO_DEMODE) {
+    @demlist = @fitlist;
+} else {
+    if ($DO_DEFRINGE) { 
+	@deflist = @fitlist; 
+    } else {
+	@detlist = @fitlist; 
+    }
+}
 
 # run the detrend system
@@ -193,4 +219,6 @@
 }
 if ($DO_DEMODE) {
+    $mapfile = "$outdir.map.fits";
+    $deflist = $detlist;
     $demlist = "$outdir.demlist";
     open (FILE, ">$demlist");
@@ -207,15 +235,14 @@
     }
     close (FILE);
-    if (!$DO_DEMODE) { $demlist = $detlist; }
+}
+
+if ($DO_DEFRINGE) {
+    $status = &vsystem ("defringe $detlist $deflist $close");
+    if ($status) { &escape ("ERROR: problem running defringe on $outdir"); }
 }
 
 if ($DO_DEMODE) {
-    $status = &vsystem ("demodemap $detlist $demlist $close");
+    $status = &vsystem ("demodemap $deflist $demlist -mapfile $mapfile $LIMITMODES $close");
     if ($status) { &escape ("ERROR: problem running demodemap on $outdir"); }
-}
-
-if ($DO_DEFRINGE) {
-    $status = &vsystem ("defringe $demlist $deflist $close");
-    if ($status) { &escape ("ERROR: problem running defringe on $outdir"); }
 }
 
Index: /trunk/Ohana/src/perl/src/defringe
===================================================================
--- /trunk/Ohana/src/perl/src/defringe	(revision 2445)
+++ /trunk/Ohana/src/perl/src/defringe	(revision 2446)
@@ -49,9 +49,16 @@
     if ($?) { die "failure to measure fringe amplitude\n"; }
 
+    print "imstats; $imstats\n";
+
     # find fringe master frames
-    $file = `detsearch -quiet $close -image $input[$i] $ccds[$i] split -type fringe`; chop $file;
+    @file = `detsearch -quiet $close -image $input[$i] $ccds[$i] split -type fringe`; 
+    $file = $file[-1]; chop $file;
     if ($?) { &escape ("can't find fringe master for $input[$i]"); }
     $fringe[$i] = $file;
     if ($dbmode eq "MEF") { $fringe[$i] = "$file\[$ccds[$i]\]"; }
+
+    print "file: $file\n";
+    print "fringe: $fringe[$i]\n";
+    print "dbmode; $dbmode\n";
 
     # get fringe master stats
Index: /trunk/Ohana/src/perl/src/demodemap
===================================================================
--- /trunk/Ohana/src/perl/src/demodemap	(revision 2445)
+++ /trunk/Ohana/src/perl/src/demodemap	(revision 2446)
@@ -1,13 +1,31 @@
 #!/usr/bin/env perl
 
-if ((@ARGV != 2) && (@ARGV != 3)) { die "USAGE: demodemap (inlist) (outlist) [-close]\n" }
+# grab the command line options
+$limitmodes = "";
+$mapfile = "";
+$close = "";
+@tARGV = ();
+for (; @ARGV > 0; ) {
+    if ($ARGV[0] eq "-close") {
+	$close = "-close";
+        shift; next;
+    }
+    if ($ARGV[0] eq "-mapfile") {
+	$mapfile = $ARGV[1];
+        shift; shift; next;
+    }
+    if ($ARGV[0] eq "-limitmodes") {
+	$limitmodes = $ARGV[1];
+        shift; shift; next;
+    }
+    @tARGV = (@tARGV, $ARGV[0]);
+    shift;
+}
+@ARGV = @tARGV;
 
-$inlist = $ARGV[0];
+if (@ARGV != 2) { die "USAGE: demodemap (inlist) (outlist) [-mapfile file] [-limitmodes N] [-close]\n" }
+
+$inlist  = $ARGV[0];
 $outlist = $ARGV[1];
-
-$close = "";
-if ((@ARGV == 3) && ($ARGV[2] eq "-close")) {
-    $close = "-close";
-}
 
 open (FILE, "$inlist");
@@ -22,5 +40,4 @@
 @ccds    = split (" ", $answer);
 
-$scale = 256;
 $modefits = `detsearch $close -quiet -image $first $ccds[0] split -type modes`; chop ($modefits);
 if ($?) { die "can't get mode image\n"; }
@@ -31,5 +48,9 @@
 open (MANA, "|mana --norc");
 print MANA "input $script\n";
-print MANA "demodemap $inlist $outlist $modefits $basename $scale\n";
+
+# override default values (set in modes.pro):
+if ($limitmodes) { print MANA "\$Nmodes = $limitmodes\n"; }
+if ($mapfile) { print MANA "\$savemap = $mapfile\n"; }
+print MANA "demodemap $inlist $outlist $modefits $basename\n";
 print MANA "exit 1\n";
 close (MANA);
@@ -52,18 +73,2 @@
     die "@_\n";
 }
-
-
-sub old {
-    print MANA "macro go\n";
-    print MANA " medianmosaic $inlist 256\n";            # load images, create mosaic
-    print MANA " rd U $modefits\n";                      # load mode images
-    print MANA " getmodes\n";                            # extract modes from mode image
-    print MANA " setmodes2\n";                           # determine mode contributions
-    print MANA " mkmodel\n";                             # create modal map
-
-    print MANA " applymodalmap $inlist $outlist 256\n";  # subtract modal map from inlist images 
-    print MANA " exit 0\n";
-    print MANA "end\n";
-
-    print MANA "go\n";
-}
Index: /trunk/Ohana/src/perl/src/elixir.postrun
===================================================================
--- /trunk/Ohana/src/perl/src/elixir.postrun	(revision 2445)
+++ /trunk/Ohana/src/perl/src/elixir.postrun	(revision 2446)
@@ -160,4 +160,6 @@
 	# wait for up to 10 seconds for $fifos/complete.pid to exist 
 	for ($Nwait = 0; ($Nwait < 30) && (! -e "$fifos/complete.pid"); $Nwait ++) { sleep 2; }
+
+
 	if (! -e "$fifos/complete.pid") { &save_escape ($entry, "failed to start elixir (sex)complete"); }
     }
Index: /trunk/Ohana/src/perl/src/flatten.flips
===================================================================
--- /trunk/Ohana/src/perl/src/flatten.flips	(revision 2445)
+++ /trunk/Ohana/src/perl/src/flatten.flips	(revision 2446)
@@ -1,3 +1,5 @@
 #!/usr/bin/env perl
+
+### darks are currently disabled (look for dark detsearch and darkfactor)
 
 # grab the command line options
@@ -12,13 +14,13 @@
 for (; @ARGV > 0; ) {
     if ($ARGV[0] eq "-C") {
-        $config = "-C $ARGV[1]";
+        $config = "$config -C $ARGV[1]";
         shift; shift; next;
     }
     if ($ARGV[0] eq "-c") {
-        $config = "-c $ARGV[1]";
+        $config = "$config -c $ARGV[1]";
         shift; shift; next;
     }
     if ($ARGV[0] eq "-D") {
-        $config = "-D $ARGV[1] $ARGV[2]";
+        $config = "$config -D $ARGV[1] $ARGV[2]";
         shift; shift; shift; next;
     }
@@ -74,4 +76,5 @@
 
 # find the appropriate detrend images (need to fix output name for MEF - option?)
+print STDERR "detsearch $config $chipname -quiet -image $input $ccd $mode -type flat $close\n";
 $flat=`detsearch $config $chipname -quiet -image $input $ccd $mode -type flat $close`; chop ($flat);
 if ($?) { die "ERROR: can't get flat for image\n"; }
@@ -81,6 +84,6 @@
     if ($?) { die "ERROR: can't get bias for image\n"; }
 
-    $dark=`detsearch $config $chipname -quiet -image $input $ccd $mode -type dark $close`; chop ($dark);
-    if ($?) { die "ERROR: can't get dark for image\n"; }
+#    $dark=`detsearch $config $chipname -quiet -image $input $ccd $mode -type dark $close`; chop ($dark);
+#    if ($?) { die "ERROR: can't get dark for image\n"; }
 }
 
@@ -125,5 +128,5 @@
 }
 
-if (! $fast) {
+if (! $fast && 0) {
     # determine scale factor for dark image (use MEF rootname if EXTNAME is given)
     $darkfile = $dark;
@@ -159,8 +162,9 @@
 	$line =~ s|BIASNAME|$bias|;
 
-	# dark corrections
-	$line =~ s|DODARK|1|;
-	$line =~ s|DARK_FACT|$darkfactor|;
-	$line =~ s|DARKNAME|$dark|;
+	# dark corrections - avoid for now
+	$line =~ s|DODARK|0|;
+#	$line =~ s|DODARK|1|;
+#	$line =~ s|DARK_FACT|$darkfactor|;
+#	$line =~ s|DARKNAME|$dark|;
     }
 
@@ -179,5 +183,5 @@
     # header blocks - we need an extra block for elixir keywords
     $line =~ s|DOHEADER|1|;
-    $line =~ s|NBLOCKS|5|;
+    $line =~ s|NBLOCKS|2|;
 }
 
Index: /trunk/Ohana/src/perl/src/fr.frstats
===================================================================
--- /trunk/Ohana/src/perl/src/fr.frstats	(revision 2445)
+++ /trunk/Ohana/src/perl/src/fr.frstats	(revision 2446)
@@ -92,9 +92,8 @@
 	if (-e $line) { $Nfound ++; }
     }
-    if ($Nfound == 0) { 
-	print STDERR "NOTE: no files from $list: assuming initial state\n";
+    if ($Nfound < @list) { 
+	print STDERR "NOTE: missing some file from $list: assuming initial state\n";
 	&goodbye; 
     }
-    if ($Nfound != @list) { &escape ("missing some files from $list"); }
 
     # run mana script:
@@ -128,9 +127,8 @@
 	if (-e $line) { $Nfound ++; }
     }
-    if ($Nfound == 0) { 
-	print STDERR "NOTE: no files from $list: assuming initial state\n";
+    if ($Nfound < @list) { 
+	print STDERR "NOTE: missing some files from $list: assuming initial state\n";
 	&goodbye; 
     }
-    if ($Nfound != @list) { &escape ("missing some files from $list"); }
 
     # run mana script:
Index: /trunk/Ohana/src/perl/src/fr.medbin.spline
===================================================================
--- /trunk/Ohana/src/perl/src/fr.medbin.spline	(revision 2445)
+++ /trunk/Ohana/src/perl/src/fr.medbin.spline	(revision 2446)
@@ -17,9 +17,11 @@
 if ($?) { die "ERROR: cameraconfig error\n"; }
 
+($Xmap, $Ymap) = split (" ", `gconfig FRINGE_MAP_SCALE`);
+if ($?) { die "ERROR: missing FRINGE_MAP_SCALE in config system\n"; }
+
 if (! -d $meddir) { vsystem ("mkdir -p $meddir"); }
 if (! -d $mapdir) { vsystem ("mkdir -p $mapdir"); }
 
 open (MANA, "|mana --norc");
-# open (MANA, ">test.pro");
 
 # convert BIASSEC string to x1, x2, y1, y2 vars
@@ -52,4 +54,6 @@
 print MANA " keyword a NAXIS1 nx\n";
 print MANA " keyword a NAXIS2 ny\n";
+
+# generate binned image 
 print MANA " medianmap a b {\$nx/$factor} {\$ny/$factor} -range 0.25 0.75\n";
 print MANA " keyword a DATASEC line\n";
@@ -57,18 +61,17 @@
 print MANA " sprint newline \"[%d:%d,%d:%d]\" {int(\$x1/2 + 1)} {int(\$x2/2 + 1)} {int(\$y1/2 + 1)} {int(\$y2/2 + 1)}\n";
 print MANA " keyword b DATASEC -w \$newline\n";
-
-# create 8x16 sky spline map
 print MANA " keyword b NAXIS1 nx\n";
 print MANA " keyword b NAXIS2 ny\n";
-print MANA " stats -q b - - - -\n";
 
 # sky from first ccd saved for reference
 print MANA " if (\$setsky)\n";
+print MANA "  stats -q b - - - -\n";
 print MANA "  \$sky = \$MEDIAN\n";
 print MANA "  \$setsky = 0\n";
 print MANA " end\n";
+# we use the sky value of the first chip to remove the DC level for map, add it to med
 
-# we use the sky value of the first chip to make the image globally flat
-print MANA " medianmap b m 8 16 -ignore 0.0 -range 0.25 0.75\n";
+# create Xmap x Ymap sky map, spline-fit to medbin scale
+print MANA " medianmap b m $Xmap $Ymap -ignore 0.0 -range 0.25 0.75\n";
 print MANA " set m = m - \$sky\n";
 print MANA " spline.construct m M x\n";
Index: /trunk/Ohana/src/perl/src/mkfringe
===================================================================
--- /trunk/Ohana/src/perl/src/mkfringe	(revision 2445)
+++ /trunk/Ohana/src/perl/src/mkfringe	(revision 2446)
@@ -21,5 +21,5 @@
 if ($ARGV[0] eq "mkconfig")   { &mk_mkconfig;   }
 if ($ARGV[0] eq "list.runs")  { &mk_list_runs;  }
-if ($ARGV[0] eq "cleanup")    { &mk_cleanup;    }
+if ($ARGV[0] eq "clean")      { &mk_cleanup;    }
 if ($ARGV[0] eq "set")        { &mk_set;        }
 if ($ARGV[0] eq "reg")        { &mk_reg;        }
@@ -48,4 +48,5 @@
 if ($ARGV[0] eq "htmlmaps")   { &mk_htmlmaps;   }
 if ($ARGV[0] eq "htmlkeep")   { &mk_htmlkeep;   }
+if ($ARGV[0] eq "htmlmapkeep"){ &mk_htmlmapkeep;}
 if ($ARGV[0] eq "htmlconfig") { &mk_htmlconfig; }
 if ($ARGV[0] eq "html1")      { &mk_html1;      }
@@ -644,8 +645,18 @@
 	$modesjpg = mknames ("modesjpg", $confline);
 	$residjpg = mknames ("residjpg", $confline);
-
+	$inmapjpg = mknames ("inmapjpg", $confline);
 
 	vsystem ("fr.mkmodes $maplist $modefits $modelist");
-	vsystem ("fr.modestats $maplist $modefits $modelist $modesjpg $residjpg");
+	if ($status) { 
+	    $confline = stconfig ($confline, "status", "fail.map");
+	    save_config (@list);
+	    next;
+	}
+	vsystem ("fr.modestats $maplist $modefits $modelist $modesjpg $residjpg $inmapjpg");
+	if ($status) { 
+	    $confline = stconfig ($confline, "status", "fail.map");
+	    save_config (@list);
+	    next;
+	}
 	$confline = stconfig ($confline, "status", "done.map");
 	save_config (@list);
@@ -653,6 +664,4 @@
     &goodbye;
 }
-
-
 
 ############## map reg ###############
@@ -980,5 +989,5 @@
     # create directory for fhtool to work in
     $links = mkfiles ("links");
-    if (! -e $links) { mkdir ($links); }
+    if (! -e $links) { system ("mkdir -p $links"); }
 
     # create namelist for those with appropriate status
@@ -1415,5 +1424,30 @@
     
     print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/fr.elixir1?&elconf=$elconf\">";
-    # print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/fr.elixir2?$key&elconf=$elconf\">\n";
+    &goodbye;
+}
+
+############## html accept ###############
+sub mk_htmlmapkeep {
+    
+    if (@ARGV != 2) { &escape ("USAGE: $MKFRINGE htmlmapkeep (config.ver)"); }
+    
+    $key = $ARGV[1];
+    @list = load_config ();
+    
+    $match = -1;
+    for ($i = 0; $i < @list; $i++) {
+	$version = gtconfig ($list[$i], "version");
+	if ($key eq $version) {
+	    $match = $i;
+	    last;
+	}
+    }
+    if ($match == -1) { &escape ("ERROR: can't find config entry"); }
+    
+    # adjust the config file: convert status to 'accepted'
+    $list[$match] = stconfig ($list[$match], "status", "accept.map");
+    save_config (@list);
+    
+    print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/fr.elixir1?&elconf=$elconf\">";
     &goodbye;
 }
@@ -1494,8 +1528,14 @@
     @list = load_config ();
     
+    # config:  run.type.filter
+    # key:     run.type.filter.ver
+    # key.col  run.type.filter.ver.column
+    # the words in config and key may consist of alphanumeric plus '_', '-'
+    # the words in col number be digits
+
     # entry on line will be either config.ver (== key) or config.ver.col for sorting
     # grab just the key portion
     $status = "none";
-    ($key) = $ARGV[1] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver)
+    ($key) = $ARGV[1] =~ /([-\w]+\.[-\w]+\.[-\w]+\.[-\w]+)/; # (config.ver)
     $arg = $ARGV[1];
     
@@ -1641,5 +1681,5 @@
     $status = "none";
     $arg = $ARGV[1];
-    ($key) = $arg =~ /(\w+.\w+.\w+.\w+)/; # (config.ver)
+    ($key) = $arg =~ /([-\w]+\.[-\w]+\.[-\w]+\.[-\w]+)/; # (config.ver)
     
     # find appropriate config.ver entry:
@@ -1791,6 +1831,6 @@
     
     $col = 0;
-    ($config) = $_[0] =~ /(\w+.\w+.\w+)/;
-    ($key)    = $_[0] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver)
+    ($config) = $_[0] =~ /([-\w]+\.[-\w]+\.[-\w]+)/;
+    ($key)    = $_[0] =~ /([-\w]+\.[-\w]+\.[-\w]+\.[-\w]+)/; # (config.ver)
 
     # look for optional sort key (config.ver[.key])
@@ -1930,6 +1970,7 @@
 sub flips_report_done {
     
-    ($config) = $_[0] =~ /(\w+.\w+.\w+)/;
-    ($key)    = $_[0] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver)
+    ($config) = $_[0] =~ /([-\w]+\.[-\w]+\.[-\w]+)/;
+    ($key)    = $_[0] =~ /([-\w]+\.[-\w]+\.[-\w]+\.[-\w]+)/; # (config.ver)
+
     $line = $_[1];
     
@@ -2062,7 +2103,9 @@
 sub map_report {
     
+    print STDOUT "A Simple Test <br>\n";
+
     $col = 0;
-    ($config) = $_[0] =~ /(\w+.\w+.\w+)/;
-    ($key)    = $_[0] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver)
+    ($config) = $_[0] =~ /([-\w]+\.[-\w]+\.[-\w]+)/;
+    ($key)    = $_[0] =~ /([-\w]+\.[-\w]+\.[-\w]+\.[-\w]+)/; # (config.ver)
 
     # look for optional sort key (config.ver[.key])
@@ -2081,10 +2124,12 @@
     open (LIST, mknames ("modesjpg", $line)); @modeslist = <LIST>; close (LIST);
     open (LIST, mknames ("residjpg", $line)); @residlist = <LIST>; close (LIST);
+    open (LIST, mknames ("inmapjpg", $line)); @inmaplist = <LIST>; close (LIST);
     foreach $name (@modeslist) { chop ($name); }
     foreach $name (@residlist) { chop ($name); }
+    foreach $name (@inmaplist) { chop ($name); }
 
     print STDOUT "You have the following choices: <br>\n";
     print STDOUT "<a href=$CGI/fr.elixir1?&elconf=$elconf> <b> return to top level </b><br></a>";
-    print STDOUT "<a href=$CGI/fr.accept?$key&elconf=$elconf> <b> accept config </b><br></a></td>";
+    print STDOUT "<a href=$CGI/fr.mapaccept?$key&elconf=$elconf> <b> accept config </b><br></a></td>";
 
     print STDOUT "Modes avaliable for this config <br>\n";
@@ -2139,4 +2184,32 @@
     print STDOUT "</form>\n";
 
+    # 2 x N table of source images 
+    print STDOUT "Source images <br>\n";
+    print STDOUT "<form method=post action=$CGI/fr.maps?&elconf=$elconf>\n";
+    print STDOUT "<table bgcolor=#fff0e0 border=1 cellspacing=0 cellpadding=3>\n";
+    for ($i = 0; $i < @mapdata; $i++) { 
+	if ((($i - 0) % 6) == 0) { print STDOUT "<tr>\n"; }
+
+	($name, $status) = split (" ", $mapdata[$i]);
+	@words = split ("/", $name);
+	$basename = $words[-1];
+	$basename =~ s/.maplist$//;
+
+	$imname = sprintf "%s/%s", $www, $inmaplist[$i];
+	print STDOUT "<td> $basename </td>\n";
+	print STDOUT "<td> <img height=64 src=$imname> </td>\n";
+	if ($status) { print STDOUT "<td bgcolor=#00c000> <input checked type=checkbox name=map.$i value=$i size=1> </td>\n"; }
+	else         { print STDOUT "<td bgcolor=#d00000> <input         type=checkbox name=map.$i value=$i size=1> </td>\n"; }
+
+	if ((($i - 5) % 6) == 0) { print STDOUT "</tr>\n"; } 
+	else { print STDOUT "<td width=10 bgcolor=#ffffff> &nbsp; </td>\n"; }
+    }
+    print STDOUT "</table>\n";
+    $Nmaps = @mapdata;
+    print STDOUT "<input type=hidden    name=Nmaps value=\"$Nmaps\">\n";
+    print STDOUT "<input type=hidden    name=config value=\"$key\">\n";
+    print STDOUT "<input type=submit    value=\"set image selection\">\n";
+    print STDOUT "<input type=reset     value=Reset>\n";
+    print STDOUT "</form>\n";
     &goodbye;
     
@@ -2341,4 +2414,10 @@
 	    $dir = mkfiles ("html");
 	    $value = "$dir/$words[0].$words[1].$words[2].$words[3].resid";
+	    last;
+	}
+	# file in HTML dir with all medbin jpg image names (also root for images)
+	if ($type eq "inmapjpg") {
+	    $dir = mkfiles ("html");
+	    $value = "$dir/$words[0].$words[1].$words[2].$words[3].inmap";
 	    last;
 	}
