var EnDirectVar;

function setEmission(prevUid,nextUid) {
	//console.log(prevUid+' :: '+nextUid)
	if(prevUid>0) {
		EnDirectVar.getContent(prevUid);
	} else {
		EnDirectVar.clearContent();
	}
}

EnDirect = new Class({
	Implements: [Options,Events],
	
	options: {
		loadingDiv: 'emissionInfosLoad'
	},
	
	initialize: function(options) {
		this.setOptions(options);
		
		this.loadingDiv = this.options.loadingDiv;
		this.loadDivHeight = $(this.loadingDiv).getSize().y;
		$(this.loadingDiv).setStyle('height',this.loadDivHeight);
		
	},
	
	getContent: function(nextUid) {
		
		var myRequest = new Request({
			method: 'get',
			url: 'emissionInfos.inc.php',
			onSuccess: function(responseText) {
				$(this.loadingDiv).set('html',responseText);
				$(this.loadingDiv).get('tween', {property: 'height'}).start([this.loadDivHeight,($('emissionInfosLoadInner').getSize().y + 20)]);
			}.bind(this)
		},this).send('nextUid='+nextUid);
		
	},
	
	clearContent: function() {
		
		$(this.loadingDiv).set('html','');
		$(this.loadingDiv).get('tween', {property: 'height'}).start(0);
		
	}
	
});

window.addEvent('domready', function() {
	EnDirectVar = new EnDirect();
});
