<!--#INCLUDE FILE="conn.asp" -->
<!--#INCLUDE FILE="Class_Checkuser.asp" -->
<!--#INCLUDE FILE="Class_Top.asp" -->
<%Call pagehead()
dim rs,sql,pi,classid,picid,photourl,upuser
%>
<script language="JavaScript">
nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){  //do this so I can take a string too
        setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
    clearTimeout(nereidFadeTimers[object.sourceIndex]);
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;
    if (object.filters.alpha.opacity != destOp){
        nereidFadeObjects[object.sourceIndex]=object;
        nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}
function ShowPic(classid,id) {

  var winClose = 0;
  if (window.viewimage != null && ! viewimage.closed)
  {
    viewimage.close();
    winClose = 1;
  }

  if (window.viewimage == null || viewimage.closed || winClose)
  {
	url="Class_Album.asp?CLassID="+classid+"&Action=ShowPhoto&PhotoID="+id;
    var w_opt="width=800,height=600,resizable=0,scrollbars=1,menubar=0,toolbar=1,status=1";
    viewimage=window.open(url,"Preview",w_opt);

    if (window.viewimage != null)
      viewimage.focus();
  }

}

function ShowsharePic(id) {

  var winClose = 0;
  if (window.viewimage != null && ! viewimage.closed)
  {
    viewimage.close();
    winClose = 1;
  }

  if (window.viewimage == null || viewimage.closed || winClose)
  {
	url="Class_SharePhoto.asp?Action=ShowPhoto&PhotoID="+id;
    var w_opt="width=800,height=600,resizable=0,scrollbars=1,menubar=0,toolbar=1,status=1";
    viewimage=window.open(url,"Preview",w_opt);

    if (window.viewimage != null)
      viewimage.focus();
  }

}

</script>
<SCRIPT language=JavaScript>
	var scrollerheight=72;		
	var html,total_area=0,wait_flag=true;
	
	var bMouseOver = 1;
	var scrollspeed = 8;		       
	var waitingtime = 2800;		
	var s_tmp = 0, s_amount = 18.8;
	var scroll_content=new Array();
	var startPanel=0, n_panel=0, i=0;
	
	function startscroll()
	{
		i=0;
		for (i in scroll_content)
			n_panel++;
			
		n_panel = n_panel -1 ;
		startPanel = Math.round(Math.random()*n_panel);
		if(startPanel == 0)
		{
			i=0;
			for (i in scroll_content) 
				insert_area(total_area, total_area++); 
		}
		else if(startPanel == n_panel)
		{
			insert_area(startPanel, total_area);
			total_area++;
			for (i=0; i<startPanel; i++) 
			{
				insert_area(i, total_area);
				total_area++;
			}
		}
		else if((startPanel > 0) || (startPanel < n_panel))
		{
			insert_area(startPanel, total_area);
			total_area++;
			for (i=startPanel+1; i<=n_panel; i++) 
			{
				insert_area(i, total_area); 
				total_area++;
			}
			for (i=0; i<startPanel; i++) 
			{
				insert_area(i, total_area); 
				total_area++;
			}
		}
		window.setTimeout("scrolling()",waitingtime);
	}
	function scrolling(){ 
		if (bMouseOver && wait_flag)
		{
			for (i=0;i<total_area;i++){
				tmp = document.getElementById('scroll_area'+i).style;
				tmp.top = parseInt(tmp.top)-scrollspeed;
				if (parseInt(tmp.top) <= -scrollerheight){
					tmp.top = scrollerheight*(total_area-1);
				}
				if (s_tmp++ > (s_amount-1)*scroll_content.length){
					wait_flag=false;
					window.setTimeout("wait_flag=true;s_tmp=0;",waitingtime);
				}
			}
		}
		window.setTimeout("scrolling()",1);
	}
	function insert_area(idx, n){ 
		html='<div style="left: 0px; width: 100%; position: absolute; top: '+(scrollerheight*n)+'px" id="scroll_area'+n+'">\n';
		html+=scroll_content[idx]+'\n';
		html+='</div>\n';
		document.write(html);
	}
<%
pi=0
set rs=server.createobject("adodb.recordset")
sql="select * from photo where passed=1 and share=0 order by picid desc"
rs.open sql,conn,1,1
if not rs.eof then
do until pi>=3 or rs.eof
classid=rs("ClassID")
picid=rs("picid")
photourl=rs("file")&rs("smallfilename")
upuser=rs("name")
%>
scroll_content[<%=pi%>]="<TABLE cellSpacing=0 cellPadding=0 width=245 border=0><TBODY><TR><TD width=70><a href=javascript:ShowPic('<%=ClassID%>','<%=picid%>')><img src=<%=photourl%> border=0 alt=ÉÏ´«Õß£º<%=upuser%> style=FILTER: alpha(opacity=45) onMouseOver=nereidFade(this,100,0,5)  onMouseOut=nereidFade(this,45,50,5)></a></TD></TR></TBODY></TABLE>";
<%
pi=pi+1
rs.movenext
loop
end if
rs.close
set rs=nothing
%>
startscroll();
</SCRIPT>
</body></html>