#use warnings;
use strict;

################################################################################
sub printAccountInfo {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Account Info</th>
	</tr>
      </thead>
      <form id="formx" name="formx" method="post" action="$params->{config}->{MARKETPLACE_REGISTRY}" onSubmit="return verifyAccountInfo();">
      <tbody>
	<tr>
	  <th>
	     <font class=required>*</font>Email :
	  </th>
	  <td>
	    <input type="text" name="email" value="" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	     <font class=required>*</font>Password :
	  </th>
	  <td>
	    <input type="password" name="password" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	    HBCU :
	  </th>
	  <td>
	    <select name="hbcu">
	      <option value="Non HBCU College">Non HBCU College</option>
~;
  foreach my $hbcu ( @{$params->{hbcus}} ) {
print qq~
		    <option value="$hbcu->{hbcu_name}">$hbcu->{hbcu_name}</option>
~;
}
print qq~
	    </select>
	  </td>
	</tr>
	<tr>
	  <th>
	    <font class=required>*</font>Name :
	  </th>
	  <td>
	    <input type="text" name="name" value="" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	     <font class=required>*</font>Phone :
	  </th>
	  <td>
	    <input type="text" name="phone" value="" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	    <font class=required>*</font>Address :
	  </th>
	  <td>
	    <input type="text" name="address" value="" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	     <font class=required>*</font>City :
	  </th>
	  <td>
	    <input type="text" name="city" value="" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	     <font class=required>*</font>State :
	  </th>
	  <td>
	    <select name="state">
	      <option value="">Select a State</option>
~;
  foreach my $state ( @{$params->{states}} ) {
print qq~
		    <option value="$state->{state_id}">$state->{label}</option>
~;
}
print qq~
	    </select>
	  </td>
	</tr>
	<tr>
	  <th>
	     <font class=required>*</font>Zip Code :
	  </th>
	  <td>
	    <input type="text" name="zip" value="" size="40" />
	  </td>
	</tr>
	<tr class=buttons>
	  <td colspan=2 align=center>
	    <input type="submit" name="submitAccountInfo" value="Continue >" />
	  </td>
	</tr>
      </tbody>
    </table>
  </form>
    <br>
~;

  printFooter($q, $params);
}

################################################################################
sub printAdminMenu {
  my ($q, $params) = @_;

print qq~
<table class=data width=100%>
  <tr>
    <th><div align=left>&nbsp;Marketplace Admin Tools</div></th>
  </tr>
  <tbody>
    <tr><td></td></tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_ADMIN_MAIN}">Administrative Tools</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_ADMIN_FEATURED_MERCHANTS}">Featured Merchants</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_ADMIN_SEARCH}">Marketplace Search</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_ADMIN_STATS}">Marketplace Statistics</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_ADMIN_ITEMS}">Manage Items</a>
      </td>
    </tr>
    <tr><td></td></tr>
  </tbody>
</table>
<br />
~;
}

################################################################################
sub printBrowseCategories {
  my ($q, $params) = @_;

print qq~
<table class=data>
  <tr>
    <th colspan=2><div align=left>&nbsp;Browse Categories</div></th>
  </tr>
  <tbody>
    <tr><td colspan="2"></td></tr>
~;
  foreach my $cat ( @{$params->{categories}} ) {
print qq~
      <tr>
	<td>
	  <img src=$params->{config}->{BULLET} />
	  <a href="$params->{config}->{MARKETPLACE_SEARCH}?submitSearch=1&category=$cat->{id}">$cat->{name} ($cat->{item_count})</a>
	</td>
      </tr>
~;
}
print qq~
    <tr><td></td></tr>
  </tbody>
</table>
    <br>
	<div align=center>
         <script type="text/javascript">
            GA_googleFillSlot("160x600-2");
         </script>
	</div>

~;
}

################################################################################
sub printContactUs {
  my ($q, $params) = @_;

  print $q->header();

print qq~
<html>
  <head>
    <link rel="StyleSheet" href=$params->{config}->{CSS_URL} type="text/css">
  </head>
  <body>
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Contact Us</th>
	</tr>
      </thead>
      <form id="formx" name="formx" method="post" action="$params->{config}->{MARKETPLACE_CONTACT_US}" onSubmit="return verifySendMessage();">
      <tbody>
	    <tr>
	      <th>
		<font class=required>*</font>Name :
	      </th>
	      <td>
		<input type="text" name="name" size="40" />
	      </td>
	    </tr>
	    <tr>
	      <th>
		<font class=required>*</font>Email :
	      </th>
	      <td>
		<input type="text" name="email" size="40" />
	      </td>
	    </tr>
	    <tr>
	      <th>
		<font class=required>*</font>Subject :
	      </th>
	      <td>
		<input type="text" name="subject" size="65" />
	      </td>
	    </tr>
	    <tr>
	      <th>
		<font class=required>*</font>Message :
	      </th>
	      <td>
		<textarea name="comments" rows="8" cols="50"></textarea>
	      </td>
	    </tr>
	    <tr class=buttons>
	      <td align="center" colspan=2>
		<input type="submit" name="submitMessage" value="Submit" />
	      </td>
	    </tr>
      </tbody>
    </table>
    </form>
    <br>
</body>
</html>
~;
}

################################################################################
sub printContactUsConfirmation {
  my ($q, $params) = @_;

  print $q->header();

print qq~
<html>
  <head>
    <link rel="StyleSheet" href=$params->{config}->{CSS_URL} type="text/css">
  </head>
  <body>
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Contact Us</th>
	</tr>
      </thead>
      <form id="formx" name="formx" method="post" action="$params->{config}->{MARKETPLACE_CONTACT_US}" onSubmit="return verifySendMessage();">
      <tbody>
	  <tr>
	    <td colspan=2>
	      You message was successfully sent!<br><br><br>	
	      <div align="center"><a href="#" onClick="window.close()">Click here to close this window</a></div>
	    </td>
	  </tr>
      </tbody>
    </table>
    </form>
    <br>
</body>
</html>
~;
}

################################################################################
sub printEmailExists {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th>$params->{config}->{SITE}: Merchant Registration</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <br>
	    Our records show that you are already a registered $params->{config}->{SITE} member. Please login above to access your account.<br><br>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>
~;

  printFooter($q, $params);
}

################################################################################
sub printFeaturedItems {
  my ($q, $params) = @_;

  return unless scalar(@{$params->{featuredItems}});

print qq~
<table class=data style="width: 100%;">
  <tr>
    <th><div align=left>&nbsp;Featured Items in the Marketplace</div></th>
  </tr>
  <tbody>
    <tr><td></td></tr>
    <tr>
      <td valign=top>
~;
  foreach my $item ( @{$params->{featuredItems}} ) {
print qq~
  <table width="100%" border="0" cellspacing="4" cellpadding="1">
    <tr>
~;
foreach my $column ( @{$item->{columns}} ) {
print qq~
	<td align="center" valign="top" width="25%">
	  <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$column->{id}"><img src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$column->{picture}->{id}" width="75" height="75" border="0" /></a><br>
	  <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$column->{id}">$column->{title}</a><br>
	  <b>Price: $column->{price}<br><br>
	</td>
~;
}
print qq~
    </tr>
  </table>
~;
}
print qq~
      </td>
    </tr>
    <tr><td></td></tr>
  </tbody>
  </table>
    <div align=right>
      <a href=$params->{config}->{MARKETPLACE_SEARCH}?submitSearch=1>More Items--></a>
    </div>
    <br>
~;
}

################################################################################
sub printFeaturedSellers {
  my ($q, $params) = @_;

  return unless scalar(@{$params->{featuredSellers}});

print qq~
<table class=data style="width: 100%;">
  <tr>
    <th><div align=left>&nbsp;Featured Sellers in the Marketplace</div></th>
  </tr>
  <tbody>
~;
  my $i;
  foreach my $seller ( @{$params->{featuredSellers}} ) {
    if ($i) {
      print "<tr class=odd>\n"; $i = 0;
    } else {
      print "<tr class=even>\n"; $i = 1;
    }
print qq~
	  <td valign="top">
	    <b><a href="$params->{config}->{MARKETPLACE_VIEW_SELLER}?id=$seller->{id}">$seller->{name}</a></b>
~;
    if ($seller->{totalReviews}) {
      print "&nbsp;(";
      foreach my $star ( @{ $seller->{stars} } ) {
	print "<img src=$star->{star} />\n";
      }
print qq~
		  )<br>
		  <a href="sellerReview.cgi?seller=$seller->{id}&showReviews=1">Read $seller->{totalReviews} Reviews</a>
~;
}
print qq~
		  <br>$seller->{description}<br>
		  <br>
	  </td>
	</tr>
~;
  }
print qq~
  </tbody>
  </table>
    <br>
~;
}

################################################################################
sub printFooter {
  my ($q, $params) = @_;

print qq~
</td>
</tr>
</table>
~;

  print $params->{config}->{FOOTER};
}

################################################################################
sub printGridItems {
  my ($q, $params) = @_;

  foreach my $record ( @{$params->{records}} ) {
print qq~

  <table width="100%" border="0" cellspacing="4" cellpadding="1">
    <tr>

~;
foreach my $item ( @{$record->{columns}} ) {
print qq~

	<td align="center" valign="top" width="25%">
	  <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$item->{id}"><img src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$item->{picture}->{id}" width="75" height="75" border="0" /></a><br>
	  <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$item->{id}">$item->{title}</a><br>
	  <b>Price: $item->{price}<br><br>
	</td>
~;
}
print qq~

    </tr>
  </table>
~;
}
}

################################################################################
sub printHeader {
  my ($q, $params) = @_;

  print $q->header();

  # The entire site header
  print $params->{config}->{HEADER};

  # This is in hbcuAuth.pl
  &printQuickLogin($q) unless $params->{authorized};

print qq~
  <table cellspacing=0 cellpadding=0 width=100%>
    <tr>
      <td valign=top width=175>
~;
  printAdminMenu($q, $params->{config}) if $ENV{'SCRIPT_NAME'} =~ /\/admin\//;

  if ($params->{authorized}) {
    printMarketplaceToolkit($q, $params);
  } else {
    printWelcomeGuest($q, $params);
  }

  printBrowseCategories($q, $params);

print qq~
      </td>
      <td cellspacing=0 cellpadding=0 valign=top>
~;
}

