#!/usr/bin/perl

### Cookies

 $hostip = $ENV{'REMOTE_ADDR'};
 require '../cookie.lib';

 $cartid = "nocookies";

 if (&GetCookies('cart')) {
   $cartid = $Cookies{'cart'};
 }
 else {
  ($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
   $cartid = "$sec$hr$min.$hostip";
   &SetCookies('cart',$cartid);
 }
# if (not &GetCookies('cart')) {
#    $cartid = "nocookies";
# }


#####################################################


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

$start = 0;
$deptid = "access";

@values = split(/&/,$ENV{'QUERY_STRING'});
          foreach $i (@values) {
            ($varname, $mydata) = split(/=/,$i);
             if ($varname eq "start") {
		$start = $mydata;
             }
	  }


open(FILE, "../data.dat") || die &error_file;
 while(<FILE>) {
  chomp;		
  @datafile = split(/\n/);
  foreach $line (@datafile) {
   next if /#.*/;
   ($depart, $prodid, $prodtitle, $proddetail, $prodprice, $prodimage, $prodthumb, $s1, $s2, $s3, $t1, $wsprice, $wsunit, $wsmin, $rtla, $wsa, $prodbrief, $prodlink) = split(/::/,  $line);
    if ($deptid eq $depart && $rtla eq "1") {
    push(@pdp,$depart);
    push(@pid,$prodid);
    push(@ptl,$prodtitle);
    push(@pdt,$proddetail);
    push(@ppr,$prodprice);
    push(@pim,$prodimage);
    push(@ptm,$prodthumb);
    push(@wsu,$wsunit);
    push(@wsm,$wsmin);
    push(@pbf,$prodbrief);
    push(@prodlink,$prodlink);
    }
   }
  }
close(FILE);
$noofitems = scalar(@pdp);
$noofpages = 1 + int($noofitems/10);

if (int($noofitems / 10) == $noofitems / 10) {
  $noofpages = $noofpages - 1;
}

if (int($start / 10) != $start / 10) {
  $start = 0;
}

if ($start > $noofitems) {
  $start = 0;
}

$htmltitle = "Princess Accessoires - Purses, Keychains, Ornaments - The Princess Store";

$max = $#pdp;



print <<EndOfHTML;


<HTML>
<HEAD>

<TITLE>$htmltitle</TITLE>
<META NAME="description" 
content="$htmltitle - Visit this site for your fairy princess needs!">

<LINK HREF="http://www.theprincessstore.com/images/css.css" REL="stylesheet" TYPE="text/css">
<SCRIPT language="JavaScript">
<!--

var message="(C) The Princess Store - All Rights Reserved."
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// --> 
</SCRIPT>
</HEAD>

<BODY topmargin="0"         bottommargin="0" 
      leftmargin="0"        rightmargin="0" 
      marginwidth="0"       marginheight="0">


<!---------- Top Nav ------------>


<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
<TR>
<TD BGCOLOR="#ff99cc">
<A HREF="http://www.theprincessstore.com/">
<IMG SRC="http://www.theprincessstore.com/images/website/navlogo.gif" BORDER=0
ALT="The Princess Store"></A></td>
<TD BGCOLOR="#ff99cc">
<DIV ALIGN=right>
<IMG SRC="http://www.theprincessstore.com/images/website/navright.gif" BORDER=0 USEMAP="#NavRight" ISMAP></DIV></TD>
</TR>
</TABLE>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
<TR><TD BACKGROUND="http://www.theprincessstore.com/images/website/shade.gif">&nbsp;</TD></TR></TABLE>


<!-- Image Map -->
<map name="NavRight"><area shape="rect" coords="168,60,340,78" href="http://www.theprincessstore.com/cgi-bin/cart/smart.cgi?command=review" title="View Your Cart" alt="View Your Cart"><area shape="rect" coords="227,14,281,37" href="http://www.theprincessstore.com/about/help/index.html" title="Help and Support" alt="Help and Support"><area shape="rect" coords="133,13,203,37" href="http://www.theprincessstore.com/about/contactform.html" title="Contact Information" alt="Contact Information"><area shape="rect" coords="39,13,108,37" href="http://www.theprincessstore.com/about/index.html" title="About The Princess Store" alt="About The Princess Store"></map>

<!----- //////// End Top Nav //////---->

<DIV ALIGN=center><BR>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=740>
<TR>
<TD WIDTH=10><BR></TD>




<!---------- Left Col (Search and Department Links) ------------------>

<TD WIDTH=200 VALIGN="top">
<DIV ALIGN=center>

<!--Search Box-->
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200>
<TR>
 <TD WIDTH=10><IMG HEIGHT=17 WIDTH=10
    SRC="http://www.theprincessstore.com/images/website/tableleft.gif"></TD>
 <TD WIDTH=180 BGCOLOR="#9999cc"><BR></TD>
 <TD WIDTH=10><IMG HEIGHT=17 WIDTH=10
    SRC="http://www.theprincessstore.com/images/website/tableright.gif"></TD>
</TR>
</TABLE>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200 BGCOLOR="#ff99cc">
<TR>
<TD HEIGHT=95>
  <FORM NAME="Search" ACTION="http://www.theprincessstore.com/cgi-bin/search.pl">
  <INPUT TYPE="hidden" VALUE="14d951d66b545178" NAME="crid">
  <DIV ALIGN=center>
  <IMG SRC="http://www.theprincessstore.com/images/website/tablesearch.gif" ALT="Search"></DIV>
  <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=180>
  <TR>
  <TD VALIGN=top width=115>
   <DIV ALIGN="right" class="smaller">
   <INPUT NAME="query" SIZE="10">&nbsp;</DIV></TD>
  <TD VALIGN=TOP WIDTH=65><INPUT 
      SRC="http://www.theprincessstore.com/images/website/butminisearch.gif" 
      BORDER=0 NAME="Search" TYPE="image"></TD>
  </TR>
  </TABLE>
  </FORM>
</TD>
</TR>
<TR><TD><IMG HEIGHT=16 WIDTH=200  SRC="http://www.theprincessstore.com/images/website/shade.gif"></TD></TR>
</TABLE><BR>

<!--Department Links-->
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200>
<TR>
 <TD WIDTH=10><IMG HEIGHT=17 WIDTH=10
    SRC="http://www.theprincessstore.com/images/website/tableleft.gif"></TD>
 <TD WIDTH=180 BGCOLOR="#9999cc"><BR></TD>
 <TD WIDTH=10><IMG HEIGHT=17 WIDTH=10
    SRC="http://www.theprincessstore.com/images/website/tableright.gif"></TD>
</TR>
</TABLE>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200 BGCOLOR="#ff99cc">
<TR>
 <TD>
 <DIV ALIGN=center>
 <BR>

EndOfHTML

open (LEFTNAV,"../leftnav.dat") || print "Could not open file \n";
while (<LEFTNAV>) {
print $_;
	}
close(LEFTNAV);	

print <<EndOfHTML;

 <BR>
 </DIV></TD>
</TR>
<TR><TD><IMG HEIGHT=16 WIDTH=200  SRC="http://www.theprincessstore.com/images/website/shade.gif"></TD></TR>
</TABLE>

<!--Other Left Col Items-->
<BR>
<A HREF="http://www.theprincessstore.com/wholesale/index.html">
<IMG SRC="http://www.theprincessstore.com/images/website/button/wholesale.gif" 
 ALT="Wholesale Resellers" BORDER=0></A><BR><BR>
</DIV></TD>

<!----- //////// End Left Col //////---->

<!--Gutter-->
<TD WIDTH=10><BR></TD>





<!-------- Main Col -------------------------->


<TD VALIGN=top WIDTH=520>

<!--Section Title Area-->
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=520>
<TR>
 <TD WIDTH=10><IMG HEIGHT=17 WIDTH=10
    SRC="http://www.theprincessstore.com/images/website/tableleft.gif"></TD>
 <TD WIDTH=500 BGCOLOR="#9999cc"><BR></TD>
 <TD WIDTH=10><IMG HEIGHT=17 WIDTH=10
    SRC="http://www.theprincessstore.com/images/website/tableright.gif"></TD>
</TR>
</TABLE>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=520 BGCOLOR="#ff99cc">
<TR>
<TD HEIGHT=95 xBACKGROUND="http://www.theprincessstore.com/images/website/tdbg.gif">
 <DIV ALIGN=center>
<IMG SRC="http://www.theprincessstore.com/images/website/titles/feathers.gif" BORDER="0">
</DIV></TD>

</TR>
<TR><TD><IMG HEIGHT=16 WIDTH=520 
SRC="http://www.theprincessstore.com/images/website/shade.gif"></TD></TR>
</TABLE>
<BR>

<!---- HEADER --------->

<DIV ALIGN=center>
<SMALL><A HREF="http://www.theprincessstore.com/">Home</A> - <I>Accessories</I><BR><BR></SMALL>
<span class=smaller>
<B>Princess Accessories - Jewelry Boxes - Purses - Keychains - Ornaments</B><BR>
Free shipping when you buy \$30 or more. <BR><BR>

From purses to keychains, The Princess Store brings you a large variety of accessories which can be used for any occasion. Free shipping is available when you buy \$30 or more.<BR><BR>

<IMG SRC='/images/website/hr.gif' HEIGHT=1 WIDTH=520><BR><BR>
</SPAN>


EndOfHTML

print "<!----- ###### I T E M   D A T A   A R E A ####### --------------->\n";


$iii = $start;
$number = 1;
while($iii <= $max) {

print "<!--Items $iii+1 and $iii+2 ---->\n";
print "<table border=\"0\" cellpadding=\"7\" cellspacing=\"0\" width=\"480\">\n";
print "<tr><td width=240 valign=top ALIGN=center>\n";
print "<a href=\"$prodlink[$iii]\"><img src=\"../../images/products/$ptm[$iii]\"  border=0 alt=\"$ptl[$iii]\"></a>\n";

print "</td>\n";

if ($ptm[$iii+1] eq "") {
  print "<TD><BR>\n";
} else {

print "<td width=240 valign=top ALIGN=center>\n";
print "<a href=\"$prodlink[$iii+1]\" ><img   src=\"../../images/products/$ptm[$iii+1]\" border=0 alt=\"$ptl[$iii+1]\"></a>\n";


}

print "</td>\n";
print "</tr>\n";
print "\n";
print "<tr>\n";
print "<td width=240 ALIGN=center VALIGN=top>\n";
print "<span class=smaller><A HREF=\"$prodlink[$iii]\"><B>$ptl[$iii]</B></A> -</span>\n";
print "<span class=smaller>$pbf[$iii]<br>\n";

#print "• <A HREF=\"../item_detail.cgi?pid=$pid[$iii]\">More Details</A><BR>• $plink[$iii]</span>";
#print "<span class=smaller>\$$ppr[$iii]</span><br>\n";
#print "<span class=smaller>Item# $pid[$iii]<br><br></span>\n";
#print "<a href=\"http://www.theprincessstore.com/cgi-bin/add.pl?pid=$pid[$iii]&q=$cartid\"><img  src=\"../../images/website/button/addtocart.gif\" border=0 alt=\"Add To Cart\"></a>&nbsp;\n";
#print "<A HREF=\"../item_detail.cgi?pid=$pid[$iii]\"><IMG SRC=\"../../images/website/button/moreinfo.gif\" WIDTH=84 HEIGHT=26 BORDER=0 ALT=\"More Info...\"></A><BR>\n";
print "</td>\n";

if ($ptm[$iii+1] eq "") {
  print "<TD><BR>\n";
} else {

print "<td width=240 ALIGN=center VALIGN=top>\n";

print "<span class=smaller><A HREF=\"$prodlink[$iii+1]\"><B>$ptl[$iii+1]</B></A> - </span>\n";
print "<span class=smaller>$pbf[$iii+1]<BR>\n";

#print "• <A HREF=\"../item_detail.cgi?pid=$pid[$iii+1]\">More Details</A><BR>• $plink[$iii+1]</span>";
#print "<span class=smaller>\$$ppr[$iii+1]</span><br>\n";
#print "<span class=smaller>Item# $pid[$iii+1]<br><br></span>\n";
#print "<a href=\"http://www.theprincessstore.com/cgi-bin/add.pl?pid=$pid[$iii+1]&q=$cartid\"><img height=26 width=84 src=\"../../images/website/button/addtocart.gif\" border=0 alt=\"Add To Cart\"></a>&nbsp;\n";
#print "<A HREF=\"../item_detail.cgi?pid=$pid[$iii+1]\"><IMG SRC=\"../../images/website/button/moreinfo.gif\" WIDTH=84 HEIGHT=26 BORDER=0 ALT=\"More Info...\"></A><BR>\n";

}

print "</td></tr></table>\n";

$iii = $iii + 2;
$number = $number + 2;
}	




print <<EndOfHTML;









<BR><BR>


<IMG SRC='/images/website/hr.gif' HEIGHT=1 WIDTH=520><BR><BR>
<DIV ALIGN=center>
 

<!------ //////// END MAIN COL AREA ///////// -------->

<BR><BR></DIV></TD>
</TR>
</TABLE>


<!----------- Footer -------------->
<DIV ALIGN=center>
EndOfHTML

open (BOTTOMNAV,"../bottomnav.dat") || print "Could not open file \n";
while (<BOTTOMNAV>) {
print $_;
	}
close(BOTTOMNAV);	

print <<EndOfHTML;
<br>

<span class="smaller">&copy; 2000-2011 The Princess Store - <a href="http://www.theprincessstore.com/about/tos.html" title="Click here for more information on the copyright.">All Rights Reserved</a><br>
<br></span></center><br><br>



<!------ GC 101 Graphics Counter Code --------------->
<!--SCRIPT SRC="http://www.vvvexp.com/images/website/replacechar.js"></SCRIPT>
<script language="javascript"--><!--- Hide code from non JS Browsers 
dcref=document.referrer;
dcref = replace(dcref,'?','&');
dcurl=document.URL;
dcurl = replace(dcurl,'?','&');
gadm1="gc101actid=princess&doc=" + dcurl;
gadm1+="&docreferrer=" + dcref +" WIDTH=1 HEIGHT=1 BORDER=0>";
gadm2="<IMG SRC=http://www.gc101graphics.com/cgi-bin/gccounter/gccounter.cgi?";
document.write(gadm2+gadm1);
// Stop Hiding --->
<!--/script-->
<!------ GC 101 Graphics Counter Code --------------->
</BODY>
</HTML>

EndOfHTML

sub error_file {
	print <<END_of_html;
<HTML>
<head>
<title>Please Wait...</title>
<style type="text/css"><!--
<!--a:link { text-decoration: none }
a:hover { color: #ff0000; text-decoration: underline }
a:visited { text-decoration: none }
a:visited:hover { color: #ff0000; text-decoration: underline }-->
</style>
</head>

<body bgcolor="white" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" link="#003399" vlink="#003399" alink="red">

<center>
<font size="4" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b><br>
<br>
<br>
<br>
L O A D I N G<br>
<br>
</b></font><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">If this page does not refresh automaticly, <a href="http://www.theprincessstore.com/"><b>click here</b></a>.</font></center>
</body>

</HTML>
END_of_html
exit;
}

