#!/usr/bin/perl
#
#
# March Search / Digi-Zone Search, Search System - The Yahoo Beater
#               
# Site HTML: Version 2.00
#         
# Edited: 2.00 (Sunday 28th February 20.15pm 1998 M Pitt)
#      
# 
##########################################################
##					  Globals                 ##
##########################################################
# You can put variables here that you would like to use throughout
# the site.

$date = &get_date;
$time = &get_time;

$font_size1     = 'font face="arial, helvetica" size=1 color="#8000FF"';
$font_new       = 'font face="arial, helvetica" size=2 color="#8000FF"';
$font_pop       = 'font face="arial, helvetica" size=2 color="#8000FF"';
$font_rev       = 'font face="arial, helvetica" size=2 color="blue"';
$font_date      = 'font face="arial, helvetica" size=1 color="#FF8000"';
$font_title     = 'font face="arial, helvetica" size=4 color="#FFFF00"';
$font_subtitle  = 'font face="arial, helvetica" size=3 color="#FFFF00"';
$font_menu      = 'font face="verdana, arial" size=2 color="#FFFFFF"';
$font_rightmenu = 'font face="verdana, arial" size=2 color="#000000"';
$font_link      = 'font face="arial, helvetica" size=2 color="#FFFF00"';
$font_category  = 'font face="arial, helvetica" size=2 color="#FFFF00" link="#FFFF00" vlink="#FFFF00"';
$font           = 'font face="arial, helvetica" size=2 color="#000000"';
$font_copyright = 'font face="arial, helvetica" size=1 color="#000000"';
$font_footop    = 'font face="ms sans serif, arial" size=1 color="#000000"';
$font_footspace = 'font face="times new roman" size=3 color="#000000"';
$font_sidebarsections = 'font face="arial, helvetica" size=2 color="#0080FF"';

$site_body = 'body background="http://www.digi-zone.com/images/99back.gif"';

$site_menu = qq~

<font color="#FFFFFF" size="2" face="Verdana">
    <A HREF="http://www.digi-zone.com/search/main.htm">Home</A><BR>
    <A HREF="$build_add_url">Add URL</A><BR>
    <A HREF="$build_modify_url">Modify URL</A><BR>
	<BR>
    <A HREF="http://www.march.force9.co.uk/search/news/">News</A><BR>
    <A HREF="http://www.march.force9.co.uk/search/weather/">Weather</A><BR>
    <A HREF="http://www.march.force9.co.uk/search/finance/">Finance</A><BR>
    <A HREF="http://www.march.force9.co.uk/search/shopping/">Shopping</A><BR>
    <A HREF="http://www.march.force9.co.uk/search/webspace/">Free Webspace</A><BR>
	<BR>
    <A HREF="$build_new_url">What's New</A><BR>
    <A HREF="$build_cool_url">What's Cool</A><BR>
    <A HREF="http://www.march.force9.co.uk/search/advertise/">Advertise</A><BR>
    </FONT>
~;

# Search Box Design

$site_searchbox = qq~
	<form action="$build_search_url" method="GET">
		<center>
<form action="$build_search_url" method="GET">
						<$font>
						Search: <INPUT TYPE="TEXT" NAME="query" SIZE=30> <SELECT NAME="mh"><OPTION>10<OPTION SELECTED>15<OPTION>30<OPTION>50<OPTION>100</SELECT> <INPUT TYPE="Submit" VALUE="Search"><BR>
						As Keywords: <INPUT TYPE="RADIO" NAME="type" VALUE="keyword" CHECKED> As Phrase: <INPUT TYPE="RADIO" NAME="type" VALUE="phrase"><BR>
						AND connector: <INPUT TYPE="RADIO" NAME="bool" VALUE="and" CHECKED> OR connector: <INPUT TYPE="RADIO" NAME="bool" VALUE="or">
						</font>
					</form>
				</center>			
~;

# Matching Category Sub Title

$site_matchingcategory = qq~
<table border="0" cellpadding="0"
                cellspacing="0" width="440">
                    <tr>
                        <td bgcolor="#000000"><img
                        src="clear.gif" align="right" hspace="0"
                        width="32" height="2"> </td>
                    </tr>
                    <tr>
                        <td bgcolor="#F5F5F5"><font size="2"
                        face="Arial"><b>Matching Categories</b></font></td>
                    </tr>
</table><br>
~;

# Matching Web Sites Sub Title

$site_matchingwebsites = qq~
<table border="0" cellpadding="0"
                cellspacing="0" width="440">
                    <tr>
                        <td bgcolor="#000000"><img
                        src="clear.gif" align="right" hspace="0"
                        width="32" height="2"> </td>
                    </tr>
                    <tr>
                        <td bgcolor="#F5F5F5"><font size="2"
                        face="Arial"><b>Matching Web Sites</b></font></td>
                    </tr>
</table><br>
~;

# Related Categories Sub Title

$site_relatedcategory = qq~
<table border="0" cellpadding="0"
                cellspacing="0" width="440">
                    <tr>
                        <td bgcolor="#000000"><img
                        src="clear.gif" align="right" hspace="0"
                        width="32" height="2"> </td>
                    </tr>
                    <tr>
                        <td bgcolor="#F5F5F5"><font size="2"
                        face="Arial"><b>Related Categories</b></font></td>
                    </tr>
</table><br>
~;

# Top Search Box

$site_topsearchbox = qq~
<table border="0" cellpadding="0" cellspacing="0"
        width="440">
            <tr>
                <td colspan="3" bgcolor="#000000"><img
                src="http://www.digi-zone.com/images/clear.gif" align="right" hspace="0"
                width="32" height="5"> </td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#F5F5F5"><br>
                <form action="$build_search_url" method="GET">
<p align="center"><font color="#000000"
                    size="2" face="arial, helvetica">Search:&nbsp;</font><font
                    color="#000000" size="2"
                    face="arial, helvetica"><input type="text"
                    size="30" name="query">&nbsp;<select
                    name="mh" size="1">
                        <option>10</option>
                        <option selected>15</option>
				<option>30</option>
                        <option>50</option>
                        <option>100</option>
                    </select></font>&nbsp;<input type="submit" value="Search" name="submit"></p>
                </form>
                </td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#000000"><img
                src="http://www.digi-zone.com/images/clear.gif" align="right" hspace="0"
                width="32" height="2"> </td>
            </tr>
        </table>
~;

# Bottom Search Box

