<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_VEHICLE_ENTRY';
if (!@$_GET['popup'])
	$path_to_root = "../..";
else	
	$path_to_root = "../..";

include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/transport/includes/ui/vehicles_ui.inc"); 
include_once($path_to_root . "/transport/includes/db/vehicles_db.inc");
include_once($path_to_root . "/assets/includes/db/assets_db.inc");

$js = '';
$js .= get_js_open_window(900, 500);
$js .= get_js_date_picker();

page(_($help_context = "Vehicle"));

simple_page_mode(true);

if(isset($_POST['Add_V'])){
    create_vehicle($Mode);
}    
 
if(isset($_POST['Update_V'])){
    $uvr = edit_vehicle($Mode);
 }

if (isset($_POST['cancel'])){
    $Mode = 'RESET';
} 

if ($Mode == 'Delete')
{
    $recs = delete_vehicle();
        if($recs == 1){
                display_notification(_("Vehicle has been deleted."));
        }
        else{
                display_error(_("Vehicle could not be deleted."));
        }
	$Mode = 'RESET';
}

$Ajax->activate('_page_body');

start_form();

    display_vehicle_selection_parameters();

    div_start('asset_details');
        display_vehicle_control($_POST['asset_id']);        br();
    div_end();

end_form();
end_page(@$_GET['popup'], false, false);        

?>