function hidelayer(lay) {
	document.getElementById([lay]).style.display = "none";
}
function showlayer(lay) {
	document.getElementById([lay]).style.display = "inline";
}
function showpicture(picture, apmax) {
	document.getElementById("bigpic").innerHTML = '<img src="photos/gallery/'+ap[picture]+'thumb.jpg" alt="" width="400" height="230" border="0" style="background:#CCCCCC;"><br>';

	if(picture+1 > apmax) moveline(picture-2, picture, apmax);
	else if(picture+2 > apmax) moveline(picture-1, picture, apmax);
	else moveline(picture, picture, apmax);
}
function moveline(pictureorder, activeorder, apmax) {
	newpictureorder = pictureorder;
	if(activeorder != newpictureorder) newactiveorder = activeorder;
	else newactiveorder = newpictureorder;

	if((newpictureorder-1) > 0) document.getElementById("spleft").innerHTML = '<img src="images/upbutactive.gif" alt="" width="100" height="46" border="0" style="cursor:pointer;" onclick="moveline('+(newpictureorder-1)+', '+newactiveorder+', '+apmax+')">';
	else document.getElementById("spleft").innerHTML = '<img src="images/upbutdisabled.gif" alt="" width="100" height="46" border="0">';

	if(newpictureorder-1 > 0) document.getElementById("sp1a").innerHTML = '<a href="photos.php?photoid='+ap[newpictureorder-1]+'"><img src="photos/gallery/'+ap[newpictureorder-1]+'thumb.jpg" alt="" width="100" height="75" border="0" id="pic1a"></a>';
	else document.getElementById("sp1a").innerHTML = '<img src="images/spacer.gif" alt="" width="100" height="75" border="0" id="pic1a">';

	if((newpictureorder <= apmax) && (newpictureorder > 0)) document.getElementById("sp2a").innerHTML = '<a href="photos.php?photoid='+ap[(newpictureorder)]+'"><img src="photos/gallery/'+ap[(newpictureorder)]+'thumb.jpg" alt="" width="100" height="75" border="0" id="pic2a"></a>';
	else document.getElementById("sp2a").innerHTML = '<img src="images/spacer.gif" alt="" width="100" height="75" border="0" id="pic2a">';

	if(((newpictureorder+1) <= apmax) && ((newpictureorder+1) > 0)) document.getElementById("sp3a").innerHTML = '<a href="photos.php?photoid='+ap[(newpictureorder+1)]+'"><img src="photos/gallery/'+ap[(newpictureorder+1)]+'thumb.jpg" alt="" width="100" height="75" border="0" id="pic3a"></a>';
	else document.getElementById("sp3a").innerHTML = '<img src="images/spacer.gif" alt="" width="100" height="75" border="0" id="pic3a">';

	if((newpictureorder+1) <= apmax) document.getElementById("spright").innerHTML = '<img src="images/downbutactive.gif" alt="" width="100" height="46" border="0" style="cursor:pointer;" onclick="moveline('+(newpictureorder+1)+', '+newactiveorder+', '+apmax+')">';
	else document.getElementById("spright").innerHTML = '<img src="images/downbutdisabled.gif" alt="" width="100" height="46" border="0">';
	
	if(activeorder == newpictureorder+1) {
		document.getElementById("pic1a").style.border = "#333333 2px solid";
		document.getElementById("pic2a").style.border = "#333333 2px solid";
		document.getElementById("pic3a").style.border = "#FE0000 2px solid";
	} else if(activeorder == newpictureorder) {
		document.getElementById("pic1a").style.border = "#333333 2px solid";
		document.getElementById("pic2a").style.border = "#FE0000 2px solid";
		document.getElementById("pic3a").style.border = "#333333 2px solid";
	} else if(activeorder == newpictureorder-1) {
		document.getElementById("pic1a").style.border = "#FE0000 2px solid";
		document.getElementById("pic2a").style.border = "#333333 2px solid";
		document.getElementById("pic3a").style.border = "#333333 2px solid";
	} else {
		document.getElementById("pic1a").style.border = "#333333 2px solid";
		document.getElementById("pic2a").style.border = "#333333 2px solid";
		document.getElementById("pic3a").style.border = "#333333 2px solid";
	}
}

