function show_search_form()
{
    echo box_start("Registrer donasjon - Søk etter bruker", "small") . '
		<form action="" method="post">
			<dl class="dd_right">
				<dt><input type="text" class="styled w150" name="value" value="' . htmlspecialchars(postval("value")) . '" /></dt>
				<dd>' . show_sbutton("ID", 'name="id"') . ' ' . show_sbutton("Bruker", 'name="user"') . ' ' . show_sbutton("E-post", 'name="email"') . '</dd>
			</dl>
		</form>' . box_end();
}
function display_dispositions()
{
    global $connection;
    if (!isset($_GET['disposition_set'])) {
        if (!isset($_GET['user_id'])) {
            $_GET['user_id'] = $_SESSION['user_id'];
        }
        $sql = "SELECT * FROM job_members, jobs WHERE job_members.job_id = jobs.id and job_members.user_id = " . sanitize($_GET['user_id']);
        $result = mysqli_query($connection, $sql);
        if ($result && mysqli_num_rows($result) > 0) {
            $row2 = mysqli_fetch_assoc($result);
            $result_dispositions = mysqli_query($connection, "SELECT * FROM job_dispositions WHERE job_id = " . $row2['job_id']);
            if (mysqli_num_rows($result_dispositions) == 0) {
            } else {
                $x = 0;
                //echo "<table id=\"dispositions\">";
                $closed = false;
                // Add disposition for rescheduling a call
                //echo "<tr>";
                $x++;
                //echo "<td>";
                echo '<button class="button_reschedule" onclick="reschedule();">';
                //box_start(145);
                //echo "<center>";
                /*?>
                  <img src = "images/clock.png" alt="Reschedule Call">
                  <?*/
                echo "Reschedule Call";
                //box_end();
                echo '</button>';
                //echo "</td>";
                while ($rowx = mysqli_fetch_assoc($result_dispositions)) {
                    if ($x == 0) {
                        //echo "<tr>";
                        $closed = false;
                    }
                    $x++;
                    //echo "<td>";
                    /* When you click a dispostion you need to do the following:
                       
                       1. Check the current record is in the database ($row['new'] != 1)
                       2. Add an interraction for the current record
                       3. Remove the dispositions
                       
                       */
                    echo '<button class="buttonx" onclick="save_disposition(\'' . $rowx['id'] . '\');jQuery(\'#dispositions\').fadeOut(500);jQuery(\'#status_bar\').text(\'Disposition set to ' . $rowx['text'] . '\');jQuery(\'#status_bar\').fadeIn(2000);jQuery(\'#status_bar\').fadeOut(5000);">';
                    //box_start(135);
                    //echo "<center>";
                    /*?>
                      <img src = "images/database.png" >
                      <?*/
                    echo ucfirst(strtolower($rowx['text']));
                    //box_end();
                    echo '</button>';
                    //echo "</td>";
                    if ($x > 5) {
                        $x = 0;
                        //echo "</tr>";
                        $closed = true;
                    }
                    //echo '</div></div>';
                }
                if (!$closed) {
                    //echo "</tr>";
                }
                //echo "</table>";
            }
        } else {
            box_start();
            echo "You are not currently assigned to a job";
            box_end();
        }
    }
}
           jQuery('#range').change(function(){
                                   //alert("x");
                                   //alert($('#range').val());
                                   if (jQuery('#range').val() == "date") {
                                   jQuery('#dateselect').show();
                                   } else {
                                   jQuery('#dateselect').hide();
                                   
                                   }
                                   
                                   });
           });
    </script>
    
    <?php 
    box_end();
    require "footer.php";
    exit(0);
}
$result = mysqli_query($connection, "SELECT name FROM jobs WHERE id = " . sanitize($_POST['jobid']));
$name = mysqli_result($result, 0, 0);
/* This is a two step process. Step one 
 *
 */
$sql = "select * from campaign_stats where campaign_id = " . (100000 + $_POST['jobid']) . " and report_date = curdate() order by report_time desc limit 1";
$result = mysqli_query($connection, $sql);
$total = 0;
$answered = 0;
while ($row = mysqli_fetch_assoc($result)) {
    //print_pre($row);
    $total += $row['new'];
 public function box($content, $id = '')
 {
     return box_start($id) . $content . box_end();
 }