################################################################################
sub printHomepageItems {
  my ($q, $params) = @_;

  return unless $params->{items};

  print $q->header;

  print qq(
	<br>
        <table class=data bgcolor=white width="100%" cellspacing="0" cellpadding="1">
	  <tr><td colspan=2 bgcolor=f5ecd8 style=color:#632100><b>&nbsp;Featured Marketplace Items...</td></tr>
);

  for (@{$params->{items}}) {
    print qq(
	  	<tr bgcolor=white><td colspan=2 height=9></td></tr>
          	<tr bgcolor="#ffffff">
            	<td width="56" align="left" style=font-size:11 valign="top" width="65" height="56">
                <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$_->{id}">
                <img align="right" src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$_->{picture}->{id}" width="65" height="56" border="1" /></a>
            	</td>
	    	<td style=font-size:11;font-family:tahoma valign=middle>
                <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$_->{id}" style=font-size:11>
		<b>$_->{title}</b></a>
	  	</td></tr>
);
  }

  print qq(
	</table>
);
}

################################################################################
sub printItemInformation {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Item Information</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_SELL_ITEM}" onSubmit="return verifyItemInformation();">
~;
  if ($q->param('edit')) {
print qq~
        <input type="hidden" name="id" value="$params->{item}->{id}" />
	<input type="hidden" name="edit" value="1" />
~;
}
print qq~
      <tbody>
	<tr>
	  <th>
	    HBCU :
	  </th>
	  <td>
	    <select name="hbcu">
	      <option value="">All HBCUs</option>
~;
  foreach my $x ( @{$params->{hbcus}} ) {
    print "<option value=\"$x->{hbcu_name}\"";
    print " selected" if $x->{default};
    print ">$x->{hbcu_name}</option>\n";
  }
print qq~
	    </select>
	  </td>
	</tr>
	<tr>
	  <th>
	    <font class=required>*</font>Title :
	  </th>
	  <td>
	    <input type="text" name="title" value="$params->{item}->{title}" size="60" />
	  </td>
	</tr>
	<tr>
	  <th nowrap>
	    <font class=required>*</font>Categories :
	  </th>
	  <td>
	    <select name="categories" multiple>
~;
  foreach my $x ( @{$params->{cats}} ) {
    print "<option value=$x->{id}";
    print " selected" if $x->{default};
    print ">$x->{name}</option>\n";
  }
print qq~
	      </select>
	  </td>
	</tr>
	<tr>
	  <th>
	    <font class=required>*</font>Price :
	  </th>
	  <td>
	    <input type="text" name="price" value="$params->{item}->{price}" size="20" />
	    <input type="checkbox" name="shipping_included" value="1"
~;
  print " checked" if $params->{item}->{shipping_included};
print qq~
	    >Shipping Included?</input>
	  </td>
	  </tr>
	<tr>
	  <th nowrap>
	    <font class=required>*</font>Description :
	  </th>
	  <td>
	    <textarea name="description" cols="45" rows="8">$params->{item}->{description}</textarea>
	  </td>
	</tr>
	<tr>
	  <th>&nbsp;</th>
	  <td>
	    <input type="checkbox" name="more_than_one" value="1" 
~;
  print " checked" if $params->{item}->{more_than_one};
print qq~
	    >Do you have more than one?</input>
	  </td>
	</tr>
	<tr class=buttons>
	  <td colspan=2 align=center>
	    <input type="submit" name="submitItemInformation" value="Continue >" />
	  </td>
	</tr>
      </tbody>
    </table>
  </form>
    <br>
~;
  printFooter($q, $params);
}

################################################################################
sub printItemPaymentReturn {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_SELL_ITEM}" enctype="multipart/form-data">
      <input type="hidden" name="id" value="$params->{item}->{id}" />
      <input type="hidden" name="edit" value="1" />
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Payment Information</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <b>Preview/Purchase Link :</b>
	  </td>
	  <td>
	    <input type="text" name="payment_url" value="$params->{item}->{payment_url}" size="50"  />
	  </td>
	</tr>
	<tr><td colspan="2"><hr></td></tr>
	<tr>
	  <td colspan="2">
	    <b>Select the payment methods you will accept :</b>
	  </td>
	</tr>
	<tr>
	  <td>
	    <input type="checkbox" name="visa" value="1"
~;
  print " checked" if $params->{item}->{visa};
print qq~
	    >Visa</input>
	  </td>
	  <td>
	    <input type="checkbox" name="paypal" value="1"
~;
  print " checked" if $params->{item}->{paypal};
print qq~
	    >PayPal</input>
	  </td>
	</tr>
	<tr>
	  <td>
	    <input type="checkbox" name="mastercard" value="1"
~;
  print " checked" if $params->{item}->{mastercard};
print qq~
	    >MasterCard</input>
	  </td>
	  <td>
	    <input type="checkbox" name="checks" value="1"
~;
  print " checked" if $params->{item}->{checks};
print qq~
	    >Personal Check</input>
	  </td>
	</tr>
	<tr>
	  <td>
	    <input type="checkbox" name="amex" value="1"
~;
  print " checked" if $params->{item}->{amex};
print qq~
	    >American Express</input>
	  </td>
	  <td>
	    <input type="checkbox" name="money_order" value="1"
~;
  print " checked" if $params->{item}->{money_order};
print qq~
	    >Money Order/Cashier's Check</input>
	  </td>
	</tr>
	<tr>
	  <td>
	    <input type="checkbox" name="discover" value="1"
~;
  print " checked" if $params->{item}->{discover};
print qq~
	    >Discover Card</input>
	  </td>
	  <td>
	    <input type="checkbox" name="other" value="1"
~;
  print " checked" if $params->{item}->{other};
print qq~
	    >Other / See Payment Instructions</input>
	  </td>
	</tr>
	<tr><td colspan="2"><hr></td></tr>
	<tr>
	  <td colspan=2>
	    <b>Enter some clear instructions to assist the buyer with payment and shipping :</b><br />
	    <textarea name="instructions" cols="65" rows="6">$params->{item}->{instructions}</textarea>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Return Policy</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <input type="checkbox" name="accepted" value="1"
~;
  print " checked" if $params->{item}->{accepted};
print qq~
	    >Returns Accepted</input><br />
	  </td>
	</tr>
	<tr>
	  <td>
	    Items must be returned within:
	    <select name="grace">
	      <option value="">--Select One--</option>
	      <option value="3"
~;
  print " selected" if $params->{item}->{grace} == 3;
print qq~
	    >3 Days</option>
	    <option value="7"
~;
  print " selected" if $params->{item}->{grace} == 7;
print qq~
	    >7 Days</option>
	    <option value="14"
~;
  print " selected" if $params->{item}->{grace} == 14;
print qq~
	    >14 Days</option>
	    <option value="30"
~;
  print " selected" if $params->{item}->{grace} == 30;
print qq~
	    >30 Days</option>
	  </select>
	  </td>
	</tr>
	<tr>
	  <td>
	    Refunds will be dispensed in the form of:
	    <select name="type">
	      <option value="">--Select One--</option>
	      <option value="Exchange"
~;
  print " selected" if $params->{item}->{type} eq 'Exchange';
print qq~
	    >Exchange</option>
	    <option value="Merchandise"
~;
  print " selected" if $params->{item}->{type} eq 'Merchandise';
print qq~
	    >Merchandise</option>
	    <option value="Money"
~;
  print " selected" if $params->{item}->{type} eq 'Money';
print qq~
	    >Money Back</option>
	  </select>
	  </td>
	</tr>
	<tr>
	  <td>
	    <b>Refund Policy</b><br>
	    <textarea name="policy" cols="65" rows="6">$params->{item}->{policy}</textarea>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <div align="center">
      <input type="submit" name="submitItemPaymentReturn" value="Continue >" />
    </div>
    <br />
~;
  printFooter($q, $params);
}

################################################################################
sub printItemPictures {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=3>Current Item Pictures</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_SELL_ITEM}" enctype="multipart/form-data" onSubmit="return verifyPicturesCaptions();">
	<input type="hidden" name="id" value="$params->{item}->{id}" />
	<input type="hidden" name="numPictures" value="$params->{item}->{numPictures}" />
	<input type="hidden" name="whichButton" value="0" />
	<input type="hidden" name="edit" value="1" />
      <tbody>
~;
  if ($params->{item}->{pictures} && scalar(@{$params->{item}->{pictures}})) {
    my $i = 1;
    foreach my $picture ( @{$params->{item}->{pictures}} ) {
      $i = $i ? 0 : 1;
      if ($i) {
	print "<tr class=odd>\n";
      } else {
	print "<tr class=even>\n";
      }
print qq~
		<td width="8%">
		  [<a href="$params->{config}->{MARKETPLACE_SELL_ITEM}?submitDeletePictureCaption=1&id=$picture->{item}&picture_id=$picture->{id}" class=small>delete</a>]
		</td>
		<td width="100" height="75" align=left>
		  <img src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$picture->{id}" width="75" height="75" />
		</td>
		<td width="92%">
		  $picture->{caption}
		</td>
	      </tr>
~;
    }
  } else {
print qq~
	      <tr>
		<td colspan=3>
		  Currently, there are no pictures for this item
		</td>
	      </tr>
~;
}
print qq~
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Add a Picture</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <th nowrap>
	    Picture :
	  </th>
	  <td>
	    <input type="file" name="image" size=60 />
	  </td>
	</tr>
	<tr>
	  <th nowrap>
	    Caption :
	  </th>
	  <td>
	    <textarea name="caption" cols="65" rows="3"></textarea>
	  </td>
	</tr>
	<tr><td colspan=2></td></tr>
	<tr class=buttons>
	  <td colspan=2 align=center>
	    <input type=submit name=submitAddPictureCaption value="Upload Picture" onClick="document.formx.whichButton.value=1" />
            &nbsp;&nbsp;&nbsp;
            <input type="submit" name="submitPicturesCaptions" value="Continue >" />
	  </td>
	</tr>
      </tbody>
    </table>
    <br>
  </form>
    <br />
~;
  printFooter($q, $params);
}

################################################################################
sub printItemReview {
  my ($q, $params) = @_;

  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Review $params->{item}->{title}</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_ITEM_REVIEW}" enctype="multipart/form-data" onSubmit="return verifyItemReview();">
	<input type="hidden" name="item" value="$params->{item}->{id}" />
      <tbody>
	<tr>
	  <th>
	    Rating:
	  </th>
	  <td>
	    <input type="radio" name="rating" value="1">1</input>
	    <input type="radio" name="rating" value="2">2</input>
	    <input type="radio" name="rating" value="3" checked>3</input>
	    <input type="radio" name="rating" value="4">4</input>
	    <input type="radio" name="rating" value="5">5</input>
	  </td>
	</tr>
	<tr>
	  <th>
	     <font class=required>*</font> Title:
	  </th>
	  <td>
	    <input type="text" name="title" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	    Pros:
	  </th>
	  <td>
	    <input type="text" name="pros" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	    Cons:
	  </th>
	  <td>
	    <input type="text" name="cons" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	     <font class=required>*</font> Comment:
	  </th>
	  <td>
	    <textarea name="comments" cols="30" rows="5"></textarea>
	  </td>
	</tr>
	<tr class=buttons>
	  <td colspan=2 align=center>
	    <input type="submit" name="submitItemReview" value="Submit Review" />
	  </td>
	</tr>
      </tbody>
    </table>
  </form>
    <br>
