// Psyberation.js

function initialize() {

	initializeInfoScreen()

}

function initializeInfoScreen() {
	var browserWindow = window.screen;
	theInfoScreen = document.getElementById('InfoScreen');
	theWidth =  browserWindow.availWidth;
	theHeight = browserWindow.availHeight;
	
	infoScreen_StartX = theWidth/2;
	if(infoScreen_StartX + 500 > theWidth){
		infoScreen_StartX = theWidth - 505;
	}
	
	infoScreen_StartY = theHeight/2 - 50;
	
	theInfoScreen.style.left = infoScreen_StartX + "px";
	theInfoScreen.style.top = infoScreen_StartY + "px";
}

function infoWindow()  {

	var theInfoScreen = document.getElementById('InfoScreen');
	screenStatus = window.getComputedStyle(theInfoScreen, null).visibility;
	
	initialHeight = window.getComputedStyle(theInfoScreen, null).height;
	initialY = window.getComputedStyle(theInfoScreen, null).top;
	newHeight = parseInt(initialHeight);
	newY = parseInt(initialY);	
	
	if(screenStatus == 'visible') {
		var theIntervalId = setInterval(closeWindow, 1);
	}
	else {
		theInfoScreen.style.visibility='visible';
		var theIntervalId = setInterval(openWindow, 1);
	}
	
	function openWindow() {
		newHeight+=10;
		newY-=5;
		theInfoScreen.style.height = newHeight + "px";
		theInfoScreen.style.top = newY + "px";
		if(newHeight > 600) clearInterval(theIntervalId);
	}
	
	function closeWindow() {
		newHeight-=12;
		newY+=6;
		theInfoScreen.style.height = newHeight + "px";
		theInfoScreen.style.top = newY + "px";
		if(newHeight <=2){
			clearInterval(theIntervalId);
			theIntervalId = setInterval(openWindow, 1);
		}
	}
}

function openScreen(sourceid) {

	infoWindow();

	var screenForm = document.getElementById('mainMenuForm');
	var theTextSource = document.getElementById('TextSource_Id');
	theTextSource.value = sourceid;
	screenForm.submit();
}
	
	


	





