
function closeBlue()
{
	Element.hide('rounded_blue');
}

var Template = Class.create();
Template.prototype = {
	initialize: function (class_name, show_container, update_container, url)
	{
		this.url = url;
		this.show_container = show_container; // container to show after update		
		this.update_container = update_container; //container to update with ajax		
		this.class_name = class_name; //classname of buttons to put actions on		
		var clickAction = this.clickFunction.bindAsEventListener(this);		
		var buttons = $$(this.class_name);		
		for(var i=0; i < buttons.length; i++)
		{
			Event.observe(buttons[i], 'click', clickAction);
		}
	},
	
	clickFunction: function (event)
	{
		var target = Event.element(event).parentNode;
		if (target.tagName == "A")
		{
			Event.stop(event);
			this.target_id = target.id.substring(1);
			var url = this.url + this.target_id;
			new Ajax.Request( url,
				{
					method: 'get',
					evalScripts: true,
					onSuccess: this.handleResponse.bindAsEventListener(this)
				});
		}
		this.initScrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
		this.initScrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
		
	},
	
	handleResponse: function(resp)
	{
		Element.update(this.update_container, resp.responseText);
		this.showBox();
	},
	
	showBox: function()
	{
		Position.prepare();
		Element.setStyle(this.show_container, {top: (this.initScrollY+20)+'px', left: 0});
		Element.show(this.show_container);
	}
};