
	/*
  		Class: recentcomments
                   Purpose: ...
                   Developer: Kyle Campbell - kc@slajax.com
                   Date: 10/12/2007
        */

	var recentcomments = new Class({
		Implements:Options,
			options:{
			},
			initialize:function(){
				$$('div#recentComments div.albumBucketLinked').each(function(el){
					el.addEvent('click',this.showComments.pass([el],this));
				}.bind(this));
			},
			showComments:function(el){
				el.getChildren().each(function(obj){
					if(obj.hasClass("recent-comments-wrapper")) this.makeCommentWindow(el,obj.innerHTML);
				}.bind(this));
			},
			makeCommentWindow:function(el,str){
				this.preview = new Element('div',{
					'styles':{'position':'absolute','border':'1px solid #ccc','overflow':'auto',
                           			 'background-color':'#fff','z-index':'1000','left':'15px','top':'15px','display':'block','opacity':0 //keep opacity 0 if using animation
		                            },
					'id':'recent-comments-preview'
					}).inject(el.getParent());				

				this.preview.innerHTML=str;

				this.close = new Element('div',{
                                        'styles':{'display':'block','float':'right','height':'125px','width':'85px','z-index':'999','border-bottom':'2px solid #ccc','margin-top':'10px'}
                                        }).injectTop(this.preview);

					new Element('img',{
					'styles':{'cursor':'pointer'},
					'events':{ 
						'click':function(){
							 new Fx.Style(this.preview,'opacity',{duration: 750,onComplete:function(){ this.preview.remove(); }.bind(this)}).start(.9,0);
						}.bind(this)
					},
					'src':'/ajax/assets/img/fotoglif/commented_close.gif'
					}).injectInside(this.close);
	
				new Fx.Scroll(el.getParent(),{	duration: 750	}).toTop();
				new Fx.Style(this.preview,'opacity',{ duration: 500 }).start(0,.9);
			}
	});

	window.addEvent('load',function(){ new recentcomments(); });


