/**
  * Return JS for preload dependent ctrl 
  *
  * @param string $fName - field name
  * @param string $fval - value of field
  * @return array
  */
 function getPreloadArr($fName, $value)
 {
     // category control field
     $strCategoryControl = $this->hasDependField($fName);
     if ($strCategoryControl === false) {
         return false;
     }
     // Is field appear or not
     $fieldAppear = true;
     if ($this->pageType == PAGE_ADD) {
         if (!AppearOnInlineAdd($fName)) {
             $fieldAppear = $this->mode != ADD_INLINE;
         } elseif (!AppearOnAddPage($fName)) {
             $fieldAppear = $this->mode == ADD_INLINE;
         }
         // Is category control appear or not
         if ($this->mode == ADD_INLINE) {
             if (AppearOnInlineAdd($strCategoryControl)) {
                 $categoryFieldAppear = true;
             } else {
                 $categoryFieldAppear = false;
             }
         } else {
             if (AppearOnAddPage($strCategoryControl)) {
                 $categoryFieldAppear = true;
             } else {
                 $categoryFieldAppear = false;
             }
         }
     } elseif ($this->pageType == PAGE_EDIT) {
         if (!AppearOnInlineEdit($fName)) {
             $fieldAppear = $this->mode != EDIT_INLINE;
         } elseif (!AppearOnEditPage($fName)) {
             $fieldAppear = $this->mode == EDIT_INLINE;
         }
         $categoryFieldAppear = true;
     } else {
         if ($strCategoryControl) {
             $categoryFieldAppear = true;
         } else {
             $categoryFieldAppear = false;
         }
     }
     if (!$fieldAppear) {
         return false;
     }
     if (GetFieldData($this->tName, $fName, 'freeInput', false)) {
         $output = array(0 => @$value[$fName], 1 => @$value[$fName]);
     } else {
         $output = loadSelectContent($fName, @$value[$strCategoryControl], $categoryFieldAppear, @$value[$fName]);
     }
     $valF = "";
     if (count($value)) {
         $valF = $value[$fName];
     }
     if ($this->pageType == PAGE_EDIT) {
         if (SelectSize($fName) == 1 && LookupControlType($fName) != LCT_CBLIST) {
             $fVal = $valF;
         } else {
             $fVal = splitvalues($valF);
         }
     } else {
         $fVal = $valF;
     }
     return array('vals' => $output, "fVal" => $fVal);
 }
function GetInputElementId($field, $id)
{
    $format = GetEditFormat($field);
    if ($format == EDIT_FORMAT_DATE) {
        $type = DateEditType($field);
        if ($type == EDIT_DATE_DD || $type == EDIT_DATE_DD_DP) {
            return "dayvalue_" . GoodFieldName($field) . "_" . $id;
        } else {
            return "value_" . GoodFieldName($field) . "_" . $id;
        }
    } else {
        if ($format == EDIT_FORMAT_RADIO) {
            return "radio_" . GoodFieldName($field) . "_" . $id . "_0";
        } else {
            if ($format == EDIT_FORMAT_LOOKUP_WIZARD) {
                $lookuptype = LookupControlType($field);
                if ($lookuptype == LCT_AJAX || $lookuptype == LCT_LIST) {
                    return "display_value_" . GoodFieldName($field) . "_" . $id;
                } else {
                    return "value_" . GoodFieldName($field) . "_" . $id;
                }
            } else {
                return "value_" . GoodFieldName($field) . "_" . $id;
            }
        }
    }
}