$site_bottomsearchbox = qq~
<table border="0" cellpadding="0" cellspacing="0"
        width="440">
            <tr>
                <td colspan="3" bgcolor="#000000"><img
                src="http://www.digi-zone.com/images/clear.gif" align="right" hspace="0"
                width="32" height="2"> </td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#F5F5F5"><br>
                <form
                action="http://www.digi-zone.com/search/search.cgi"
                method="GET">
                    <p align="center"><font color="#000000"
                    size="2" face="arial, helvetica">Search:&nbsp;</font><font
                    color="#000000" size="2"
                    face="arial, helvetica"><input type="text"
                    size="30" name="query">&nbsp;<select
                    name="mh" size="1">
                        <option>10</option>
                        <option selected>15</option>
				<option>30</option>
                        <option>50</option>
                        <option>100</option>
                    </select></font>&nbsp;<input type="submit" value="Search" name="submit"></p>
                </form>
                </td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#000000"><img
                src="http://www.digi-zone.com/images/clear.gif" align="right" hspace="0"
                width="32" height="5"> </td>
            </tr>
        </table>
~;

# NEW - Search Box which includes a way to narrow the search within current category

$site_topcatsearch = qq~
<table border="0" cellpadding="0" cellspacing="0"
        width="440">
            <tr>
                <td colspan="3" bgcolor="#000000"><img
                src="clear.gif" align="right" hspace="0"
                width="32" height="2"> </td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#F5F5F5"><br>
                <form action="$build_search_url" method="GET"><p align="center"><font color="#000000"
                    size="2" face="arial, helvetica">Search:&nbsp;</font><font
                    color="#000000" size="2"
                    face="arial, helvetica"><input type="text"
                    size="30" name="query">&nbsp;<select
                    name="mh" size="1">
                        <option>10</option>
                        <option selected>15</option>
				<option>30</option>
                        <option>50</option>
                        <option>100</option>
                    </select></font>&nbsp;<input type="submit" value="Search" name="submit"><br>
Narrow your matches</font><input type="checkbox" name="where" value="$category_real"></font>
</p>
                </form>
                </td>
            </tr>
            <tr>
                <td colspan="3" bgcolor="#000000"><img
                src="clear.gif" align="right" hspace="0"
                width="32" height="5"> </td>
            </tr>
        </table>
~;



# NEW - Category Only Search.
$site_catsearch = qq~
	<form action="$build_search_url" method="get">
	<input type="text" name="query">
	<input type="submit" value="Search!" name="submit">
	<br><$font>Search only in <strong>$category_clean - </strong></font><input type="checkbox" name="where" value="$category_real">
	<hr width="90%">
	</center>			
	</form>
	~;

# If you want to put in a generic advertisement.
$site_ad = qq~
	<A TARGET="_top" HREF="http://www6.valueclick.com/cgi-bin/redirect?host=h0016145&b=1">
	<IMG SRC="http://www6.valueclick.com/cgi-bin/cycle?host=h0016145&b=1" HEIGHT=60 WIDTH=468 BORDER=0 ALT="Please visit our sponsors."></A>
	~;

# If you want to add a mailing list.
$site_mail = qq~
		<form method="POST" action="http://www.digi-zone.com/cgi-bin/digimail/maillist.cgi">
                <input type="hidden" name="join_list" value="join_list"><p><small><font
                face="MS Sans Serif">Subscribe to our action packed, monthly newsletter! Enter your
                address below:-</font></small><br>
                <input type="text" size="25" name="new_email"> <input type="submit" name="B1"
                value="Subscribe"></p>
                </form>

		~;


# NEW - Right Menu Display.
$site_rightmenu = qq~
<$font_rightmenu>
    Right menu coming soon.
</FONT>
~;


# Page Footers.
$site_footeroptions = qq~
			<center>
<$font_footop>
<A HREF="http://www.digi-zone.com/search/main.htm">Home</A></font>
<$font_footspace> | </font> 

<$font_footop>
<A HREF="http://www.digi-zone.com/search/add.cgi">Add URL</A></font>
<$font_footspace> | </font> 

<$font_footop>
<A HREF="$build_modify_url">Modify URL</A></font>
<$font_footspace> | </font> 

<$font_footop>
<A HREF="$build_new_url">What's New</A></font>
<$font_footspace> | </font>  

<$font_footop>
<A HREF="$build_cool_url">What's Cool</A></font>
<$font_footspace> | </font>

<$font_footop>
<A HREF="http://www.march.force9.co.uk/faq.htm">FAQ</A><font>
<br>


<$font_footop>
<A HREF="http://digi-zone.com/search/support/info.htm">Contact Us</A></font>
<$font_footspace> | </font>

<$font_footop>
<A HREF="http://www.march.force9.co.uk/press.htm">Press Releases</A><font> 
<$font_footspace> | </font>  

<$font_footop>
<A HREF="http://www.march.force9.co.uk/advertise.htm">Advertise</A><font> 
<$font_footspace> | </font>

<$font_footop>
<A HREF="http://www.march.force9.co.uk/privacy.htm">Privacy Policy</A><font> 
<$font_footspace> | </font>  

<$font_footop>
<A HREF="http://www.march.force9.co.uk/copyright.htm">Copyright Policy</A><font>


<br>
</font>
</center>
~;

# This is the Copyright that appears at the bottom of any page that you want it to appear on.
$site_copynotice = qq~
			<center>
<$font_copyright>&copy; Copyright March New Media  / Digi-Zone Internet Services 1999. All Rights Reserved.</font>
			</center>			
	
~;

##########################################################
##					  A Link                  ##
##########################################################

sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like. It's a little complex looking just because we have to 
# check for blank entries..

my (%rec) = @_;

$output = qq|
	<b><$font><a href="$build_jump_url?$db_key=$rec{$db_key}"target="_top">$rec{'Title'}</a> </font></b><br>|;

if ($rec{'Description'})        { $output .= qq| <$font>$rec{'Description'}</font>\n|; }
if ($rec{'isNew'} eq "Yes")     { $output .= qq| <$font_new><i><b>new</b></i></font>|; }
if ($rec{'isPopular'} eq "Yes") { $output .= qq| <$font_pop><i><b>pop</b></i></font>|; }

$output .= qq| <br><$font_size1><b>(Date Added: $rec{'Date'}, Hits: $rec{'Hits'})</b></font><br>
<$font_size1><a href="$build_jump_url?$db_key=$rec{$db_key}"target="_top">$rec{'URL'}</a></font><br><br>|;

return $output;
}

##########################################################
##					  Home Page               ##
##########################################################