~;

  printFooter($q, $params);
}

################################################################################
sub printItemReviewConfirm {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Item Information</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_SELL_ITEM}" enctype="multipart/form-data">
	<input type="hidden" name="id" value="$params->{item}->{id}" />
	<input type="hidden" name="edit" value="1" />
      <tbody>
	<tr>
	  <th>
	    Seller :
	  </th>
	  <td>
	    $params->{item}->{seller_name}
	  </td>
	</tr>
	<tr>
	  <th>
	    HBCU :
	  </th>
	  <td>
	    $params->{item}->{hbcu}
	  </td>
	</tr>
	<tr>
	  <th>
	    Title :
	  </th>
	  <td>
	    $params->{item}->{title}
	  </td>
	</tr>
	<tr>
	  <th>
	    Categories :
	  </th>
	  <td>
	    $params->{item}->{categoryNames}
	  </td>
	</tr>
	<tr>
	  <th>
	    Price :
	  </th>
	  <td>
	    $params->{item}->{price}
	  </td>
	</tr>
	<tr>
	  <th>
	    Description :
	  </th>
	  <td>
	    $params->{item}->{description}
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Pictures & Captions</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <table width="100%" border="0" cellspacing="3" cellpadding="1">
~;
  my $i;
  foreach my $picture ( @{$params->{item}->{pictures}} ) {
    if ($i) {
      print "<tr class=odd>\n";
    } else {
      print "<tr class=even>\n";
    }
print qq~
		    <td align="center" valign="top" width=75>
		      <img src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$picture->{id}" width="75" height="75" />
		    </td>
		    <td valign="top">
		      $picture->{caption}
		    </td>
		  </tr>
~;
  }
print qq~
	    </table>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Payment Methods</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
~;
  if ($params->{item}->{visa}) { print "<img src=$params->{config}->{VISA} />&nbsp;&nbsp;\n"; }
  if ($params->{item}->{mastercard}) { print "<img src=$params->{config}->{MASTERCARD} />&nbsp;&nbsp;\n"; }
  if ($params->{item}->{amex}) { print "<img src=$params->{config}->{AMEX} />&nbsp;&nbsp;\n"; }
  if ($params->{item}->{discover}) { print "<img src=$params->{config}->{DISCOVER} />&nbsp;&nbsp;\n"; }
  if ($params->{item}->{paypal}) { print "<img src=$params->{config}->{PAYPAL} />&nbsp;&nbsp;\n"; }
  print "<br><br>\n";
  if ($params->{item}->{checks}) { print "Personal Check<br><br>\n"; }
  if ($params->{item}->{money_order}) { print "Money Order / Cashier's Check<br><br>\n"; }
  if ($params->{item}->{other}) { print "Other / See Payment Instructions<br><br>\n"; }
print qq~
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Payment Instructions</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    $params->{item}->{instructions}
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Return Policy</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
~;
			if ($params->{item}->{accepted}) {
print qq~
	      Returns Accepted<br>
	      Items must be returned within: $params->{item}->{grace}<br>
		Refunds will be dispensed in the form of: $params->{item}->{type}<br>

~;
if ($params->{item}->{policy}) {
  print "<b>Return Policy:</b> $params->{item}->{policy}\n";
} else {
  print "Returns not accepted\n";
}
}
print qq~
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <div align=center>
      <input type="submit" name="submitReviewConfirm"
~;
			if ($q->param('edit')) {
			  print "value=\"Save Item\"";
			} else {
			  print "value=\"Activate Item\"";
			}
print qq~
	/>
    </div>
    <br>
</form>
~;
  printFooter($q, $params);
}

################################################################################
sub printItemReviews {
  my ($q, $params) = @_;

  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=4>$params->{item}->{title}</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_VIEW_ITEM}" enctype="multipart/form-data">
	<input type="hidden" name="id" value="$params->{item}->{id}" />
      <tbody>
	<tr>
	  <td align="center" width="100" valign="top">
~;
  foreach my $picture (@{ $params->{item}->{pictures} }) {
print qq~
	    <img src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$picture->{id}" width="100" height="100" /><br>
	    <img src=$params->{config}->{MAGNIFY_GLASS} />
	      <a href="#" onClick="window.open('$params->{config}->{MARKETPLACE_VIEW_ITEM}?submitShowLargeImage=1&id=$picture->{item}','LargeView','left=20,top=20,width=725,height=650,toolbar=0,location=0,menubar=0,resizable=1'); return false;">View Larger</a>
~;
last;
}
print qq~
	  </td>
	  <td valign="top">
	    <b>Seller :</b> <a href="$params->{config}->{MARKETPLACE_VIEW_SELLER}?id=$params->{item}->{seller}">$params->{item}->{seller_name}</a><br>
	      <b>Category :</b> $params->{item}->{categoryNames}<br>
		<b>HBCU :</b> $params->{item}->{hbcu}<br>
		  <b>Price :</b> $params->{item}->{price}<br>
		    <b>Item Views :</b> $params->{item}->{hits}<br><br>
		      <input type="submit" name="submitGotoPurchase" value="Buy Now!" />
	  </td>
	  <td height="100%" width="1">
	    <table background=$params->{config}->{VSEP} width="1" height="100%" cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td>
	  <td valign="top" width=125 align=center>
~;
  if ($params->{item}->{totalReviews}) {
    foreach my $star (@{ $params->{item}->{stars} }) {
      print "<img src=$star->{star} />";
    }
    print "<br>\n";
  } else {
    print "No Ratings<br>\n";
  }
  print "Average User Rating<br>\n";

  if ($params->{item}->{totalReviews}) {
    print "<a href=\"$params->{config}->{MARKETPLACE_ITEM_REVIEW}?item=$params->{item}->{id}&showReviews=1\">Read $params->{item}->{totalReviews} Reviews</a><br>\n";
  }
print qq~
		  <a href="$params->{config}->{MARKETPLACE_ITEM_REVIEW}?item=$params->{item}->{id}">Write a Review</a><br>
	  </td>
	</tr>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Product Description</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    $params->{item}->{description}
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>User Reviews</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
                            <table width="100%" border="0" cellspacing="2" cellpadding="2">
~;
  foreach my $review ( @{ $params->{item}->{reviews} } ) {
print qq~
                              <tr>
                                <td valign="top" width="150">
                                  <font size=2>Rating:</font>
~;
foreach my $star ( @{ $review->{stars} } ) {
  print "<img src=$star->{star} />\n";
}
print qq~
                                </td>
                                <td>
                                  <font size=3><b>$review->{title}</b></font>, <font size=2>$review->{date_created}</font><br />
                                  <font size=2>Reviewer: <a href="$params->{config}->{MEMBER_MAIN}?registry_id=$review->{registry_id}\"><font size=2>$review->{registry_data}->{name}</a>
 <!-- - <a href="$params->{config}->{MARKETPLACE_ITEM_REVIEW}?showSellerReviews=1&id=$review->{registry_data}->{registry_id}"><font size=2>See all $review->{registry_data}->{name}'s reviews</font></a><br> -->
~;
if ($review->{useful} || $review->{not_useful}) {
  print "<br /><font size=2>$review->{useful} out of ", ($review->{not_useful} + $review->{useful}), " found this review helpful!<br>\n";
}
print qq~
                                  <br>
                                  <b>Pros:</b> $review->{pros}<br>
                                  <b>Cons:</b> $review->{cons}<br><br>
                                  $review->{comments}
                                  <br><br>
                                  <b>Was this review helpful to you?
                                  <a href="$params->{config}->{MARKETPLACE_ITEM_REVIEW}?addUseful=1&id=$review->{id}&item=$params->{item}->{id}">Yes</a>
                                  &nbsp;&nbsp;
                                  <a href="$params->{config}->{MARKETPLACE_ITEM_REVIEW}?addNotUseful=1&id=$review->{id}&item=$params->{item}->{id}">No</a>
                                </td>
                              </tr>
                              <tr><td colspan=2><hr style="border: thin dotted #632100"></td></tr>
~;
}
print qq~
                            </table>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>
~;

  printFooter($q, $params);
}

################################################################################
sub printItemReviewThankYou {
  my ($q, $params) = @_;

  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Review $params->{item}->{title}</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <br>
	    Thank you for submitting your review for the $params->{item}->{title}!<br /><br /><a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$params->{item}->{id}">Click here</a> to return to the item page.
	      <br><br>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>
~;

  printFooter($q, $params);
}

################################################################################
sub printLargeViewItem {
  my ($q, $params) = @_;

  print $q->header();

print qq~
<html>
  <head>
    <link rel="StyleSheet" href=$params->{config}->{CSS_URL} type="text/css">
  </head>
  <body>
    <table class=data width=100%>
      <thead>
	<tr>
	  <th>$params->{item}->{title}</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
~;
  foreach my $picture ( @{$params->{item}->{pictures}} ) {
    print "<img src=\"http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$picture->{id}\" width=700 height=600 /><br>";
    last;
  }
print qq~
	  </td>
	</tr>
      </tbody>
    </table>

    <div align=center>
      <br><a href="#" onClick="window.close();">Click here to close this window</a><br>
    </div>

</body>
</html>
~;
}

################################################################################
sub printListItems {
  my ($q, $params) = @_;

print qq~
  <table width="100%" border="0" cellspacing="2" cellpadding="1">

~;
  foreach my $item ( @{$params->{records}} ) {
print qq~

    <tr><td colspan=2><hr></td></tr>
    <tr>
      <td align="center" valign="top" width="100" height="100">
        <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$item->{id}"><img src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$item->{picture}->{id}" width="75" height="75" border="0" /></a><br>

~;
if ($item->{totalReviews}) {
  foreach my $star ( @{$item->{stars}} ) {
print qq~
	    <img src=$params->{config}->{STAR} />
~;
}
print qq~
		<br />
		<a class=small href="$params->{config}->{MARKETPLACE_ITEM_REVIEW}?item=$item->{id}&showReviews=1">Read $item->{totalReviews} Reviews</a>
~;
} else {
print qq~
		    <a class=small href="$params->{config}->{MARKETPLACE_ITEM_REVIEW}?item=$item->{id}">Write a Review</a>
~;
}
print qq~

      </td>
      <td valign="top">
	<a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$item->{id}">$item->{title}</a><br>
	$item->{description}<br>
	$item->{price} - 
        <a href="$params->{config}->{MARKETPLACE_VIEW_SELLER}?id=$item->{seller}">$item->{seller_name}</a>
        <br>
      </td>
    </tr>
~;
}
print qq~
  </table>
~;
}

