Box = Class.create();
Object.extend(Box.prototype,{

	initialize: function(id,params){

		this.id = id;

		this.box = new Element('div', { 'class': 'float_box', 'id': this.id });
		this.set_position(400,600);

		this.has_html = false;
		if (params.header && params.body) this.set_html(params.header,params.body);

	},

	set_position: function( box_width, box_height ){

		var b_dims = document.viewport.getDimensions();
		var offsets = document.viewport.getScrollOffsets();

		this.box.style.position = "absolute";
		this.box.style.left = (b_dims.width/2 - box_width/2) + 'px';
		this.box.style.top = (offsets.top + (b_dims.height/2 - box_height/2)) + 'px';

	},

	set_html: function( header, body ){
		this.box.update("<div class='header'><div class='name'>" + header + "</div></div><div class='body' id='box_body''>" + body + "</div>");
		this.has_html = true;
	},

// 	get_folder_options: function (folder_id){
//
// 		new Ajax.Updater('new_parent_folder_id', 'folder_options.php',{
// 			method: 'get',
// 			parameters: {
// 				exclude_folder_id: folder_id
// 			}
// 		});
//
// 	},

	// public methods

	show_activity: function(){

		$('box_body').hide();
		$('box_body').insert({after: "<div class='activity' id='box_activity'><img src='../img/activity.gif' /><br/>One moment please...</div>"});

	},

	hide_activity: function(){

		$('box_body').show();
		$('box_activity').remove();

	},


	open: function(){

		if (this.has_html && !this.is_open){
			this.is_open = true;
			$('body').insert(this.box);
		}

	},

	close: function(){

		if (this.is_open){
			$( this.id ).remove();
		}

	}

});