////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	aquapopup-1.0.0.js
//
////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//	functions
////////////////////////////////////////////////////////////////////////////////////////////////////

function aquaFnClean () {

	$("table a span").hide ();
}

function aquaFnStore () {

	aquaVrWidth  = $("table img").width ();
	aquaVrHeight = $("table img").height ();

	$(window).resize (aquaFnStretch);
	$(window).trigger ("resize");
}

function aquaFnSmooth () {

	$("table .typoCaption").flashText ({

		source: "/swf/telegroteskult-1.0.2.swf",
		tagstyle: "text-align: center; font-weight: normal; font-size: 18px; color: #ffffff;",
		linkstyle: "text-align: center; font-weight: normal; font-size: 18px; color: #ffffff;",
		width: "100%",
		height: "20",
		left: "-3"

	}, {

		shadow: {

			distance: "1",
			angle: "30",
			color: "#000000",
			alpha: "0.4",
			blur: "3"
		}
	});
}

function aquaFnStretch () {

	var funcVrWidth  = Math.max (($(window).width () - 160), 120);
	var funcVrHeight = Math.max (($(window).height () - 286), 100);
	var funcVrRatio  = Math.max
	(
		(aquaVrWidth / funcVrWidth),
		(aquaVrHeight / funcVrHeight)
	);

	funcVrWidth  = Math.min (Math.round (aquaVrWidth / funcVrRatio), funcVrWidth);
	funcVrHeight = Math.min (Math.round (aquaVrHeight / funcVrRatio), funcVrHeight);

	if ((funcVrWidth > aquaVrWidth) ||
	    (funcVrHeight > aquaVrHeight)) {

		funcVrWidth  = aquaVrWidth;
		funcVrHeight = aquaVrHeight;
	}

	$("table img").css ("display", "block");
	$("table img").width (funcVrWidth);
	$("table img").height (funcVrHeight);
}

////////////////////////////////////////////////////////////////////////////////////////////////////
//	core
////////////////////////////////////////////////////////////////////////////////////////////////////

var aquaVrWidth;
var aquaVrHeight;

$(document).ready (function () {

	aquaFnClean ();
	aquaFnSmooth ();
});

////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	aquapopup-1.0.0.js
//
////////////////////////////////////////////////////////////////////////////////////////////////////