################################################################################
sub printMain {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

  printQuickSearch($q, $params);

  printMarketplaceNews($q, $params);

  printFeaturedItems($q, $params) if $params->{featuredItems};

  printFeaturedSellers($q, $params) if $params->{featuredSellers};

  printFooter($q, $params);
}

################################################################################
sub printMarketplaceNews {
  my ($q, $params) = @_;

print qq~
<table class=data style="width: 100%;">
  <tr>
    <th><div align=left>&nbsp;Marketplace News</div></th>
  </tr>
  <tbody>
    <tr><td></td></tr>
    <tr>
      <td>
	Welcome to the $params->{config}->{SITE} Marketplace!<br>
	What is our vision for the Marketplace? We envision the $params->{config}->{SITE} Marketplace as a place where you can find and acquire the latest and hottest Gear fresh from the hottest suppliers all over the country!
	Got Ideas? <a href=$params->{config}->{MARKETPLACE_CONTACT_US}>Send Feedback!</a>.
      </td>
    </tr>
    <tr><td></td></tr>
  </tbody>
</table>
<br />
~;
}

################################################################################
sub printMarketplaceToolkit {
  my ($q, $params) = @_;

print qq~
<table class=data style="width: 97%;">
  <tr>
    <th colspan=2><div align=left>&nbsp;Marketplace Toolkit</div></th>
  </tr>
  <tbody>
    <tr><td></td></tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_MAIN}">Marketplace Home</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_SELL_ITEM}">Sell Item</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_SEARCH}">Advanced Search</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_MY_SUMMARY}">My Summary</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_REGISTRY}?edit=1">My Store</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="#" onClick="window.open('$params->{config}->{MARKETPLACE_CONTACT_US}','$params->{config}->{DOMAIN}','width=550,height=500,toolbar,resizable');">Ask a Quick Question</a>
      </td>
    </tr>
    <tr><td></td></tr>
  </tbody>
</table>
    <br>
~;
}

################################################################################
sub printMerchantInfo {
  my ($q, $params) = @_;

  printMerchantInfoHow($q, $params) && exit if $q->param('how');
  printMerchantInfoPricing($q, $params) && exit if $q->param('pricing');
  printMerchantInfoRequirements($q, $params) && exit if $q->param('requirements');
  printMerchantInfoOverview($q, $params);
}

################################################################################
sub printMerchantInfoHow {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>How It Works</th>
	</tr>
      </thead>
      <tbody>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td width=25% valign=top>
	    <b>Create Your Account</b>
	  </td>
	  <td>
	    Fill out our online registration form to create your account in just minutes.  No credit card or account information is required.
	  </td>
	</tr>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td valign=top>
	    <b>Manage Your Account</b>
	  </td>
	  <td>
	    Add product information on items you are offering to your account. View reports of how your products are doing on the $params->{config}->{SITE}. Set up email notifications in connection with your products.
	  </td>
	</tr>
	<tr>
	  <td colspan=2 align=center>
	    <br>
	    <a href="$params->{config}->{MARKETPLACE_REGISTRY}">Signup</a> now and start listing your products today!
	  </td>
	</tr>
	<tr><td colspan=2></td></tr>
      </tbody>
    </table>
    <br>

</td>
<td valign=top>
~;

  printMerchantInfoLinks($q, $params);

  printFooter($q, $params);
}

################################################################################
sub printMerchantInfoOverview {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Merchant Overview</th>
	</tr>
      </thead>
      <tbody>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td width=25% valign=top>
	    <b>Promote Your Products</b>
	  </td>
	  <td>
	    Thousands of people visit $params->{config}->{DOMAIN} each day, and many are looking for the products you are selling.
	  </td>
	</tr>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td valign=top>
	    <b>It's Free!!!</b>
	  </td>
	  <td>
	    Unlike other online shopping web sites such as Yahoo and Ebay, $params->{config}->{SITE} Marketplace currently costs nothing! No credit card numbers are required and no cost-per-click fees.  The $params->{config}->{SITE} Marketplace is <b>FREE</b>!!!
	  </td>
	</tr>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td valign=top>
	    <b>It's Easy</b>
	  </td>
	  <td>
	    With the $params->{config}->{site} Marketplace, you easily manage and monitor your product information through our simple web interface.
	  </td>
	</tr>
	<tr>
	  <td colspan=2 align=center>
	    <br>
	    <a href="$params->{config}->{MARKETPLACE_REGISTRY}">Signup</a> now and start listing your products today!
	  </td>
	</tr>
	<tr><td colspan=2></td></tr>
      </tbody>
    </table>
    <br>

</td>
<td valign=top>
~;

  printMerchantInfoLinks($q, $params);

  printFooter($q, $params);
}

################################################################################
sub printMerchantInfoLinks {
  my ($q, $params) = @_;

print qq~
<table class=data style="width: 175;">
  <tr>
    <th><div align=left>&nbsp;Merchant Links</div></th>
  </tr>
  <tbody>
    <tr><td></td></tr>
    <tr>
      <td>
        <img src=$params->{config}->{BULLET} />
        <a href="$params->{config}->{MARKETPLACE_MERCHANT_INFO}">Merchant Overview</a>
      </td>
    </tr>
    <tr>
      <td>
        <img src=$params->{config}->{BULLET} />
        <a href="$params->{config}->{MARKETPLACE_MERCHANT_INFO}?how=1">How It Works</a>
      </td>
    </tr>
    <tr>
      <td>
        <img src=$params->{config}->{BULLET} />
        <a href="$params->{config}->{MARKETPLACE_MERCHANT_INFO}?pricing=1">Pricing</a>
      </td>
    </tr>
    <tr>
      <td>
        <img src=$params->{config}->{BULLET} />
        <a href="$params->{config}->{MARKETPLACE_MERCHANT_INFO}?requirements=1">Requirements</a>
      </td>
    </tr>
    <tr>
      <td>
        <img src=$params->{config}->{BULLET} />
        <a href="$params->{config}->{MARKETPLACE_REGISTRY}">Signup Now!</a>
      </font>
      </td>
    </tr>
    <tr><td></td></tr>
  </tbody>
</table>
<br />
~;
}


################################################################################
sub printMerchantInfoPricing {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Pricing</th>
	</tr>
      </thead>
      <tbody>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td width=25% valign=top>
	    <b>It's FREE!!!</b>
	  </td>
	  <td>
	    The $params->{config}->{SITE} Marketplace is absolutely free!
	  </td>
	</tr>
	<tr>
	  <td colspan=2 align=center>
	    <br>
	    <a href="$params->{config}->{MARKETPLACE_REGISTRY}">Signup</a> now and start listing your products today!
	  </td>
	</tr>
	<tr><td colspan=2></td></tr>
      </tbody>
    </table>
    <br>

</td>
<td valign=top>
~;

  printMerchantInfoLinks($q, $params);
  printFooter($q, $params);
}

################################################################################
sub printMerchantInfoRequirements {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Requirements</th>
	</tr>
      </thead>
      <tbody>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td width=25% valign=top>
	    <b>$params->{config}->{SITE} Account</b>
	  </td>
	  <td>
	    All you need to list products in the $params->{config}->{SITE} Marketplace is an $params->{config}->{SITE} account.  The $params->{config}->{SITE} Marketplace is absolutely free!
	  </td>
	</tr>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td width=25% valign=top>
	    <b>Shipping</b>
	  </td>
	  <td>
	    You must be able to sell and ship products anywhere in the United States of America.
	  </td>
	</tr>
	<tr><td colspan=2><hr></td></tr>
	<tr>
	  <td width=25% valign=top>
	    <b>Terms of Use</b>
	  </td>
	  <td>
	    You must agree to and abide by the $params->{config}->{SITE} Terms of Use policy.  To view the policy, <a href="$params->{config}->{DOMAIN}/terms.shtml">click here</a>.
	  </td>
	</tr>
	<tr>
	  <td colspan=2 align=center>
	    <br>
	    <a href="$params->{config}->{MARKETPLACE_REGISTRY}">Signup</a> now and start listing your products today!
	  </td>
	</tr>
	<tr><td colspan=2></td></tr>
      </tbody>
    </table>
    <br>

</td>
<td valign=top>
~;

  printMerchantInfoLinks($q, $params);
  printFooter($q, $params);
}

################################################################################
sub printMustLogIn {
  my ($q, $params) = @_;

  print $q->header;

  print $params->{config}->{HEADER};

  &printLogIn($q);

  print $params->{config}->{FOOTER};
}

################################################################################
sub printMyItemsForSale {
  my ($q, $params) = @_;

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=6>My Items For Sale</th>
	</tr>
      </thead>
      <form name="items_for_sale_form" method="post" action="$params->{config}->{MARKETPLACE_MY_SUMMARY}">
	<input type="hidden" name="order_by" value="$params->{items_for_sale}->{order_by}" />
	<input type="hidden" name="items_for_sale" value="1" />
      <tbody>
~;
  if (scalar(@{$params->{items_for_sale}->{records}})) {
print qq~
	  <tr class=search_columns>
	    <td width=5%>&nbsp;</td>
	    <td>
	      Item #
	    </td>
	    <td>
	      <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{items_for_sale}->{current_page}&order_by=title">Title</a>
	    </td>
	    <td>
	      <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{items_for_sale}->{current_page}&order_by=hits"># of Views
	    </td>
	    <td>
	      <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{items_for_sale}->{current_page}&order_by=num_sold"># Sold
	    </td>
	    <td>
	      <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{items_for_sale}->{current_page}&order_by=status">Status
	    </td>
	  </tr>

~;
my $i;
foreach my $record ( @{$params->{items_for_sale}->{records}} ) {
  if ($i) {
    print "<tr class=odd>\n"; $i = 0;
  } else {
    print "<tr class=even>\n"; $i = 1;
  }
print qq~
		<td>
		  <input type="checkbox" name="ids" value="$record->{id}" />
		</td>
		<td>
		  $record->{id}
		</td>
		<td>
		  <a href="$params->{config}->{MARKETPLACE_SELL_ITEM}?edit=1&id=$record->{id}">$record->{title}</a>
		</td>
		<td align=center>
		  $record->{hits}
		</td>
		<td align=center>
		  $record->{num_sold}
		</td>
		<td>
		  $record->{status}
		</td>
	      </tr>
~;
}
print qq~

	    <tr class=buttons>
	      <td colspan=3 valign=top>
		&nbsp;
		<img src=$params->{config}->{LEFT_ARROW} />
		  With Selected:
		  <select name="action" onChange="if (document.items_for_sale_form.action.value) { document.items_for_sale_form.submit();}">
		    <option value="">--Select--</option>
		    <option value="Activate">Activate</option>
		    <option value="Deactivate">Deactivate</option>
		    <option value="Delete">Delete</option>
		  </select>
	      </td>
	      <td colspan=3>
		$params->{items_for_sale}->{start_record} - $params->{items_for_sale}->{end_record} of $params->{items_for_sale}->{total_records} Records
		      |
~;
if ($params->{items_for_sale}->{previous_page}) {
  print "<a href=\"$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{items_for_sale}->{previous_page}&order_by=$params->{items_for_sale}->{order_by}\">Previous Page</a>\n";
} else {
  print "Previous Page\n";
}
print "|\n";

if ($params->{items_for_sale}->{next_page}) {
  print "<a href=\"$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{items_for_sale}->{next_page}&order_by=$params->{items_for_sale}->{order_by}\">Next Page</a>\n";
} else {
  print "Next Page\n";
}
print qq~
	      </td>
	    </tr>
~;
} else {
print qq~
	      <tr>
		<td colspan="2">
		  You currently have no items for sale.
		</td>
	      </tr>
~;
}
print qq~
      </tbody>
    </table>
  </form>
    <br>
~;
}

