<?php
function button($type,$text='',$link='',$width=15,$addition='')
{
	if($type=='dot')
	{
		$button = '<TABLE border=0 cellpadding=0 cellspacing=0 height='.$width.' width='.$width.' bgcolor=#'.$text.' style="display:inline;"><TR><TD>';
		$button .= '<IMG SRC=images/dot.gif height='.$width.' width='.$width.' border=0 vspace=0 hspace=0>';
		$button .= '</TD></TR></TABLE>';
	}
	elseif($type=='file_upload')
	{
		if($text)
		  $button = '<TABLE border=0 cellpadding=0 cellspacing=0 height=10><TR><TD>';
		if($link)
		  $button .= "<IMG SRC='images/file_edit_button.gif'".($width?"width=$width":'').' '.$addition." border=0 vspace=0 class=GridOutput_fieldint><U>".$link." ".$text."</U>";
		if($text)
		  $button .= "</TD></TR></TABLE>";
	}
	elseif($type=='file_download')
	{
		if($text)
			$button = '<TABLE border=0 cellpadding=0 cellspacing=0 height=10><TR><TD>';
		if($link)
			$button .= "<A HREF=".$link."><IMG SRC='images/file_download_button.gif'".($width?"width=$width":'').' '.$addition." border=0 vspace=0 class=GridOutput_fieldint>&nbsp;$text</A>";
		if($text)
			$button .= "</TD></TR></TABLE>";
	}
	elseif($type=='file_delete')
	{
		if($text)
			$button = '<TABLE border=0 cellpadding=0 cellspacing=0 height=10><TR><TD>';
		if($link)
			$button .= "<A HREF=".$link."><IMG SRC='images/file_delete_button.gif'".($width?"width=$width":'').' '.$addition." border=0 vspace=0 class=GridOutput_fieldint>&nbsp;$text</A>";
		if($text)
			$button .= "</TD></TR></TABLE>";
	}
	else
	{
		if($text)
			$button = '<TABLE border=0 cellpadding=0 cellspacing=0 height=10><TR><TD>';
		if($link)
			$button .= "<A HREF=".$link.">";
		if($type=='phone')
			$button .= DrawPNG($type.'_button.png','width='.$width.' '.$addition.' border=0');
		else
			$button .= "<IMG SRC='images/".$type."_button.gif' ".($width?"width=$width":'').' '.$addition." border=0 vspace=0 class=GridOutput_fieldint>";
		if($link)
			$button .= '</A>';

		if($text)
		{
			$button .= "</TD><TD valign=middle>";
			$button .= "<font face=verdana size=1 color=#000000><b>";
			if($link)
				$button .= "<A HREF=".$link.">";
			$button .= $text;
			if($link)
				$button .= '</A>';
			$button .= "</b></font>";
			$button .= "</TD>";
			$button .= "</TR></TABLE>";
		}
	}

	return $button;
}
?>