/**
 * Extension of "SexyLightBox" specific for project "velcro"
 *
 * @author Adrian Foeder <a.foeder@iveins.de>
 * @see  http://www.coders.me/web-html-js-css/javascript/sexy-lightbox-2
 */
var VelcroSplashBox = new Class({
	Extends:SexyLightBox,

	initialize: function(options) {
		this.parent(options);	// call parent function

		this.Wrapper.store('velcroSBobj', this);
	},

	/**
	 * Alternative function for display(); shows the box only if not already in this browser session.
	 */
	displayOncePerSession: function(url, title, force) {
		var cookieName = 'velcroSB_seenAlrdy';
		if(!Cookie.read(cookieName)) {
			Cookie.write(cookieName, 'true');
			return this.show(title, url, '', force);
		}
	}//,


	/**
	 * Setzt und positioniert die Splash-Box
	 ****************
	replaceBox: function(data) {

		if(0 == this.options.displayed) {
			this.parent(data);	// call parent function
			return;
		}


		var size   = window.getSize();
		var scroll = window.getScroll();
		var width  = this.options.BoxStyles['width'];
		var height = this.options.BoxStyles['height'];

		if (this.options.displayed == 0) {
			var x = 0;
			var y = 0;

			// vertically center
			y = scroll.x + ((size.x - width) / 2);

			if (this.options.emergefrom == "bottom") {
				x = (scroll.y + size.y + 80);
			}
			else { // top
				x = (scroll.y - height) - 80;
			}

			this.Wrapper.css({
				'display' : 'none',
				'top'     : x,
				'left'    : y
			});
			this.Contenedor.css({
				'width'   : width
			});
			this.Contenido.css({
				'height'  : height - 80
			});
		}

		data = $extend({
			'width'  : this.lightbox.width,
			'height' : this.lightbox.height,
			'resize' : 0
		}, data || {});

		if (this.MoveBox) this.MoveBox.cancel();

		this.MoveBox = new Fx.Morph(this.Wrapper, {
			duration   : 5,
			transition : this.options.moveEffect
		}).start({
			'left': (scroll.x + ((size.x - data.width) / 2)),
			'top' : (scroll.y + (size.y - (data.height + (this.navigator ? 80 : 48))) / 2)
		});


		if (data.resize) {
			if (this.ResizeBox2) this.ResizeBox2.cancel();
			this.ResizeBox2 = new Fx.Morph(this.Contenido, {
				duration   : this.options.resizeDuration,
				transition : this.options.resizeEffect
			}).start({ 'height': data.height });

			if (this.ResizeBox) this.ResizeBox.cancel();
			this.ResizeBox = new Fx.Morph(this.Contenedor, {
				duration   : this.options.resizeDuration,
				transition : this.options.resizeEffect
			}).start({ 'width': data.width });
		}
	}

	*******/
});