<?php


function USERS_COLUMN_COLOR_RETURN($ARG1,$ARG1_VAL,$ARG2) {
//echo "<TD";
if($ARG1==A_STATUS) { 
if($ARG1_VAL==NORMAL) { return "$ARG2='#88FF88'"; }
if($ARG1_VAL==OFF_SOFT) { return "$ARG2='#FF9999'"; }
if($ARG1_VAL==DELETED) { return "$ARG2='#CCCCCC'"; }
if($ARG1_VAL==DELETED) { return "$ARG2='#CCCCCC'"; }
if($ARG1_VAL==WARNING) { return "$ARG2='#FFCCCC'"; }
if($ARG1_VAL==OFF_HARD) { return "$ARG2='#EEEEEE'"; }
if($ARG1_VAL==WAITING) { return "$ARG2='#FF88FF'"; }
} else if($ARG1==A_PROBLEM) {
if($ARG1_VAL==WARNING) { return "$ARG2='#FFFF88'"; }
if($ARG1_VAL==PROBLEM) { return "$ARG2='#FFBBBB'"; }
if($ARG1_VAL==SERIOUS) { return "$ARG2='#FF5555'"; }
if($ARG1_VAL==UNVERIFIED) { return "$ARG2='#FFc57D'"; }
} else if($ARG1==S_HWSTAT) {
if($ARG1_VAL==DETECT) return " $ARG2='#FFFF88'";
if($ARG1_VAL==FREE) return " $ARG2='#FFBBBB'";
if($ARG1_VAL==BLOCK) return " $ARG2='#FF5555'";
if($ARG1_VAL==FIXED) return " $ARG2='#88FF88'";
if(!$ARG1_VAL) return " $ARG2='#FF5555'";
} else if($ARG1==L_APPOITMENT_TYPE) {
if($ARG1_VAL==ARRANGED) return " $ARG2='#FFFF88'";
if($ARG1_VAL==TO_ARRANGE) return " $ARG2='#FF88FF'";
if($ARG1_VAL==CANCELLED) return " $ARG2='#FF5555'";
if($ARG1_VAL==TO_CANCEL) return " $ARG2='#FF55FF'";
if($ARG1_VAL==RELATE) return " $ARG2='#FFBBBB'";
if($ARG1_VAL==WAIT) echo " $ARG2='#FF00BB'";
if(!$ARG1_VAL) return " $ARG2='#FFFFFF'";
}  else if($ARG1==L_APPOITMENT_DATE) {
$VAR="$ARG1_VAL";
$VAR = join('-',(split(':',$VAR)));
$VAR = join('-',(split('  ',$VAR)));
$VAR = join('-',(split(' ',$VAR)));
$VAR=explode('-',$VAR);
 if(strlen($VAR[3])==0) $VAR[3]="0";
 if(strlen($VAR[4])==0) $VAR[4]="0";
$VAR = "$VAR[0]-$VAR[1]-$VAR[2] $VAR[3]:$VAR[4]";
if((strlen($ARG1_VAL)>5)) {
 $CTIME = time();
  if (!(($VAR = strtotime($VAR)) === -1)) {
   if($VAR > $CTIME) {
    if(($VAR - $CTIME) < 7200) {
     return " $ARG2='#FFFF88'"; 
    } if(($VAR - $CTIME) < 43200) {
     return " $ARG2='#DCDC88'"; 
    }  else return " $ARG2='#CCCCCC'"; 
 
   } else if($VAR < $CTIME) {
    if(($CTIME - $VAR) < 1000) {   
     return " $ARG2='red'"; 
    } else return " $ARG2='#FF5555'"; 
   }
  }
 } //EOF strlen(ARG1_VAL>5)
} //EOF L_APPOINTMEND_DATE
//echo ">";
}
