//
// Copyright(c) 2005 Gammakurve Corporation. All rights reserved.
//
// All Rights Reserved.
// Permission to use is granted provided:
// 1. This copyright remain unaltered.
// 2. You link to my webpage at http://www.gammakurve.com
// 3. You pass any improvements and bug fixes back to me.
// 4. Web site development only. Not to be included in any other software 
//    without prior permission.
// Louay Gammo

function fadein(id) {
  var steps = eval('document.f.steps').value;
  var duration = eval('document.f.duration').value;
  var minOpacity = eval('document.f.minOpacity').value;
  var maxOpacity = eval('document.f.maxOpacity').value;
  var debug = eval('document.f.debug').checked;

  showMessage('');
  if (debug) {
    showMessage(minOpacity+' ');
    showMessage(maxOpacity, true);
  }

  var Darth = new Fader().init(id, steps, 0.0, maxOpacity, duration);
  if (debug) {
    Darth.toggleDebug();
  }

  Darth.fadeIn();
}
function fadeout(id) {
  var steps = eval('document.f.steps').value;
  var duration = eval('document.f.duration').value;
  var minOpacity = eval('document.f.minOpacity').value;
  var maxOpacity = eval('document.f.maxOpacity').value;
  var debug = eval('document.f.debug').checked;

  showMessage('');
  if (debug) {
    showMessage(minOpacity+' ');
    showMessage(maxOpacity, true);
  }

  var Darth = new Fader().init(id, steps, minOpacity, maxOpacity, duration);
  if (debug) {
    Darth.toggleDebug();
  }

  Darth.fadeOut();
}

function showMessage(msg, append)
{
  var elt = document.getElementById('message');
  if (elt == null) {
      return
  }

  if (typeof(append) == 'undefined') {
      append = false;
  }

  if (append) {
    elt.value = elt.value + msg;
  } else {
    elt.value = msg;
  }
}