################################################################################
sub printMyPurchasedItems {
  my ($q, $params) = @_;

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=7>My Purchased Items</th>
	</tr>
      </thead>
      <tbody>
      <form name="purchased_items_form" method="post" action="$params->{config}->{MARKETPLACE_MY_SUMMARY}">
	<input type="hidden" name="order_by" value="$params->{purchased_items}->{order_by}" />
	<input type="hidden" name="purchased_items" value="1" />
~;
  if (scalar(@{$params->{purchased_items}->{records}})) {
print qq~
	<tr class=search_columns>
	    <td width="5%">&nbsp;</td>
	  <td>
	    Item #</font>
	  </td>
	  <td>
	    <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{purchased_items}->{current_page}&order_by=title">Title</a></font>
	  </td>
	  <td>
	    <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{purchased_items}->{current_page}&order_by=quantity">Qty</font>
	  </td>
	  <td>
	    <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{purchased_items}->{current_page}&order_by=total">Total Price</font>
	  </td>
	  <td>
	    <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{purchased_items}->{current_page}&order_by=tstamp">Date</font>
	  </td>
	  <td>
	    <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{purchased_items}->{current_page}&order_by=seller">Seller</font>
	  </td>
	</tr>
~;
my $i;
foreach my $record (@{ $params->{purchased_items}->{records} } ) {
  if ($i) {
    print "<tr class=odd>\n"; $i = 0;
  } else {
    print "<tr class=even>\n"; $i = 1;
  }
print qq~
 	      <td width="5%">
		<input type="checkbox" name="ids" value="$record->{id}" />
	      </td>
	      <td align=center>
		$record->{id}
	      </td>
	      <td>
		$record->{title}
	      </td>
	      <td align=center>
		$record->{quantity}
	      </td>
	      <td>
		$record->{total}
	      </td>
	      <td>
		$record->{date_created}
	      </td>
	      <td>
		$record->{seller_name}
	      </td>
	    </tr>
~;
}
print qq~
	    <tr class=buttons>
	      <td>
		&nbsp;
		<img src=$params->{config}->{LEFT_ARROW} />
	      </td>
	      <td colspan=6>
		With Selected:
		<select name="action" onChange="if (document.purchased_items_form.action.value) { document.purchased_items_form.submit();}">
		  <option value="">--Select--</option>
		  <option value="Hide">Hide</option>
		</select>
	      $params->{purchased_items}->{start_record} - $params->{purchased_items}->{end_record} of $params->{purchased_items}->{total_records} Records
		    |
~;
if ($params->{purchased_items}->{previous_page}) {
  print "<a href=\"$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{purchased_items}->{previous_page}&order_by=$params->{purchased_items}->{order_by}\">Previous Page</a>\n";
} else {
  print "Previous Page\n";
}
print "|\n";

if ($params->{purchased_items}->{next_page}) {
  print "<a href=\"$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{purchased_items}->{next_page}&order_by=$params->{purchased_items}->{order_by}\">Next Page</a>\n";
} else {
  print "Next Page\n";
}
print qq~
	    </td>
	  </tr>
~;
} else {
print qq~
	    <tr>
	      <td colspan=7>
		You currently have no purchased items.
	      </td>
	    </tr>
~;
}
print qq~
      </tbody>
    </table>
  </form>
    <br>
~;
}

################################################################################
sub printMySavedItems {
  my ($q, $params) = @_;

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=5>My Saved Items</th>
	</tr>
      </thead>
      <form name="saved_items_form" method="post" action="$params->{config}->{MARKETPLACE_MY_SUMMARY}">
	<input type="hidden" name="order_by" value="$params->{saved_items}->{order_by}" />
	<input type="hidden" name="saved_items" value="1" />
      <tbody>
~;
  if (scalar(@{$params->{saved_items}->{records}})) {
print qq~
	  <tr class=search_columns>
	    <td width="5%">&nbsp;</td>
	    <td align="center">
	      Picture
	    </td>
	    <td>
	      <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{saved_items}->{current_page}&order_by=title">Title
	    </td>
	    <td>
	      <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{saved_items}->{current_page}&order_by=price">Price</a>
	    </td>
	    <td>
	      <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{saved_items}->{current_page}&order_by=seller">Seller
	    </td>
	  </tr>
~;
my $i;
foreach my $record (@{ $params->{saved_items}->{records} }) {
  if ($i) {
    print "<tr class=odd>\n"; $i = 0;
  } else {
    print "<tr class=even>\n"; $i = 1;
  }
print qq~
		<td width="5%">
		  <input type="checkbox" name="ids" value="$record->{id}" />
		</td>  
		<td align="left" width="60" height="60">
		  <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$record->{id}"><img src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$record->{picture}->{id}" width="60" height="60" border="0" /></a>
		</td>
		<td>
		  <a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?id=$record->{id}">$record->{title}</a>
		</td>
		<td>
		  <font class=emph>$record->{price}</font>
		</td>
		<td>
		  $record->{seller_name}
		</td>
	      </tr>
~;
}
print qq~
	    <tr class=buttons>
	      <td>
		&nbsp;
		<img src=$params->{config}->{LEFT_ARROW} />
	      </td>
	      <td colspan=4>
		With Selected:
		<select name="action" onChange="if (document.saved_items_form.action.value) { document.saved_items_form.submit();}">
		  <option value="">--Select--</option>
		  <option value="Delete">Delete</option>
		</select>
		$params->{saved_items}->{start_record} - $params->{saved_items}->{end_record} of $params->{saved_items}->{total_records} Records
		      |
~;
if ($params->{saved_items}->{previous_page}) {
  print "<a href=\"$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{saved_items}->{previous_page}&order_by=$params->{saved_items}->{order_by}\">Previous Page</a>\n";
} else {
  print "Previous Page\n";
}
print "|\n";

if ($params->{saved_items}->{next_page}) {
  print "<a href=\"$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{saved_items}->{next_page}&order_by=$params->{saved_items}->{order_by}\">Next Page</a>\n";
} else {
  print "Next Page\n";
}
print qq~
	      </td>
	    </tr>
~;
} else {
print qq~
	      <tr>
		<td colspan=5>
		  You currently have no saved items.
		</td>
	      </tr>
~;
}
print qq~
      </tbody>
    </table>
  </form>
    <br>
~;
}

################################################################################
sub printMySavedSearches {
  my ($q, $params) = @_;

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>My Saved Searches</th>
	</tr>
      </thead>
      <form name="saved_searches_form" method="post" action="$params->{config}->{MARKETPLACE_MY_SUMMARY}">
	<input type="hidden" name="order_by" value="$params->{saved_searches}->{order_by}" />
	<input type="hidden" name="saved_searches" value="1" />
      <tbody>
~;
  if (scalar(@{$params->{saved_searches}->{records}})) {
print qq~
	  <tr class=search_columns>
	    <td width="5%">&nbsp;</td>
	    <td>
	      <a class=white href="$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{saved_searches}->{current_page}&order_by=name">Name of Search</a>
	    </td>
	  </tr>
~;
my $i;
foreach my $record ( @{ $params->{saved_searches}->{records} } ) {
  if ($i) {
    print "<tr class=odd>\n"; $i = 0;
  } else {
    print "<tr class=even>\n"; $i = 1;
  }
print qq~
		<td>
		  <input type="checkbox" name="ids" value="$record->{id}" />
		</td>
		<td>
		  <a href="$params->{config}->{MARKETPLACE_SEARCH}?submitSavedSearch=1&id=$record->{id}">$record->{name}</a>
		</td>
	      </tr>
~;
}
print qq~
	    <tr class=buttons>
	      <td valign=middle>
		&nbsp;
		<img src=$params->{config}->{LEFT_ARROW} />
	      </td>
	      <td>
		With Selected:
		<select name="action" onChange="if (document.saved_searches_form.action.value) { document.saved_searches_form.submit();}">
		  <option value="">--Select--</option>
		  <option value="Delete">Delete</option>
		</select>
		$params->{saved_searches}->{start_record} - $params->{saved_searches}->{end_record} of $params->{saved_searches}->{total_records} Records
		      |
~;
if ($params->{saved_searches}->{previous_page}) {
  print "<a href=\"$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{saved_searches}->{previous_page}&order_by=$params->{saved_searches}->{order_by}\">Previous Page</a>\n";
} else {
  print "Previous Page\n";
}
print "|\n";

if ($params->{saved_searches}->{next_page}) {
  print "<a href=\"$params->{config}->{MARKETPLACE_MY_SUMMARY}?current_page=$params->{saved_searches}->{next_page}&order_by=$params->{saved_searches}->{order_by}\">Next Page</a>\n";
} else {
  print "Next Page\n";
}
print qq~
	      </td>
	    </tr>
~;
} else {
print qq~
	      <tr>
		<td colspan="2">
		  You currently have no saved searches.
		</td>
	      </tr>
~;
}
print qq~
      </tbody>
    </table>
  </form>
    <br>
~;
}

################################################################################
sub printMySummary {
  my ($q, $params) = @_;

  printHeader($q, $params);

  printMyItemsForSale($q, $params);
  printMySavedItems($q, $params);
  printMySavedSearches($q, $params);
  printMyPurchasedItems($q, $params);

  printFooter($q, $params);
}

