window.addEventListener("load", function() { setTimeout(loaded, 100) }, false);
	
function loaded() {
	document.getElementById("page_wrapper").style.visibility = "visible";
	//window.scrollTo(0, 1); // pan to the bottom, hides the location bar
}

currentPhoto = 0;

function showNextPhoto(max) {
	if(currentPhoto<(max-1)) {
		document.getElementById('photo_'+currentPhoto).style['-webkit-transform'] = 'translate(-100%)';
		currentPhoto++;
		document.getElementById('photo_'+currentPhoto).style.visibility='visible';
		document.getElementById('photo_'+currentPhoto).style['-webkit-transform'] = 'translate(0px)';
	}
	document.getElementById('left').style.visibility='visible';
	if(currentPhoto==(max-1)) {
		document.getElementById('right').style.visibility='hidden';
	}
}

function showPreviousPhoto(max) {
	if(currentPhoto>0) {
		document.getElementById('photo_'+currentPhoto).style['-webkit-transform'] = 'translate(100%)';
		currentPhoto--;
		document.getElementById('photo_'+currentPhoto).style['-webkit-transform'] = 'translate(0px)';
	}
	document.getElementById('right').style.visibility='visible';
	if(currentPhoto==0) {
		document.getElementById('left').style.visibility='hidden';
	}
}

function showProject(id) {
	window.location.href='/project/'+id+".html";
}

function showPhotos(device,id,div) {
	makeAjaxRequest('/p_photos.php','device='+device+'&project_id='+id,'',div);
}

function setTitle(title) {
	if (document.getElementById) {
			document.getElementById("projectTitle").innerHTML = title;
	} else if (document.all) {
		document.all["projectTitle"].innerHTML = title;
	}
}
