Proto.UI._notifys=[],
Proto.UI._notify=Class.create({
    initialize: function() 
    {
    
    this.options = Object.extend({
            msg:'',
            type:''
            }, arguments[0] || { });
            
      this.notify_container = new Element('div',{'class':'flash-notice','style':'display:none;'});
      Element.insert(document.body,this.notify_container);
      this.notify_container.update(this.options.msg);
      var vd=document.viewport.getDimensions();
      var vs=document.viewport.getScrollOffsets();
      this.notify_container.setStyle({bottom:-200+"px",left:(vd.width/2-this.notify_container.getWidth()/2)+"px",display:''});
      
          if(this.options.type=='error')
            {
              this.notify_container.addClassName('notice_error');
            }
           if(this.options.type=='ok')
            {
              this.notify_container.addClassName('notice_ok');
            }
            
        
         
         Proto.UI._notifys.push(this.notify_container.identify());         
         var count=Proto.UI._notifys.length-1; 
                    
      new Effect.Tween(null, -200, 50*count+50,{ 
        duration: 1, 
        afterFinish: function()
        { 
          

                      
                      this.outbox.delay(3+1*count,this.notify_container.id);
            
        }.bind(this)}, function(p){ this.notify_container.style.bottom=p+"px"; }.bind(this));

      
     },
     outbox:function(i)
     {
     		new Effect.Tween(null, Number(_(i).style.bottom.replace("px","")), -200,{ 
                    duration: 1,
                    afterFinish: function(){_(i).remove();
                    Proto.UI._notifys=Proto.UI._notifys.without(i);
                    }.bind(this)
                    }, 
                    function(p){ 
                    	_(i).style.bottom=p+"px"; 
                    }.bind(this));
                    
      }
     
            
});
Proto.UI.notify=function(msg,params)
    {
		
		new Proto.UI._notify({msg:msg,type:((typeof params == "object")?params.type:"")});
      
    }