Tons of errors. Keep getting parse errors....line 45, 59...every time I get one, more pop up...please help.

<?php
session_start();
//ini_set( "memory_limit", "128M" );
//error_reporting(5);

// added in by jaime to insure they are logged into the admin

if(!$_SESSION["loginOK"]){
  $err=1;
  $message="You must log in first";
  exit;
}

if($_REQUEST["button"]=="Return to Main Menu"){ 
  header("Location:index.php");
}

include("../content/global.php");
//include("site_config.php");



///////////// UPLOAD ASSET -- ADDED BY JAIME /////////////////////////////////


if($_REQUEST["button"]=="Upload"){
  $_REQUEST["button"]="Edit";
  $_REQUEST["bID"]=$_REQUEST["assetID"];
  set_time_limit(300); // 5 minutes
  //Check that we have a file
  if((!empty($_FILES['userfile'])) && ($_FILES['userfile']['error'] == 0)) {
    if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
      $filename = basename($_FILES['userfile']['name']);
      $fileExt = substr($filename,strlen($filename)-4,4);
      if ($_FILES['userfile']['size'] < 6300000) {
  //      $newname = dirname(__FILE__).'/upload/'.$filename;
        $_REQUEST["listname"]=ucfirst(ereg_replace(" ","_",$_REQUEST["listname"])).$fileExt;
        $newname = $pdfUploadPath.'/assets/'.$_REQUEST["assetID"].'_'.$_REQUEST["listname"];
        if (!file_exists($newname)) {
            //Attempt to move the uploaded file to it's new place
          if ((move_uploaded_file($_FILES['userfile']['tmp_name'],$newname))) {
            $listnameNice=ereg_replace($_REQUEST["assetID"]."_","",$_REQUEST["listname"]);
            $listnameNice=ereg_replace("_"," ",$listnameNice);
            $listnameNice=substr($listnameNice,0,strlen($listnameNice)-4);
            $uploadResponse = "File Upload Complete!<br /> The file has been saved as ¥"".$_REQUEST["listname"]."¥" and will be displayed as ¥"".$listnameNice."¥"<br /><br />";
          } else {
            $uploadResponse = "Error: A problem occurred during file upload!";
          }
        } else {
         // $uploadResponse = "Error: File ".$_FILES["userfile"]["name"]." already exists";
          $uploadResponse = "Error: File ¥"".$_REQUEST["listname"]."¥" already exists!";
        }
      } else {
        $uploadResponse = "Error: Your file size exceeds 6MB";
        //exit;
      }
    } else {
       $uploadResponse = "Possible file upload attack: ";
       $uploadResponse = "filename '". $_FILES['userfile']['tmp_name'] . "'.";
    }
  } else {
   $uploadResponse = "Error: No file uploaded";
  }
}
set_time_limit(30);


////////////////////////////////////////////////////////////////////////////////////////////////




$button = $_REQUEST['button'];
//$button = "Edit";

/*
To access mySQL, go here: http://www.chicagoindustrialre.com/admin/mysqlAdmin/ and login using:

username: cireAdmin
password: cire63!


*/
$Dt = date("Ymd");
print "<html>¥n<head>¥n<title>" . $siteName . "</title>¥n";
print "<style>¥n";
print ".text{font-family: arial;font-size:10pt;color:black;}¥n";
print ".tblText{font-size:10pt;color:black;}¥n";
print ".nav{text-decoration:none;color:blue;}¥n";
print ".titles{text-decoration:none;color:black;font-weight:bold;}¥n";
print "</style>¥n";
?>
<script language="javascript">
function changeFeatured(page,item,bid){
  if(item!=""){
    // Sean
    //url = 'http://www.chicagoindustrialre.com' + page + '&f=' + item + '#' + bid;
    url = 'http://cirecommercial.com' + page + '&f=' + item + '#' + bid;
    window.location.href = url;
  }
}
function openWin(url){
  window.open(url,'pic','');
}
</script>
<script type="text/javascript" src="popupWindow.js"></script>
<script type="text/javascript" src="animatedcollapse.js">

/***********************************************
* Animated Collapsible DIV- ゥ Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>

<?php
print "</head>¥n<body class=¥"text¥">¥n";
print "<form ENCTYPE=¥"multipart/form-data¥" name=¥"admin¥" method=¥"POST¥" action=¥"" . $_SERVER["PHP_SELF"] . "¥">";

if(trim($button)=="No" || trim($button)=="Cancel" || trim($button)=="Listings"){
  $button = "";
}

if(trim($button)=="chgfeature"){
  $dblink = mysql_connect($connectionHost, $connectionUser, $connectionPass);
  $db = mysql_select_db($dbName, $dblink);
  $query = "update " . $dbData . " set featured=" . $_REQUEST['f'] . " where id=" . $_REQUEST['bID'];
  $result = mysql_query($query,$dblink);
  $chkResult = mysql_affected_rows($dblink);
  if($chkResult<1){
    print $query . "<BR>";
  }
  $button = "";
}

if(trim($button)=="Yes"){
  $dblink = mysql_connect($connectionHost, $connectionUser, $connectionPass);
  $db = mysql_select_db($dbName, $dblink);
  $query = "delete from " . $dbData . " where id=" . $_REQUEST['bID'];
  $result = mysql_query($query,$dblink);
  $chkResult = mysql_affected_rows($dblink);
  if($chkResult>0 && $result){
    print "<center><b>Entry (" . $_REQUEST['bID'] . ") has been deleted.</b><BR><BR></center>";
  }else{
    print "<center><b>Could not delete entry " . $_REQUEST['bID'] . "</b><BR><font size=-2>" . $query . "</font><BR><BR></center>";
  }
  if(file_exists($picPath . $_REQUEST['bID'] . ".jpg")){
    unlink($picPath . $_REQUEST['bID'] . ".jpg");
  }
  $button = "";
}

if(trim($button)=="Delete"){
  print "<input type=¥"hidden¥" name=¥"bID¥" value=¥"" . $_REQUEST['bID'] . "¥">";
  //print "<input type=¥"hidden¥" name=¥"bldg¥" value=¥"" . $_REQUEST['bldg'] . "¥">";
  print "<center>Are you sure you want to delete ID " . $_REQUEST['bID'] . "?<BR><BR>"; //<font size=-2>ID: " . $_REQUEST['bID'] . "</font><BR><BR>";
  print "<input type=¥"submit¥" name=¥"button¥" value=¥"Yes¥">&nbsp;&nbsp;";
  print "<input type=¥"submit¥" name=¥"button¥" value=¥"No¥"></center>";
}

if(trim($button)=="Save New" || trim($button)=="Save Changes"){

  foreach($_REQUEST as $key => $value) {
  $_REQUEST[$key] = stripslashes($value);
  }
// check for errors...
  $chkErrs = 0;
//echo "errors0:$chkErrs<br />";
  $chkErr = array("sdate","edate","address","city","state","market","sqft","asqft","stories","sitesize","officesize","truckdocks","driveindoors","leaseprice","saleprice","brokeremail","brokerphone","picture1","picture2","needamount","minSF","maxSF");
  if(trim($_REQUEST['sMonth'])=="" || trim($_REQUEST['sDay'])=="" || trim($_REQUEST['sYear'])==""){
    $chkErrs = 1;
    $chkErr['sdate'] = 1;
  }
  if(trim($_REQUEST['eMonth'])!="" && trim($_REQUEST['eDay'])!="" && trim($_REQUEST['eYear'])!="" && trim($_REQUEST['eYear']) . trim($_REQUEST['eMonth']) . trim($_REQUEST['eDay']) <= trim($_REQUEST['sYear']) . trim($_REQUEST['sMonth']) . trim($_REQUEST['sDay'])){
    $chkErrs = 1;
    $chkErr['edate'] = 1;
  }

//echo "errors after dates: $chkErrs<br />";

  if(trim($_REQUEST['bldgAddr'])==""){
    $chkErrs = 1;
    $chkErr['address'] = 1;
  }
  if(trim($_REQUEST['bldgCity']=="")){
    $chkErrs = 1;
    $chkErr['city'] = 1;
  }
  if(trim($_REQUEST['bldgState']=="")){
    $chkErrs = 1;
    $chkErr['state'] = 1;
  } 
  if(trim($_REQUEST['bldgMarket']=="")){
    $chkErrs = 1;
    $chkErr['market'] = 1;
  }
  /*
  if(trim($_REQUEST['bldgSQFootage']=="")){
    $_REQUEST['bldgSQFootage'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgSQFootage']))){
    $chkErrs = 1;
    $chkErr['sqft'] = 1;
  }else{
    $_REQUEST['bldgSQFootage'] = str_replace(",","",$_REQUEST['bldgSQFootage']);
  }
  if(trim($_REQUEST['bldgAvailSQFootage']=="")){
    $_REQUEST['bldgAvailSQFootage'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgAvailSQFootage']))){
    $chkErrs = 1;
    $chkErr['asqft'] = 1;
  }else{
    $_REQUEST['bldgAvailSQFootage'] = str_replace(",","",$_REQUEST['bldgAvailSQFootage']);
  }

*/

