﻿function SetPage(aValue) {
  if (aValue == '') {
    return;
  }
  if (aValue.length == 1) {
    return;
  }
  var arrVal = aValue.split("|");
  for (y in arrVal) {
    var oValue;
    var iOperationCode;

    var arrMain = arrVal[y].split(":");
    var arrTemp = arrMain[1].split("-");

    oValue = arrTemp[0];
    iOperationCode = arrTemp[1];

    var arrControls = arrMain[0].split(",");
    for (ctrl in arrControls) {
      SetFields(arrControls[ctrl], oValue, iOperationCode);
    }
  }
}
function SetFields(aControlId, aValue, aOperationCode) {
  if (aOperationCode == 0) {
    SetValue(aControlId, aValue);
  }
  if (aOperationCode == 1) {
    SetVisible(aControlId, aValue);
  }
}
function SetValue(aControlId, aValue) {
  document.getElementById(aControlId).innerHTML = aValue;
}
function SetVisible(aControlId, aValue) {
  var sDisplay = "none";
  var bVal = new Boolean(false);
  var oElement = document.getElementById(aControlId);

  if (aValue == 'True' || aValue == '1')
    bVal = new Boolean(true);

  if (bVal == true) {
    switch (oElement.tagName.toLowerCase()) {
      case 'span':
        sDisplay = 'inline';
        break;
      case 'div':
        sDisplay = 'block';
        break;
      default:
        sDisplay = 'block';
        break;
    }
  }
  oElement.style.display = sDisplay;
}


