function toggleLoader() {
	if (document.getElementById('loadingBar').style.display == '') {
		document.getElementById('loadingBar').style.display = 'none';
	} else {
		document.getElementById('loadingBar').style.display = '';
	}
}

function loadNewHouse() {
	toggleLoader();
	fade('houesTab');
	setTimeout("getFileToObject('getRandomHustype.php', 'houesTab');", 600);
}

function doLoadHouse() {
	fade('houesTab');
	toggleLoader();
	setTimeout('loadNewHouse();', 10000);
}

function toggle(id) {
	if (document.getElementById(id).style.display == '') {
		document.getElementById(id).style.display = 'none';
	} else {
		document.getElementById(id).style.display = '';
	}
}

function showPopup() {
	show('infoWrapper');
	show('infoBox');
	document.getElementById("infoBox").style.left = Math.max(0,(document.body.clientWidth - 400)/2) + "px";
	document.getElementById('infoWrapper').onclick = closeInfo;

	if (navigator.appName == "Microsoft Internet Explorer"){var position = document.body.scrollTop;}
	else {var position = window.pageYOffset;}

	document.getElementById("infoWrapper").style.height = getDocHeight() + "px";
	document.getElementById("infoBox").style.top = Math.max(0,(document.body.clientHeight - 400)/2) + position + "px";
}

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function closeInfo() {
	hide('infoWrapper');
	hide('infoBox');
}
function show(id) {
	document.getElementById(id).style.display = '';
}
function hide(id) {
	document.getElementById(id).style.display = 'none';
}