/*
  if(trim($_REQUEST['bldgStories']=="")){
    $chkErrs = 1;
    $chkErr['stories'] = 1;
  }
  if(trim($_REQUEST['bldgStories']=="")){
    $_REQUEST['bldgStories'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgStories']))){
    $chkErrs = 1;
    $chkErr['stories'] = 1;
  }else{
    $_REQUEST['bldgStories'] = str_replace(",","",$_REQUEST['bldgStories']);
  }
*/

//print_r($_REQUEST);
//echo "errors before SF: $chkErrs<br />";

  if(trim($_REQUEST['bldgMinSF']=="")){
//    echo "PART 1";
    $_REQUEST['bldgMinSF'] = 0;


  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgMinSF']))){
//    echo "PART 2";
    $chkErrs = 1;
    $chkErr['minSF'] = 1;
  }else{
    $_REQUEST['bldgMinSF'] = str_replace(",","",$_REQUEST['bldgMinSF']);
  }
  if(trim($_REQUEST['bldgMaxSF']=="")){
    $_REQUEST['bldgMaxSF'] = 999999999;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgMaxSF']))){
    $chkErrs = 1;
    $chkErr['maxSF'] = 1;
  }else{
    $_REQUEST['bldgMaxSF'] = str_replace(",","",$_REQUEST['bldgMaxSF']);
  }

