<?
require_once("../conn.php");
require_once("access.php");
require_once("LeftStyles.php");
require_once("../includes.php");

//get the agent details
$q1 = "select * from yellow_agents where AgentID = '$_GET[id]' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

//get the logo
if(!empty($a1[logo]))
{
	$AgentLogo = "<img src=\"../yellow_images/$a1[logo]\" border=0 width=125 height=65>";
}

$AgentName = $a1[FirstName]." ".$a1[LastName];

if(!empty($a1[address]))
{
	$contact .= "$a1[address]<br>";
}

if(!empty($a1[city]))
{
	$csc[] = $a1[city];
}

if(!empty($a1[state]))
{
	$csc[] = $a1[state];
}

if(!empty($a1[country]))
{
	$csc[] = $a1[country];
}

$csc2 .= implode(", ", $csc);

$contact .= $csc2."<br>";

if(!empty($a1[phone]))
{
	$contacts .= "Phone: <b>$a1[phone]</b>";
}

if(!empty($a1[cellular]))
{
	$contacts .= "; Cellular: <b>$a1[cellular]</b>";
}

if(!empty($a1[pager]))
{
	$contacts .= "; Pager: <b>$a1[pager]</b>";
}

$email = "Click <a class=RedLink href=\"mailto:$a1[email]\">here</a> to email!";

//get the number of offers
$q2 = "select count(ListingID) from yellow_listings where AgentID = '$a1[AgentID]' ";
$r2 = mysql_query($q2) or die(mysql_error());
$a2 = mysql_fetch_array($r2);

$offers = $a2[0];

if($offers > '0')
{
	$offers = $offers." <a class=BlueLink href=\"../search.php?AgentID=$_GET[id]\" target=_blank>View offers</a>";
}


if(!empty($a1[ResumeImages]))
{
	$MyImages = explode("|", $a1[ResumeImages]);

	while(list($k,$v) = each($MyImages))
	{
		$images .= "<a href=\"resume.php?id=$_GET[id]&si=$k\"><img src=\"../yellow_images/$v\" border=0 width=100 height=100></a> &nbsp;&nbsp;";
	}

	if($_GET[si] >= '0' && $_GET[si] < count($MyImages))
	{
		$ind = $_GET[si];
		$SingleImage = "<img src=\"../yellow_images/$MyImages[$ind]\">";
	}
}

if(!empty($a1[resume]))
{
	$resume = strip_tags($a1[resume]);

	$resume = nl2br($resume);

	$resume = "<div style=\"background-color:dddddd; padding:5\">$resume</div>";
}


?>
<link rel="stylesheet" href="style.css" type="text/css">
 &nbsp; 
<table width="90%" cellspacing="0" cellpadding="10" align="center" class="form">
  <tr> 
    <td> 
    <div align="right"><font face="Arial, Helvetica, sans-serif" size="4"><b><font color="#FFFFFF">CLASSIFIEDS v2.0</font></b></font></div>
    </td>
  </tr>
</table>
&nbsp; 
<table align=center width=595>
<tr>
	<td width=130 height=80 valign=top><?=$AgentLogo?></td>
	<td width=465 valign=top><span class=BlackLink><?=$AgentName?></span><br><?=$contacts?><br><?=$email?><br><br>Offers: <?=$offers?></td>
</tr>

<tr>
	<td colspan=2 valign=top><?=$resume?></td>
</tr>

<tr>
	<td colspan=2 align=center valign=top bgcolor=white><?=$images?></td>
</tr>

<tr>
	<td colspan=2 align=center valign=top bgcolor=white><?=$SingleImage?></td>
</tr>

</table>