var XMLHTTP_SUCCEED_CODE = 200;
var XMLHTTP_READY = 4;
function createXmlhttp() {
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		//if not, try older IE versions for even dumber people
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function reloadPage() {
	reloadHref = window.location.href;
	window.location = reloadHref;
}
function loadPage (serverPage, contentDiv) {
	xmlhttp = createXmlhttp();
	obj = document.getElementById(contentDiv);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState == XMLHTTP_READY && xmlhttp.status == XMLHTTP_SUCCEED_CODE) {
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}
function openFotoDiv(divId, width, height) {
	var oGreyDiv = document.getElementById('grey');
	//gray overlay first
	//header height
	var scrolled  = GetScrollTop();
	oGreyDiv.style.position = 'absolute';
	oGreyDiv.style.left = '0px';
	oGreyDiv.style.top = '0px';
	oGreyDiv.style.visibility = 'visible';
	oGreyDiv.style.width = '100%';
	oGreyDiv.style.height = '100%';
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 
		calculateLeft = (Math.round(window.screen.availWidth/2) - (width/2));
		calculateTop = (Math.round(window.screen.availHeight/2)-(height/2))-125;
	} else {
		calculateLeft = (Math.round(window.innerWidth/2) - (width/2));
		calculateTop = (Math.round(window.innerHeight/2)-(height/2));
	}
	if (calculateTop < 0) {
		calculateTop = 0;
	}
	theDiv = document.getElementById(divId);
	theDiv.style.visibility = 'visible';
	//theDiv.style.height 	= height+'px';
	theDiv.style.height 	= '600px';
	//theDiv.style.width 		= width+'px';
	theDiv.style.width 		= '800px';
	//place the div
	theDiv.style.position = 'absolute';
	theDiv.style.top = Math.round((calculateTop+scrolled))+"px";
	theDiv.style.left = calculateLeft+"px";	
}
function GetScrollTop() {
  return window.pageYOffset||
    document.documentElement&&document.documentElement.scrollTop||
    document.body.scrollTop||0;
}
function hideFotoDiv(divId) {
	var oGreyDiv = document.getElementById('grey');
	var obigFoto = document.getElementById(divId);
	obigFoto.style.visibility = 'hidden';
	obigFoto.style.width = '0px';
	obigFoto.style.height = '0px';
	obigFoto.innerHTML = "";
	oGreyDiv.style.width = '0px';
	oGreyDiv.style.height = '0px';
	oGreyDiv.style.visibility = 'hidden';
}
