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

$results = mysql_query("SELECT regionlong FROM ".$prefix."ResourceRegions WHERE regionid = '".mysql_real_escape_string($_GET[region])."' LIMIT 1") OR die ( header('Location: '.$site_url.'?mysql_error'));

if (mysql_num_rows($results) == 0) {
  header('Location: '.$site_url.'?mysql_error');
}

$row = mysql_fetch_array($results);
$regionname = $row['regionlong'];

$results = mysql_query("SELECT * FROM ".$prefix.$main_table." AS gf
RIGHT JOIN ".$prefix."ResourceStates AS gts
ON gts.regionid = '".mysql_real_escape_string($_GET[region])."' AND gf.".$field_lead."state_tag = gts.statetag
WHERE gf.".$field_lead."valid = 1 ORDER BY gf.".$field_lead."name ASC") OR die(mysql_error());

$none = FALSE;
if (mysql_num_rows($results) == 0) {
  $none = TRUE;
}

// set the page title
$pagetitle = $regionname;

// set meta tags
$meta_keywords = $local_name_lc." in ".$regionname;
$meta_description = "Trying to find ".$local_name_lc." in ".$regionname."? Here is a listing of all ".$regionname.$local_name_lc.".";
?>

<? include("include_common_head.php"); ?>
<? include("include_common_content.php"); ?>

<!-- Start outer -->
<div id="outer">

<!-- BODY -->
<div class="content">
<!-- LEFT COLUMN -->

<!-- End left column -->
<!-- Content col -->

<h1 class="content-title"><strong><? echo ($regionname." ".$local_name); ?></strong></h1>
<div class="indent">
<?
if($none == TRUE){
echo ("No ".$local_name_lc." have been entered yet for ".$regionname.".");
}
?>
<table border="0" cellspacing="0" cellpadding="1" width="580">
<? 
$x = 0;
while($row = mysql_fetch_array($results)){
$x++;
if($x % 2 == 0){ $bg = '#dddddd'; }else{ $bg = '#eeeeee'; }
?>
<tr bgcolor="<? echo "$bg"; ?>"><td><br><a class="sub-hdr" style="margin-left: 5px;" href="<? echo ("individual.php?".$field_lead."id=".$row[''.$field_lead.'id'].""); ?>"><? echo $row[''.$field_lead.'name']; ?></a></td></tr>

<tr bgcolor="<? echo "$bg"; ?>">
	<td><strong class="indent">Address:</strong> <? 
		echo ($row[''.$field_lead.'address']); 
		if($row[''.$field_lead.'address_two']) { 
			echo ("<br /><span class='indent'>".$row[''.$field_lead.'address_two']."</span>"); 
		} 
		echo("<br /><span class='indent'>".$row[''.$field_lead.'city'].", ".$row[''.$field_lead.'state']." ".$row[''.$field_lead.'zip']."</span>"); 
	?>
	</td>
</tr>
<tr bgcolor="<? echo "$bg"; ?>">
	<td><strong class="indent"><? 
		echo ("Phone: </strong>".$row[''.$field_lead.'phone']."<br /><strong class='indent'>Fax/Alt Phone: </strong>". $row[''.$field_lead.'fax']."");
	?>
	</td>
</tr>

<tr bgcolor="<? echo "$bg"; ?>">
	<td>
		<div class="indent">
			<strong>Email:</strong> <? echo "<a href='mailto:".$row[''.$field_lead.'email']."'>".$row[''.$field_lead.'email']."</a>"; ?><br />
			<strong>Website:</strong> <? echo "<a href='".$row[''.$field_lead.'website']."' target='_blank'>".$row[''.$field_lead.'website']."</a>"; ?>
			<br />
			<? echo ("<a class='nav' href='individual.php?".$field_lead."id=".$row[''.$field_lead.'id']."'>More information</a>"); ?>
			<br /><br />
		</div>
	</td>
</tr>

<? } ?>
</table>
</div>
<!-- End content col -->

</div>
<!-- End BODY -->
</div>
<!-- End Outer -->

<? include("include_common_footer.php"); ?>

