
//  ICON Names Array
var ICONarray = new Array("consumer", "about", "contact", "consult", "register", "case");

// ICON BAR Width -- Global containing the WIDTH of the LEFT ICON BAR. It's value is set in a
// script in the HTML file: "LeftIcons.html". Website uses this WIDTH in formatting itself.
gICONBarWidth = 0;

// PRELOAD ICONS:  (Left ICON BAR fed early...)
var consumerICON = new Image(57,57);
consumerICON.src="images/wheelchairIcon.gif";
var aboutICON = new Image(57,57);
aboutICON.src="images/knight-left.gif";
var contactICON = new Image(57,57);
contactICON.src="images/at-symbol.gif";
var consultICON = new Image(57,57);
consultICON.src="images/reqcon.gif";
var registerICON = new Image(57,57);
registerICON.src="images/registration.gif";
var caseICON = new Image(57,57);
caseICON.src="images/submit.gif";
// END PRELOADING ICONS


function ShowAllIcons(Caller) {
  // The Calling Page identifies itself as: (consumer, about, contact...)
  // Hide Icon of Calling Page, show all others.
  var vOffset = 0;
  for(var i=0;i < ICONarray.length;i++) {
    if (Caller != ICONarray[i]) {
      // Show Icon for Page that isn't me, (shifting Icons below me UP by "vOffset")
      document.getElementById("ICON"+ICONarray[i]).style.marginTop = vOffset+"px";
      document.getElementById("ICON"+ICONarray[i]).style.visibility = 'visible';
      // Reset vOffset: use once, here... (as above)
      vOffset = 0;
    } else {
      // Clear HTML of this Icon <DIV> so others shift up...
      document.getElementById("ICON"+ICONarray[i]).innerHTML = "&nbsp;";
      // Shift Next Icon UP, (height of 'empty' <DIV>)
      vOffset = -20;
    }
  }
}

// Dispatcher for Flash Objects invoking "fscommand()", 'Callbacks' !
function MENUX_DoFSCommand(command, args) {
  if (command == "nav") {
    // This is one of the Navigation Buttons at top of all windows
    // Construct explicit URL that will withstand Domain Change, (moving someday!)
    // (Avoid using SSL server, (https), on 'normal' pages...)
    window.location.href = "http://" + document.domain + "/" + args + ".html";
  } else {
    // Flash Chessboard is calling to HIDE ITSELF...
    HideShowFlash();
  }
}

function GenericResize() {
  // Various Browsers disagree on how to calculate WIDTH. Calculate it ourselves...
  ResetContentWidth();

  // Show 'WrapContent', if it exists... (It starts out invisible for cleaner 'start')
  oTest = document.getElementById('WrapContent')
  if (oTest) oTest.style.visibility = "visible";
}

function ResetContentWidth() {
  // Set WIDTH of "WrapContent" DIV... (if it exists!  Cause no harm if it doesn't!!!)
  // Calculate WIDTH of the "viewable area" in Browser to the Right of the ICON BAR.
  // Some Browsers screw this up. We calculate it ourselves for cross-browser consistancy.

  if ( document.getElementById('WrapContent') ) {
    document.getElementById('WrapContent').style.width = (document.body.clientWidth-gICONBarWidth - 5)+"px";
  }
}


// ---------------------------------------------------------------------------
// Cookie Code -- create and read Cookies...
function createCookie(name,
value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  } else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}
// ---------------------------------------------------------------------------