# indiktab
! $ARGS[0]
! ARGS[1] ... percentage
! ARGS[2] ... real value
! ARGS[3] ... text for type 3 bar

ap = ARGS[1]
ar = ARGS[2]
if ap > 100:ap = 100
if ap < 0:ap = 0
$apc = ap
$apg = 100-ap
if Enable_Android = 1:
	$vbcolor = 'gray'
else
	$vbcolor = '#d0d0d0'
end

$vfcolor='rgb(<<(16777216 + bcolor) mod 256>>,<<(16777216 + bcolor)/256 mod 256>>,<<(16777216 + bcolor)/65536>>)'

if $ARGS[0] = '1':
	if Enable_Android = 1:
		if ap  >= 65:
			$vcolor = 'green'
		elseif ap >= 35:
			$vcolor = 'blue'
		else
			$vcolor = 'red'
		end
	else
		if ap >= 85:
			$vcolor = 'green'
		elseif ap >= 70:
			$vcolor = '#b3b300'
		elseif ap >= 50:
			$vcolor = '#00CED1'
		elseif ap >= 20:
			$vcolor = 'blue'
		elseif ap >= 10:
			$vcolor = '#ff6600'
		else
			$vcolor = 'red'
		end
	end
	if ap = 0: $vcolor = $vbcolor
	if ap = 100: $vbcolor = $vcolor
	$result = '<TABLE  cellpadding="0" cellspacing="0" width="220"><TR><TD bgcolor="<<$vcolor>>" width="<<$apc>>%"></TD><TD bgcolor="<<$vbcolor>>" width="<<$apg>>%"></TD><TD width="40" align="right"><<ar>></TD></TR></TABLE>'
end

if $ARGS[0] = '2':
	if Enable_Android = 1:
		if ap  >= 85:
			$vcolor = 'red'
		elseif ap >= 65:
			$vcolor = 'orange'
		elseif ap >= 45:
			$vcolor = 'yellow>'
		elseif ap >= 25:
			$vcolor = 'green'
		else
			$vcolor = 'blue'
		end
	else
		if ap >= 90:
			$vcolor = '#ff0000'
		elseif ap >= 80:
			$vcolor = '#ff1a1a'
		elseif ap >= 70:
			$vcolor = '#ff3333'
		elseif ap >= 60:
			$vcolor = '#ff4d4d'
		elseif ap >= 50:
			$vcolor = '#ff6666'
		elseif ap >= 40:
			$vcolor = '#ff8080'
		elseif ap >= 30:
			$vcolor = '#e68080'
		elseif ap >= 20:
			$vcolor = '#cc8080'
		elseif ap >= 10:
			$vcolor = '#b38080'
		else
			$vcolor = '#998080'
		end
	end
	if ap = 0: $vcolor = $vbcolor
	if ap = 100: $vbcolor = $vcolor
	$result = '<font color="<<$vfcolor>>"><TABLE  cellpadding="0" cellspacing="0" width="220"><TR><TD bgcolor="<<$vcolor>>" width="<<$apc>>%"></TD><TD bgcolor="<<$vbcolor>>" width="<<$apg>>%"></TD><TD width="40" align="right"><<ar>></TD></TR></TABLE></font>'
end
if $ARGS[0] = '3':
	ap = ar
	if Enable_Android = 1:
		if ap  >= 130:
			$vcolor = 'green'
		elseif ap >= 70:
			$vcolor = 'blue'
		else
			$vcolor = 'red'
		end
	else
		if ap < 20:
			$vcolor = '#b3b300'
		elseif ap < 60:
			$vcolor = '#00CED1'
		elseif ap <= 140:
			$vcolor = 'blue'
		elseif ap <= 180:
			$vcolor = '#00CED1'
		else
			$vcolor = '#b3b300'
		end
	end
	if ap < 100:
		ap = (100-ap)/2
		apg = 50 - ap
		$result = '<TABLE  cellpadding="0" cellspacing="0" width="220"><TR><TD bgcolor="<<$vbcolor>>" width="<<apg>>%"></TD><TD bgcolor="<<$vcolor>>" width="<<ap>>%"></TD><TD bgcolor="<<$vbcolor>>" width="50%"><<$ARGS[3]>></TD><TD width="40" align="right">-<<100-ar>></TD></TR></TABLE>'
	else
		ap = (ap - 100)/2
		apg = 50 - ap
		$result = '<TABLE  cellpadding="0" cellspacing="0" width="220"><TR><TD bgcolor="<<$vbcolor>>" width="50%"><<$ARGS[3]>></TD><TD bgcolor="<<$vcolor>>" width="<<ap>>%"></TD><TD bgcolor="<<$vbcolor>>" width="<<apg>>%"></TD><TD width="40" align="right"><<ar-100>></TD></TR></TABLE>'
	end
end
killvar 'ap'
killvar 'ar'
killvar '$apg'
killvar '$apc'
killvar '$vcolor'
killvar '$vfcolor'

--- indiktab ---------------------------------

