# indiktab
! ARGS[0] ... color
!!  color palette selector

! ARGS[1] ... percentage
!!  scales the bar from 0 to 100

! ARGS[2] ... real value
!!  the value displayed on the bar

! ARGS[3] ... phantom
!!  ghost value, used for painkillers


indiktab['bar_progress'] = min(max(ARGS[1], 0), 100)
if Enable_statfsize > 0:
	indiktab['label_width'] = len(str(ARGS[2])) * Enable_statfsize*2
else
	indiktab['label_width'] = len(str(ARGS[2])) * fsize/2
end
if ARGS[3] > 0: indiktab['bar_phantom'] = min(max(ARGS[3] - indiktab['bar_progress'], 0), 100 - indiktab['bar_progress'])

!{if Enable_Android = 1:
	$indiktab['bar_bg_color'] = 'gray'
else}
$indiktab['bar_bg_color'] = $bcolor
! end

if ARGS[0] = 1:
!{	if Enable_Android = 1:
		if indiktab['bar_progress']  >= 65:
			$indiktab['bar_color'] = 'green'
		elseif indiktab['bar_progress'] >= 35:
			$indiktab['bar_color'] = 'blue'
			$indiktab['phantom_color'] = '#00007F'
		else
			$indiktab['bar_color'] = 'red'
		end
	else}
	if indiktab['bar_progress'] >= 85:
		$indiktab['bar_color'] = '#008000'
		$indiktab['phantom_color'] = '#003F00'
		$indiktab['bar_label'] = '#FFFFFF'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 70:
		$indiktab['bar_color'] = '#b3b300'
		$indiktab['phantom_color'] = '#595900'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 50:
		$indiktab['bar_color'] = '#00CED1'
		$indiktab['phantom_color'] = '#006666'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 20:
		$indiktab['bar_color'] = '#0000ff'
		$indiktab['phantom_color'] = '#00007F'
		$indiktab['bar_label'] = '#FFFFFF'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 10:
		$indiktab['bar_color'] = '#ff6600'
		$indiktab['phantom_color'] = '#7F3300'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	else
		$indiktab['bar_color'] = '#ff0000'
		$indiktab['phantom_color'] = '#7F0000'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	end
	! end

elseif ARGS[0] = 2:
!{	if Enable_Android = 1:
		if indiktab['bar_progress']  >= 85:
			$indiktab['bar_color'] = 'red'
		elseif indiktab['bar_progress'] >= 65:
			$indiktab['bar_color'] = 'orange'
		elseif indiktab['bar_progress'] >= 45:
			$indiktab['bar_color'] = 'yellow'
		elseif indiktab['bar_progress'] >= 25:
			$indiktab['bar_color'] = 'green'
		else
			$indiktab['bar_color'] = 'blue'
		end
	else}
	if indiktab['bar_progress'] >= 90:
		$indiktab['bar_color'] = '#ff0000'
		$indiktab['phantom_color'] = '#7F0000'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 80:
		$indiktab['bar_color'] = '#ff1a1a'
		$indiktab['phantom_color'] = '#7F0E0E'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 70:
		$indiktab['bar_color'] = '#ff3333'
		$indiktab['phantom_color'] = '#7F1919'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 60:
		$indiktab['bar_color'] = '#ff4d4d'
		$indiktab['phantom_color'] = '#7F2727'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 50:
		$indiktab['bar_color'] = '#ff6666'
		$indiktab['phantom_color'] = '#7F3333'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 40:
		$indiktab['bar_color'] = '#ff8080'
		$indiktab['phantom_color'] = '#7F4141'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 30:
		$indiktab['bar_color'] = '#e68080'
		$indiktab['phantom_color'] = '#724040'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 20:
		$indiktab['bar_color'] = '#cc8080'
		$indiktab['phantom_color'] = '#664040'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	elseif indiktab['bar_progress'] >= 10:
		$indiktab['bar_color'] = '#b38080'
		$indiktab['phantom_color'] = '#594040'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	else
		$indiktab['bar_color'] = '#998080'
		$indiktab['phantom_color'] = '#4C4040'
		$indiktab['bar_label'] = '#000000'
		$indiktab['phantom_label'] = '#FFFFFF'
	end
	! end
