$(".anim").livequery(function() {
  var anim=$(this)
  var aid=anim.attr("aid");
  anim.click(function()
  {
    var link=$(this).attr("link");
    if (link)
      window.open(link,'_blank');
  
  });
  var link=anim.attr("link");
  var changePhase = function()
  {
    var current=anim.find(".current");
    if (current.length>0)
    {
      var type=current.attr("anim_type");
      var next = current.next(".frame");
      if (type=="")
      {
        current.hide();      
      }
      if (type=="fade")
      {
        current.fadeOut(1000);
      }
      if (type=="move_vert")
      {
        current.hide("bounce");
      }
      if (type=="explode")
      {
        current.hide("explode");
      }
      if (type=="fold")
      {
        current.hide("fold");
      }
      if (type=="drop")
      {
        current.hide("drop");
      }
      current.removeClass("current");
      if (next.length==0)
        next=anim.find(".frame").eq(0);
    }
    else
    {
        next=anim.find(".frame").eq(0);
    }
    if (next.length>0)
    {
      current=next;
      var type=current.attr("anim_type");
      current.css("top",(anim.height()-current.height())/2)
      if (type=="")
      {
        current.hide();      
      }
      if (type=="fade")
      {
        current.fadeIn(1000);      
      }
      if (type=="move_vert")
      {
        current.show("slide",{ direction : 'top'},100);
      }
      if (type=="explode")
      {
        current.show("explode");
      }
      if (type=="fold")
      {
        current.show("fold");
      }
      if (type=="drop")
      {
        current.show("drop");
      }
      current.addClass("current");
      try
      {
        anim.animate( {'backgroundColor': current.attr("bgcolor")},1000);
      }
      catch(x)
      {
      }
    }
  };
  anim.everyTime("3s",changePhase);



});