################################################################################
sub printPurchaseConfirmation {
  my ($q, $params) = @_;

  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Purchase Confirmation</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <br>
	    Thank you for using the $params->{config}->{SITE} Marketplace! Information regarding your purchase has been sent to the seller. Remember, all inquiries with regard to items you have purchased should be directed to the seller.<br><br>
	      We encourage you to <a href="#" onClick="window.open('$params->{config}->{MARKETPLACE_PURCHASE}?receipt=1&id=$params->{id}','$params->{config}->{DOMAIN}','width=550,height=500,toolbar,resizable');">click here</a> to view a printable receipt of this transaction.<br><br>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>
~;

  printFooter($q, $params);
}

################################################################################
sub printPurchaseItem {
  my ($q, $params) = @_;

  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Purchase Confirmation</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_PURCHASE}">
	<input type="hidden" name="id" value="$params->{item}->{id}" />
	<input type="hidden" name="total" value="$params->{item}->{total}" />
      <tbody>
	<tr>
	  <th>
	    Item ID :
	  </th>
	  <td>
	    $params->{item}->{id}
	  </td>
	</tr>
	<tr>
	  <th>
	    Title :
	  </th>
	  <td>
	    $params->{item}->{title}
	  </td>
	</tr>
	<tr>
	  <th>
	    Seller :
	  </th>
	  <td>
	    $params->{item}->{seller_name}
	  </td>
	</tr>
	<tr>
	  <th>
	    Category :
	  </th>
	  <td>
	    $params->{item}->{categoryNames}
	  </td>
	</tr>
	<tr>
	  <th>
	    Price :
	  </th>
	  <td>
	    $params->{item}->{price}
~;
  if ($params->{item}->{shipping_included}) {
    print "(Shipping Included)\n";
  } else {
    print "(Shipping Not Included)\n";
  }
print qq~
	  </td>
	</tr>

~;
  if ($params->{item}->{more_than_one}) {
print qq~
	  <tr>
	    <th>
	      Quantity :
	    </th>
	    <td>
	      <input type="text" name="quantity" value="$params->{item}->{quantity}" size="5"/>&nbsp;&nbsp;&nbsp;
	      <input type="submit" name="submitUpdateTotal" value="Update Total" />
	    </td>
	  </tr>
~;
}
print qq~
	  <tr>
	    <td colspan="2"><hr></td>
	  </tr>
	  <tr>
	    <th>
	      <b>Total Price :
	    </th>
	    <td>
	      $params->{item}->{total}
	    </td>
	  </tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Confirmation Information</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
~;
if ($params->{item}->{payment_url}) {
print qq~
	      <b>It's Simple!</b>
	      Clicking the "Buy Now" button will take you to the vendor's payment page to complete the transaction.  We will also keep track of your attempt to buy this item for your records and also for the seller's fullfillment records.
~;
} else {
print qq~
		<b>It's Simple!</b>
		Clicking the "Buy Now" button will track your desire to purchase this item and also notify the seller such that the seller can make payment and shipping arrangements with you personally.
~;
}
print qq~
	      <br><br>
	      <b>Buyers and sellers will be able to submit positive or negative feedback after the transaction.</b><br /><br />
	  </td>
	</tr>
	<tr class=buttons>
	  <td colspan="2" align="center">
	    <input type="submit" name="submitPurchase" value="Buy Now!" onClick="return confirm('Are you sure you want to purchase this item?');" />
	  </td>
	</tr>
      </tbody>
    </table>
  </form>
    <br>
~;

  printFooter($q, $params);
}

################################################################################
sub printPurchaseReceipt {
  my ($q, $params) = @_;

  print $q->header();

print qq~
<html>
  <head>
    <link rel="StyleSheet" href=$params->{config}->{CSS_URL} type="text/css">
  </head>
  <body>
    <table class=data>
      <thead>
	<tr>
	  <th colspan=2>Receipt of Purchase</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_PURCHASE}">
	<input type="hidden" name="id" value="$params->{purchase}->{item}->{id}>" />
	<input type="hidden" name="total" value="$params->{purchase}->{total}" />
      <tbody>
	<tr>
	  <th>
	    Item ID :
	  </th>
	  <td>
	    $params->{purchase}->{item}->{id}
	  </td>
	</tr>
	<tr>
	  <th>
	    Title :
	  </th>
	  <td>
	    $params->{purchase}->{title}
	  </td>
	</tr>
	<tr>
	  <th>
	    Seller :
	  </th>
	  <td>
	    $params->{purchase}->{seller}->{name}
	  </td>
	</tr>
	<tr>
	  <th>
	    Category :
	  </th>
	  <td>
	    $params->{purchase}->{item}->{categoryNames}
	  </td>
	</tr>
	<tr>
	  <th>
	    Price :
	  </th>
	  <td>
	    $params->{purchase}->{price}
~;
  if ($params->{purchase}->{item}->{shipping_included}) {
    print "(Shipping Included)\n";
  } else {
    print "(Shipping Not Included)\n";
  }
print qq~
	  </td>
	</tr>
	<tr>
	  <th>
	    Quantity :
	  </th>
	  <td>
	    $params->{purchase}->{quantity}
	  </td>
	</tr>
	<tr>
	  <td colspan="2"><hr></td>
	</tr>
	<tr>
	  <th>
	    <b>Total Price :
	  </th>
	  <td>
	    $params->{purchase}->{total}
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data>
      <thead>
	<tr>
	  <th colspan=2>Confirmation Information</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <b>You have agreed to a contract</b> -- You have entered into a legally binding contract to purchase the item from the seller. You are responsible for reading the full item listing, including the seller's instructions and accepted payment methods. Seller assumes all responsibility for listing this item.<br><br>
	  </td>
	</tr>
      </tbody>
    </table>
  </form>
    <br>

    <div align="center">
      <a href="#" onClick="window.close();">Click here to close this window</a>
    </div>
</body>
</html>
~;
}

################################################################################
sub printQuickSearch {
  my ($q, $params) = @_;

print qq~
<table class=data style="width: 100%;">
  <tr>
    <th colspan=2><div align=left>&nbsp;Quick Search (<a class=small href="$params->{config}->{MARKETPLACE_SEARCH}">Advanced Search</a>)</div></th>
  </tr>
  <tbody>
    <tr><td colspan=2></td></tr>
    <form name=form method=post action="$params->{config}->{MARKETPLACE_SEARCH}">
    <tr>
      <td>
	<select name=category>
	  <option value="">All Categories</option>
~;
  foreach my $cat ( @{$params->{categories}} ) {
print qq~
	  <option value="$cat->{id}">$cat->{name}</option>
~;
}
print qq~
	</select>
      </td>
      <td align=right>
	<input name=keywords size=40>
	<input type=submit name=submitSearch value="Search">
      </td>
    </tr>
  </form>
    <tr><td colspan=2></td></tr>
  </tbody>
</table>
<br />
~;
}

################################################################################
sub printSearchDisplayInfo {
  my ($q, $results) = @_;

print qq~
    Displaying $results->{start_record} - $results->{end_record} of about $results->{total_records} Items |
~;
  if ($results->{previous_page}) {
print qq~
	      <a class=white href="#" onClick="document.form.submitSearch.value=1;document.form.page.value=$results->{previous_page};document.form.submit();return false;"><--Previous Page</a>
~;
} else {
print qq~
		<--Previous Page
~;
}
print qq~

	      |

~;
  if ($results->{next_page}) {
print qq~
		<a class=white href="#" onClick="document.form.submitSearch.value=1;document.form.page.value=$results->{next_page};document.form.submit();return false;">Next Page--></a>
~;
} else {
print qq~
		  Next Page-->
~;
}
}

################################################################################
sub printSearchForm {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data>
      <thead>
	<tr>
	  <th colspan=2>Advanced Marketplace Search</th>
	</tr>
      </thead>
      <tbody>
	<tr class=odd>
	  <td>
~;
  if ($params->{admin}) {
    print "<form name=form method=post action=\"$params->{config}->{MARKETPLACE_ADMIN_SEARCH}\">\n";
  } else {
    print "<form name=form method=post action=\"$params->{config}->{MARKETPLACE_SEARCH}\">\n";
  }
print qq~
	    <table width=100%>
	      <tr>
		<td valign="top" width="20%">
		  <b>Keyword Search :</b><br />
		  <input type="text" name="keywords" size="60" /><br />
		  <input type="checkbox" name="title_and_description" value="1">Search Title <b>and</b> Description</input>
		</td>
	      </tr>
	      <tr>
		<td>
		  <b>HBCU :</b><br />
		  <select name="hbcu">
		    <option value="">All HBCUs</option>
~;
  foreach my $hbcu ( $params->{hdb}->getHbcuDatas(ORDER => 'hbcu_name') ) {
print qq~
		    <option value="$hbcu->{hbcu_name}">$hbcu->{hbcu_name}</option>
~;
}
print qq~
		  </select>
		</td>
	      </tr>
	      <tr>
		<td>
		  <b>Category :</b><br />
		  <select name="category">
		    <option value="">All Categories</option>
~;
  foreach my $cat ( @{$params->{categories}} ) {
print qq~
		    <option value="$cat->{id}">$cat->{name}</option>
~;
}
print qq~
		  </select>
		</td>
	      </tr>
	      <tr>
		<td>
		  <b>Min Price :</b><br />
		  <input type="text" name="min_price" size="20" />
		</td>
	      </tr>
	      <tr>
		<td>
		  <b>Max Price :</b><br />
		  <input type="text" name="max_price" size="20" />
		</td>
	      </tr>
	      <tr>
		<td>
		  <b>Specific Seller :</b><br />
		  <input type="text" name="sellers" size="40" />
		</td>
	      </tr>
~;
  if ($params->{authorized} && !$params->{admin}) {
print qq~
		<tr><td></td></tr>
		<tr>
		  <td>
		    <input type="checkbox" name="saveSearch" value="1" onChange="if (document.form.saveSearch.checked) {document.getElementById('search_name').style.display = '';} else {document.getElementById('search_name').style.display = 'none';}">Add this search to my Favorite Searches</input>
		  </td>
		</tr>
		<tr id=search_name style="display: none;">
		  <td>
		    <b>Search Name :</b><br />
		    <input type="text" name="search_name" size="40" />
		  </td>
		</tr>
~;
} elsif ($params->{admin}) {
print qq~
	      <tr>
		<td>
		  <b>Status :</b><br />
		  <select name="status">
		    <option value="">All Items</option>
		    <option value="activated">Activated</option>
		    <option value="deactivated">Deactivated</option>
		    <option value="deleted">Deleted</option>
		  </select>
		</td>
	      </tr>

~;
}
print qq~
	    </table>
	  </td>
	  <td valign=top align=center>
	    <table>
	      <thead>
		<tr>
		  <th>Featured Sponsor</th>
		</tr>
	      </thead>
	      <tbody>
		<tr>
		  <td>
                     <script type="text/javascript">
                       GA_googleFillSlot("300x250-2");
                     </script>

		  </td>
		</tr>
	      </tbody>
	    </table>
	  </td>
	</tr>
	<tr class=buttons>
	  <td colspan=2 align=center>
	    <input type=radio name=grid_view value="0" checked> List View
	    <input type=radio name=grid_view value="1"> Grid View
	    &nbsp;&nbsp;
	    <input type=submit name=submitSearch value="Start Search!">
	  </td>
	</tr>
      </form>
    </table>
    <br>
~;
  printFooter($q, $params);
}

