var PictureBig = new Class({
	
	Extends:Picture,
	
	Implements: [Options, Events],
	options:{
		filename:null,
		width:null,
		height:null,
		parent:null
	},
	
	initialize:function(options) {
		this.setOptions(options);
		//debug('Picture:initialize');
		
		this.path = ROOT_URL+'upload/profils/images/bigs/';

		this.initContainer();
		
	},
	
	
	loadComplete:function() {
		this.fireEvent('loadComplete');
		this.target = this.target[0];
		
		this.target.inject(this.options.parent, 'top');
		this.target.erase('width');
		this.target.erase('height');
		
		window.addEvent('resize', this.resize.bind(this));
		this.resize();

		this.target.addEvents({
			'click': function(e) {
				this.fireEvent('click', e);
			}.bind(this)
		});
		this.is_open = false;

		this.initFx();
		
		this.open();
	},
	
	initFx:function() {
		this.fx = new Fx.Morph(this.target, {
			transition: Fx.Transitions.Quad.easeOut,
			link:'cancel',
			duration:300
		});
		
		this.fx_src = {
			'opacity':0,
			'margin-left':-60
		};
		
		this.fx_dest = {
			'opacity':1,
			'margin-left': 0
		};
		
		this.bound_open_complete = this.openComplete.bind(this);
		this.bound_close_complete = this.closeComplete.bind(this);
		
		this.fx.set(this.fx_src);
	},
	
	resize:function() {
		var max_height = window.getSize().y - 216;
		var max_width = 660;
		
		var height = max_width / this.ratio;
		var width = max_width;
		
		if(height > max_height) {
			height = max_height;
			width = height * this.ratio;
		}
		
		this.target.setStyles({
			width: width,
			height: height
		});
	}
			
});
