/*

	The copyrights of these scripts belong to LarsGrevelink.nl, if you wish to use any of them. Please notify the administrator of the website and ask for it's permission.

*/



curOp = 0;

curWd = 0;

isVisible = false;

isInvisible = true;

isOpen = false;

isClosed = true;

active = "";



function decide(page) {
	
	if(active != page || page.substr(0,7) == "archive") {
		
		if(curOp == 100)
	
			showOverlay(page);
	
		else {
	
			refreshContent(page);
	
		}
	
	}

}



function makeVisible() {

	if(isInvisible) {

		curOp = curOp + 10;	

		document.getElementById('content').style.opacity = (curOp / 100);

		document.getElementById('content').style.filter = "alpha(opacity=" + curOp + ")";

		if(curOp < 70) {

			document.getElementById('contentPane').style.opacity = (curOp / 100);

			document.getElementById('contentPane').style.filter = "alpha(opacity=" + curOp + ")";

		}

	

		if(curOp < 100) {

			setTimeout("makeVisible();",2);

		} else {

			isInvisible = false;

			isVisible = true;

		}

	}

}



function makeInvisible() {

	if(isVisible) {

		curOp = curOp - 10;



		document.getElementById('content').style.opacity = (curOp / 100);

		document.getElementById('content').style.filter = "alpha(opacity=" + curOp + ")";

		if(curOp < 65) {

			document.getElementById('contentPane').style.opacity = (curOp / 100);

			document.getElementById('contentPane').style.filter = "alpha(opacity=" + curOp + ")";

		}

	

		if(curOp > 0) {

			setTimeout("makeInvisible();",2);

		} else {

			isVisible = false;

			isInvisible = true;
			
			document.getElementById(active).style.display = 'none';
			document.getElementById(active + '_item').className = 'item_gamespace';
			
			active = "";

		}

	}

}



function showOverlay(page) {

	if(isClosed) {

		curWd = curWd + 24.1;

		if(curWd < 482) {

			document.getElementById('overlay').style.width = curWd + "px";

			setTimeout("showOverlay('" + page + "');",1);

		} else {

			curWd = 482;

			document.getElementById('overlay').style.width = curWd + "px";

			isOpen = true;

			isClosed = false;

			refreshContent(page);

		}

	}

}



function hideOverlay() {

	curWd = curWd - 24.1;

	if(curWd < 0)

		curWd = 0;

	document.getElementById('overlay').style.width = curWd + "px";

	if(curWd > 0) {

		setTimeout("hideOverlay();",1);

	} else {

		isOpen = false;

		isClosed = true;

	}

}



function createXMLHTTPsocket() {

	var xmlhttp=false;

	/*@cc_on @*/

	/*@if (@_jscript_version >= 5)

	try{

		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

	} catch (e) {

		try {

			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

		} catch (E) {

			xmlhttp = false;

		}

	}

	@end @*/

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

		xmlhttp = new XMLHttpRequest();

	}

	return xmlhttp;

}



function refreshContent(page) {

	if(page.substr(0,7) == "archive") {
		
		if(active != "" && active != "archive") {
			document.getElementById(active).style.display = 'none';
			document.getElementById(active + '_item').className = 'item_gamespace';
		}
			
		document.getElementById('archive').style.display = 'block';
		document.getElementById('archive_item').className = 'item_gamespace active_gamespace_gen';
		
		active = "archive";

		http.open('post','/_ajax/_archive.php');
	
		http.onreadystatechange = getContent;
	
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
		http.send('page='+page);

	} else {
		if(document.getElementById(page) != null) {
			
			if(active != "" && active != page) {
				document.getElementById(active).style.display = 'none';
				document.getElementById(active + '_item').className = 'item_gamespace';
			}
				
			document.getElementById(page).style.display = 'block';
			document.getElementById(page + '_item').className = 'item_gamespace active_gamespace_gen';
			
			active = page;
			
			setTimeout("hideOverlay();",250);
	
			setTimeout("makeVisible();",250);
			
		} else {
			refreshContent('archive');
		}
	}

}



function getContent() {

	if(http.readyState == 4) {

		var response = http.responseText;

		document.getElementById('archive').innerHTML = response;

		setTimeout("hideOverlay();",250);

		setTimeout("makeVisible();",250);

	}

}



var http = createXMLHTTPsocket();