function Window(id, opts) { 
    this.id = id;
	if (! document.getElementById(id)) {
		$('#left').append("<div id='"+id+"'></div>");
	}
    this.window = $('#'+id);
	this.window.draggable({handle: '.title', containment: '#left'});
	this.window.resizable();
	
	if (opts != undefined) {
		if (opts.height != undefined) { this.window.css('height', opts.height); }
		if (opts.width != undefined) { this.window.css('width', opts.width); }
		if (opts.left != undefined) { this.window.css('position', 'absolute'); this.window.css('left', opts.left); }
		if (opts.top != undefined) { this.window.css('position', 'absolute'); this.window.css('top', opts.top); }
	}
	
	/* INITIALISATION DU CONTENU DE LA FENETRE */
	var html = '';
	
	this.window.addClass('window');
	html += "<div class='title'></div>";
	html += "<div class='content'></div>";
	this.window.html(html);
	
	/* METHODES */
	this.title = function(data) {
		if (data == undefined) {
			return $('.title', this.window).html();
		} else {
			$('.title', this.window).html(data);
			$('.title', this.window).append("<a class='close' onclick=\"$('#" + this.id + "').remove()\">X</a>");
		}
	}
	this.content = function(data) {
		if (data == undefined) {
			return $('.content', this.window).html();
		} else {
			$('.content', this.window).html(data);
		}
	}
}
