<?PHP include("config.php");

// set the page title
$pagetitle = "Search The Database";

// set meta tags
$meta_keywords = "search triathlons";
$meta_description = "Do you want to search for triathlons in our online multisport calendar? Then use this form to enter your criteria.";

?>

<?
//Array of states for use in the form

$state_list = mysql_query("SELECT * FROM gforum_ResourceStates");

?>

<? include("include_common_head.php"); ?>
<body class="listings">
  <? include($common_path . "/ads/ad_wallpaper.html"); ?>

  <div class="container">
    <? include($common_path . "/templates/include_header.php"); ?>
    <div class="main">
      <div class="contentwrapper clearfix">
        <? include("include_breadcrumb.php"); ?>

        <section class="section listings section-has-widgets section-static remove-sidebar">
          <div class="sidebar-b">
            <? include("include_sidebar.php"); ?>
          </div>

          <div class="content content-has-widgets">
            <div class="grid">

              <div class="clearfix">
                <h1>Search For A Roadshow Event</h1>
                <hr class="line">
                <p>If you would like to search for a roadshow event, please use the form below. None of the fields are mandatory. Checking no box "selects all." Checking regions selects all states in that region. Checking any state's box selects or deselects that state.</p>
                <? if ( $errmsg ) { ?>
                <p class="error"><? echo $errmsg; ?></p>
                <? } ?>
                <form enctype="multipart/form-data" action="search_X.php" method="post" name="searchform">
                <div class="dtable form">
                    <div class="drow">
                        <div class="dcell name">Date Override</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <input type="checkbox" name="futuredates" value="1"> Yes
                            [overrides keyword search default and allows you to use the date boxes below. Also resets default search to start with today's date.]
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Start Date</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <select name="aftermonth">
                                <option value="0">Month
                                <option value="01">January
                                <option value="02">February
                                <option value="03">March
                                <option value="04">April
                                <option value="05">May
                                <option value="06">June
                                <option value="07">July
                                <option value="08">August
                                <option value="09">September
                                <option value="10">October
                                <option value="11">November
                                <option value="12">December
                            </select>
                            <select name="afterday">
                                <option value="0">Day
                                <? for ($i = 1; $i <= 31; $i++) { echo ("<option value='".sprintf('%02d', $i)."'>$i"); } ?>
                            </select>
                            <select name="afteryear">
                                <option value="0">Year
                            </select><br>[Leave blank for today's date]
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">End Date</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <select name="beforemonth">
                            <option value="0">Month
                            <option value="01">January
                            <option value="02">February
                            <option value="03">March
                            <option value="04">April
                            <option value="05">May
                            <option value="06">June
                            <option value="07">July
                            <option value="08">August
                            <option value="09">September
                            <option value="10">October
                            <option value="11">November
                            <option value="12">December
                            </select>
                            <select name="beforeday">
                            <option value="0">Day
                            <? for ($i = 1; $i <= 31; $i++) { echo ("<option value='".sprintf('%02d', $i)."'>$i"); } ?>
                            </select>
                            <select name="beforeyear">
                                <option value="2016" selected>2016
                            </select>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name"></div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <h3>Local Assets</h3>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Slowtwitch Ambassador(s)</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <input type="checkbox" name="stambassador" value="1">Yes
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Tri Club(s)</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <input type="checkbox" name="triclub" value="1">Yes
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Coach(es)</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <input type="checkbox" name="coach" value="1">Yes
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Race Director(s)</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <input type="checkbox" name="racedirector" value="1">Yes
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Brewery(ies)</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <input type="checkbox" name="brewery" value="1">Yes
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Fit Bikes</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[fitbike])){ $explosion = explode(",", $_POST[fitbike]); } else { $explosion = $_POST[fitbike]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceFitbike ORDER BY fitbike_name ASC");
	
    echo("<p><input type=\"checkbox\" name=\"fitbike[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"fitbike[]\" value=\"$row[fitbike_id]\" ");
		if (in_array($row[fitbike_id], $explosion)){ echo "checked "; }
		echo(">$row[fitbike_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Saddle Quick Change</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[saddlechange])){ $explosion = explode(",", $_POST[saddlechange]); } else { $explosion = $_POST[saddlechange]; }
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceSaddlechange ORDER BY saddlechange_name ASC");
    echo("<p><input type=\"checkbox\" name=\"saddlechange[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"saddlechange[]\" value=\"$row[saddlechange_id]\" ");
		if (in_array($row[saddlechange_id], $explosion)){ echo "checked "; }
		echo(">$row[saddlechange_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Motion Capture Systems</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	
	$explosion = array("");
	if (!is_array($_POST[motioncapture])){ $explosion = explode(",", $_POST[motioncapture]); } else { $explosion = $_POST[motioncapture]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceMotioncapture ORDER BY motioncapture_name ASC");
	
    echo("<p><input type=\"checkbox\" name=\"motioncapture[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"motioncapture[]\" value=\"$row[motioncapture_id]\" ");
		if (in_array($row[motioncapture_id], $explosion)){ echo "checked "; }
		echo(">$row[motioncapture_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Custom Footbeds</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[footbed])){ $explosion = explode(",", $_POST[footbed]); } else { $explosion = $_POST[footbed]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceCustomfootbed ORDER BY footbed_name ASC");
    echo("<p><input type=\"checkbox\" name=\"footbed[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"footbed[]\" value=\"$row[footbed_id]\" ");
		if (in_array($row[footbed_id], $explosion)){ echo "checked "; }
		echo(">$row[footbed_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name"></div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <h3>Brands</h3>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Tri Apparel</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[apparel_tri])){ $explosion = explode(",", $_POST[apparel_tri]); } else { $explosion = $_POST[apparel_tri]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceApparelTri ORDER BY apparel_tri_name ASC");
	
    echo("<p><input type=\"checkbox\" name=\"apparel_tri[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"apparel_tri[]\" value=\"$row[apparel_tri_id]\" ");
		if (in_array($row[apparel_tri_id], $explosion)){ echo "checked "; }
		echo(">$row[apparel_tri_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Bike Brands</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[bike])){ $explosion = explode(",", $_POST[bike]); } else { $explosion = $_POST[bike]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBike ORDER BY bike_name ASC");
    echo("<p><input type=\"checkbox\" name=\"bike[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"bike[]\" value=\"$row[bike_id]\" ");
		if (in_array($row[bike_id], $explosion)){ echo "checked "; }
		echo(">$row[bike_name]</span>\n");
    }
	
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Bike Saddles/Footwear/Aerobars/Bike Hydration</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[bikeaccessory])){ $explosion = explode(",", $_POST[bikeaccessory]); } else { $explosion = $_POST[bikeaccessory]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBikeAccessory ORDER BY bikeaccessory_name ASC");
	
    echo("<p><input type=\"checkbox\" name=\"bikeaccessory[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"bikeaccessory[]\" value=\"$row[bikeaccessory_id]\" ");
		if (in_array($row[bikeaccessory_id], $explosion)){ echo "checked "; }
		echo(">$row[bikeaccessory_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Bike Helmets/Eyewear</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[bikehelmet])){ $explosion = explode(",", $_POST[bikehelmet]); } else { $explosion = $_POST[bikehelmet]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBikeHelmet ORDER BY bikehelmet_name ASC");
    echo("<p><input type=\"checkbox\" name=\"bikehelmet[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"bikehelmet[]\" value=\"$row[bikehelmet_id]\" ");
		if (in_array($row[bikehelmet_id], $explosion)){ echo "checked "; }
		echo(">$row[bikehelmet_name]</span>\n");
    }
	
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Bike Nutritionals/Lubricants/Botanicals</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[bikebody])){ $explosion = explode(",", $_POST[bikebody]); } else { $explosion = $_POST[bikebody]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBikeBody ORDER BY bikebody_name ASC");
	
    echo("<p><input type=\"checkbox\" name=\"bikebody[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"bikebody[]\" value=\"$row[bikebody_id]\" ");
		if (in_array($row[bikebody_id], $explosion)){ echo "checked "; }
		echo(">$row[bikebody_name]</span>\n");
    }
	
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Bike Stationary Trainers</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	
	$explosion = array("");
	if (!is_array($_POST[biketrainer])){ $explosion = explode(",", $_POST[biketrainer]); } else { $explosion = $_POST[biketrainer]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBikeTrainer ORDER BY biketrainer_name ASC");
	
	$i = 0;
	echo("<tr>");
	while ($row = mysql_fetch_array($results)) {
		if(!($i%4)) echo "</tr><tr>";
		echo("<td width=\"25%\"><input type=\"checkbox\" name=\"biketrainer[]\" value=\"$row[biketrainer_id]\" ");
		if (in_array($row[biketrainer_id], $explosion)){ echo "checked "; }
		echo(">$row[biketrainer_name]</td>\n");
	$i++;
}
if(!($i%4)) echo "</tr><tr>";
echo("<td width=\"25%\"><input type=\"checkbox\" name=\"biketrainer[]\" value=\"999\" ><strong>ANY</strong></td>
");
echo("</tr>");
	
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Bike Electronics/Cameras/Metrics</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[bikeelectronic])){ $explosion = explode(",", $_POST[bikeelectronic]); } else { $explosion = $_POST[bikeelectronic]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBikeElectronic ORDER BY bikeelectronic_name ASC");
	
    echo("<p><input type=\"checkbox\" name=\"bikeelectronic[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"bikeelectronic[]\" value=\"$row[bikeelectronic_id]\" ");
		if (in_array($row[bikeelectronic_id], $explosion)){ echo "checked "; }
		echo(">$row[bikeelectronic_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Bike Wheels/Tires</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[bikewheel])){ $explosion = explode(",", $_POST[bikewheel]); } else { $explosion = $_POST[bikewheel]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBikeWheel ORDER BY bikewheel_name ASC");
    echo("<p><input type=\"checkbox\" name=\"bikewheel[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"bikewheel[]\" value=\"$row[bikewheel_id]\" ");
		if (in_array($row[bikewheel_id], $explosion)){ echo "checked "; }
		echo(">$row[bikewheel_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Bike Components</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[bikecomponent])){ $explosion = explode(",", $_POST[bikecomponent]); } else { $explosion = $_POST[bikecomponent]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBikeComponent ORDER BY bikecomponent_name ASC");
	
    echo("<p><input type=\"checkbox\" name=\"bikecomponent[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span span=\"col\"><input type=\"checkbox\" name=\"bikecomponent[]\" value=\"$row[bikecomponent_id]\" ");
		if (in_array($row[bikecomponent_id], $explosion)){ echo "checked "; }
		echo(">$row[bikecomponent_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Socks</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	
	$explosion = array("");
	if (!is_array($_POST[sock])){ $explosion = explode(",", $_POST[sock]); } else { $explosion = $_POST[sock]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceSock ORDER BY sock_name ASC");
    echo("<p><input type=\"checkbox\" name=\"sock[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"sock[]\" value=\"$row[sock_id]\" ");
		if (in_array($row[sock_id], $explosion)){ echo "checked "; }
		echo(">$row[sock_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Running Shoes</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[shoe])){ $explosion = explode(",", $_POST[shoe]); } else { $explosion = $_POST[shoe]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceShoe ORDER BY shoe_name ASC");
    echo("<p><input type=\"checkbox\" name=\"shoe[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"shoe[]\" value=\"$row[shoe_id]\" ");
		if (in_array($row[shoe_id], $explosion)){ echo "checked "; }
		echo(">$row[shoe_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Run Apparel</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[apparel_run])){ $explosion = explode(",", $_POST[apparel_run]); } else { $explosion = $_POST[apparel_run]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceApparelRun ORDER BY apparel_run_name ASC");
    echo("<p><input type=\"checkbox\" name=\"apparel_run[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"apparel_run[]\" value=\"$row[apparel_run_id]\" ");
		if (in_array($row[apparel_run_id], $explosion)){ echo "checked "; }
		echo(">$row[apparel_run_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Run Hydration</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[runhydrate])){ $explosion = explode(",", $_POST[runhydrate]); } else { $explosion = $_POST[runhydrate]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceRunHydrate ORDER BY runhydrate_name ASC");
    echo("<p><input type=\"checkbox\" name=\"runhydrate[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"runhydrate[]\" value=\"$row[runhydrate_id]\" ");
		if (in_array($row[runhydrate_id], $explosion)){ echo "checked "; }
		echo(">$row[runhydrate_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Wetsuits</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[wetsuit])){ $explosion = explode(",", $_POST[wetsuit]); } else { $explosion = $_POST[wetsuit]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceWetsuit ORDER BY wetsuit_name ASC");
    echo("<p><input type=\"checkbox\" name=\"wetsuit[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"wetsuit[]\" value=\"$row[wetsuit_id]\" ");
		if (in_array($row[wetsuit_id], $explosion)){ echo "checked "; }
		echo(">$row[wetsuit_name]</span>\n");
    }
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Swim Apparel/Gear</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[swimgear])){ $explosion = explode(",", $_POST[swimgear]); } else { $explosion = $_POST[swimgear]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceSwimgear ORDER BY swimgear_name ASC");
    echo("<p><input type=\"checkbox\" name=\"swimgear[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"swimgear[]\" value=\"$row[swimgear_id]\" ");
		if (in_array($row[swimgear_id], $explosion)){ echo "checked "; }
		echo(">$row[swimgear_name]</span>\n");
    }
	
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Body Care Tools</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[bodycare])){ $explosion = explode(",", $_POST[bodycare]); } else { $explosion = $_POST[bodycare]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceBodycare ORDER BY bodycare_name ASC");
    echo("<p><input type=\"checkbox\" name=\"bodycare[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"bodycare[]\" value=\"$row[bodycare_id]\" ");
		if (in_array($row[bodycare_id], $explosion)){ echo "checked "; }
		echo(">$row[bodycare_name]</span>\n");
    }
	
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name"></div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <h3>Technology, Community &amp; Education</h3>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Key Tri-Specific Contact(s)</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <input type="checkbox" name="trispecific" value="1">Yes
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Diagnostic Equipment</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
    <?
	$explosion = array("");
	if (!is_array($_POST[diagnostic])){ $explosion = explode(",", $_POST[diagnostic]); } else { $explosion = $_POST[diagnostic]; }
	
	$results = mysql_query("SELECT * FROM ".$prefix."ResourceDiagnostic ORDER BY diagnostic_name ASC");
	
    echo("<p><input type=\"checkbox\" name=\"diagnostic[]\" value=\"999\" ><strong>ANY</strong></p>");
	while ($row = mysql_fetch_array($results)) {
		echo("<span class=\"col\"><input type=\"checkbox\" name=\"diagnostic[]\" value=\"$row[diagnostic_id]\" ");
		if (in_array($row[diagnostic_id], $explosion)){ echo "checked "; }
		echo(">$row[diagnostic_name]</span>\n");
    }
	
	?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">Region</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
