var nlsEffectList={
  barn:"progid:DXImageTransform.Microsoft.Barn(Duration=0.3,motion=out,orientation=vertical);",
  blinds:"progid:DXImageTransform.Microsoft.Blinds(Duration=0.3,Bands=8,direction=right);",
  checkerboard:"progid:DXImageTransform.Microsoft.Checkerboard(Duration=0.3,Direction=right,SquaresX=20,SquaresY=20);",
  fade:"progid:DXImageTransform.Microsoft.Fade(Duration=0.3,Overlap=1.00);",
  inset:"progid:DXImageTransform.Microsoft.Inset(Duration=0.3);",
  iris:"progid:DXImageTransform.Microsoft.Iris(Duration=0.3,irisstyle=CIRCLE,motion=in);",
  pixelate:"progid:DXImageTransform.Microsoft.Pixelate(Duration=0.3,MaxSquare=10);",
  radialwipe:"progid:DXImageTransform.Microsoft.RadialWipe(Duration=0.3,wipestyle=WEDGE)",
  randombars:"progid:DXImageTransform.Microsoft.RandomBars(Duration=0.3,Orientation=horizontal);",
  randomdissolve:"progid:DXImageTransform.Microsoft.RandomDissolve(duration=0.5);",
  slide:"progid:DXImageTransform.Microsoft.Slide(Duration=0.3,slidestyle=HIDE,Bands=5);",
  spiral:"progid:DXImageTransform.Microsoft.Spiral(Duration=0.3,GridSizeX=64,GridSizeY=64);",
  stretch:"progid:DXImageTransform.Microsoft.Stretch(Duration=0.3,stretchstyle=HIDE);",
  strips:"progid:DXImageTransform.Microsoft.Strips(Duration=0.3,motion=rightdown);",
  wheel:"progid:DXImageTransform.Microsoft.Wheel(Duration=0.3,spokes=10);",
  gradienwipe:"progid:DXImageTransform.Microsoft.GradientWipe(Duration=0.3,GradientSize=0.75,wipestyle=0,motion=forward);",
  zigzag:"progid:DXImageTransform.Microsoft.Zigzag(Duration=0.3,GridSizeX=8,GridSizeY=8);",
  itemfade:"progid:DXImageTransform.Microsoft.Fade(Duration=0.2,Overlap=0.75);",
  itemdissolve:"progid:DXImageTransform.Microsoft.RandomDissolve(duration=0.3);"
};

function NlsMenuEffect(mId, effName) {
  this.tmId=null;
  this.mId=mId;
  this.opa=0;
  this.elm=null;
  this.effName=effName;
  this.isOut=false;
  this.onShow=function() {};
  this.onHide=function() {};
}

NlsMenuEffect.prototype.init=function(isOut) {
  if (nls_isIE) {
    if (this.elm==null) this.elm=NlsGetElementById("effwin_"+this.mId); 
    this.elm.style.filter=nlsEffectList[this.effName];
    if (this.elm.filters.length>0) this.elm.filters[0].apply();
  } else {
    if (this.elm==null) this.elm=NlsGetElementById("effwin_"+this.mId).childNodes[0]; 
    this.isOut=(isOut==true);
    this.elm.style.MozOpacity=(isOut?99:0);
  }
}

NlsMenuEffect.prototype.start=function() {
  if (nls_isIE) {
    if (this.elm.filters.length>0) this.elm.filters[0].play();
  } else {
    var me=this;
    if (this.tmId!=null)clearInterval(this.tmId);
    if (this.isOut) {
      this.opa=99; this.tmId=setInterval(function () { effect_run_hide (me); }, 30);      
    } else {
      this.opa=0; this.tmId=setInterval(function () { effect_run_show (me); }, 30);
    }
  }
}

function effect_run_hide(eff) {
  eff.elm.style.MozOpacity=eff.opa/100;
  eff.opa-=10; if (eff.opa==-1) eff.opa=0;
  if (eff.opa==0) { clearInterval(eff.tmId); eff.tmId=null; eff.onHide();};
}

function effect_run_show(eff) {
  eff.elm.style.MozOpacity=eff.opa/100;
  eff.opa+=10; if (eff.opa==100) eff.opa=99;
  if (eff.opa>100) {clearInterval(eff.tmId); eff.tmId=null; eff.onShow();};
}


function NlsMenuItemEffect(itemId, effName) {
  this.tmId=null;
  this.itemId=itemId;
  this.elm=null;
  this.effName=effName;
}

NlsMenuItemEffect.prototype.init=function() {
  if(!nls_isIE) return;
  if (this.elm==null) this.elm=NlsGetElementById(this.itemId); 
  if (nlsEffectList[this.effName]) this.elm.style.filter=nlsEffectList[this.effName];
  if (this.elm.filters.length>0) this.elm.filters[0].apply();
}

NlsMenuItemEffect.prototype.start=function() {
  if(!nls_isIE) return;
  if (this.elm.filters.length>0) this.elm.filters[0].play();
}