#!/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 = "ssmom";

@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) = 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);
    }
   }
  }
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 = "Personalized Sterling Silver Necklace for Mothers - 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!">
<META NAME="keywords" 
content="crystal, sterling, silver, birthstone, baby, shoe, charm, mother">

<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>
<DIV ALIGN=center>

<!--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>
 <DIV ALIGN=center>

 <!--- ############### S E C T I O N   T I T L E ############ --->
 <IMG SRC="http://www.theprincessstore.com/images/website/titles/wedding.gif"></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> - <A HREF="http://www.theprincessstore.com/mothers_jewelry/">Mothers Jewelry</A> - <I>Sterling Silver Necklace Letter Blocks</I><BR><BR></SMALL>

<span class=smaller>
<B>Sterling Silver Necklace Letter Blocks</B><BR><BR>
Create a custom sterling silver necklace for Mom! Our sterling silver chain necklaces, complete with sterling silver letter charm blocks and spacers, can spell out any name or set of names. Free shipping is available when you buy \$50 or more.<BR><BR>
</SPAN>
<IMG SRC="/images/website/hr.gif" HEIGHT=1 WIDTH=520><BR><BR>
</DIV>

EndOfHTML

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


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

print "<!--Items $iii+1 and $iii+2 ---->\n";
print "<table border=\"0\" cellpadding=\"9\" cellspacing=\"2\" width=\"480\">\n";
print "<tr><td width=240 valign=top ALIGN=center>\n";
print "<A HREF=\"../item_detail.cgi?pid=$pid[$iii]\"><FONT COLOR=black><span class=header>$ptl[$iii]<br></span></FONT></A>\n";
print "<a href=\"../item_display.pl?pid=$pid[$iii]\" target=\"_blank\" onClick=\"window.open(\'../item_display.pl?pid=$pid[$iii]\',\'_blank\',\'width=640,height=480,resizable=yes,scrollbars=yes\');return false;\"   ><img src=\"../../images/products/$ptm[$iii]\"  border=0 alt=\"$ptl[$iii]\"></a>\n";
print "<BR><span class=smaller>$pbf[$iii]<br></span>\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=\"../item_detail.cgi?pid=$pid[$iii+1]\"><FONT COLOR=black><span class=header>$ptl[$iii+1]</A><br></span></FONT></A>\n";
print "<a href=\"../item_display.pl?pid=$pid[$iii+1]\" target=\"_blank\"  onClick=\"window.open(\'../item_display.pl?pid=$pid[$iii+1]\',\'_blank\',\'width=640,height=480,resizable=yes,scrollbars=yes\');return false;\"><img   src=\"../../images/products/$ptm[$iii+1]\" border=0 alt=\"$ptl[$iii+1]\"></a>\n";
print "<BR><span class=smaller>$pbf[$iii+1]<br></span>\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>\$$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>\$$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><br><br>\n";

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


print "<IMG SRC=\"/images/website/hr.gif\" HEIGHT=1 WIDTH=520><BR><BR>\n";
$firstitem = $start+1;
$lastitem = $start+10;
if ($lastitem > $noofitems) {
  $lastitem = $noofitems;
}
print "<SMALL>Items $firstitem - $lastitem of $noofitems Items Found</SMALL><BR>\n";

if ($noofitems > 10){


if ($start >= 10){
 $prevpage = $start - 10;
 if ($prevpage == 0) {
     print "<A HREF=\"crystal_tiaras.pl\">\&lt;- <B>Previous</B></A> \n";
 }
 if ($prevpage != 0) {
     print "<A HREF=\"crystal_tiaras.pl\?start=$prevpage\">\&lt;- <B>Previous</B></A> \n";
 }
}

$iii = 0;
while($iii <= $noofpages-1) {
     $thispage = $iii*10;
     $printpage = $iii + 1;
     if ($thispage != $start && $thispage == 0) {
         print "- <A HREF=\"crystal_tiaras.pl\"><B>$printpage</B></A> \n";
     }
     if ($thispage != $start && $thispage != 0) {
          print "- <A HREF=\"crystal_tiaras.pl\?start=$thispage\"><B>$printpage</B></A> \n";
     }
     if ($thispage == $start && $thispage != 0) {
          print "- $printpage \n";
     }
     if ($thispage == $start && $thispage == 0) {
          print "$printpage \n";
     }

     $iii = $iii + 1;
}

if ($start+10 < $noofpages*10){
 $nextpage = $start + 10;
     print "- <A HREF=\"crystal_tiaras.pl\?start=$nextpage\"><B>Next</B> -\&gt;</A> \n";
}


}

print "<BR><BR><IMG SRC=\"/images/website/hr.gif\" HEIGHT=1 WIDTH=520><BR><BR>\n";

print <<EndOfHTML;







 

<!------ //////// 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-2006 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;
}

