<?php 
function smarty_function_build_edit_control($params, &$smarty)
{
	$field=$params["field"];
	if($params["mode"]=="edit")
		$mode=MODE_EDIT;
	else if($params["mode"]=="add")
		$mode=MODE_ADD;
	else
		$mode=MODE_SEARCH;
	$second=false;
	if(@$params["second"])
		$second=true;
	$format=GetEditFormat($field);
	if(($mode==MODE_EDIT || $mode==MODE_ADD) && $format==EDIT_FORMAT_READONLY)
	{
		global $readonlyfields;
		echo $readonlyfields[$field];
	}
	if($mode==MODE_SEARCH)
	{
		global $editformats;
		$format=$editformats[$field];
	}
	BuildEditControl($field,@$params["value"],$format,$mode,$second);

}
?>