sub site_html_home {
# --------------------------------------------------------
# This routine will build a home page. It is not meant to have any 
# links on it, only subcategories.
#
#   $category       : The list of subcategories.
#   $time           : The current time.
#   $date           : The current date.
#   $grand_total    : The total number of links.
#

my ($output);

$output = qq~ 
<html>

<head>
<title>$site_title: Welcome</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td valign="top" width="140">$site_menu</td>
        <td width="10"></td>
        <td valign="top" width="440"><img src="http://www.digi-zone.com/images/welcome-title.gif" width="435" height="19"><br>
<br>
<center>$site_topsearchbox</center><br>

<div align="center"><center><table border="0"
        cellpadding="0" cellspacing="0" width="440">
            <tr>
                <td valign="top" width="50%"><dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Arts/"><font
                        color="#0000FF" size="2" face="Arial"><strong>Arts</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Literature,
                        Photography</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Business/"><font
                        color="#0000FF" size="2" face="Arial"><strong>Business</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Companies, Finance,
                        Jobs</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Computers/"><font
                        color="#0000FF" size="2" face="Arial"><strong>Computers</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Internet, WWW,
                        Software</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Culture/"><font
                        color="#0000FF" size="2" face="Arial"><strong>Culture</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">People, Enviroment,
                        Religion</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Education/"><font
                        color="#0000FF" size="2" face="Arial"><strong>Education</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Schools, Colleges,
                        Universities</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Entertainment/"><font
                        color="#0000FF" size="2" face="Arial"><strong>Entertainment</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Movies, Humour,
                        Music</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Government/"><font
                        color="#0000FF" size="2" face="Arial"><strong>Government</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Law, Politics, Taxes</font></dd>
                </dl>
                </td>
                <td valign="top" width="50%"><dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Health/"><font
                        color="#0000FF" size="2"
                        face="arial, helvetica"><strong>Health</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Diseases, Drugs,
                        Fitness</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/News/"><font
                        color="#0000FF" size="2"
                        face="arial, helvetica"><strong>News</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Media, Newspapers,
                        TV</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Recreation/"><font
                        color="#0000FF" size="2"
                        face="arial, helvetica"><strong>Recreation</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Sports, Travel,
                        Outdoors</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Reference/"><font
                        color="#0000FF" size="2"
                        face="arial, helvetica"><strong>Reference</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Libaries,
                        Dictionaries, Quotations</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Regional/"><font
                        color="#0000FF" size="2"
                        face="arial, helvetica"><strong>Regional</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Countries, Regions</font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Science/"><font
                        color="#0000FF" size="2"
                        face="arial, helvetica"><strong>Science</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Astronomy, Biology,
                        Engineering </font></dd>
                </dl>
                <dl>
                    <dt><a
                        href="http://www.digi-zone.com/search/Social/"><font
                        color="#0000FF" size="2"
                        face="arial, helvetica"><strong>Social</strong></font></a><font
                        color="#FFFFFF" size="2"
                        face="arial, helvetica"> </font></dt>
                    <dd><font color="#000000" size="1"
                        face="MS Sans Serif">Archaeology,
                        Languages</font></dd>
                </dl>
                </td>
            </tr>
</table>
        </center></div>
<br>
$site_bottomsearchbox<br> 
$site_footeroptions<br> 
$site_copynotice<br>

</td>
        <td width="10"></td>
        <td valign="top" width="140">$site_rightmenu</td>
    </tr>
</table>
</body>
</html>
~;

return $output;
}

##########################################################
##					  What's New Page         ##
##########################################################

sub site_html_new {
# --------------------------------------------------------
# This routine will build a what's new page. You can use the following
# variables
#
#   $time           : The current time.
#   $date           : The current date.
#   $total          : The total number of new links.
#   $grand_total    : The total number of links.
#   $link_results   : The list of new links.
#   $title_linked
#

$output = qq~ 
<html>

<head>
<title>$site_title: What's New</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: What's New</strong></font><BR>
		<$font><strong>$title_linked</strong></font>
		<center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td>
					<$font_subtitle><strong><center>$total New Links:</center></strong></font><br>
					<$font_category>$link_results</font></td>
</tr>				
			</table>
		</center>
  
    <hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;

return $output;
}

##########################################################
##					  What's Cool Page        ##
##########################################################

sub site_html_cool {
# --------------------------------------------------------
# This routine will build a what's new page. You can use the following
# variables
#
#   $time           : The current time.
#   $date           : The current date.
#   $total          : The total number of new links.
#   $grand_total    : The total number of links.
#   $percent        : The cool percent cutoff (top 3%, etc).
#   $link_results   : The list of cool links.
#

# Your Title and Header.
$output = qq~ 
<html>

<head>
<title>$site_title: What's Cool</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: What's Cool - The Top $percent%!</strong></font><BR>
		<$font><strong>$title_linked</strong></font>
<center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td>
					<$font_subtitle><strong><center>$total Cool Links:</center></strong></font><br>
					<$font_category>$link_results</font></td>
</tr>				
			</table>
		</center>
  
    <hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;

return $output;
}

##########################################################
##					  Category Pages          ##
##########################################################

sub site_html_category {
# --------------------------------------------------------
# This rountine will build a page based for the current category.
# Insert the following variables in the appropriate place.
#
#   $category       : The list of subcategories.
#   $links          : The list of links in this category.
#   $time           : The current time.
#   $date           : The current date.
#   $title_linked   : A linked version of the title bar.
#   $title          : An unlinked version of the title bar.
#   $total          : The total number of links in this category.
#   $grand_total    : The total number of links.
#   $category_name  : The category name.
#   $category_name_escaped  : The category name URL escaped (used for the Add function)
#   $category_clean : The category name with _ and / removed.
#
# The following will work assuming you haven't changed the order of the
# category database. If you have, or have added new fields, you can access
# any of the information by using $category{$category_name}[field_num] where 
# field number is the number (indexed from 0) of the field you want. Otherwise
# you can just use the following:
#
#   $description	: Category Description
#	$meta_name		: Meta Description Tag
#	$meta_keywords	: Meta Keywords Tag
#	$header			: Custom Header
#	$footer			: Custom Footer
#	$related		: A <li> list of related categories.
#

my ($output);

$output = qq~
<html>

<head>
<title>$site_title: Search Results</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td valign="top" width="140">$site_menu</td>
        <td width="10"></td>
        <td valign="top" width="440"><img src="http://www.digi-zone.com/images/results-title.gif" width="435" height="19"><br>
<br>
<center>$site_topsearchbox</center><br>

<$font><strong><$title_linked</strong></font><br>
<center>
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>
~; if ($header) { $output .= qq~<p><$font size=5>$header</font></p><br>
~; }


if ($category) { $output .= qq~
$site_matchingcategory 
<$font_category>$category</font><br><br>
~; } 


if ($links) {$output .= qq~          
$site_matchingwebsites 
<$font>$links</font>
<br><br>
~; }


if ($related) {
$output .= qq~
$site_relatedcategories 
<$font>$related</font>

~; }

if ($prev or $next) { $output .= qq~<p align=right>~; }
if ($prev)   { $output .= qq~<$font><strong><a href="$prev">Prev $build_links_per_page</a></strong></font> ~; }
if ($next)   { $output .= qq~<$font><strong><a href="$next">Next $build_links_per_page</a></strong></font> ~; }
if ($prev or $next) { $output .= qq~</p>~; }

if ($footer) { $output .= qq~<p>$footer</p>~; }

$output .= qq~
</table>

$site_bottomsearchbox<br> 
$site_footeroptions<br> 
$site_copynotice<br>

</td>
        <td width="10"></td>
        <td valign="top" width="140">$site_rightmenu</td>
    </tr>
</table>
</body>
</html>
~;

return $output;
}

