<%template _albumheader%>

<%if page_err==0%>
	<%if ispost%>
		<%template _msgbox%>
	<%else%>
	<script type="text/javascript" src="javascript/ajax.js"></script>
	<script type="text/javascript" src="editor/post.js"></script>
	<script type="text/javascript">
	function shownavbar(albumid, curphotoid, b){
		var c="tools/ajax.aspx?t=album&albumid=" + albumid;
		var f="{jsonfilename}";
		_sendRequest(f,function(d){var e={};try{e=eval("("+d+")")}catch(f){e={};
		
		_sendRequest(c,function(d){var e={};try{e=eval("("+d+")")}catch(f){e={}}var h=e?e:null;b(h, curphotoid);e=null;b=null},false,true);
		return;
		
		}var h=e?e:null;b(h, curphotoid);e=null;b=null},false,false)
	}
	function bindPhotoNav(obj, curphotoid)
	{
		var items = obj.items;
		var length = items.length;
		var photoindex = 1;
		var photonav = $("photonav");
		if (items.length < 1)
		{
			photonav.innerHTML = "暂时无法显示导航条";
			return;
		}

		var html = "";
		html += "<table cellpadding='1'><tr>";
		for (var i in items)
		{
			var border = "";
			var size = 88;
			if (items[i].photoid == curphotoid)
			{
				photoindex = new Number(i) + 1;
				border = " class=\"activeimg\"";
				size = 76;
			}
			html += "<td><a href='showphoto.aspx?photoid=" + items[i].photoid + "'><div" + border + "><img title='" + items[i].title + "' alt='" + items[i].title + "' src='" + items[i].square + "' onerror=\"this.src='templates/{templatepath}/images/errorphoto.gif';\" width='" + size + "' height='" + size + "' border='0' /></div></a></td>";
		
		}
		html += "</tr></table>";
		photonav.innerHTML = html;

		//scrolling
		if (photoindex > 5)
		{
			$('photonav').scrollLeft = (photoindex-5) * 90;
		}
		
		//disable prevImg
		if (photoindex == 1)
		{
			$("prevImg").href = '###';
		}

		//disable nextImg
		if (photoindex == length)
		{
			$("nextImg").href = '###';
			$("nextImgOnPhoto").href = 'showphoto.aspx?photoid=' + items[0].photoid;
		}

		$("photoIndex").innerHTML = '<em>' + photoindex + '</em>/' + length;

	}

	function resizePhoto(img)
	{
		if (img.width > 685)
		{
			img.width = 685;
		}
	}
	</script>

	<%template _albumnavigation%>

	<div id="ntforumposition">
		<div class="ntforumnote">
			<h3><a href="{config.albumurl}" id="NavHome" onmouseover="showMenu(this.id);" onmouseout="showMenu(this.id);">{config.albumname}首页</a> > <a href="showalbumlist.aspx?cate={albumcategory.albumcateid}">{albumcategory.title}</a> > <a href="showalbum.aspx?albumid={album.albumid}">{album.title}</a> </h3>
		</div>
	    <div class="ntforumsearch">
			<div id="search">
				<%template _quicksearch%>
			</div>
		</div>
	</div>
	
	{navhomemenu}
	<div id="ntforumbody" style="overflow:visible;">
		<%if {!needpassword}%>
			<div class="modulebox">
					<div class="forumtitle">
						<h2>{photo.title}</h2>
						<em>
						<%if {config.silverlight}==1%>
						<a id="silverlightalbum" target="_blank" title="Silverlight相册展示" href="silverlight/album/index.html?albumid={album.albumid}">Silverlight酷炫体验</a>&nbsp;
						<%/if%>
						<a title="幻灯片播放" href="javascript:void(0);" onclick="window.open('{spaceurl}space/slidealbum.aspx?albumid={album.albumid}','','fullscreen=yes')">幻灯展示</a>&nbsp;<a href="showalbum.aspx?albumid={album.albumid}">+ 更多</a></em>
					</div>
					<div class="scrollphoto"><ul><li id="scrollleft" style='cursor: pointer;margin-top:8px;"' onclick="scrollHiddenDiv($('photonav'), -90);"><img src='templates/{templatepath}/images/scrollarrowleft.jpg' alt='向左移动' /></li><li style='width: 810px;'><div style='position:relative;'><div class='photonavbar' id="photonav" style='overflow: hidden;width:810px;'>加载导航图，请稍候...</div></div></li><li id="scrollright" style='cursor: pointer;margin-top:8px;"' onclick="scrollHiddenDiv($('photonav'), 90);"><img src="templates/{templatepath}/images/scrollarrowright.jpg" alt="向右移动" /></li></ul></div>

					<script type="text/javascript">shownavbar({photo.albumid}, {photo.photoid}, bindPhotoNav);</script>

					<div class="photoshowBox">
					<div class="boxbody">
						<div class="Photo" style="margin: 10px 20px;">
							<strong>
									<cite>
										<%if {config.enablespace}==1%><a href="{spaceurl}space/?uid={photo.userid}" target="_blank">{photo.username}的空间</a><%/if%>
									</cite>
									<cite>
										<a href="{albumurl}showalbumlist.aspx?uid={photo.userid}" target="_blank">{photo.username}的相册</a>
									</cite>
									<cite>大小:
											<script language="javascript" type="text/javascript">
												ShowFormatBytesStr({photo.filesize});
											</script>
									</cite>		
									<cite>上传时间: {photo.postdate}</cite>
									<cite>浏览量: {photo.views}</cite>
									<cite>评论数: {comments.count}</cite>
							</strong>
							<div class="PhotoPIc" style="width: 685px"><a id="nextImgOnPhoto" href="{albumurl}showphoto.aspx?photoid={photo.photoid}&go=next" alt="点击图片查看下一张" title="点击图片查看下一张"><img onload="resizePhoto(this);" alt="{photo.title}" title="{photo.title}" src="{photo.filename}" /></a></div>		
							<div class="PageBox">
								<div class="PageBoxLeft"><a id="prevImg" href="{albumurl}showphoto.aspx?photoid={photo.photoid}&go=prev">上一张</a><cite>第 <span id="photoIndex"><em>1</em>/1</span> 张</cite> <a id="nextImg" href="showphoto.aspx?photoid={photo.photoid}&go=next">下一张</a></div>
								<%if {userid}!=-1%>
									<div class="Pageboxright">
											<script type="text/javascript">
												enableinfo = '<img src="templates/{templatepath}/images/buttonreport.gif" alt="举报此图片" />';											;
												show_report_button("<img src=templates/{templatepath}/images/reportfinish.gif alt=已经举报此图片 />");
												enableinfo = '<span class="commenreport">举报<span>';
											</script>
									
									</div>
								<%/if%>
							</div>
							<strong>{photo.description}</strong>
							<%if {editable} || {comments.count}>0%>
							<p class="commentstitle"><a name="comments"></a>
								<%if {editable}%>
									<form id="commentform" name="commentform" method="post" action=""><input name="delcommentid" type="hidden" /></form>
									<script type="text/javascript">
									function del_comment(cid)
									{
										if (confirm('确定要删除吗?'))
										{
											var form = $("commentform");
											form.delcommentid.value = cid;
											form.submit();
										}
										return false;
									}
									</script>
								<%/if%>
								<%if {photo.comments}>0%>
								评论 ({photo.comments})
								<%/if%>
								</p>
							<%/if%>
						</div>
						<%set (int) {rowindex}=1%>
						<%loop (PhotoCommentInfo) comment comments%>
							<div class="<%if {rowindex}%2==0%>reviewbox2<%else%>reviewbox<%/if%>">
								<div class="reviewboxleft">{rowindex}.</div>
								<p>{comment.content}</p>
								<div class="reviewwriterbox">
									<div class="ReviewManager"><%if {comment.userid}!=-1%>
									<%set {aspxrewriteurl} = this.UserInfoAspxRewrite({comment.userid})%>
									<a href="{forumurl}{aspxrewriteurl}">{comment.username}</a>
									<%else%>{comment.username}<%/if%>      {comment.postdatetime}</div>
									<em>
										<%if {userid}!=-1%>
											<script type="text/javascript">
												show_report_button('<span class=reportfinish>已举报</span>');
											</script>
										<%/if%>
									<%if {editable}%>
										<a id="e{comment.commentid}" title="删除此评论" onclick="del_comment({comment.commentid});" href="###" class="commenddelete">删除</a></em>
									<%/if%>
									</em>
								</div>
							</div>
							<%set {rowindex}={rowindex}+1%>
						<%/loop%>
						<%if {commentable}%>
							<script type="text/javascript">
							function validate(form)
							{
								if (form.message.value == "")
								{
									alert("请输入评论内容");
									return false;
								}
								if(form.message.value.length > 2000) {
									alert("评论最多2000字");
									return false;
								}
							}
							</script>							
							<form method="post" id="postform" onsubmit="return validate(this);">
										<h3><a name="reply"></a>发表评论</h3>
										<p>
											<textarea id="message" tabindex="1" name="message" style="width: 400px;" onKeyDown="ctlent(event,false);" rows="8" class="colorblue"></textarea><br>
										</p>
										<p>						
											<input tabindex="2" id="postsubmit" name="post_comment" class="lightbutton" value="提交" type="submit">[完成后可按 Ctrl+Enter 发布]
										</p>	
							</form>
						<%else%>
						<div style="margin: 15px 0 15px 20px">
						<p>
						&nbsp;&nbsp;此图片禁止评论 或 登录用户才可评论
						</p>
						</div>
						<%/if%>
					</div>
					<div class="boxright">
						<h3>一周热图总排行</h3>
						<ul>
							<%loop (PhotoInfo) weekhotphoto weekhotphotolist%>
							    <%if {weekhotphoto.title}!="" %>
								<li><a href="{albumurl}showphoto.aspx?photoid={weekhotphoto.photoid}">{weekhotphoto.title}</a> (<a href="{albumurl}showalbumlist.aspx?uid={weekhotphoto.userid}">{weekhotphoto.username}</a>)</li>
								<%/if%>
							<%/loop%>
						</ul>
					</div>
			</div>
		<%else%>
			<div class="modulebox">
				<div class="forumtitle">
					<h2>此相册已被设置密码</h2>
				</div>
				<div class="forumpassword">
					<form id="enteralbum" name="enteralbum" method="post" action="">
							<label for="password">请输入密码:</label><input name="albumpassword" type="password" id="albumpassword" size="20" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" />
							<p><input type="submit"  value="确定" class="lightbutton"/></p>
					</form>
				</div>
			</div>
		<%/if%>
	</div>
	<%/if%>
<%else%>
	<%template _photoerrmsgbox%>
<%/if%>
</div>
<%template _websitefooter%>