<p>[Selecting a region will select all states in that region. You can then deselect or select any additional states. Only the selected states will be included in your search. Leaving all boxes blank will select races in all states.]</p>
<? 
$regions = array();
$regionsql = "SELECT gts.statetag AS statetag, gtr.regionlong AS regionlong
FROM gforum_TriathlonsStates AS gts
LEFT JOIN gforum_TriathlonsRegions AS gtr
ON gts.regionid = gtr.regionid
ORDER BY gtr.regionlong";

$region_list = mysql_query($regionsql);

//use loop for check box array
while($row = mysql_fetch_array($region_list)){
   if (!is_array($regions[$row[regionlong]])) { $regions[$row[regionlong]] = array(); }
   array_push($regions[$row[regionlong]], $row[statetag]);
}

foreach($regions AS $region => $statetag) {
    echo("<span class=\"col\"><input type=\"checkbox\" name=\"region\" value=\"$region\" onClick=\"javascript: checkUncheck(this,'".implode("', '", $statetag)."');\">$region</span>\n");
    $i++;
  
}
?>

                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcell name">State</div>
                        <div class="dcell divider"></div>
                        <div class="dcell value states">
<? //use loop for check box array
while($row = mysql_fetch_array($state_list)){
   echo "<span class=\"col\"><input type='checkbox' id='states' name='states[]' value=\"$row[statetag]\"> $row[statelong]</span>\n";
}
?>
<p>[Leave blank to select all.]</p>
                        </div>
                    </div>
                    <div class="drow actions">
                        <div class="dcell name"></div>
                        <div class="dcell divider"></div>
                        <div class="dcell value">
                            <input type="submit" value="Search" class="btn">
                        </div>
                    </div>
                </div>
                </form>

              </div><!-- end col-2/3 -->

            </div><!-- end grid -->
          </div><!-- end content -->
        </section>

      </div><!-- end contentwrapper -->
    </div> <!-- end main -->

  <? include($common_path . "/templates/include_footer.php") ?>
  </div> <!-- container  -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>