##########################################################
##					  Category Listings       ##
##########################################################

sub site_html_print_cat {
# --------------------------------------------------------
# This routine determines how the list of categories will look.
# We now use a table to split the category name up into two columns.
# For each category you can use the following variables:
#
#   $url        : The URL to go to that category
#   $category_name : The category name with _ and / removed.
#   $category_descriptions{$subcat}: The category description (if any).
#   $numlinks   : The number of links inside that category (and subcategories).
#   $mod        : The newest link inside of that category.
#

    my (@subcat) = @_; 
    my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i, $cat_desc);
    my ($half) = int (($#subcat+2) / 2);
	
    # Print Header.
	$output = qq|<CENTER><TABLE BORDER=0 WIDTH="100%"><TR><TD VALIGN=TOP WIDTH="50%">\n|;
    
    foreach $subcat (sort @subcat) { 
	($description) = @{$category{$subcat}}[2];
         ($cat_desc) = @{$category{$subcat}}[5];
		
		
# First let's get the name, number of links, and last modified date...	
        $url = "$build_root_url/" . &urlencode($subcat) . "/";
        if ($cat_desc eq "") {
             if ($subcat =~ m,.*/([^/]+)$,) { 
                 $category_name = &build_clean($1); 
             } 
             else { 
                 $category_name = &build_clean($subcat); 
             }
         }
         else {
             $category_name = &build_last_title_mb($cat_desc);
         }        $numlinks = $stats{"$subcat"}[0]; 
        $mod = $stats{"$subcat"}[1];

# We check to see if we are half way through, if so we stop this table cell
# and begin a new one (this lets us have category names in two columns).		
		if ($i == $half) {
			$output .= qq|</UL></TD><TD VALIGN=TOP WIDTH="50%">\n|;
		}
		$i++;
		
        
# Then we print out the name linked, new if it's new, and popular if its popular.
        $output .= qq|<dl><dt><$font><strong><A HREF="$url">$category_name</A></strong> ($numlinks)</font>|;
		$output .= qq|<$font_new><strong>New</strong></font>| if (&days_old($mod) < $db_new_cutoff);
		$output .= qq|</dt>|;
		$output .= qq|<dd><$font>$description </font></dd>| if (!($description =~ /^[\s\n]*$/));
		$output .= qq|</dl>|;
        
    }
    
# Don't forget to end the unordered list..
    $output .= "</TD></TR></TABLE></CENTER>\n";
    return $output;
}

##########################################################
##					  Add Resources           ##
##########################################################

sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like. 
#
    &html_print_headers;
    
    print qq~   
<html>

<head>
<title>$site_title: Add a Resource</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: Add a URL</strong></font>
  <center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td>
				<FORM ACTION="$build_add_url" METHOD="POST">
					<p><center><$font>Please fill out the form completely, and we'll add your resource as soon as possible.</font></center>
						<table border="0">
							<tr><td align=right valign=top><$font>Title:</font></td>
								<td><INPUT NAME="Title" VALUE="$in{'Title'}" SIZE=50></td></tr>
							<tr><td align=right valign=top><$font>URL:</font></td>
								<td><INPUT NAME="URL" VALUE="http://" SIZE=50></td></tr>
							<tr><td align=right valign=top><$font>Category:</font></td>
								<td>~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Cat'}"); print qq~</font></td></tr> 
							<tr><td align=right valign=top><$font>Description: (Max 25 Words)</font></td>
								<td><TEXTAREA NAME="Description" VALUE="$in{'Description'}" ROWS=3 COLS=42>$in{'Description'}</TEXTAREA></td></tr>
							<tr><td align=right valign=top><$font>Contact Name:</font></td>
								<td><INPUT NAME="Contact Name" VALUE="$in{'Contact Name'}" SIZE=40></td></tr>					           
							<tr><td align=right valign=top><$font>Contact Email:</font></td>
								<td><INPUT NAME="Contact Email" VALUE="$in{'Contact Email'}" SIZE=40></td></tr>
							<tr><td align=right valign=top></td><td>Expires in:
								<INPUT NAME="Expire" VALUE="$in{'Expire'}" SIZE=10> days if you have a temporary link.</td></tr>
							<tr><td align=right valign=top><p><font face="Verdana" size="1"><INPUT TYPE="CHECKBOX" NAME="Promotion" VALUE="No">
                                           </td><td>Check this box if you DO NOT wish to recieve e-mail about site updates and special events.<BR> 
                                           </font></td></tr>
							<INPUT TYPE="HIDDEN" NAME="Votes" VALUE="0" SIZE="5" MAXLENGTH="8">
							<INPUT TYPE="HIDDEN" NAME="Rating" VALUE="0" SIZE="5" MAXLENGTH="8">					           
							<tr><td colspan=2><Center><INPUT TYPE="SUBMIT" VALUE="Add Resource"></Center></td></tr>
						</table>
					<center><table width=100%><p>
					<tr><td align=right valign=top><$font><center>Webmasters! Increase the popularity rating of your site by
					linking to us. <br> Just email us for the HTML to include in your site!
                              </center></td></tr></table></center>
                              </font></td>
					</form>
	
				</td></tr>
           	</table>
		</center>
    <hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;
}

