$area->ID = $areaID;
                $res = $area->putToDB($areaID ? 1 : 0);
                if ($res) {
                    echo "<BR>Area updated! ";
                } else {
                    echo "<BR>Problem in updating Area ! ";
                }
                if ($areaAction == 'Edit') {
                    echo "<div align=center><a href='" . getLeonardoLink(array('op' => 'area_admin', 'areaAction' => 'Edit', 'areaID' => $areaID)) . "'>RETURN TO AREA</a> </div><BR>";
                }
            }
        } else {
            if (in_array($areaAction, array('Add', 'Edit', 'Delete'))) {
                $area = new area($areaID);
                if ($areaID) {
                    $area->getFromDB();
                }
            }
            ?>
		<form id="areaForm" name="areaForm" method="post" action="">
		<table width="700" border="1" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="161">Area Name </td>
			<td width="533">
				  <input type="text" name="name" size="40" value="<?php 
            echo $area->name;
            ?>
"/>		</td>
		  </tr>
		  		  <tr>
			<td>Type</td>
}
if (is_array($clubsList[$clubID]['gliderCat'])) {
    $where_clause .= " AND ( 0 ";
    foreach ($clubsList[$clubID]['gliderCat'] as $c_gliderCat) {
        $where_clause .= " OR  {$flightsTable}.cat={$c_gliderCat} ";
    }
    $where_clause .= " ) ";
}
// only locally submitted flights for this club ?
if ($clubsList[$clubID]['onlyLocalFlights']) {
    $where_clause .= " AND externalFlightType = 0 ";
}
if ($areaID) {
    require_once dirname(__FILE__) . "/CL_area.php";
    $clubArea = new area($areaID);
    $clubArea->getFromDB();
    if ($clubArea->areaType == 0) {
        $where_clause .= " \tAND {$areasTakeoffsTable}.areaID={$areaID} \n\t\t\t\t\t\t\t\tAND {$areasTakeoffsTable}.takeoffID={$flightsTable}.takeoffID  ";
        $extra_table_str .= ",{$areasTakeoffsTable} ";
    } else {
        if ($clubArea->areaType == 1) {
            // bounding box
            $where_clause .= " \tAND firstLat >=" . $clubArea->min_lat . "\n\t\t\t\t\t\t\t\tAND firstLat <=" . $clubArea->max_lat . " \n\t\t\t\t\t\t\t\tAND firstLon >=" . $clubArea->min_lon . "\n\t\t\t\t\t\t\t\tAND firstLon <=" . $clubArea->max_lon . "\n\t\t\t\t\t\t\t\t";
        }
    }
}
if ($addManual) {
    $clubFlights = getClubFlightsID($clubID);
    if (!$add_remove_mode) {
        // select only spefici flights
        $where_clause .= " \tAND {$clubsFlightsTable}.flightID={$flightsTable}.ID \n\t\t\t\t\t\t\tAND {$clubsFlightsTable}.clubID={$clubID} ";