if( typeof(px) == 'undefined' )
{
	px = {};
}
px.send2friend = Class.create();
px.send2friend.prototype =
{
	initialize: function(element)
	{
		this.element = $(element);

		this.reset();

		if ( this.getWindowHeight() > (this.element.offsetTop + this.element.clientHeight) )
		{
			this.setAbsolute();
		}
		else
		{
			this.setStatic();
		}
	},

	setAbsolute: function()
	{
		this.element.setStyle(
			{
				position: 'absolute',
//				top: (this.getWindowHeight() - this.element.clientHeight) + 'px',
				bottom: '0px',
				visibility: 'visible'
			}
		);
	},

	setStatic: function()
	{
			this.element.setStyle(
				{
					position: 'static',
					visibility: 'visible'
				}
			);
	},

	reset: function()
	{
		this.element.setStyle(
			{
				position: 'static',
				display: 'block',
				visibility: 'hidden'
			}
		);
	},

	getWindowHeight: function()
	{
		return (self.innerHeight ||  document.documentElement.clientHeight || document.body.clientHeight || 0);
	},

	getDocumentHeight: function()
	{
		return Math.max(document.body.scrollHeight, this.getWindowHeight());
	}
}

Event.observe(window, 'resize', function() { new px.send2friend('footer'); } );
Event.observe(window, 'load', function() { new px.send2friend('footer'); } );
Event.observe(window, 'load', function(event) {
	px_send2friend = new Control.Modal('send2friend-form', {
		opacity: 0.8,
		width: 471,
		fade: true,
		fadeDuration: 0.5,
		overlayCloseOnClick: true,
		containerClassName: 'send2friend-modal-container',
		overlayClassName: 'send2friend-modal-overlay'
	});
});

function hallo(element, url)
{
	var ajax = new Ajax.Updater(element, url);
}