sub site_html_add_success {
# --------------------------------------------------------
# This routine determines how the add failure page will look like. You have
# access to the following variables:
#
#   %in     : the variables used to add the link, useful in confirming what was
#             added.
#

    &html_print_headers;
    print qq~
<html>

<head>
<title>$site_title: Add Success</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: Resource Added</strong></font>
<center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td>
				<$font>We have received the following link:</font>
<PRE><strong>          Title:  $in{'Title'}
            URL:  $in{'URL'}
    Description:  $in{'Description'}
         Review:  $in{'Review'}
   Contact Name:  $in{'Contact Name'}
  Contact Email:  $in{'Contact Email'}
       Category:  $in{'Category'}
     Expires in:  $in{'Expire'} days
</strong></PRE>
					<P><$font>We will send you an email giving you all the information you need once your web sites details have been added to the system.<br><br>In the meantime do pass on our site details to your friends. We are adding thousands of new web sites to the system each week, so we are sure we will have something for you and your friends.</font>
				
<BR><BR><center><$font><A href="
http://useast.gifwizard.com/PGW?task=sitescanps&pn=38883&lang=uk&curr=uk&url=$in{'URL'}&results_email=$in{'Contact Email'}" target="_top">
Click here for a free site survey by GIF Wizard</A>.</font>
</tr></td>
			</table>
		</center>
    <hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;
}

sub site_html_add_failure {
# --------------------------------------------------------
# This routine determines how the add failure page will look like. You have
# access to the following variables:
#
#   $errormsg       : A bulleted list of the problems.
#   %in             : variables used in adding the form. Useful for recreating
#					 the form
#

    my ($errormsg) = $_[0];

    &html_print_headers;
    print qq~
<html>

<head>
<title>$site_title: Error Adding Resource</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: Error Adding Resource</strong></font>
<center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td colspan=2>
					<FORM ACTION="$build_add_url" METHOD="POST">					    
						<$font>There were the following errors trying to add your resource:
						<font color="red">
							$errormsg
						</font>
						<P>Please make any changes and try again!</font>
						<table border="0">
							<tr><td align=right valign=top><$font>Title:</font></td>
								<td><INPUT NAME="Title" VALUE="$in{'Title'}" SIZE=50></td></tr>
							<tr><td align=right valign=top><$font>URL:</font></td>
								<td><INPUT NAME="URL" VALUE="http://" SIZE=50></td></tr>
							<tr><td align=right valign=top><$font>Category:</font></td>
								<td>~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Cat'}"); print qq~</font></td></tr> 
							<tr><td align=right valign=top><$font>Description: (Max 25 Words)</font></td>
								<td><TEXTAREA NAME="Description" VALUE="$in{'Description'}" ROWS=3 COLS=42>$in{'Description'}</TEXTAREA></td></tr>
							<tr><td align=right valign=top><$font>Review:</font></td>
								<td><TEXTAREA NAME="Review" VALUE="$in{'Review'}" ROWS=3 COLS=42>$in{'Review'}</TEXTAREA></td></tr>
							<tr><td align=right valign=top><$font>Contact Name:</font></td>
								<td><INPUT NAME="Contact Name" VALUE="$in{'Contact Name'}" SIZE=40></td></tr>					           
							<tr><td align=right valign=top><$font>Contact Email:</font></td>
								<td><INPUT NAME="Contact Email" VALUE="$in{'Contact Email'}" SIZE=40></td></tr>
							<tr><td align=right valign=top></td><td>Expires in:
								<INPUT NAME="Expire" VALUE="$in{'Expire'}" SIZE=10> days if you have a temporary link.</td></tr>
							<tr><td align=right valign=top><p><font face="Verdana" size="1"><INPUT TYPE="CHECKBOX" NAME="Promotion" VALUE="No">
                                           </td><td>Check this box if you DO NOT wish to recieve e-mail about site updates and special events.<BR> 
                                           </font></td></tr>
							<INPUT TYPE="HIDDEN" NAME="Votes" VALUE="0" SIZE="5" MAXLENGTH="8">
							<INPUT TYPE="HIDDEN" NAME="Rating" VALUE="0" SIZE="5" MAXLENGTH="8">					           
							<tr><td colspan=2><Center><INPUT TYPE="SUBMIT" VALUE="Add Resource"></Center></td></tr>
							</table>
					<center><table width=100%><p>
					<tr><td align=right valign=top><$font><center>Webmasters! Increase the popularity rating of your site by
					linking to us. <br> Just email us for the HTML to include in your site!
                              </center></td></tr></table></center>
                              </font></td>
					</form>
				</td></tr>
			</table>
		</center>
    <hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;

}

##########################################################
##					  Modify Resources        ##
##########################################################

sub site_html_modify_form {
# --------------------------------------------------------
# This routine determines how the modify form page will look like. 
# You should include a text field for the URL to be modified as well
# as a new form for the new link information.
#
    &html_print_headers;
    
    print qq~   
<html>

<head>
<title>$site_title: Modify a Resource</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: Modify a Resource</strong></font>
<center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td>
				
<FORM ACTION="$build_modify_url" METHOD="POST">
						<p><$font>Please enter the URL of the link you wish to update. Make sure it is identical to the one already in the database:</font>
						<input name="Current URL" value="http://" size=30>
						<p><$font>Now enter the new information (all of it, not just the changes) below:
							<table border = 0">
							<tr><td align=right valign=top><$font>Title:</font></td>
								<td><INPUT NAME="Title" VALUE="$in{'Title'}" SIZE=50></td></tr>
							<tr><td align=right valign=top><$font>URL:</font></td>
								<td><INPUT NAME="URL" VALUE="http://" SIZE=50></td></tr>
							<tr><td align=right valign=top><$font>Category:</font></td>
								<td>~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Cat'}"); print qq~</font></td></tr> 
							<tr><td align=right valign=top><$font>Description:</font></td>
								<td><TEXTAREA NAME="Description" VALUE="$in{'Description'}" ROWS=3 COLS=42>$in{'Description'}</TEXTAREA></td></tr>
							<tr><td align=right valign=top><$font>Contact Name:</font></td>
								<td><INPUT NAME="Contact Name" VALUE="$in{'Contact Name'}" SIZE=40></td></tr>					           
							<tr><td align=right valign=top><$font>Contact Email:</font></td>
								<td><INPUT NAME="Contact Email" VALUE="$in{'Contact Email'}" SIZE=40></td></tr>
							<tr><td align=right valign=top></td><td>Expires in:
								<INPUT NAME="Expire" VALUE="$in{'Expire'}" SIZE=10> days if you have a temporary link.</td></tr>
							<tr><td align=right valign=top><p><font face="Verdana" size="1"><INPUT TYPE="CHECKBOX" NAME="Promotion" VALUE="No">
                                           </td><td>Check this box if you do not wish to recieve e-mail about site updates and special events.<BR> 
                                           </font></td></tr>
							<INPUT TYPE="HIDDEN" NAME="Votes" VALUE="0" SIZE="5" MAXLENGTH="8">
							<INPUT TYPE="HIDDEN" NAME="Rating" VALUE="0" SIZE="5" MAXLENGTH="8">					           
							<tr><td colspan=2><Center><INPUT TYPE="SUBMIT" VALUE="Add Resource"></Center></td></tr>
						</table>
					<center><table width=100%><p>
					<tr><td align=right valign=top><$font><center>Webmasters! Increase the popularity rating of your site by
					linking to us. <br> Just email us for the HTML to include in your site!
                              </center></td></tr></table></center>
                              </font></td>
					</form>
	
				</td></tr>
			</table>
		</center>

    <hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;
}

