﻿// basic setup

function setPosition() {
	var w = window.innerWidth;
	var h = window.innerHeight;
	
	if(document.all) {
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	}
	
	$('#mainContainer').css('top', Math.round((h-580)/2)+'px');
}

$(document).ready(function() {
	setPosition();

	var mainContentNode = $("#mainContent");
	if(mainContentNode.length == 0) return;

	// activate overlay images
	var frame = document.createElement('img');
	frame.src = 'images/frame_710x457.png';
	frame.setAttribute("class", "frame710x457");

	var overlayImgs = $(".overlayImage");
	if(overlayImgs.length) {
		var parent = null;
		var nt = 0;
		$(".overlayImage")
			.each(function() {
				/*
				var thisParent = this.parentNode;
				if(thisParent != parent) {
					var first = $(overlayImgs.get(0));
					if(first.attr('keeppos') == 'true') nt = 0;
					else nt = -overlayImgs.get(0).offsetTop+123;
				
					parent = thisParent;
				}
				*/
				
				var jthis = $(this);
				if(jthis.attr('keeppos') != 'true') this.style.top='123px';
				// var h = parseInt(jthis.height());
				// nt -= h;
				if(jthis.attr('visible') != 'true') jthis.css('visibility','hidden');
				// add the frame
				jthis.append(frame.cloneNode(true));
			});
	}

});

$(window).bind("resize", setPosition);