end

$result = '<TABLE  cellpadding="1" cellspacing="0" width="200"><TR>'
if indiktab['bar_progress'] >= ARGS[3]:
	if indiktab['bar_progress'] = 100: $indiktab['bar_bg_color'] = $indiktab['bar_color']

	if indiktab['bar_progress'] > indiktab['label_width']:
		$result += '<TD bgcolor="<<$indiktab[''bar_color'']>>" width="<<indiktab[''bar_progress'']>>%"' & !! bar
		$result += 'align="right"><font color ="<<$indiktab[''bar_label'']>>"><<ARGS[2]>></font>&nbsp;</TD>' & !! label
		$result += '<TD bgcolor="<<$indiktab[''bar_bg_color'']>>" width="<<100 - indiktab[''bar_progress'']>>%"></TD>' & !! background
	else
		$result += '<TD bgcolor="<<$indiktab[''bar_color'']>>" width="<<indiktab[''bar_progress'']>>%"></TD>' & !! bar
		$result += '<TD bgcolor="<<$indiktab[''bar_bg_color'']>>" width="<<100 - indiktab[''bar_progress'']>>%"' & !! background
		$result += 'align="left">&nbsp;<font color ="<<$fcolor>>"><<ARGS[2]>></font></TD>' & !! label
	end
else
	if indiktab['bar_progress'] + indiktab['bar_phantom'] = 100: $indiktab['bar_bg_color'] = $indiktab['phantom_color']

	if indiktab['bar_progress'] > indiktab['label_width']:
		$result += '<TD bgcolor="<<$indiktab[''bar_color'']>>" width="<<indiktab[''bar_progress'']>>%"' & !! bar
		$result += 'align="right"><font color ="<<$indiktab[''bar_label'']>>"><<ARGS[2]>></font>&nbsp;</TD>' & !! label
		$result += '<TD bgcolor="<<$indiktab[''phantom_color'']>>" width="<<indiktab[''bar_phantom'']>>%"></TD>' & !! phantom
		$result += '<TD bgcolor="<<$indiktab[''bar_bg_color'']>>" width="<<100 - indiktab[''bar_phantom''] - indiktab[''bar_progress'']>>%"></TD>' & !! background
	elseif indiktab['bar_phantom'] > indiktab['label_width']:
		$result += '<TD bgcolor="<<$indiktab[''bar_color'']>>" width="<<indiktab[''bar_progress'']>>%"></TD>' & !! bar
		$result += '<TD bgcolor="<<$indiktab[''phantom_color'']>>" width="<<indiktab[''bar_phantom'']>>%"' & !! phantom
		$result += 'align="left">&nbsp;<font color ="<<$indiktab[''phantom_label'']>>"><<ARGS[2]>></font></TD>' & !! label
		$result += '<TD bgcolor="<<$indiktab[''bar_bg_color'']>>" width="<<100 - indiktab[''bar_phantom''] - indiktab[''bar_progress'']>>%"></TD>' & !! background
	else
		$result += '<TD bgcolor="<<$indiktab[''bar_color'']>>" width="<<indiktab[''bar_progress'']>>%"></TD>' & !! bar
		$result += '<TD bgcolor="<<$indiktab[''phantom_color'']>>" width="<<indiktab[''bar_phantom'']>>%"></TD>' & !! phantom
		$result += '<TD bgcolor="<<$indiktab[''bar_bg_color'']>>" width="<<100 - indiktab[''bar_progress'']>>%"' & !! background
		$result += 'align="left">&nbsp;<font color ="<<$fcolor>>"><<ARGS[2]>></font></TD>' & !! label
	end
end
$result += '</TR></TABLE>'

killvar 'indiktab'
killvar '$indiktab'

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