sub site_html_modify_success {
# --------------------------------------------------------
# This routine determines how the modify failure page will look like. You have
# access to the following variables:
#
#   %in     : the variables used to modify the link, useful in confirming what was
#             modified.
#

    &html_print_headers;
    print qq~
<html>

<head>
<title>$site_title: Modify a Resource</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: Modify a Resource</strong></font>
<center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td>
					<$font>We have received the following link:</font>
<PRE><strong>          Title:  $in{'Title'}
            URL:  $in{'URL'}
    Description:  $in{'Description'}
         Review:  $in{'Review'}
   Contact Name:  $in{'Contact Name'}
  Contact Email:  $in{'Contact Email'}
       Category:  $in{'Category'}
     Expires in:  $in{'Expire'} days
</strong></PRE>				
					<P><$font>We will send you an email giving you all the information you need once your web sites details have been added to the system.<br><br>In the meantime do pass on our site details to your friends. We are adding thousands of new web sites to the system each week, so we are sure we will have something for you and your friends.</font><br>
</td></tr>
			</table>
		</center>
    
<hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;
}

sub site_html_modify_failure {
# --------------------------------------------------------
# This routine determines how the modify failure page will look like. You have
# access to the following variables:
#
#   $errormsg       : A bulleted list of the problems.
#   %in             : variables used in modifying the form. Useful for recreating
#					 the form
#

    my ($errormsg) = $_[0];

    &html_print_headers;
    print qq~
<html>

<head>
<title>$site_title: Error Modifying Resource</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: Error Modifying Resource</strong></font>
<center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td colspan=2>
			<FORM ACTION="$build_modify_url" METHOD="POST">
						<p align=center><$font>There were the following errors trying to modify your resource:<br>
						<font color="red"><strong>
							$errormsg
						</strong></font>
						<p>Please make any changes and try again!</font>
						<p><$font>Please enter the URL of the link you wish to update. Make sure it is identical to the one already in the database:</font>
						<input name="Current URL" value="$in{'Current URL'}" size=30>
						<p><$font>Now enter the new information (all of it, not just the changes) below:
								<table border = 0 bgcolor="#FFFFDF">
							<tr><td align=right valign=top><$font>Title:</font></td>
								<td><INPUT NAME="Title" VALUE="$in{'Title'}" SIZE=50></td></tr>
							<tr><td align=right valign=top><$font>URL:</font></td>
								<td><INPUT NAME="URL" VALUE="http://" SIZE=50></td></tr>
							<tr><td align=right valign=top><$font>Category:</font></td>
								<td>~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Cat'}"); print qq~</font></td></tr> 
							<tr><td align=right valign=top><$font>Description:</font></td>
								<td><TEXTAREA NAME="Description" VALUE="$in{'Description'}" ROWS=3 COLS=42>$in{'Description'}</TEXTAREA></td></tr>
							<tr><td align=right valign=top><$font>Contact Name:</font></td>
								<td><INPUT NAME="Contact Name" VALUE="$in{'Contact Name'}" SIZE=40></td></tr>					           
							<tr><td align=right valign=top><$font>Contact Email:</font></td>
								<td><INPUT NAME="Contact Email" VALUE="$in{'Contact Email'}" SIZE=40></td></tr>
							<tr><td align=right valign=top></td><td>Expires in:
								<INPUT NAME="Expire" VALUE="$in{'Expire'}" SIZE=10> days if you have a temporary link.</td></tr>
							<tr><td align=right valign=top><p><font face="Verdana" size="1"><INPUT TYPE="CHECKBOX" NAME="Promotion" VALUE="No">
                                           </td><td>Check this box if you do not wish to recieve e-mail about site updates and special events.<BR> 
                                           </font></td></tr>
							<INPUT TYPE="HIDDEN" NAME="Votes" VALUE="0" SIZE="5" MAXLENGTH="8">
							<INPUT TYPE="HIDDEN" NAME="Rating" VALUE="0" SIZE="5" MAXLENGTH="8">					           
							<tr><td colspan=2><Center><INPUT TYPE="SUBMIT" VALUE="Add Resource"></Center></td></tr>
						</table>
					<center><table width=100% border=1 bgcolor="#B5FFB5"><p>
					<tr><td align=right valign=top><$font><center>Webmasters! Increase the popularity rating of your site by
					linking to us. <br> Just email us for the HTML to include in your site!
                              </center></td></tr></table></center>
                              </font></td>
					</form>
</td></tr>
			</table>
		</center>

<hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;

}

##########################################################
##					  Search Results          ##
##########################################################

sub site_html_search_results {
# --------------------------------------------------------
# This routine displays the search results for a certain keyword.
# 

my (@hits) = @_;
    
    &html_print_headers;    
    print qq~
<html>

<head>
<title>$site_title: Search Results</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
    <tr>
        <td valign="top" width="140">$site_menu</td>
        <td valign="top" width="10"></td>
        <td valign="top" width="440"><img src="http://www.digi-zone.com/images/results-title.gif" width="435" height="19"><br>
<br>
<center>$site_topsearchbox</center><br>
<$font>
Your search for <b>$in{'query'}</b> resulted in:<br>
<b>$cat_hits</b> matching categories<br>
<b>$link_hits</b> matching web sites</font><br>
					
~;
}
if ($category_results) {
	print qq~
				<table border="0" cellpadding="0"
                cellspacing="0" width="440">
                    <tr>
                        <td bgcolor="#FFFFFF"><img
                        src="http://www.digi-zone.com/images/clear.gif" align="right" hspace="0"
                        width="32" height="2"> </td>
                    </tr>
                    <tr>
                        <td bgcolor="#FFFFFF"><font size="2"
                        face="Arial"><b>Matching Categories:</b></font></td>
                    </tr>
</table>
<$font>$category_results</font><br>

~;
}
if ($link_results) {
	print qq~   
					<table border="0" cellpadding="0"
                cellspacing="0" width="440">
                    <tr>
                        <td bgcolor="#000000"><img
                        src="http://www.digi-zone.com/images/clear.gif" align="right" hspace="0"
                        width="32" height="2"> </td>
                    </tr>
                    <tr>
                        <td bgcolor="#F5F5F5"><font size="2"
                        face="Arial"><b>Matching Web Sites</b></font></td>
                    </tr>
                </table>
~;
if ($next) {
	my (@lang) = ("first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eigth");
	print qq~
<$font>Here is your $lang[$in{'nh'}] $maxhits matches. Get the next <strong><a href="$next">$next_hits</a></strong> matches?
</font>
<br>

<$font>$link_results</font>

~;
}
if ($next) {
	my (@lang) = ("first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eigth");
	print qq~
<$font>Here is your $lang[$in{'nh'}] $maxhits matches. Get the next <strong><a href="$next">$next_hits</a></strong> matches?
</font>
	~;
}
print qq~
$site_bottomsearchbox 
</td>
        <td valign="top" width="10">&nbsp;</td>
        <td valign="top" width="140">$site_rightmenu</td>
    </tr>
</table>
</body>
</html>

~;
}