################################################################################
sub printSearchResults {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Marketplace Search Results</th>
	</tr>
      </thead>
      <tbody>
	<tr><td></td></tr>

~;
  if ($params->{searchResults}->{records}) {
print qq~
	  <form name="form" method="post" action="$params->{config}->{MARKETPLACE_SEARCH}">
	    <input type=hidden name=submitSearch value="0" />
	    <input type=hidden name=page value="$params->{searchResults}->{page}" />
	    <input type=hidden name=order_by value="$params->{searchResults}->{order}" />
	    <input type=hidden name=grid_view value="$params->{searchResults}->{view}" />
~;
foreach my $param ( @{$params->{searchResults}->{params}} ) {
print qq~
		<input type=hidden name=$param->{name} value="$param->{value}" />
~;
}
print qq~

	  <tr class=buttons>
	    <td align=center>
~;
printSearchDisplayInfo($q, $params->{searchResults});
print qq~
	    </td>
	  </tr>

	  <tr>
	    <td>
~;
if ($params->{searchResults}->{view}) {
  printGridItems($q, {config => $params->{config}, records => $params->{searchResults}->{records}});
} else {
  printListItems($q, {config => $params->{config}, records => $params->{searchResults}->{records}});
}
print qq~
	    </td>
	  </tr>

	  <tr class=buttons>
	    <td align=center>
~;
printSearchDisplayInfo($q, $params->{searchResults});
print qq~
	    </td>
	  </tr>

~;
} else {
print qq~
	      <tr>
		<td>
		  No matching items were found. Please try your search again.<br><br>
		</td>
	      </tr>
~;
}
print qq~
	  <tr><td></td></tr>
    </form>
  </tbody>
  </table>
<br>
~;
  printFooter($q, $params);
}

################################################################################
sub printSeller {
  my ($q, $params) = @_;

  ### Now we output
  printHeader($q, $params);

print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Store Information</th>
	</tr>
      </thead>
      <form id="formx" name="formx" method="post" action="$params->{config}->{MARKETPLACE_REGISTRY}" onSubmit="return verifySeller();">
~;
  print "<input type=hidden name=edit value=1 />\n" if $q->param('edit');
print qq~
      <tbody>
	<tr>
	  <th>
	    <font class=required>*</font>Store Name :
	  </th>
	  <td>
	    <input type="text" name="name" value="$params->{seller}->{name}" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	    <font class=required>*</font>Categories :
	  </th>
	  <td>
	    <select name="categories" multiple>
~;
  foreach my $x ( @{$params->{cats}} ) {
    print "<option value=$x->{id}";
    print " selected" if $x->{default};
    print ">$x->{name}</option>\n";
  }
print qq~
	      </select>
	  </td>
	</tr>
	<tr>
	  <th>
	    Website Url :
	  </th>
	  <td>
	    <input type="text" name="website_url" value="$params->{seller}->{website_url}" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	    Privacy Policy Url :
	  </th>
	  <td>
	    <input type="text" name="privacy_url" value="$params->{seller}->{privacy_url}" size="40" />
	  </td>
	</tr>
	<tr>
	  <th>
	     <font class=required>*</font>Description :
	  </th>
	  <td>
	    <textarea name="description" cols="55" rows="6">$params->{seller}->{description}</textarea>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Payment Information</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <b>Preview/Purchase Link :</b>
	  </td>
	  <td>
	    <input type="text" name="payment_url" value="$params->{seller}->{payment_url}" size="50"  />
	  </td>
	</tr>
	<tr><td colspan="2"><hr></td></tr>
	<tr>
	  <td colspan="2">
	    <b>Select the payment methods you will accept :</b>
	  </td>
	</tr>
	<tr>
	  <td>
	    <input type="checkbox" name="visa" value="1"
~;
  print " checked" if $params->{seller}->{visa};
print qq~
	    >Visa</input>
	  </td>
	  <td>
	    <input type="checkbox" name="paypal" value="1"
~;
  print " checked" if $params->{seller}->{paypal};
print qq~
	    >PayPal</input>
	  </td>
	</tr>
	<tr>
	  <td>
	    <input type="checkbox" name="mastercard" value="1"
~;
  print " checked" if $params->{seller}->{mastercard};
print qq~
	    >MasterCard</input>
	  </td>
	  <td>
	    <input type="checkbox" name="checks" value="1"
~;
  print " checked" if $params->{seller}->{checks};
print qq~
	    >Personal Check</input>
	  </td>
	</tr>
	<tr>
	  <td>
	    <input type="checkbox" name="amex" value="1"
~;
  print " checked" if $params->{seller}->{amex};
print qq~
	    >American Express</input>
	  </td>
	  <td>
	    <input type="checkbox" name="money_order" value="1"
~;
  print " checked" if $params->{seller}->{money_order};
print qq~
	    >Money Order/Cashier's Check</input>
	  </td>
	</tr>
	<tr>
	  <td>
	    <input type="checkbox" name="discover" value="1"
~;
  print " checked" if $params->{seller}->{discover};
print qq~
	    >Discover Card</input>
	  </td>
	  <td>
	    <input type="checkbox" name="other" value="1"
~;
  print " checked" if $params->{seller}->{other};
print qq~
	    >Other / See Payment Instructions</input>
	  </td>
	</tr>
	<tr><td colspan="2"><hr></td></tr>
	<tr>
	  <td colspan=2>
	    <b>Enter some clear instructions to assist the buyer with payment and shipping :</b><br />
	    <textarea name="instructions" cols="65" rows="6">$params->{seller}->{instructions}</textarea>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Return Policy</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    <input type="checkbox" name="accepted" value="1"
~;
  print " checked" if $params->{seller}->{accepted};
print qq~
	    >Returns Accepted</input><br />
	  </td>
	</tr>
	<tr>
	  <td>
	    Items must be returned within:
	    <select name="grace">
	      <option value="">--Select One--</option>
	      <option value="3"
~;
  print " selected" if $params->{seller}->{grace} == 3;
print qq~
	    >3 Days</option>
	    <option value="7"
~;
  print " selected" if $params->{seller}->{grace} == 7;
print qq~
	    >7 Days</option>
	    <option value="14"
~;
  print " selected" if $params->{seller}->{grace} == 14;
print qq~
	    >14 Days</option>
	    <option value="30"
~;
  print " selected" if $params->{seller}->{grace} == 30;
print qq~
	    >30 Days</option>
	  </select>
	  </td>
	</tr>
	<tr>
	  <td>
	    Refunds will be dispensed in the form of:
	    <select name="type">
	      <option value="">--Select One--</option>
	      <option value="Exchange"
~;
  print " selected" if $params->{seller}->{type} eq 'Exchange';
print qq~
	    >Exchange</option>
	    <option value="Merchandise"
~;
  print " selected" if $params->{seller}->{type} eq 'Merchandise';
print qq~
	    >Merchandise</option>
	    <option value="Money"
~;
  print " selected" if $params->{seller}->{type} eq 'Money';
print qq~
	    >Money Back</option>
	  </select>
	  </td>
	</tr>
	<tr>
	  <td>
	    <b>Refund Policy</b><br>
	    <textarea name="policy" cols="65" rows="6">$params->{seller}->{policy}</textarea>
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <div align="center">
      <input type="submit" name="submitSeller" value="Submit" />
    </div>
    <br />
~;
  printFooter($q, $params);
}

################################################################################
sub printSellerItemCategories {
  my ($q, $params) = @_;

print qq~
<table class=data style="width: 175;">
  <tr>
    <th><div align=left>&nbsp;Seller Categories</div></th>
  </tr>
  <tbody>
    <tr><td></td></tr>
~;
  foreach my $cat ( @{$params->{seller}->{itemCategories}} ) {
print qq~
      <tr>
	<td>
	  <img src=$params->{config}->{BULLET} />
	  <a href="$params->{config}->{MARKETPLACE_SEARCH}?submitSearch=1&seller_id=$params->{seller}->{id}&category=$cat->{id}&grid_view=1">$cat->{name} ($cat->{item_count})</a>
	</td>
      </tr>
~;
}
print qq~
    <tr><td></td></tr>
  </tbody>
</table>
    <br>
~;
}

################################################################################
sub printSendEmail {
  my ($q, $params) = @_;

  print $q->header();

print qq~
<html>
  <head>
    <link rel="StyleSheet" href=$params->{config}->{CSS_URL} type="text/css">
  </head>
  <body>
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Send Email</th>
	</tr>
      </thead>
      <form id="formx" name="formx" method="post" action="$params->{config}->{MARKETPLACE_SEND_EMAIL}" onSubmit="return verifySendMessage();">
	<input type="hidden" name="id" value="$params->{item}->{id}" />
      <tbody>
	    <tr>
	      <th>
		<font class=required>*</font>To :
	      </th>
	      <td>
		<input type="text" name="receiver" size="40" />
	      </td>
	    </tr>
	    <tr>
	      <th>
		<font class=required>*</font>Subject :
	      </th>
	      <td>
		<input type="text" name="subject" value="Interesting $params->{config}->{SITE} Item: $params->{item}->{title}" size="65" />
	      </td>
	    </tr>
	    <tr>
	      <th>
		<font class=required>*</font>Message :
	      </th>
	      <td>
		<textarea name="comments" rows="8" cols="50">I saw this item for sale on the $params->{config}->{SITE} Marketplace, and thought that you might be interested.</textarea>
	      </td>
	    </tr>
	    <tr class=buttons>
	      <td align="center" colspan=2>
		<input type="submit" name="submitMessage" value="Submit" />
	      </td>
	    </tr>
      </tbody>
    </table>
    </form>
    <br>
</body>
</html>
~;
}

