#!/usr/bin/perl

use CGI qw(:standard);
&decode_vars;

$title=$fields{'title'};
$affiliatenum=$fields{'affiliatenum'};
$titleurl=$fields{'titleurl'};
$navigation=$fields{'navigation'};
$open=$fields{'open'};
$open="navigationopen";

if($open =~ /^pages\//) {
  $open = $open;
} else {
  $open = "bg01/$open";
}

print "Content-type: text/html\n\n";
print <<"END";

<html>
<head>
<title>$title</title>
</head>
<frameset cols=112,* frameborder=0 border=0>   
<frame src="http://mallcom.com/superstore-cgi/hazel.cgi?rn=$affiliatenum&action=serve&item=bg01/$navigation.html&theme=bg01" noresize name="category" border=0>       
<frameset rows=96,* cols=620 border=0>          
<frame src="http://$titleurl" scrolling=no noresize name="title" border=0 marginheight=0 marginwidth=0>          
<frame src="http://mallcom.com/superstore-cgi/hazel.cgi?rn=$affiliatenum&action=serve&item=$open.html&theme=bg01" name="products" border=0>
</frameset>
</frameset>
</html>

END
	


##################################################################
sub decode_vars
 {
  $i=0;
  @pairs=split(/&/,$ENV{'QUERY_STRING'});
  foreach $item(@pairs)
   {
    ($key,$content)=split(/=/,$item,2);
    $content=~tr/+/ /;
    $content=~s/%(..)/pack("c",hex($1))/ge;
    $content=~s/\t/ /g;
    $fields{$key}=$content;
   }
}