sub site_html_search_failure {
# --------------------------------------------------------
# This routine displays a failed search page with error in $error.
#
    my ($error) = $_[0];
    &html_print_headers;
    
    print qq~
<html>

<head>
<title>$site_title: Search Failed</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
    <$font_subtitle><strong>$site_title: Search Failed</strong></font>
<center>
			<table border="0" cellpadding="0" cellspacing="0" width="85%">            
				<tr><td>
<p><$font>Error: <font color=red>$error</font></p>
					
</td></tr>
			</table>
		</center>
    
<hr noshade color="#FF0000" size="1" width="580" align="center"> 
    <p align="center">$site_footeroptions<br><br>$site_copynotice<br>
    </p>
    </div></td>
  </tr>
</table>
</body>
</html>
~;
}
    

sub site_html_search_form {
# --------------------------------------------------------
# This routine displays the search form.

    &html_print_headers;
    print qq~
<html>

<head>
<title>$site_title: Search Options</title>
</head>

<$site_body>
<center>
<center>$site_ad</center>
<table border="0" width="700">
	<tr><td valign="top">
		<P>
		<hr size=1 width=700>
		<$font_subtitle><strong>$site_title: Search Options</strong></font><BR>
		<hr size=1 width=700>
		$site_menu
		<hr size=1 width=700>
		<center>
			<table border=1 bgcolor="#FFFFDF" width="80%">            
				<tr><td><center>
					<form action="$build_search_url" method="GET">
						<$font>
						Search: <INPUT TYPE="TEXT" NAME="query" SIZE=30> <INPUT TYPE="Submit" VALUE="Search"><BR>
						Number of Results: <SELECT NAME="mh"><OPTION>10<OPTION SELECTED>25<OPTION>50<OPTION>100</SELECT><BR>
						As Keywords: <INPUT TYPE="RADIO" NAME="type" VALUE="keyword" CHECKED> As Phrase: <INPUT TYPE="RADIO" NAME="type" VALUE="phrase"><BR>
						AND connector: <INPUT TYPE="RADIO" NAME="bool" VALUE="and" CHECKED> OR connector: <INPUT TYPE="RADIO" NAME="bool" VALUE="or">
						</font>
					</form>
				</center></td></tr>
			</table>
		</center>
	    $site_footer
	</td></tr>
</table>
</center>
</body>
</html>
~;
}

##########################################################################
# HTML for the top of the Links Tree                                    ##
##########################################################################
sub build_tree_top   {

qq~ 
<html> 

<head> 
<title>$site_title: Links Tree</title> 
</head> 

<$site_body> 

<center> 
$site_ad 
<table border="0" width="700"> 
 <tr><td valign="top"> 
  <P><hr size=1 width=700> 
  <$font_subtitle><strong>$site_title: Links Tree</strong></font><BR> 
  <$font><strong><a href="$url">Links Tree</a></strong></font><BR> 
  <hr size=1 width=700> 
   <center>$site_menu</center> 
  <hr size=1 width=700> 
 </td></tr> 
</table> 
</center><center><table width=700><tr><td> 
~; 
}

##########################################################################
# HTML for the bottom of the Links Tree##
##########################################################################
sub build_tree_bottom {

qq~ 
</td></tr></table></center>
<center> 
  $site_footer 
</center> 
</body> 
</html> 
~; 
}

##########################################################################
# HTML for the FrameIt Rating Mod
##########################################################################
sub output_footer {

# Output the footer
	print "Content-type: text/html\n\n";
	print "<html><body bgcolor=\"#B5DAFF\">\n";
	print "<center>\n";
	print "<a href=$build_rate_url?ID=$Form{ID} target=\"bottom\"><font size=2 face=arial><b>Rate this site</a></b></font>&nbsp;&nbsp;&nbsp;\n";
	print "<a href=\"$Form{back}\" target=\"_top\"><font size=2 face=arial><b>Go Back</a></b></font>&nbsp;&nbsp;&nbsp;\n";
	print "<a href=\"$Form{url}\" target=\"_top\"><font size=2 face=arial><b>Remove Frame</b></font></a></b></font>&nbsp;&nbsp;&nbsp;\n";
	print "</center>\n";
	print "</body></html>\n";

}

###############################################################
# This routine determines how the rating page will look like.
#
#   $id             : stores the ID of the page.
#   $title          : stores the Title of the page.
###############################################################
sub site_html_rating_form {
                    
        my ($id) = $_[0];
        my ($title) = $_[1];
        &html_print_headers;
	print qq~
	<html>
	<head>
	<title>Rate It</title>
	</head>
	<body bgcolor=B5DAFF topmargin=0 marginheight=0>
      <center>
	<table cellpadding=0 cellspacing=0><tr><td align=right valign=top><font size=2 face=arial,helvetica><b>Rating for: <i>$title</i></b></font>&nbsp;&nbsp;&nbsp;&nbsp;
	</td><td align=right valign=top><form method="POST" action="$build_root_url/rate.cgi">
      <input NAME="ID" VALUE="$id" type="hidden">
	<select name="R">
	<OPTION>---
	<OPTION>1
	<OPTION>2
	<OPTION>3
	<OPTION>4
	<OPTION>5
	<OPTION>6
	<option>7
	<option>8
	<option>9
	<option>10
	</select>
	<input type=submit value="Submit">
	</form></td><td align=right valign=top><font size=2 face=arial,helvetica>
	<b>(10 being best)</b></font></td></tr></table></center>
	~;
}

