Page = Class.create();
Page.instance = null;
Page.getInstance = function()
{
	return Page.instance;
}

Page.require = function(libraryName, absolute)
{
	if(absolute===true)
	{
		document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
	}
	else
	{
		$A(document.getElementsByTagName("script")).findAll( function(s) {
		  return (s.src && s.src.match(/page\.js(\?.*)?$/))
		}).each( function(s)
		{
			var path = s.src.replace(/page\.js(\?.*)?$/,'');

			document.write('<script type="text/javascript" src="'+path+libraryName+'"><\/script>');
		});
	}
};

Page.prototype = {

	action: null,

	initialize: function(action, options)
	{
		Page.instance = this;
		this.action = action;
		this.setOptions(options);
		window.onload = this.onload.bind(this);
		//Event.observe(document, 'dom:loaded', this.onload.bind(this));
	},

	setOptions: function(options)
	{
		this.options = Object.extend({
			urlBase: null
		}, options || { });
	},
	
	onload: function(){}
}
