<?php

session_start();
header("Cache-control: private");
//IE 6 Fix
include "includes/config.php";
include "includes/checklogin.php";
include "../inc/classes/Light.php";
include "../inc/classes/LightTest.php";
include "../inc/classes/Helpers.php";
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'sort') {
    $objLightTest = new LightTest();
    $objLightTest->SortValues(substr($_REQUEST['action'], 1), substr($_REQUEST['action'], 0, 1));
    unset($objLightTest);
} elseif (isset($_REQUEST['dragsort'])) {
    // handle drag sort ajax request:
    $objLightTest = new LightTest($_REQUEST['id']);
    $new_sort_order = $_REQUEST['idx'] * 10 + 5;
    if ($new_sort_order > $objLightTest->SortOrder) {
        $new_sort_order += 10;
        // increasing sort order so must add another 10
    }
    $objLightTest->SortOrder = $new_sort_order;
    $objLightTest->update();
    echo "success";
    exit;
    // just exit since this is an ajax request
}
$objLight = new Light($_REQUEST['light']);
include "includes/pagetemplate.php";
function PageContent()