###############################################################
# This routine is called when someone calls rate.cgi without
# an id.
###############################################################                    
sub site_html_rating_form_noid {

        &html_print_headers;
	print qq~
	<html>
	<head>
	<title>Rate It</title>
	</head>
	<body bgcolor=B5DAFF topmargin=0 marginheight=0>
      <center><font size=2 face=arial,helvetica><b>You must enter an ID, go back...</b></center></font>
        </body>
        </html>
	~;
}

###############################################################
# This routine is called when someone rates a page successfully
#   $id             : stores the ID of the page.
#   $title          : stores the Title of the page.
###############################################################                    
sub site_html_rating_form_success {

        my ($id) = $_[0];	
        my ($url) = $_[1];
	my ($title) = $_[2];
	my ($votes) = $_[3];
	my ($rating) = $_[4];
        &html_print_headers;
	print qq~
        <html>
	<body bgcolor=B5DAFF topmargin=0 marginheight=0>
      <center><font size=2 face=arial,helvetica>
	<b>Thank you for voting for: <i>$title</i></b>&nbsp;&nbsp;&nbsp;
	<a href=$url target="_top">Remove Frame</a>&nbsp;&nbsp;&nbsp;
	<a href=$build_root_url target="_top">Home</font></center>
        </body>
        </html>
        ~;
}

###############################################################
# This routine is called when someone attempts to rate a site
# for the second time within the past 6 hours.
###############################################################                    
sub site_html_rating_form_cheat {

        my ($ip) = $_[0];
        &html_print_headers;
        print qq~
        <html>
	<body bgcolor=B5DAFF topmargin=0 marginheight=0>
      <center><font size=2 face=arial,helvetica>
	<b>ERROR:&nbsp&nbsp;$ip has already voted for this resource, go back...</b></center></font>
        </body>
        </html>
        ~;
}

###############################################################
# This routine determines what one site in the top x/% list 
# will look like.
###############################################################                    
sub site_html_rstat_listing {

        my ($id) = $_[0];	
        my ($url) = $_[1];
	my ($title) = $_[2];
	my ($votes) = $_[3];
	my ($rating) = $_[4];
	my ($d) = $_[5];
	
	$output = qq|
	<ul type=disc><li><a href="$build_jump_url?ID=$id">$title</a>&nbsp;&nbsp;Votes: $votes. Rating: $rating.</ul>|;
	return $output;
}

###############################################################
# This routine is called to show the real time statistics.
###############################################################                    
sub site_html_rstat_show {

        my ($votes) = $_[0];	# Statistics by Votes
	my ($rating) = $_[1];	# Statistics by Rating
        print qq~ 
<html>
<head>
<title>$site_title</title>
</head>

<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top"><center>$site_searchbox</center>
    <hr size="1" noshade width="580" color="#FF0000" align="center">
		
		<$font_title>$site_title</font><BR>
		<$font><em>$site_subtitle</em></font><BR>
		<center><TABLE WIDTH=85%><TR><TD><FONT SIZE=2 FACE=ARIAL><B>Top 10% By Votes</B></FONT><br>$votes<hr><FONT SIZE=3 FACE=ARIAL><B>Top 10% By Rating</B></FONT><br>$rating<br></TD></TR></TABLE></center>
		$site_footer
	</td></tr>
</table>
</center>
</body>
</html>
~;
  
}

############################################################
# Review-It Mod HTML for a successful review
############################################################
sub site_html_review {
# --------------------------------------------------------
# This routine Prints Out The Review
#   $title       : Name of Link to be reviewed   
#   $review      : Site review
#   $url         : Full URL of reviewed site
#   $date        : The date the link was last modified or added
#   $hits        : the number of hit this site has
#   $votes	     : How many votes the link has (if you have Rate-It installed)
#   $rating	     : Rating of the site (if you have Rate-It installed)
#     IF YOU ARE ADDING THE REVIEW-IT MOD TO A SITE THAT DOESN'T HAVE 
#	THE RATE-IT MOD INSTALLED --> YOU MUST MODIFY THE HTML BELOW TO REMOVE
#	BOTH THE VOTES AND THE RATING SECTIONS OF THE REVIEW
		
&html_print_headers;
print qq~
<html>

<head>
<title>$site_title: Review for $title</title>
</head>
<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top">
    <hr size="1" noshade width="580" color="#FF0000" align="center">

		<table width=85% cellspacing=0 cellpadding=0 border=0><tr><td><$font_title>$site_title</font><BR>
		<$font><i>$site_subtitle</i></font></td><td align=center></td></tr></table>
		<center>
			<table border=0 bgcolor="#000033" width="80%"><tr><td>
			<table width=100% align=left valign=top><tr><td align=left valign=top><font size=2 face=verdana,arial><b>Review for $title</b><br>$review</font>
			</td><td><table border=1 bgcolor="#000033" align=top><tr><td><font size=1>ADDED: $date<br>HITS: $hits<br>VOTES: $votes<br>RATING: $rating<br></font></td></tr></table>
	       	</td></tr></table></td></tr><tr><td bgcolor="#000033"><table width=100% bgcolor="#000033"><tr><td>Full URL: <a href="$url" target="_top">$url</a></td></tr></table>			
			</td></tr></table>
		</center>
		$site_footer
	</td></tr>
</table>
</center>
</body>
</html>
~;
}

############################################################
# Review-It Mod HTML for review submission that has no ID#
############################################################
sub site_html_review_noid {
&html_print_headers;
print qq~
<html>

<head>
<title>$site_title: Review for $title</title>
</head>
<$site_body>

<table border="0" cellpadding="0" cellspacing="0" width="740">
  <tr>
    <td width="150" valign="top">$site_menu</td>
    <td width="590" valign="top">
    <hr size="1" noshade width="580" color="#FF0000" align="center">

	<tr><td valign="top">
		<P>
		<table width=85% cellspacing=0 cellpadding=0 border=0><tr><td><$font_title>$site_title</font><BR>
		<$font><i>$site_subtitle</i></font></td><td align=center></td></tr></table>
		<center><hr size=1 width=700>
			$site_menu
		
			<table border=1 bgcolor="#000033" width="80%"><tr><td>
			<table width=85% align=left valign=top><tr><td align=left valign=top><center><font size=3 face=verdana,arial><b>Go back, you did something wrong!</b></font></center></td></tr></table>		
			</td></tr></table>
		</center>
		$site_footer
	</td></tr>
</table>
</center>
</body>
</html>
~;
exit;
}

1;
