<?

if ($_GET['uid']) {

	$shareInfo = $share->getInfo($sys['uid'], $sys['path'], "");

	$sys['fullPath'] = $shareInfo['path'];
	
} else {

$path = gluePath("/",$sys['path']);
$sys['fullPath'] = gluePath($permissions['path'],$path);

}


$d = dir($sys['fullPath']);
while ($file = @$d->read()) {
	if (
$file != "." && 
$file != ".." && 
!in_array($file, $ignoreFiles) && 
!is_dir(gluePath($sys['fullPath'], $file)) && $img->isImage($file)) {
	$objects[] = $file;
	}
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title><?$lang->display("Slideshow");?></title>
	<link rel="stylesheet" type="text/css" rev="stylesheet" href="css/includer.php?files=common.css">
	<script src="js/compiled/misc.js" type="text/javascript" language="JavaScript1.2"></script>
	<script language="JavaScript1.2" type="text/javascript">
	
	function getSelIndex() {
	for (var i = 0 ; i < document.controls.objects.length; i++) {
		if (document.controls.objects[i].selected == true) {
			return i;
		}
	}
	}
	
	function selNextObject() {
		currentSelIndex = getSelIndex();
		if (currentSelIndex < document.controls.objects.length-1) {
		document.getElementById('loading').style.visibility='visible';
		document.controls.objects.selectedIndex = currentSelIndex+1;
		parent.document.getElementById("displayFrame").src='?slideshow=1&frame=display&uid=<?echo $str->safeJS($str->forURL($sys['uid']));?>&path=<?echo $str->safeJS($str->forURL($sys['path']));?>&object='+document.controls.objects.options[currentSelIndex+1].value;
		}
		hideButtons();
	}
	
	function selPrevObject() {
		currentSelIndex = getSelIndex();
		if (currentSelIndex > 0) {
		document.getElementById('loading').style.visibility='visible';
		document.controls.objects.selectedIndex = currentSelIndex-1;
		parent.document.getElementById("displayFrame").src='?slideshow=1&frame=display&uid=<?echo $str->safeJS($str->forURL($sys['uid']));?>&path=<?echo $str->safeJS($str->forURL($sys['path']));?>&object='+document.controls.objects.options[currentSelIndex-1].value;
		}
		hideButtons();
	}
	
	function onChange(selectValue) {
	currentSelIndex = getSelIndex();
	document.getElementById('loading').style.visibility='visible';
	parent.document.getElementById("displayFrame").src='?slideshow=1&frame=display&uid=<?echo $str->safeJS($str->forURL($sys['uid']));?>&path=<?echo $str->safeJS($str->forURL($sys['path']));?>&object='+selectValue;
	hideButtons();
	}
	
	function hideButtons() {
	currentSelIndex = getSelIndex();
	
	if (currentSelIndex == document.controls.objects.length-1) {
	document.getElementById('nextButton').style.visibility='hidden';
	} else {
	document.getElementById('nextButton').style.visibility='visible';
	}
	if (currentSelIndex == 0) {
	document.getElementById('previousButton').style.visibility='hidden';
	} else {
	document.getElementById('previousButton').style.visibility='visible';
	}
	}
	</script>
	<style>
	#titleBar {
	font-weight:bold;
	color:#595959;
	width:500px;
	overflow:hidden;
	white-space:nowrap;
	}
	</style>
</head>
<body bottommargin="0" marginheight="0" leftmargin="0" marginwidth="0" rightmargin="0" topmargin="0">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
	<td comment="title bar">
<div style="position:relative">

<table border="0" cellpadding="0" cellspacing="0" height="21" width="100%">
<tr>
	<td width="9" height="21"><img src="images/interface/titlebar-left.gif" width="9" height="21" border="0" alt=""></td>
	<td align="center" style="background-image:url('images/interface/titlebar-bg.gif');padding-top:2px;">
		<div id="titleBar" nowrap><?$lang->display("Image Slideshow");?></div>
	</td>
	<td width="13" height="21"><img src="images/interface/titlebar-right.gif" width="13" height="21" border="0" alt=""></td>
</tr>
</table>

<a href="#" onclick="parent.close();" style="position:absolute;top:8;right:14" onFocus="blur()" title="<?$lang->display("Close slideshow");?>"><img src="images/interface/titlebar-close.gif" width="10" height="11" border="0" alt="<?$lang->display("Close slideshow");?>"></a>

</div>
	</td>
</tr>
<tr>
	<td>
<table border="0" cellspacing="0" cellpadding="0" align="center" style="width:100%;" height="30">
<tr>
	<td width="9" background="images/interface/gradient-left.gif"><img src="images/interface/pixel.gif" width="9" height="18" border="0" alt=""></td>
	<td width="9" background="images/interface/gradient-bg.gif"><img src="images/interface/menu-dots.gif" width="9" height="14" border="0" alt=""></td>
	<td style="padding-left:4px;white-space:nowrap;padding-top:2px;" background="images/interface/gradient-bg.gif">

<form name="controls">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
	<td align="center">
<span id="previousButton" style="visibility:hidden">
<a href="javascript:selPrevObject()"><?$lang->display("Previous");?></a>
</span>
<select name="objects" onchange="javascript:onChange(this.value)">
<?
for ($i = 0 ; $i < sizeof($objects) ; $i++) {
?>
<option value="<?echo $str->forURL($objects[$i]);?>" <?
if ($objects[$i]==$_GET['object']) {
	echo "selected";
}?>><?echo $objects[$i];?></option>
<?
}
?>
</select>
<span id="nextButton">
<a href="javascript:selNextObject()"><?$lang->display("Next");?></a>
</span>
<span id="loading" style="margin-left:20px;visibility:hidden"><?$lang->display("loading...");?></span>
	
	</td>
</tr>
</table>
</form>


	</td>
	<td width="9" background="images/interface/gradient-right.gif"><img src="images/interface/pixel.gif" width="9" height="18" border="0" alt=""></td>
</tr>
<tr>
<td background="images/interface/gradient-bg.gif" style="background-repeat:repeat-x;height:40px;" colspan="4">
&nbsp;
</td>
</tr>
</table>



		</td>
</tr>
</table>




</body>
</html>
