<?php

function input_num2($value, $dflt=0)
{
	if ($value == null || $value == ""){
	  	return $dflt;
    }

    return user_numeric($value);
}

function display_view_cell($name, $value, $param1 = "class='tableheader2'", $params2="")
{    
    label_cells($name, $value, $param1, $params2);    
}

function display_view_row($name, $value, $param1 = "class='tableheader2'", $params2="")
{
    start_row();        
    display_view_cell($name, $value, $param1, $params2);
    end_row();
    
}

function screen_field_label_cell($label, $params="", $id=null)
{
    global $Ajax;

	if(isset($id))
	{
	    $params .= " id='$id'";
	    $Ajax->addUpdate($id, $id, $label);
	}
	echo "<td $params>$label</td>\n";

	return $label;
}

function time_cells($label, $name, $value=null, $size="", $title=false, 
	$labparams="", $post_label="", $inparams="")
{
  	global $Ajax;

	$max = 8;
        
        default_focus($name);
	if ($label != null)
		label_cell($label, $labparams);
	echo "<td>";

	if ($value === null)
		$value = get_post($name);
	echo "<input $inparams type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\""
	    .($title ? " title='$title'" : '')
	    .">";

	if ($post_label != "")
		echo " " . $post_label;

	echo "</td>\n";
	$Ajax->addUpdate($name, $name, $value);
}

function time_row($label, $name, $value, $size, $title=null, $params="", $post_label="", $inparams = "")
{
	echo "<tr><td class='label'>$label</td>";
	time_cells(null, $name, $value, $size, $title, $params, $post_label, $inparams);

	echo "</tr>\n";
}