var VisibleLayer = '';
function showLayer(id, stp, maxAlph) {
  if (!stp) {stp = 6; }
  if (!maxAlph) {maxAlph = 100; }
  VisibleLayer = id;
  ElementVis(VisibleLayer, true, stp, maxAlph);
}
function divV(val){
  if (val == 0) return '0'; else
  if (val == 100) return '1'; else
  if (val < 10) return '.0'+val; else
  return '.'+val;
}
function SetAlpha(obj,val) {
 if (obj) {
   var xVal = divV(val);
   if (obj.filters && obj.filters.alpha) obj.filters.alpha.opacity = val;
   obj.style.filter = 'alpha(opacity='+val+')';
   obj.style.opacity = xVal;
   obj.style["-moz-opacity"] = xVal;
 }
}
function ChangeAlpha(nm) {
 var obj = getObj(nm);
 if (obj && obj.alphaAdd) {
   obj.alpha += obj.alphaAdd;
   obj.steps --;
   if (obj.steps>0 && obj.style.visibility != 'hidden') {
     SetAlpha(obj,parseInt(obj.alpha));
     setTimeout("ChangeAlpha('"+nm+"')",50);
   } else {
     SetAlpha(obj,obj.maxA);
   }
 }
}
function ElementVis(nm, val, steps, maxalpha) { 
 var obj = getObj(nm);
 if (obj) {
  if (!steps || steps == 1) { 
   SetAlpha(obj,obj.maxA);
   if (!val) {obj.alphaAdd = 0;}
  }
  else { 
   if (!obj.style.opacity) obj.style.opacity = .75;
   obj.alpha = parseInt(obj.style.opacity*100);
   obj.steps = steps;
   obj.alphaAdd = (maxalpha-obj.alpha)/steps;
   obj.maxA = maxalpha;
   if (!val) {
     obj.alphaAdd = - obj.alphaAdd;
     SetAlpha(obj,100);
   }
    setTimeout("ChangeAlpha('"+nm+"')",10);
  }
 }
}
function fadeIn(nm) {
 ElementVis(nm, 100, 3, 100);
}
function fadeS(nm) {
 ElementVis(nm, 70, 3, 70);
}
function fadeOut(nm) {
 ElementVis(nm, 1, 5, 1);
}
function grayOut(nm) {
 ElementVis(nm, 30, 4, 30);
}

