	var divLayer = '';
	var xOffSet = 0;
	var yOffSet = 0;
	
	window.onresize = function() {
		if (document.getElementById(divLayer)) {
			setContentPos(divLayer, xOffSet, yOffSet);
		}
	}

	function showLayer(inLayer,sourceUrl,flag) {
		divLayer = inLayer;
		theFlash = document.getElementById(divLayer);
		//alert(theFlash.style.display);
		if (theFlash.style.display == "none") {
			//so = new SWFObject(sourceUrl, divLayer, "700", "525", "7", "#F3F1E9");
			so = new SWFObject(sourceUrl+"?pageref="+flag, divLayer, "700", "525", "7", "#F3F1E9");			
			so.addParam("quality", "high");
			so.addParam("wmode", "transparent");
			so.addParam("menu", "false");
			so.addParam("allowScriptAccess", "always");
			so.addVariable("pageref",flag);
			so.write(divLayer);
			theFlash.style.display = "inline";
			setContentPos(divLayer, xOffSet, yOffSet);
		} else {
			theFlash.style.display = "none";
			if (so) {
				document.getElementById("rex").togglePlayback();
			}
		}
		//alert(theFlash.style.display);
	}

	function getWindowHeight() {
		var windowHeight = 0;
		if (typeof(window.innerHeight) == 'number') {
			windowHeight = window.innerHeight;
		}
		else {
			if (document.documentElement && document.documentElement.clientHeight) {
				windowHeight = document.documentElement.clientHeight;
			}
			else {
				if (document.body && document.body.clientHeight) {
					windowHeight = document.body.clientHeight;
				}
			}
		}
		return windowHeight;
	}

	function getWindowWidth() {
		var windowWidth = 0;
		if (typeof(window.innerWidth) == 'number') {
			windowWidth = window.innerWidth;
		}
		else {
			if (document.documentElement && document.documentElement.clientWidth) {
				windowWidth = document.documentElement.clientWidth;
			}
			else {
				if (document.body && document.body.clientWidth) {
					windowWidth = document.body.clientWidth;
				}
			}
		}
		return windowWidth;
	}
		
	function setContentPos(inLayer, xos, yos) {
		if (document.getElementById) {
			var contentElement = document.getElementById(inLayer);
			var windowHeight = getWindowHeight();
			var windowWidth = getWindowWidth();
			if (windowWidth > 0) {
				var contentWidth = contentElement.offsetWidth;
				if (windowWidth - contentWidth > 0) {
					contentElement.style.position = 'absolute';
					contentElement.style.left = ((windowWidth / 2) - (contentWidth / 2)) + xos + 'px';
				}
				else {
					contentElement.style.position = 'static';
				}
			}
			if (windowHeight > 0) {
				var contentHeight = contentElement.offsetHeight;
				if (windowHeight - contentHeight > 0) {
					contentElement.style.position = 'absolute';
					contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + yos + 'px';
				}
				else {
					contentElement.style.position = 'static';
				}
			}
		}
	}

	function show_hide(what,id){
		if(what == 'show'){
			document.getElementById(id).style.display='block';
		} else {
			document.getElementById(id).style.display='none';
		}
	}