//echo "errors after SF:$chkErrs<br />";


  if(trim($_REQUEST['bldgSiteSize']=="")){
    $_REQUEST['bldgSiteSize'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgSiteSize']))){
   // $chkErrs = 1;
   // $chkErr['sitesize'] = 1;
  }else{
    $_REQUEST['bldgSiteSize'] = str_replace(",","",$_REQUEST['bldgSiteSize']);
  }
  if(trim($_REQUEST['bldgOfficeSize']=="")){
    $_REQUEST['bldgOfficeSize'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgOfficeSize']))){
   // $chkErrs = 1;
   // $chkErr['officesize'] = 1;
  }else{
    $_REQUEST['bldgOfficeSize'] = str_replace(",","",$_REQUEST['bldgOfficeSize']);
  }
  if(trim($_REQUEST['bldgTruckDocks']=="")){
    $_REQUEST['bldgTruckDocks'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgTruckDocks']))){
   // $chkErrs = 1;
   // $chkErr['truckdocks'] = 1;
  }else{
    $_REQUEST['bldgTruckDocks'] = str_replace(",","",$_REQUEST['bldgTruckDocks']);
  }


/*
  if(trim($_REQUEST['bldgDriveInDoors']=="")){
    $chkErrs = 1;
    $chkErr['bldgDriveInDoors'] = 1;
  }
  if(trim($_REQUEST['bldgDriveInDoors']=="")){
    $_REQUEST['bldgDriveInDoors'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgDriveInDoors']))){
    $chkErrs = 1;
    $chkErr['driveindoors'] = 1;
  }else{
    $_REQUEST['bldgDriveInDoors'] = str_replace(",","",$_REQUEST['bldgDriveInDoors']);
  }
*/



/*
  if(trim($_REQUEST['bldgLeasePrice']=="")){
    $chkErrs = 1;
    $chkErr['leaseprice'] = 1;
  }
  if(trim($_REQUEST['bldgLeasePrice']=="")){
    $_REQUEST['bldgLeasePrice'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgLeasePrice']))){
    $chkErrs = 1;
    $chkErr['leaseprice'] = 1;
  }else{
    $_REQUEST['bldgLeasePrice'] = str_replace(",","",$_REQUEST['bldgLeasePrice']);
  }
*/

/* removed per Matt 9-27-11

  if(trim($_REQUEST['bldgLeaseType'])=="" && trim($_REQUEST['bldgSalePrice'])==""){
    $chkErrs = 1;
    $chkErr['needamount'] = 1;
  }
*/  

  if(trim($_REQUEST['bldgLeaseType']=="")){
    $_REQUEST['bldgLeaseType'] = 0;
  }


/*  
    if(trim($_REQUEST['bldgSalePrice']=="")){
      $chkErrs = 1;
      $chkErr['saleprice'] = 1;
    }
  if(trim($_REQUEST['bldgSalePrice']=="")){
    $_REQUEST['bldgSalePrice'] = 0;
  }elseif(eregi("[‾`#%^*-+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgSalePrice']))){
    $chkErrs = 1;
    $chkErr['saleprice'] = 1;
  }else{
    $_REQUEST['bldgSalePrice'] = str_replace(",","",$_REQUEST['bldgSalePrice']);
  }
*/  



  if(trim($_REQUEST['bldgBrokerEmail'])!=""){
    $ckmail1 = ereg(".*¥@.*¥..*", $_REQUEST['bldgBrokerEmail']);
    $ckmail2 = ereg("^www¥.", $_REQUEST['bldgBrokerEmail']);
    $ckmail3 = ereg("http:", $_REQUEST['bldgBrokerEmail']);
    $ckmail4 = ereg(" ", $_REQUEST['bldgBrokerEmail']);
    $ckmail5 = ereg("¥.¥.", $_REQUEST['bldgBrokerEmail']);
    $ckmail6 = ereg(",", $_REQUEST['bldgBrokerEmail']);
    $ckmail7 = ereg(chr(34), $_REQUEST['bldgBrokerEmail']);
    $ckmail8 = ereg("[‾`!#$%^&*()-+={}|¥?/><,;:]", $_REQUEST['bldgBrokerEmail']);
    if($ckmail1==0 || $ckmail2==1 || $ckmail3==1 || $ckmail4==1 || $ckmail5==1 || $ckmail6==1 || $ckmail7==1 || $ckmail8==1){
      $chkAllErrs = 1;
      $chkErr["brokeremail"] = 1;
    }
  }
  if(trim($_REQUEST['bldgBrokerPhone']=="")){
    $_REQUEST['bldgBrokerPhone'] = 0;
  }elseif(eregi("[‾`#%^*+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgBrokerPhone']))){
    $chkErrs = 1;
    $chkErr['brokerphone'] = 1;
  }else{
    $_REQUEST['bldgBrokerPhone'] = str_replace("-","",$_REQUEST['bldgBrokerPhone']);
  }

  if(trim($_REQUEST['bldgBroker2Phone']=="")){
    $_REQUEST['bldgBroker2Phone'] = 0;
  }elseif(eregi("[‾`#%^*+={}|¥/><;:abcdefghijklmnopqrstuvwxyz]", trim($_REQUEST['bldgBroker2Phone']))){
    $chkErrs = 1;
    $chkErr['broker2phone'] = 1;
  }else{
    $_REQUEST['bldgBroker2Phone'] = str_replace("-","",$_REQUEST['bldgBroker2Phone']);
  }


/*
  if(trim($_REQUEST['bldgSQFootage'])!="" && preg("",$_REQUEST['bldgSQFootage'])){
    $chkErrs = 1;
  }
*/
  if(trim($_FILES['picFile'])!="" && $_FILES['picFile']["type"]!=""){
    $chkType = $_FILES['picFile']["type"];
    $chkSize = $_FILES['picFile']["size"];
      if($chkType!="image/png" && $chkType!="image/gif" && $chkType!="image/jpg" && $chkType!="image/jpeg" && $chkType!="image/pjpeg"){
      $chkErr["picture1"] = 1;
      $chkErrs = 1;
    }
    if($chkType=="image/png"){
      if(!$allowPNG){
        $chkErr["picture1"] = 1;
        $chkErrs = 1;
      }
      $tmpType = ".png";
    }
    if($chkType=="image/gif"){
      if(!$allowGIF){
        $chkErr["picture1"] = 1;
        $chkErrs = 1;
      }
      $tmpType = ".gif";
    }
    if($chkType=="image/jpg"){
      if(!$allowJPG){
        $chkErr["picture1"] = 1;
        $chkErrs = 1;
      }
      $tmpType = ".jpg";
    }
    if($chkType=="image/jpeg"){
      if(!$allowJPG){
        $chkErr["picture1"] = 1;
        $chkErrs = 1;
      }
      $tmpType = ".jpg";
    }
    if($chkType=="image/pjpeg"){
      if(!$allowJPG){
        $chkErr["picture1"] = 1;
        $chkErrs = 1;
      }
      $tmpType = ".jpg";
    }
/*
    if($chkSize > $maxPicSize){
      $chkErr["picture2"] = 1;
      $chkErrs = 1;
    }
*/
  }
  if(trim($_REQUEST['bldgVirtLink'])!=""){
    if(substr(trim($_REQUEST['bldgVirtLink']),0,6)!="http://"){
      $_REQUEST['bldgVirtLink'] = "http://" . trim($_REQUEST['bldgVirtLink']);
    }
  }
  $saveEDate = $_REQUEST['eYear'] . $_REQUEST['eMonth'] . $_REQUEST['eDay'];
  if($saveEDate == ""){
    $saveEDate = 0;
  }
  if($chkErrs==0){
    $dblink = mysql_connect($connectionHost, $connectionUser, $connectionPass);
    $db = mysql_select_db($dbName, $dblink);
    if(trim($button)=="Save New"){
      $query = "insert into " . $dbData . " set 
      dtEntered=" . $Dt . ",
      sDate=" . $_REQUEST['sYear'] . $_REQUEST['sMonth'] . $_REQUEST['sDay'] . ",
      eDate=" . $saveEDate . ",
      address=¥"" . $_REQUEST['bldgAddr'] . "¥",
      city=¥"" . $_REQUEST['bldgCity'] . "¥",
      state=¥"" . $_REQUEST['bldgState'] . "¥",
      zip=¥"" . $_REQUEST['bldgZip'] . "¥",
      market=" . $_REQUEST['bldgMarket'] . ",
      featured=" . $_REQUEST['bldgFeatured'] . ",
      sqft=¥"" . $_REQUEST['bldgSQFootage'] . "¥",
      availsqft=¥"" . $_REQUEST['bldgAvailSQFootage'] . "¥",
      stories=¥"" . $_REQUEST['bldgStories'] . "¥",
      sitesize=¥"" . $_REQUEST['bldgSiteSize'] . "¥",
      parking=¥"" . $_REQUEST['bldgParking'] . "¥",
      bldgDesc=¥"" . $_REQUEST['bldgDesc'] . "¥",
      officesize=" . $_REQUEST['bldgOfficeSize'] . ",
      truckdocks=" . $_REQUEST['bldgTruckDocks'] . ",
      driveindoors=¥"" . $_REQUEST['bldgDriveInDoors'] . "¥",
      ceilingheight=¥"" . $_REQUEST['bldgCeilingHeights'] . "¥",
      power=¥"" . $_REQUEST['bldgPower'] . "¥",
      airlines=" . $_REQUEST['bldgAirlines'] . ",
      sprinklered=" . $_REQUEST['bldgSprinklered'] . ",
      elevators=¥"" . $_REQUEST['bldgElevators'] . "¥",
      heat=¥"" . $_REQUEST['bldgHeat'] . "¥",
      aircond=¥"" . $_REQUEST['bldgAC'] . "¥",
      usda=" . $_REQUEST['bldgUSDA'] . ",
      coolers=¥"" . $_REQUEST['bldgCoolers'] . "¥",
      freezers=¥"" . $_REQUEST['bldgFreezers'] . "¥",
      floordrains=" . $_REQUEST['bldgFloorDrains'] . ",
      baysizes=¥"" . $_REQUEST['bldgBaySizes'] . "¥",
      cranes=¥"" . $_REQUEST['bldgCranes'] . "¥",
      rail=¥"" . $_REQUEST['bldgRail'] . "¥",
      zoning=¥"" . $_REQUEST['bldgZoning'] . "¥",
      transportation=¥"" . $_REQUEST['bldgTransportation'] . "¥",
      economicincentives=¥"" . $_REQUEST['bldgEcoIncentives'] . "¥",
      investmentproperty=" . $_REQUEST['bldgInvestment'] . ",
      developmentproperty=" . $_REQUEST['bldgDevelopment'] . ",
      realestatetaxes=¥"" . $_REQUEST['bldgTaxes'] . "¥",
      comments=¥"" . $_REQUEST['bldgComments'] . "¥",
      leaseprice=¥"" . $_REQUEST['bldgLeasePrice'] . "¥",
      leasegrossnet=" . $_REQUEST['bldgLeaseType'] . ",
      saleprice=¥"" . $_REQUEST['bldgSalePrice'] . "¥",
      virtualtourlink=¥"" . $_REQUEST['bldgVirtLink'] . "¥",
      broker=¥"" . $_REQUEST['bldgBroker'] . "¥",
      brokerphone=" . $_REQUEST['bldgBrokerPhone'] . ",
      brokeremail=¥"" . $_REQUEST['bldgBrokerEmail'] . "¥",
      broker2=¥"" . $_REQUEST['bldgBroker2'] . "¥",
      broker2phone=" . $_REQUEST['bldgBroker2Phone'] . ",
      broker2email=¥"" . $_REQUEST['bldgBroker2Email'] . "¥",
      lat=" . $_REQUEST['bldgLat'] . ",
      lon=" . $_REQUEST['bldgLon'] . ",
      status=" . $_REQUEST['bldgStatus'] . ",
      dateSold=" . $_REQUEST['soldYear'] . $_REQUEST['soldMonth'] . $_REQUEST['soldDay'] . ",
      minSF=" . $_REQUEST['bldgMinSF'] . ",
      maxSF=" . $_REQUEST['bldgMaxSF'] . ",
      modifiedGross=¥"" . $_REQUEST['bldgModGross'] . "¥",
      opExp=¥"" . $_REQUEST['bldgOpExp'] . "¥",
      ADA=" . $_REQUEST['bldgADA'] . ",
      subleaseEndDate=" . $_REQUEST['subleasedYear'] . $_REQUEST['subleasedMonth'] . $_REQUEST['subleasedDay'] . "
      ";
    }else{
      $query = "update " . $dbData . " set 
      sDate=" . $_REQUEST['sYear'] . $_REQUEST['sMonth'] . $_REQUEST['sDay'] . ",
      eDate=" . $saveEDate . ",
      address=¥"" . $_REQUEST['bldgAddr'] . "¥",
      city=¥"" . $_REQUEST['bldgCity'] . "¥",
      state=¥"" . $_REQUEST['bldgState'] . "¥",
      zip=¥"" . $_REQUEST['bldgZip'] . "¥",
      market=" . $_REQUEST['bldgMarket'] . ",
      featured=" . $_REQUEST['bldgFeatured'] . ",
      sqft=¥"" . $_REQUEST['bldgSQFootage'] . "¥",
      availsqft=¥"" . $_REQUEST['bldgAvailSQFootage'] . "¥",
      stories=¥"" . $_REQUEST['bldgStories'] . "¥",
      sitesize=¥"" . $_REQUEST['bldgSiteSize'] . "¥",
      parking=¥"" . $_REQUEST['bldgParking'] . "¥",
      bldgDesc=¥"" . $_REQUEST['bldgDesc'] . "¥",
      officesize=" . $_REQUEST['bldgOfficeSize'] . ",
      truckdocks=" . $_REQUEST['bldgTruckDocks'] . ",
      driveindoors=¥"" . $_REQUEST['bldgDriveInDoors'] . "¥",
      ceilingheight=¥"" . $_REQUEST['bldgCeilingHeights'] . "¥",
      power=¥"" . $_REQUEST['bldgPower'] . "¥",
      airlines=" . $_REQUEST['bldgAirlines'] . ",
      sprinklered=" . $_REQUEST['bldgSprinklered'] . ",
      elevators=¥"" . $_REQUEST['bldgElevators'] . "¥",
      heat=¥"" . $_REQUEST['bldgHeat'] . "¥",
      aircond=¥"" . $_REQUEST['bldgAC'] . "¥",
      usda=" . $_REQUEST['bldgUSDA'] . ",
      coolers=¥"" . $_REQUEST['bldgCoolers'] . "¥",
      freezers=¥"" . $_REQUEST['bldgFreezers'] . "¥",
      floordrains=" . $_REQUEST['bldgFloorDrains'] . ",
      baysizes=¥"" . $_REQUEST['bldgBaySizes'] . "¥",
      cranes=¥"" . $_REQUEST['bldgCranes'] . "¥",
      rail=¥"" . $_REQUEST['bldgRail'] . "¥",
      zoning=¥"" . $_REQUEST['bldgZoning'] . "¥",
      transportation=¥"" . $_REQUEST['bldgTransportation'] . "¥",
      economicincentives=¥"" . $_REQUEST['bldgEcoIncentives'] . "¥",
      investmentproperty=" . $_REQUEST['bldgInvestment'] . ",
      developmentproperty=" . $_REQUEST['bldgDevelopment'] . ",
      realestatetaxes=¥"" . $_REQUEST['bldgTaxes'] . "¥",
      comments=¥"" . $_REQUEST['bldgComments'] . "¥",
      leaseprice=¥"" . $_REQUEST['bldgLeasePrice'] . "¥",
      leasegrossnet=" . $_REQUEST['bldgLeaseType'] . ",
      saleprice=¥"" . $_REQUEST['bldgSalePrice'] . "¥",
      virtualtourlink=¥"" . $_REQUEST['bldgVirtLink'] . "¥",
      broker=¥"" . $_REQUEST['bldgBroker'] . "¥",
      brokerphone=" . $_REQUEST['bldgBrokerPhone'] . ",
      brokeremail=¥"" . $_REQUEST['bldgBrokerEmail'] . "¥",
      broker2=¥"" . $_REQUEST['bldgBroker2'] . "¥",
      broker2phone=" . $_REQUEST['bldgBroker2Phone'] . ",
      broker2email=¥"" . $_REQUEST['bldgBroker2Email'] . "¥",
      lat=" . $_REQUEST['bldgLat'] . ",
      lon=" . $_REQUEST['bldgLon'] . ",
      status=" . $_REQUEST['bldgStatus'] . ",
      dateSold=" . $_REQUEST['soldYear'] . $_REQUEST['soldMonth'] . $_REQUEST['soldDay'] . ", 
      minSF=" . $_REQUEST['bldgMinSF'] . ",
      maxSF=" . $_REQUEST['bldgMaxSF'] . ",
      modifiedGross=¥"" . $_REQUEST['bldgModGross'] . "¥",
      opExp=¥"" . $_REQUEST['bldgOpExp'] . "¥",
      ADA=" . $_REQUEST['bldgADA'] . ",
      subleaseEndDate=" . $_REQUEST['subleasedYear'] . $_REQUEST['subleasedMonth'] . $_REQUEST['subleasedDay'] . "
      where id=" . $_REQUEST['bID'];
    }
    $result = mysql_query($query,$dblink);
    if(trim($button)=="Save New"){
      $returnCode = mysql_insert_id($dblink);
    }else{
      $returnCode = $_REQUEST['bID'];
    }
    $chkResult = mysql_affected_rows($dblink);
    if(trim($_FILES['picFile'])!=""){
    // IMAGE MAGIC HERE!!!
      $saved = copy($_FILES['picFile']["tmp_name"],$picPath . $returnCode . ".jpg");
      if($saved){
        //print "Picture Saved!";
        scale_fill($picPath . $returnCode,"jpg",$lgPicWidth,$lgPicHeight,$smPicWidth,$smPicHeight);
      }else{
        //print "Picture NOT Saved!";
      }
    }
    if($chkResult>0 || $saved){
      // SAVED!!!
      $button = "";
    }else{
      //echo mysql_error() . "<br />query was: $query<br />";
      print "<center><b>Changes have not been saved!</b><BR><font size=-2>If you didn't make any changes, then this error is expected.</font><BR><BR>";
      print "<input type=¥"submit¥" name=¥"button¥" value=¥"Listings¥"><BR><BR>";
      //print "<font size=-2>" . $query . "</font>";
      print "</center>";
    }
  }else{
  // ERRORS - go to the new or edit screen...
    if(trim($button)=="Save New"){
      $button = "Add New Entry";
  //  }else{
  //    $button = "Edit";
    }
  }
}

if(trim($button)=="Edit" || trim($button)=="Add New Entry" || trim($button)=="Save Changes" || $_REQUEST["button"]=="Upload"){
  if(trim($button)=="Edit"){
    $dblink = mysql_connect($connectionHost, $connectionUser, $connectionPass);
    $db = mysql_select_db($dbName, $dblink);
    // Get data from database...
    $editQuery = "select id,dtEntered,sDate,eDate,address,city,state,zip,market,featured,sqft,availsqft,stories,sitesize,parking,bldgDesc,officesize,truckdocks,driveindoors,ceilingheight,power,airlines,sprinklered,elevators,heat,aircond,usda,coolers,freezers,floordrains,baysizes,cranes,rail,zoning,transportation,economicincentives,investmentproperty,developmentproperty,realestatetaxes,comments,leaseprice,leasegrossnet,saleprice,virtualtourlink,broker,brokerphone,brokeremail,broker2,broker2phone,broker2email,lat,lon,status,dateSold,minSF,maxSF,modifiedGross,opExp,ADA,subleaseEndDate from " . $dbData . " where id=" . $_REQUEST['bID'];
    //$editQuery = "select id,dtEntered,sDate,eDate,address,city,state,market,featured,sqft,availsqft,stories,sitesize,parking,bldgDesc,officesize,truckdocks,driveindoors,ceilingheight,power,airlines,sprinklered,elevators,heat,aircond,usda,coolers,freezers,floordrains,baysizes,cranes,rail,zoning,transportation,econimicincentives,investmentproperty,developmentproperty,realestatetaxes,comments,leaseprice,leasegrossnet,saleprice,virtualtourlink,broker,brokerphone,brokeremail from " . $dbData . " where id=" . $eID;
    $editResult = mysql_query($editQuery,$dblink);
    $editCheck = mysql_affected_rows($dblink);
    if($editCheck > 0 && $editResult){
      $row = mysql_fetch_array($editResult);
      $eID = $row['id'];
      $_REQUEST['sMonth'] = substr($row['sDate'],4,2);
      $_REQUEST['sDay'] = substr($row['sDate'],6,2);
      $_REQUEST['sYear'] = substr($row['sDate'],0,4);
      $_REQUEST['eMonth'] = substr($row['eDate'],4,2);
      $_REQUEST['eDay'] = substr($row['eDate'],6,2);
      $_REQUEST['eYear'] = substr($row['eDate'],0,4);
      $_REQUEST['bldgFeatured'] = $row['featured'];
      $_REQUEST['bldgAddr'] = $row['address'];
      $_REQUEST['bldgCity'] = stripslashes($row['city']);
      $_REQUEST['bldgState'] = stripslashes($row['state']);
      $_REQUEST['bldgZip'] = $row['zip'];
      $_REQUEST['bldgMarket'] = $row['market'];
      $_REQUEST['bldgSQFootage'] = stripslashes($row['sqft']);
      $_REQUEST['bldgAvailSQFootage'] = stripslashes($row['availsqft']);
      $_REQUEST['bldgStories'] = stripslashes($row['stories']);
      $_REQUEST['bldgSiteSize'] = stripslashes($row['sitesize']);
      $_REQUEST['bldgParking'] = stripslashes($row['parking']);
      $_REQUEST['bldgDesc'] = stripslashes($row['bldgDesc']);
      $_REQUEST['bldgOfficeSize'] = stripslashes($row['officesize']);
      $_REQUEST['bldgTruckDocks'] = stripslashes($row['truckdocks']);
      $_REQUEST['bldgDriveInDoors'] = stripslashes($row['driveindoors']);
      $_REQUEST['bldgCeilingHeights'] = stripslashes($row['ceilingheight']);
      $_REQUEST['bldgPower'] = stripslashes($row['power']);
      $_REQUEST['bldgAirlines'] = stripslashes($row['airlines']);
      $_REQUEST['bldgSprinklered'] = stripslashes($row['sprinklered']);
      $_REQUEST['bldgElevators'] = stripslashes($row['elevators']);
      $_REQUEST['bldgHeat'] = stripslashes($row['heat']);
      $_REQUEST['bldgAC'] = stripslashes($row['aircond']);
      $_REQUEST['bldgCooler'] = stripslashes($row['coolers']);
      $_REQUEST['bldgFreezers'] = stripslashes($row['freezers']);
      $_REQUEST['bldgUSDA'] = stripslashes($row['usda']);
      $_REQUEST['bldgFloorDrains'] = stripslashes($row['floordrains']);
      $_REQUEST['bldgBaySizes'] = stripslashes($row['baysizes']);
      $_REQUEST['bldgCranes'] = stripslashes($row['cranes']);
      $_REQUEST['bldgRail'] = stripslashes($row['rail']);
      $_REQUEST['bldgTransportation'] = stripslashes($row['transportation']);
      $_REQUEST['bldgEcoIncentives'] = stripslashes($row['econimicincentives']);
      $_REQUEST['bldgZoning'] = stripslashes($row['zoning']);
      $_REQUEST['bldgInvestment'] = stripslashes($row['investmentproperty']);
      $_REQUEST['bldgDevelopment'] = stripslashes($row['developmentproperty']);
      $_REQUEST['bldgTaxes'] = stripslashes($row['realestatetaxes']);
      $_REQUEST['bldgComments'] = stripslashes($row['comments']);
      $_REQUEST['bldgLeasePrice'] = stripslashes($row['leaseprice']);
      $_REQUEST['bldgLeaseType'] = stripslashes($row['leasegrossnet']);
      $_REQUEST['bldgSalePrice'] = stripslashes($row['saleprice']);
      $_REQUEST['bldgBroker'] = stripslashes($row['broker']);
      // Sean
      $_REQUEST['bldgBrokerPhone'] = stripslashes($row['brokerphone']);
      if($_REQUEST['bldgBrokerPhone']==0){
        $_REQUEST['bldgBrokerPhone']="";
      }
      $_REQUEST['bldgBrokerEmail'] = stripslashes($row['brokeremail']);
      $_REQUEST['bldgVirtLink'] = stripslashes($row['virtualtourlink']);
      $_REQUEST['bldgBroker2'] = stripslashes($row['broker2']);
      $_REQUEST['bldgBroker2Phone'] = stripslashes($row['broker2phone']);
      if($_REQUEST['bldgBroker2Phone']==0){
        $_REQUEST['bldgBroker2Phone']="";
      }
      $_REQUEST['bldgBroker2Email'] = stripslashes($row['broker2email']);
      $_REQUEST['bldgLat'] = $row['lat'];
      $_REQUEST['bldgLon'] = $row['lon'];
      $_REQUEST['bldgStatus'] = $row['status'];
      $_REQUEST['soldMonth'] = substr($row['dateSold'],4,2);
      $_REQUEST['soldDay'] = substr($row['dateSold'],6,2);
      $_REQUEST['soldYear'] = substr($row['dateSold'],0,4);
      $_REQUEST['subleasedMonth'] = substr($row['subleaseEndDate'],4,2);
      $_REQUEST['subleasedDay'] = substr($row['subleaseEndDate'],6,2);
      $_REQUEST['subleasedYear'] = substr($row['subleaseEndDate'],0,4);
      $_REQUEST['bldgMinSF'] = stripslashes($row['minSF']);
      $_REQUEST['bldgMaxSF'] = stripslashes($row['maxSF']);
      $_REQUEST['bldgModGross'] = stripslashes($row['modifiedGross']);
      $_REQUEST['bldgOpExp'] = stripslashes($row['opExp']);
      $_REQUEST['bldgADA'] = $row['ADA'];

      //echo count($_REQUEST)." count of request vars";

      //for($i=0; $i<count($_REQUEST); $i++){
      //  $_REQUEST[$i]=stripslashes($_REQUEST[$i]);
      //}
    }
  }
  print "<input type=¥"hidden¥" name=¥"bID¥" value=¥"" . $_REQUEST['bID'] . "¥">";
  print "<center>";


//////////////////// ADDED BY JAIME ///////////////////////
if($_REQUEST["button"]=="Upload" || $_REQUEST["button"]=="Edit"){
  echo "<div style=¥"color:blue;font-size:10pt¥">$uploadResponse</div>";
}

////////////////////////////////////////////////////////////


  if($chkErrs>0){
    print "<table cellpadding=0 cellspacing=0 border=0 class=¥"text¥">¥n";
    print "<tr><td colspan=2><font color=red><b>Oooops...</b> you have errors that need to be fixed.</font></td></tr>¥n";
    $num = 1;
    if($chkErr['address']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter the address.</td></tr>¥n";
      $num++;
    }
    if($chkErr['city']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter the city.</td></tr>¥n";
      $num++;
    }
    if($chkErr['state']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must select the state.</td></tr>¥n";
      $num++;
    }
    if($chkErr['market']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must select the market.</td></tr>¥n";
      $num++;
    }
    if($chkErr['brokeremail']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a correct and proper broker email address.</td></tr>¥n";
      $num++;
    }
   /*
    if($chkErr['sqft']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for square footage.</td></tr>¥n";
      $num++;
    }
    if($chkErr['asqft']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for available square footage.</td></tr>¥n";
      $num++;
    }
   */

    if($chkErr['minSF']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for minimum square footage.</td></tr>¥n";
      $num++;
    }
    if($chkErr['maxSF']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for maximum square footage.</td></tr>¥n";
      $num++;
    }


   if($chkErr['stories']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for stories.</td></tr>¥n";
      $num++;
    }
    if($chkErr['sitesize']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for site size.</td></tr>¥n";
      $num++;
    }
    if($chkErr['officesize']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for office size.</td></tr>¥n";
      $num++;
    }
    if($chkErr['truckdocks']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for truck docks.</td></tr>¥n";
      $num++;
    }
    if($chkErr['driveindoors']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for drive-in doors.</td></tr>¥n";
      $num++;
    }
    if($chkErr['needamount']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter either a lease price or sale price.</td></tr>¥n";
      $num++;
    }
    if($chkErr['leaseprice']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for lease price.</td></tr>¥n";
      $num++;
    }
    if($chkErr['saleprice']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for sale price.</td></tr>¥n";
      $num++;
    }
    if($chkErr['brokerphone']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>You must enter a numeric value for the brokers phone number.</td></tr>¥n";
      $num++;
    }
    if($chkErr['picture1']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>Your picture upload must be a JPG photo.</td></tr>¥n";
      $num++;
    }
    if($chkErr['picture2']>0){
      print "<tr><td>" . $num . ".&nbsp;</td><td>Your picture upload can not exceed " . ($maxPicSize/1000) . "kb.</td></tr>¥n";
      $num++;
    }
    print "</table><BR>¥n";
  }
  print "<table cellpadding=3 cellspacing=3 border=0 class=¥"tblText¥">";
  //print "<tr><td align=right>&nbsp;</td><td><input type=¥"text¥" name=¥"¥" value=¥"¥"></td></tr>";
  print "<tr><td class=¥"$textClass¥" align=right>Start Date:&nbsp;</td><td class=¥"$textClass¥"><select name=¥"sMonth¥" class=¥"$fieldClass¥">";
  print "<option value=¥"¥"></option>";
  for($i=1;$i<=12;$i++){
    if(strlen($i)<2){
      $tmpI = "0" . $i;
    }else{
      $tmpI = $i;
    }
    if($tmpI==$_REQUEST['sMonth'] || ($_REQUEST['sMonth']=="" && $tmpI==substr($Dt,4,2))){
      print "<option value=¥"$tmpI¥" selected>$tmpI</option>";
    }else{
      print "<option value=¥"$tmpI¥">$tmpI</option>";
    }
  }
  print "</select> / <select name=¥"sDay¥" class=¥"$fieldClass¥">";
  print "<option value=¥"¥"></option>";
  for($i=1;$i<=31;$i++){
    if(strlen($i)<2){
      $tmpI = "0" . $i;
    }else{
      $tmpI = $i;
    }
    if($tmpI==$_REQUEST['sDay'] || ($_REQUEST['sDay']=="" && $tmpI==substr($Dt,6,2))){
      print "<option value=¥"$tmpI¥" selected>$tmpI</option>";
    }else{
      print "<option value=¥"$tmpI¥">$tmpI</option>";
    }
  }
  print "</select> / <select name=¥"sYear¥" class=¥"$fieldClass¥">";
  print "<option value=¥"¥"></option>";
  for($i=(substr($Dt,0,4)-1);$i<=(substr($Dt,0,4)+4);$i++){
    if($i==$_REQUEST['sYear'] || ($_REQUEST['sYear']=="" && $i==substr($Dt,0,4))){
      print "<option value=¥"$i¥" selected>$i</option>";
    }else{
      print "<option value=¥"$i¥">$i</option>";
    }
  }
  print "</select>&nbsp;&nbsp;&nbsp;&nbsp;";
  print "End Date:&nbsp;<select name=¥"eMonth¥" class=¥"$fieldClass¥">";
  print "<option value=¥"¥"></option>";
  for($i=1;$i<=12;$i++){
    if(strlen($i)<2){
      $tmpI = "0" . $i;
    }else{
      $tmpI = $i;
    }
    if($tmpI==$_REQUEST['eMonth']){
      print "<option value=¥"$tmpI¥" selected>$tmpI</option>";
    }else{
      print "<option value=¥"$tmpI¥">$tmpI</option>";
    }
  }
  print "</select> / <select name=¥"eDay¥" class=¥"$fieldClass¥">";
  print "<option value=¥"¥"></option>";
  for($i=1;$i<=31;$i++){
    if(strlen($i)<2){
      $tmpI = "0" . $i;
    }else{
      $tmpI = $i;
    }
    if($tmpI==$_REQUEST['eDay']){
      print "<option value=¥"$tmpI¥" selected>$tmpI</option>";
    }else{
      print "<option value=¥"$tmpI¥">$tmpI</option>";
    }
  }
  print "</select> / <select name=¥"eYear¥" class=¥"$fieldClass¥">";
  print "<option value=¥"¥"></option>";
  for($i=(substr($Dt,0,4)-1);$i<=(substr($Dt,0,4)+4);$i++){
    if($i==$_REQUEST['eYear']){
      print "<option value=¥"$i¥" selected>$i</option>";
    }else{
      print "<option value=¥"$i¥">$i</option>";
    }
  }
  print "</select></td><tr>";
  print "<tr><td align=right>Address:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgAddr¥" value=¥"" . $_REQUEST['bldgAddr'] . "¥"></td></tr>¥n";
  print "<tr><td align=right>City&nbsp;</td><td><input type=¥"text¥" name=¥"bldgCity¥" value=¥"" . $_REQUEST['bldgCity'] . "¥">&nbsp;&nbsp;";
  print "State:&nbsp;<select name=¥"bldgState¥"><option value=¥"¥"></option>";
  $states = file("states.txt");
  foreach($states as $state){
    $state=trim($state);
    echo "<option value=¥"" . $state . "¥"";
    if($_REQUEST['bldgState']==trim($state) || ($_REQUEST['bldgState']=="" && trim($state)=="IL")){
      echo " SELECTED";
    }
    echo ">" . $state . "</option>¥n";
  }
  print "</select>&nbsp;&nbsp;";

  echo "Zip: <input type=¥"text¥" size=6 name=¥"bldgZip¥" value=¥"" . $_REQUEST['bldgZip'] . "¥">&nbsp;&nbsp;";

  print "Market:&nbsp;<select name=¥"bldgMarket¥"><option value=¥"¥"></option>";
  $markets = file("markets.txt");
  sort($markets);
  foreach($markets as $market){
    $mrktData = explode("|",$market);
    echo "<option value=¥"" . trim($mrktData[1]) . "¥"";
    if($_REQUEST['bldgMarket']==trim($mrktData[1])){
      echo " SELECTED";
    }
    echo ">" . trim($mrktData[0]) . "</option>¥n";
  }
  print "</select></td></tr>¥n";

  print "<tr><td align=right>Building Square Footage:&nbsp;</td><td><input type=¥"text¥" name=¥"bldgSQFootage¥" maxlength=10 size=11 value=¥"" . $_REQUEST['bldgSQFootage'] . "¥">&nbsp;&nbsp;";
  print "Available Sq. Footage:&nbsp;<input type=¥"text¥" name=¥"bldgAvailSQFootage¥" maxlength=10 size=11 value=¥"" . $_REQUEST['bldgAvailSQFootage'] . "¥">&nbsp;&nbsp;";
  print "Stories:&nbsp;<input type=¥"text¥" name=¥"bldgStories¥" size=11 value=¥"" . $_REQUEST['bldgStories'] . "¥"></td></tr>¥n";


  print "<tr><td align=right>Minimum Square Footage:&nbsp;</td><td><input type=¥"text¥" name=¥"bldgMinSF¥" maxlength=10 size=11 value=¥"" . $_REQUEST['bldgMinSF'] . "¥">&nbsp;&nbsp;";
  print "Maximum Square Footage:&nbsp;<input type=¥"text¥" name=¥"bldgMaxSF¥" maxlength=10 size=11 value=¥"" . $_REQUEST['bldgMaxSF'] . "¥">&nbsp;&nbsp;";
  print "ADA Compliant?:&nbsp;<input type=¥"radio¥" name=¥"bldgADA¥" value=¥"1¥"";
  if($_REQUEST['bldgADA']=="1" || $_REQUEST['bldgADA']==""){ echo " checked"; }
  echo " ¥"> Yes   <input type=¥"radio¥" name=¥"bldgADA¥" value=¥"2¥"";
  if($_REQUEST['bldgADA']=="2"){ echo " checked"; } echo " ¥"> No   </td></tr>¥n";



  print "<tr><td align=right>Site Size:&nbsp;</td><td><input type=¥"text¥" size=17 name=¥"bldgSiteSize¥" maxlength=10 size=11 value=¥"" . $_REQUEST['bldgSiteSize'] . "¥">&nbsp;&nbsp;";
  print "Parking:&nbsp;<input type=¥"text¥" name=¥"bldgParking¥" size=25 value=¥"" . $_REQUEST['bldgParking'] . "¥"></td></tr>¥n";

  print "<tr><td align=right valign=top>Building Description:&nbsp;</td><td><textarea rows=5 cols=50 name=¥"bldgDesc¥">" . $_REQUEST['bldgDesc'] . "</textarea></td></tr>¥n";

  print "<tr><td align=right>Office Size:&nbsp;</td><td><input type=¥"text¥" name=¥"bldgOfficeSize¥" size=7 maxlength=6 value=¥"" . $_REQUEST['bldgOfficeSize'] . "¥">&nbsp;&nbsp;";
  print "Truck Docks:&nbsp;<input type=¥"text¥" name=¥"bldgTruckDocks¥" size=4 maxlength=3 value=¥"" . $_REQUEST['bldgTruckDocks'] . "¥"> &nbsp;&nbsp;";
  print "Drive In Doors:&nbsp;<input type=¥"text¥" name=¥"bldgDriveInDoors¥" size=11 value=¥"" . $_REQUEST['bldgDriveInDoors'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Ceiling Height:&nbsp;</td><td><input type=¥"text¥" name=¥"bldgCeilingHeights¥" value=¥"" . $_REQUEST['bldgCeilingHeights'] . "¥">&nbsp;&nbsp;";
  print "Power:&nbsp;<input type=¥"text¥" name=¥"bldgPower¥" value=¥"" . $_REQUEST['bldgPower'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Airlines:&nbsp;</td><td><select name=¥"bldgAirlines¥"><option value=¥"0¥"></option>";
  print "<option value=¥"1¥"";
  if($_REQUEST['bldgAirlines']=="1"){
    print " SELECTED";
  }
  print ">No</option>";
  print "<option value=¥"2¥"";
  if($_REQUEST['bldgAirlines']=="2"){
    print " SELECTED";
  } 
  print ">Yes</option>";
  print "</select>&nbsp;&nbsp;";
  print "Sprinklered:&nbsp;<select name=¥"bldgSprinklered¥"><option value=¥"0¥"></option>";
  print "<option value=¥"1¥"";
  if($_REQUEST['bldgSprinklered']=="1"){
    print " SELECTED";
  }
  print ">No</option>";
  print "<option value=¥"2¥"";
  if($_REQUEST['bldgSprinklered']=="2"){
    print " SELECTED";
  } 
  print ">Wet</option>";
  print "<option value=¥"3¥"";
  if($_REQUEST['bldgSprinklered']=="3"){
    print " SELECTED";
  } 
  print ">Dry</option>";
  print "</select>&nbsp;&nbsp;";
  print "Elevators:&nbsp;<input type=¥"text¥" size=15 name=¥"bldgElevators¥" value=¥"" . $_REQUEST['bldgElevators'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Heating:&nbsp;</td><td><input type=¥"text¥" name=¥"bldgHeat¥" size=50 value=¥"" . $_REQUEST['bldgHeat'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Air Conditioning:&nbsp;</td><td><input type=¥"text¥" name=¥"bldgAC¥" size=50 value=¥"" . $_REQUEST['bldgAC'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Coolers:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgCoolers¥" value=¥"" . $_REQUEST['bldgCoolers'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Freezers:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgFreezers¥" value=¥"" . $_REQUEST['bldgFreezers'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>USDA:&nbsp;</td><td><select name=¥"bldgUSDA¥"><option value=¥"0¥"></option>";
  print "<option value=¥"1¥"";
  if($_REQUEST['bldgUSDA']=="1"){
    print " SELECTED";
  }
  print ">No</option>";
  print "<option value=¥"2¥"";
  if($_REQUEST['bldgUSDA']=="2"){
    print " SELECTED";
  } 
  print ">Yes</option>";
  print "</select>&nbsp;&nbsp;";
  print "Floor Drains:&nbsp;<select name=¥"bldgFloorDrains¥"><option value=¥"0¥"></option>";
  print "<option value=¥"1¥"";
  if($_REQUEST['bldgFloorDrains']=="1"){
    print " SELECTED";
  }
  print ">No</option>";
  print "<option value=¥"2¥"";
  if($_REQUEST['bldgFloorDrains']=="2"){
    print " SELECTED";
  } 
  print ">Yes</option>";
  print "</select></td></tr>¥n";

  print "<tr><td align=right>Bay Sizes:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgBaySizes¥" value=¥"" . $_REQUEST['bldgBaySizes'] . "¥"></td></tr>¥n";
  print "<tr><td align=right>Cranes:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgCranes¥" value=¥"" . $_REQUEST['bldgCranes'] . "¥"></td></tr>¥n";
  print "<tr><td align=right>Rail:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgRail¥" value=¥"" . $_REQUEST['bldgRail'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Transportation:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgTransportation¥" value=¥"" . $_REQUEST['bldgTransportation'] . "¥"></td></tr>¥n";
  print "<tr><td align=right>Economic Incentives:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgEcoIncentives¥" value=¥"" . $_REQUEST['bldgEcoIncentives'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Zoning:&nbsp;</td><td><input type=¥"text¥" size=11 maxlength=10 name=¥"bldgZoning¥" value=¥"" . $_REQUEST['bldgZoning'] . "¥">&nbsp;&nbsp;";
  print "Investment Property:&nbsp;<select name=¥"bldgInvestment¥"><option value=¥"0¥"></option>";
  print "<option value=¥"1¥"";
  if($_REQUEST['bldgInvestment']=="1"){
    print " SELECTED";
  }
  print ">No</option>";
  print "<option value=¥"2¥"";
  if($_REQUEST['bldgInvestment']=="2"){
    print " SELECTED";
  } 
  print ">Yes</option>";
  print "</select>&nbsp;&nbsp;";
  print "Development Property:&nbsp;<select name=¥"bldgDevelopment¥"><option value=¥"0¥"></option>";
  print "<option value=¥"1¥"";
  if($_REQUEST['bldgDevelopment']=="1"){
    print " SELECTED";
  }
  print ">No</option>";
  print "<option value=¥"2¥"";
  if($_REQUEST['bldgDevelopment']=="2"){
    print " SELECTED";
  } 
  print ">Yes</option>";
  print "</select></td></tr>¥n";

  print "<tr><td align=right>Real Estate Taxes:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgTaxes¥" value=¥"" . $_REQUEST['bldgTaxes'] . "¥"></td></tr>¥n";

  print "<tr><td align=right valign=top>Comments:&nbsp;</td><td><textarea rows=5 cols=50 name=¥"bldgComments¥">" . $_REQUEST['bldgComments'] . "</textarea></td></tr>¥n";

  print "<tr><td align=right>Asking Lease Price:&nbsp;</td><td><input type=¥"text¥" name=¥"bldgLeasePrice¥" value=¥"" . $_REQUEST['bldgLeasePrice'] . "¥"> ";
  print "<input type=¥"radio¥" name=¥"bldgLeaseType¥" value=¥"1¥"";
  if($_REQUEST['bldgLeaseType']=="1"){
    print " CHECKED";
  }
  print "> Gross ";
  print "<input type=¥"radio¥" name=¥"bldgLeaseType¥" value=¥"2¥"";
  if($_REQUEST['bldgLeaseType']=="2"){
    print " CHECKED";
  }
  print "> Net";
  print "</td></tr>¥n";
  print "<tr><td align=right>Asking Sales Price:&nbsp;</td><td><input type=¥"text¥" name=¥"bldgSalePrice¥" value=¥"" . $_REQUEST['bldgSalePrice'] . "¥"></td></tr>¥n";

  print "<tr><td class=¥"$textClass¥" align=right>Date Sold or Leased:&nbsp;</td><td class=¥"$textClass¥"><select name=¥"soldMonth¥" class=¥"$fieldClass¥">";
  print "<option value=¥"0¥"></option>";
  for($i=1;$i<=12;$i++){
    if(strlen($i)<2){
      $tmpI = "0" . $i;
    }else{
      $tmpI = $i;
    }
    if($tmpI==$_REQUEST['soldMonth']){
      print "<option value=¥"$tmpI¥" selected>$tmpI</option>";
    }else{
      print "<option value=¥"$tmpI¥">$tmpI</option>";
    }
  }
  print "</select> / <select name=¥"soldDay¥" class=¥"$fieldClass¥">";
  print "<option value=¥"0¥"></option>";
  for($i=1;$i<=31;$i++){
    if(strlen($i)<2){
      $tmpI = "0" . $i;
    }else{
      $tmpI = $i;
    }
    if($tmpI==$_REQUEST['soldDay']){
      print "<option value=¥"$tmpI¥" selected>$tmpI</option>";
    }else{
      print "<option value=¥"$tmpI¥">$tmpI</option>";
    }
  }
  print "</select> / <select name=¥"soldYear¥" class=¥"$fieldClass¥">";
  print "<option value=¥"0¥"></option>";
  for($i=(substr($Dt,0,4)-1);$i<=(substr($Dt,0,4)+4);$i++){
    if($i==$_REQUEST['soldYear']){
      print "<option value=¥"$i¥" selected>$i</option>";
    }else{
      print "<option value=¥"$i¥">$i</option>";
    }
  }
  print "</select>&nbsp;&nbsp;&nbsp;&nbsp;";
  print "</select></td><tr>";


  print "<tr><td class=¥"$textClass¥" align=right>Subleased until:&nbsp;</td><td class=¥"$textClass¥"><select name=¥"subleasedMonth¥" class=¥"$fieldClass¥">";
  print "<option value=¥"0¥"></option>";
  for($i=1;$i<=12;$i++){
    if(strlen($i)<2){
      $tmpI = "0" . $i;
    }else{
      $tmpI = $i;
    }
    if($tmpI==$_REQUEST['subleasedMonth']){
      print "<option value=¥"$tmpI¥" selected>$tmpI</option>";
    }else{
      print "<option value=¥"$tmpI¥">$tmpI</option>";
    }
  }
  print "</select> / <select name=¥"subleasedDay¥" class=¥"$fieldClass¥">";
  print "<option value=¥"0¥"></option>";
  for($i=1;$i<=31;$i++){
    if(strlen($i)<2){
      $tmpI = "0" . $i;
    }else{
      $tmpI = $i;
    }
    if($tmpI==$_REQUEST['subleasedDay']){
      print "<option value=¥"$tmpI¥" selected>$tmpI</option>";
    }else{
      print "<option value=¥"$tmpI¥">$tmpI</option>";
    }
  }
  print "</select> / <select name=¥"subleasedYear¥" class=¥"$fieldClass¥">";
  print "<option value=¥"0¥"></option>";
  for($i=(substr($Dt,0,4)-1);$i<=(substr($Dt,0,4)+4);$i++){
    if($i==$_REQUEST['subleasedYear']){
      print "<option value=¥"$i¥" selected>$i</option>";
    }else{
      print "<option value=¥"$i¥">$i</option>";
    }
  }
  print "</select>&nbsp;&nbsp;&nbsp;&nbsp;";
  print "</select></td><tr>";


  print "<tr><td align=right>Modified Gross:&nbsp;</td><td><input type=¥"text¥" size=20 name=¥"bldgModGross¥" value=¥"" . $_REQUEST['bldgModGross'] . "¥">&nbsp;&nbsp;";
  print "Operating Expense:&nbsp;<input type=¥"text¥" size=20 name=¥"bldgOpExp¥" value=¥"" . $_REQUEST['bldgOpExp'] . "¥"></td></tr>¥n";


  print "<tr><td align=right>Broker:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgBroker¥" value=¥"" . $_REQUEST['bldgBroker'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Broker Phone:&nbsp;</td><td><input type=¥"text¥" size=20 maxlength=12 name=¥"bldgBrokerPhone¥" value=¥"" . $_REQUEST['bldgBrokerPhone'] . "¥">&nbsp;&nbsp;";
  print "Broker Email:&nbsp;<input type=¥"text¥" size=20 name=¥"bldgBrokerEmail¥" value=¥"" . $_REQUEST['bldgBrokerEmail'] . "¥"></td></tr>¥n";

  print "<tr><td align=right>Broker 2:&nbsp;</td><td><input type=¥"text¥" size=50 name=¥"bldgBroker2¥" value=¥"" . $_REQUEST['bldgBroker2'] . "¥"></td></tr>¥n";
  print "<tr><td align=right>Broker 2 Phone:&nbsp;</td><td><input type=¥"text¥" size=20 maxlength=12 name=¥"bldgBroker2Phone¥" value=¥"" . $_REQUEST['bldgBroker2Phone'] . "¥">&nbsp;&nbsp;";
  print "Broker 2 Email:&nbsp;<input type=¥"text¥" size=20 name=¥"bldgBroker2Email¥" value=¥"" . $_REQUEST['bldgBroker2Email'] . "¥"></td></tr>¥n";


  print "<tr><td align=right>Virtual Tour Link:&nbsp;</td><td><input type=¥"text¥" size=37 name=¥"bldgVirtLink¥" value=¥"" . $_REQUEST['bldgVirtLink'] . "¥">&nbsp;&nbsp;";
  print "Featured:&nbsp;<select name=¥"bldgFeatured¥">";
  print "<option value=¥"0¥"";
  if($_REQUEST['bldgFeatured']=="0"){
    print " SELECTED";
  }
  print ">No</option>";
  print "<option value=¥"1¥"";
  if($_REQUEST['bldgFeatured']=="1"){
    print " SELECTED";
  } 
  print ">Yes</option>";
  print "</select></td></tr>¥n";
if($_REQUEST['bldgLat']==""){ $_REQUEST['bldgLat']="0.0"; }
if($_REQUEST['bldgLon']==""){ $_REQUEST['bldgLon']="0.0"; }

  print "<tr><td align=right><a href=¥"http://itouchmap.com/latlong.html¥" target=¥"_blank¥">Google Maps Info</a>:</td><td>Latitude: <input type=¥"text¥" size=10 name=¥"bldgLat¥" value=¥"" . $_REQUEST['bldgLat'] . "¥">&nbsp;&nbsp;";
  echo "Longitude: <input type=¥"text¥" size=10 name=¥"bldgLon¥" value=¥"" . $_REQUEST['bldgLon'] . "¥">&nbsp;&nbsp;";
  print "Status:&nbsp;<select name=¥"bldgStatus¥">";
  print "<option value=¥"0¥"";
  if($_REQUEST['bldgStatus']=="0"){
    print " SELECTED";
  }
  print ">Active</option>";
  print "<option value=¥"1¥"";
  if($_REQUEST['bldgStatus']=="1"){
    print " SELECTED";
  } 
  print ">Sold</option>";
  print "<option value=¥"2¥"";
  if($_REQUEST['bldgStatus']=="2"){
    print " SELECTED";
  } 
  print ">Leased</option>";
  print "</select></td></tr>¥n";

  print "<tr><td align=right>Picture:&nbsp;</td><td><input type=¥"file¥" name=¥"picFile¥" size=40 value=¥"" . $_REQUEST['picFile'] . "¥"></td></tr>¥n";

  print "</table><BR>";

  ////////////////////  ADDED BY JAIME /////////////////////

      if($_REQUEST["button"]=="Edit"){

        echo "<div style=¥"border:1px dotted #000;padding:3px;width:360px;background:#CFFFD1¥"><a href=¥"javascript:collapse1.slidedown();¥">Upload Asset</a>¥n";
        echo "<div id=¥"assets¥" style=¥"width:100%;height:130px¥"><br />¥n";
        echo "<input type=¥"hidden¥" name=¥"MAX_FILE_SIZE¥" value=¥"6291456¥"></input>";
        echo "List file as: (a-z,0-9,()!-_. ONLY!)<br /> <input type=¥"text¥" name=¥"listname¥" style=¥"width:180px¥"><br />";
        echo "File to upload (max 6MB):<br /><input type=¥"file¥" name=¥"userfile¥" style=¥"width:200px¥">";
        echo "<br /><input type=¥"submit¥" name=¥"button¥" value=¥"Upload¥" style=¥"padding:2px¥"></input> [ <a href=¥"javascript:collapse1.slideup()¥">close</a> ]"; 
        echo "<input type=¥"hidden¥" name=¥"assetID¥" value=¥"".$_REQUEST["bID"]."¥"></input></input>¥n";
        echo "</div>¥n";
        echo "<script type=¥"text/javascript¥">¥n";
        echo "var collapse1=new animatedcollapse(¥"assets¥",130,false)¥n";
        echo "</script>¥n";
        echo "</div><br />";
        echo "<div style=¥"border:1px dotted #000;padding:3px;width:360px;background:#FFFBCF¥"><a href=¥"javascript:;¥" onClick=¥"OpenWindow('manage.php?id=".$_REQUEST["bID"]."','manage','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',580,285,'center','ignoreLink','',0,'');return false;¥">Asset Management</a></div>¥n";
        echo "<br />";
      }

  ////////////////////////////////////////////////////////////





  if(trim($button)=="Edit"|| trim($button)=="Save Changes" ){
    print "<input type=¥"submit¥" name=¥"button¥" value=¥"Save Changes¥">";
  }else{
    print "<input type=¥"submit¥" name=¥"button¥" value=¥"Save New¥">";
  }
  print "&nbsp;&nbsp;<input type=¥"submit¥" name=¥"button¥" value=¥"Cancel¥">";
  print "</center>";
}
/**********************************************************************************************
                    INITIAL VIEWING
**********************************************************************************************/
if(trim($button)==""){
  $markets = file("markets.txt");
  sort($markets);
  $txt_dir = array();
  $dir=opendir($picPath);
  while($file = readdir($dir)){ 
     array_push($txt_dir,$file);
  }
  closedir($dir);
  array_shift($txt_dir);
  array_shift($txt_dir);
  sort($txt_dir);
  print "<center>";
  $dblink = mysql_connect($connectionHost, $connectionUser, $connectionPass);
  $db = mysql_select_db($dbName, $dblink);
  $viewQuery = "select id,dtEntered,sDate,eDate,address,city,state,market,featured,sqft,availsqft,stories,sitesize,parking,bldgDesc,officesize,truckdocks,driveindoors,ceilingheight,power,airlines,sprinklered,elevators,heat,aircond,usda,coolers,freezers,floordrains,baysizes,cranes,rail,zoning,transportation,economicincentives,investmentproperty,developmentproperty,realestatetaxes,comments,leaseprice,leasegrossnet,saleprice,virtualtourlink,broker,brokerphone,brokeremail from " . $dbData;
  switch($_REQUEST['qtype']){
    case "address":
      $viewQuery .= " order by address, city";
      break;
    case "city":
      $viewQuery .= " order by city, state, address";
      break;
    case "state":
      $viewQuery .= " order by state, city";
      break;
    case "market":
      $viewQuery .= " order by market";
      break;
    case "sqft":
      $viewQuery .= " order by sqft, city";
      break;
    case "featured":
      $viewQuery .= " order by featured, id";
      break;
    case "expires":
      $viewQuery .= " order by eDate";
      break;
    default:
      $viewQuery .= " order by id";
      break;
  }
  $viewResult = mysql_query($viewQuery,$dblink);
  $viewCheck = mysql_affected_rows($dblink);
  if($viewCheck>0 && $viewResult){
    print "<table cellpadding=0 cellspacing=0 border=1 class=¥"tblText¥">";
    print "<tr>";
    //print "<td align=center bgcolor=silver><b>ID</b></td>";
    print "<td align=center bgcolor=silver><a href=¥"" . $_SERVER["PHP_SELF"] . "?qtype=address¥" class=¥"titles¥">Address</a></td>";
    print "<td align=center bgcolor=silver><a href=¥"" . $_SERVER["PHP_SELF"] . "?qtype=city¥" class=¥"titles¥">City</a></td>";
    print "<td align=center bgcolor=silver><a href=¥"" . $_SERVER["PHP_SELF"] . "?qtype=state¥" class=¥"titles¥">ST</a></td>";
    print "<td align=center bgcolor=silver><a href=¥"" . $_SERVER["PHP_SELF"] . "?qtype=market¥" class=¥"titles¥">Market</a></td>";
    print "<td align=center bgcolor=silver><a href=¥"" . $_SERVER["PHP_SELF"] . "?qtype=sqft¥" class=¥"titles¥">Sq.Ft.</a></td>";
    print "<td align=center bgcolor=silver><a href=¥"" . $_SERVER["PHP_SELF"] . "?qtype=featured¥" class=¥"titles¥">Feat.</a></td>";
    print "<td align=center bgcolor=silver><a href=¥"" . $_SERVER["PHP_SELF"] . "?qtype=expires¥" class=¥"titles¥">Expires</a></td>";
    print "<td align=center bgcolor=silver><b>Options</b></td>";
    print "</tr>¥n";
    while($datarow = mysql_fetch_array($viewResult)){
    // Change Colors...
      if($bgcolor=="" || $bgcolor=="#fbffc0"){
        $bgcolor = "#FFFFFF";
      }else{
        $bgcolor = "#fbffc0";
      }
      if($datarow['featured']==1){
        $bgcolor = "#a6ff83";
      }
      if($datarow['eDate']>0 && $datarow['eDate']<=$Dt){
        $bgcolor = "pink";
      }
    // Show Data...
      print "<tr bgcolor=¥"" . $bgcolor . "¥"><a name=¥"" . $datarow['id'] . "¥">¥n";
      // ID...
      //print "<td align=center>&nbsp;" . $datarow['id'] . "&nbsp;</td>";
      // Address...
      print "<td>&nbsp;" . $datarow['address'] . "&nbsp;</td>";
      // City...
      print "<td>&nbsp;" . $datarow['city'] . "&nbsp;</td>";
      // State...
      print "<td>&nbsp;" . $datarow['state'] . "&nbsp;</td>";
      // Market...
      print "<td>&nbsp;";
      foreach($markets as $market){
        $mrktData = explode("|",$market);
        if($datarow['market']==trim($mrktData[1])){
          print $mrktData[0];
        }
      }
      print "&nbsp;</td>";
      // Sq Ft...
      print "<td>&nbsp;" . $datarow['sqft'] . "&nbsp;</td>";
      // Featured...
      print "<td align=center><select name=¥"featured¥" onchange=¥"javascript:changeFeatured('" . $_SERVER["PHP_SELF"] . "?button=chgfeature&bID=" . $datarow['id'] . "',this.value," . $datarow['id'] . ");¥" style=¥"border: 0px;¥">";
      print "<option value=¥"0¥"";
      if($datarow['featured']==0){
        print " SELECTED";
      }
      print ">No</option>";
      print "<option value=¥"1¥"";
      if($datarow['featured']==1){
        print " SELECTED";
      }
      print ">Yes</option>";
      print "</select></td>";
      // Expires...
      if($datarow['eDate']==0){
        print "<td align=center>&nbsp;<font color=gray>Never</font>&nbsp;</td>";      
      }else{
        print "<td align=center>&nbsp;" . substr($datarow['eDate'],4,2) . "/" . substr($datarow['eDate'],6,2) . "/" . substr($datarow['eDate'],0,4) . "&nbsp;</td>";
      }
      // Options...
      print "<td>&nbsp;";
      // Look for photo and give link to it.
      $photoFound = 0;
      foreach($txt_dir as $photo){
        if($photo == $datarow['id'] . "_sys.jpg"){
          print "<a href=¥"javascript:openWin('/properties/" . $photo . "');¥" class=¥"nav¥">Picture</a> | ";
          $photoFound = 1;
        }
      }
      if($photoFound==0){
        print "<font color=silver>Picture</font> | ";
      }
      print "<a href=¥"" . $_SERVER["PHP_SELF"] . "?button=Edit&bID=" . $datarow['id'] . "¥" class=¥"nav¥">Edit</a> | ";
      print "<a href=¥"" . $_SERVER["PHP_SELF"] . "?button=Delete&bID=" . $datarow['id'] . "¥" class=¥"nav¥">Delete</a>&nbsp;</td>";
      print "</tr>¥n";
    }
    print "</table><BR><BR>¥n";
  }else{
    print "<b>There are currently no entries to view.</b><BR>";
    //print $viewQuery;
    print "<BR>";
  }
  print "<input type=¥"submit¥" name=¥"button¥" value=¥"Add New Entry¥">";
  print "&nbsp;&nbsp;<input type=¥"submit¥" name=¥"button¥" value=¥"Return to Main Menu¥">";
  print "</center>";
}
print "</form>¥n</body>¥n</html>¥n";
mysql_close($dblink);


function scale_fill($name,$ext,$width,$height,$smwidth,$smheight){
  // location of ImageMagick
  $imLoc = "/usr/local/bin/";

  // if you want to save newly converted images, set this to false
  $killdummy = false;

  $original_file = $name . "." . $ext;
  $dummy_file = $name . "_sys.jpg";

  //if(!file_exists($dummy_file)){ // if we change this to save the dummy file, don't run this code

    if ($height && $width)  // if the image url on the page specifies a new height and width, use them
    {
      $newheight = $height;
      $newwidth = $width;
    }
    else  // if no height and width specified, u

$uploadResponse = "File Upload Complete!<br /> The file has been saved as ¥".$_REQUEST['listname']."¥ and will be displayed as ¥".$listnameNice."¥<br /><br />";

proper formatting for concatenation is:
$var = "my string starts here and I will only use one quote to break it ".$add_this_var." and now I can continue with my string. If I want to use an array I have a few options, but the easiest is to ".$myarray['use_this_method']."and notice the single quotes.";

Line 59 is formatted correctly, but I think the error is coming from line 51, having the same format error of using "" after a .

Good luck!

Ryan

For the record, you have TONS of these all over the place... it will take you a while to find them all, I fear... I would go through line by line and fix them as you come across them.

line 45:

$uploadResponse = "File Upload Complete!<br /> The file has been saved as ¥".$_REQUEST["listname"]."¥ and will be displayed as ¥".$listnameNice."¥<br /><br />";

line 51

$uploadResponse = "Error: File ¥".$_REQUEST["listname"]."¥already exists!";

i think you have problem with this characters (¥"), replace it with space or nothing
, use dreamwaver to do that ,it's helpfull,GOOD LUCK.
%%^Murtada^%%

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.