################################################################################
sub printSendEmailConfirm {
  my ($q, $params) = @_;

  print $q->header();

print qq~
<html>
  <head>
    <link rel="StyleSheet" href=$params->{config}->{CSS_URL} type="text/css">
  </head>
  <body>
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=2>Send Email</th>
	</tr>
      </thead>
      <form id="formx" name="formx" method="post" action="$params->{config}->{MARKETPLACE_SEND_EMAIL}" onSubmit="return verifySendMessage();">
	<input type="hidden" name="id" value="$params->{item}->{id}" />
      <tbody>
	  <tr>
	    <td colspan=2>
	      You message was successfully sent!<br><br><br>	
	      <div align="center"><a href="#" onClick="window.close()">Click here to close this window</a></div>
	    </td>
	  </tr>
      </tbody>
    </table>
    </form>
    <br>
</body>
</html>
~;
}

################################################################################
sub printViewItem {
  my ($q, $params) = @_;

  printHeader($q, $params);

  printViewItemAdminOptions($q, $params) if $params->{admin};

  print qq~
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=4>$params->{item}->{title}</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_VIEW_ITEM}" enctype="multipart/form-data">
	<input type="hidden" name="id" value="$params->{item}->{id}" />
      <tbody>
	<tr>
	  <td align="center" width="100" valign="top">
~;
  foreach my $picture ( @{$params->{item}->{pictures}} ) {
print qq~
	    <img src="http://club.hbcuconnect.com/cgi-bin/showImage.cgi?database=marketplace&table=picture&field=image&key=id&value=$picture->{id}" width="100" height="100" /><br>
	    <img src=$params->{config}->{MAGNIFY_GLASS} />
	      <a href="#" onClick="window.open('$params->{config}->{MARKETPLACE_VIEW_ITEM}?submitShowLargeImage=1&id=$picture->{item}','LargeView','left=20,top=20,width=725,height=650,toolbar=0,location=0,menubar=0,resizable=1'); return false;">View Larger</a>
~;
last;
}
print qq~
	  </td>
	  <td valign="top">
	    <b>Seller :</b> <a href="$params->{config}->{MARKETPLACE_VIEW_SELLER}?id=$params->{item}->{seller}">$params->{item}->{seller_name}</a><br>
	      <b>Category :</b> $params->{item}->{categoryNames}<br>
		<b>HBCU :</b> $params->{item}->{hbcu}<br>
		  <b>Price :</b> $params->{item}->{price}<br>
		    <b>Item Views :</b> $params->{item}->{hits}<br><br>
		      <input type="submit" name="submitGotoPurchase" value="Buy Now!" />
	  </td>
	  <td height="100%" width="1">
	    <table background=$params->{config}->{VSEP} width="1" height="100%" cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td>
	  <td valign="top" width=125 align=center>
~;
  if ($params->{item}->{totalReviews}) {
    foreach my $star ( @{$params->{item}->{stars}} ) {
      print "<img src=$star->{star} />";
    }
    print "<br>\n";
  } else {
    print "No Ratings<br>\n";
  }
  print "Average User Rating<br>\n";

  if ($params->{item}->{totalReviews}) {
    print "<a href=\"$params->{config}->{MARKETPLACE_ITEM_REVIEW}?item=$params->{item}->{id}&showReviews=1\">Read $params->{item}->{totalReviews} Reviews</a><br>\n";
  }
print qq~
		  <a href="$params->{config}->{MARKETPLACE_ITEM_REVIEW}?item=$params->{item}->{id}">Write a Review</a><br>
	  </td>
	</tr>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Product Description</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    $params->{item}->{description}
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Payment Methods</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
~;
  if ($params->{item}->{visa}) { print "<img src=$params->{config}->{VISA} />&nbsp;&nbsp;\n"; }
  if ($params->{item}->{mastercard}) { print "<img src=$params->{config}->{MASTERCARD} />&nbsp;&nbsp;\n"; }
  if ($params->{item}->{amex}) { print "<img src=$params->{config}->{AMEX} />&nbsp;&nbsp;\n"; }
  if ($params->{item}->{discover}) { print "<img src=$params->{config}->{DISCOVER} />&nbsp;&nbsp;\n"; }
  if ($params->{item}->{paypal}) { print "<img src=$params->{config}->{PAYPAL} />&nbsp;&nbsp;\n"; }
  print "<br><br>\n";
  if ($params->{item}->{checks}) { print "Personal Check<br><br>\n"; }
  if ($params->{item}->{money_order}) { print "Money Order / Cashier's Check<br><br>\n"; }
  if ($params->{item}->{other}) { print "Other / See Payment Instructions<br><br>\n"; }
print qq~
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Payment Instructions</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    $params->{item}->{instructions}
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Return Policy</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
~;
  if ($params->{item}->{accepted}) {
print qq~
	      Returns Accepted<br>
	      Items must be returned within: $params->{item}->{grace}<br>
		Refunds will be dispensed in the form of: $params->{item}->{type}<br>

~;
if ($params->{item}->{policy}) {
  print "<b>Return Policy:</b> $params->{item}->{policy}\n";
} else {
  print "Returns not accepted\n";
}
}
print qq~
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <div align=center>
      <input type="submit" name="submitGotoPurchase" value="Buy Now!" />
    </div>
    <br>
</form>
~;

  printFooter($q, $params);
}

################################################################################
sub printViewItemAdminOptions {
  my ($q, $params) = @_;

  print qq~
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=4>Admin Options</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td width="100" valign="top">
            <ul>
~;

  if ($params->{item}->{featured_homepage}) {
    print qq~
	    <li><a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?unfeatureHomepageItem=1&id=$params->{item}->{id}">Remove From Homepage</a></li>
~;
  } else {
    print qq~
	    <li><a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?featureHomepageItem=1&id=$params->{item}->{id}">Feature on Homepage</a></li>
~;
  }

  if ($params->{item}->{featured}) {
    print qq~
	    <li><a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?unfeatureItem=1&id=$params->{item}->{id}">Remove From Featured Items</a></li>
~;
  } else {
    print qq~
	    <li><a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?featureItem=1&id=$params->{item}->{id}">Add to Featured Items</a></li>
~;
  }

  unless ($params->{db}->getSavedItem({item => $params->{item}->{id},
				       registry_id => $q->cookie('ID')})) {
    print qq~
	    <li><a href="$params->{config}->{MARKETPLACE_VIEW_ITEM}?submitSaveItem=1&id=$params->{item}->{id}">Save to My Items</a></li>
~;
  }

  print qq~
	     <li><a href="#" onClick="window.open('$params->{config}->{MARKETPLACE_SEND_EMAIL}?id=$params->{item}->{id}','Message','left=20,top=20,width=575,height=325,toolbar=0,location=0,menubar=0,resizable=0'); return false;">Send to a Friend</a></li>
            </ul>
	  </td>
	</tr>
      </tbody>
    </table>
~;
}

###############################################################################
sub printViewSeller {
  my ($q, $params) = @_;

  printHeader($q, $params);

  if ($params->{admin}) {
print qq~
      <br>
      <div align=center>
~;
if ($params->{seller}->{featured}) {
  print "<img src=$params->{config}->{ADD} />&nbsp;<a href=\"$params->{config}->{MARKETPLACE_VIEW_SELLER}?unfeatureSeller=1&id=$params->{seller}->{id}\">Remove From Featured Sellers</a>\n";
} else {
  print "<img src=$params->{config}->{ADD} />&nbsp;<a href=\"$params->{config}->{MARKETPLACE_VIEW_SELLER}?featureSeller=1&id=$params->{seller}->{id}\">Add to Featured Sellers</a>\n";
}
print qq~
      </div>
~;
}
print qq~
    <br>
    <table class=data width=100%>
      <thead>
	<tr>
	  <th colspan=3>$params->{seller}->{name}</th>
	</tr>
      </thead>
      <form name="formx" method="post" action="$params->{config}->{MARKETPLACE_VIEW_ITEM}" enctype="multipart/form-data">
	<input type="hidden" name="id" value="$params->{seller}->{id}" />
      <tbody>
	<tr>
	  <td valign="top">
	    <b>Category :</b> $params->{seller}->{categoryNames}<br>
	      <b>HBCU :</b> $params->{seller}->{hbcu}<br>
		<b>Seller's Website :</b> <a href="$params->{seller}->{website_url}">$params->{seller}->{website_url}</a>
	  </td>
	  <td height="100%" width="1">
	    <table background=$params->{config}->{VSEP} width="1" height="100%" cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td>
	  <td valign="top" width=125 align=center>
~;
  if ($params->{seller}->{totalReviews}) {
    foreach my $star ( @{$params->{seller}->{stars}} ) {
      print "<img src=$params->{config}->{STAR} />";
    }
    print "<br>\n";
  } else {
    print "No Ratings<br>\n";
  }
  print "Average User Rating<br>\n";

  if ($params->{seller}->{totalReviews}) {
    print "<a href=\"$params->{config}->{MARKETPLACE_SELLER_REVIEW}?item=$params->{seller}->{id}&showReviews=1\">Read $params->{seller}->{totalReviews} Reviews</a><br>\n";
  }
print qq~
	  </td>
	</tr>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Seller Description</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
	    $params->{seller}->{description}
	  </td>
	</tr>
      </tbody>
    </table>
    <br>

    <table class=data width=100%>
      <thead>
	<tr>
	  <th>Popular Items</th>
	</tr>
      </thead>
      <tbody>
	<tr>
	  <td>
~;
  printGridItems($q, {config => $params->{config}, records => $params->{seller}->{records}});
print qq~

	  </td>
	</tr>
      </tbody>
    </table>
    <div align=right>
      <a href=$params->{config}->{MARKETPLACE_SEARCH}?submitSearch=1&seller_id=$params->{seller}->{id}>More Items--></a>
    </div>
    <br>

</td>
<td valign=top>
~;

  printSellerItemCategories($q, {config => $params->{config}, seller => $params->{seller}});

  printFooter($q, $params);
}

################################################################################
sub printWelcomeGuest {
  my ($q, $params) = @_;

print qq~
<table class=data style="width: 175;">
  <tr>
    <th><div align=left>&nbsp;Welcome, Guest</div></th>
  </tr>
  <tbody>
    <tr><td></td></tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_MAIN}">Marketplace Home</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_SEARCH}">Advanced Search</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="$params->{config}->{MARKETPLACE_MERCHANT_INFO}">Create Your Store</a>
      </td>
    </tr>
    <tr>
      <td>
	<img src=$params->{config}->{BULLET} />
	<a href="#" onClick="window.open('$params->{config}->{MARKETPLACE_CONTACT_US}','$params->{config}->{DOMAIN}','width=550,height=500,toolbar,resizable');">Ask a Quick Question</a>
      </td>
    </tr>
    <tr><td></td></tr>
  </tbody>
</table>
<br />
~;
}


1;
