<?
//image.php 显示附件的图片
include "config.inc.php";
include "class/member.class.php";
$member=new member();
$confirm==false;//true 会员才能看,false 都能看
$user_info = $member->member_auth();
if($user_info[user_level]=="Guest" && $confirm==true){
		include "modules/member/index.php";
}else{
$imgdb = $PlusDB->prefix(images);
$id=$_GET[id];
$aid = $_GET[aid];
$sql="select id from $imgdb where aid=$aid order by id ";
$rt=$PlusDB->query($sql);
$num=$rt->RecordCount($rt);
if($num==0){	
	echo _LANG_1050;
}else{
	$start = $_GET[start];
	$start=empty($start)?0:$start;
    	$start=$start>$num?0:$start;
    	$page=1;
		if($id>0){
		$sql="select id,name as title  from $imgdb where aid=$aid  and id=$id";
		}else{
    	$sql="select id,name as title  from $imgdb where aid=$aid order by id  ";
		}
	$rt=$PlusDB->SelectLimit($sql,$page,$start);
	$row=$rt->fetchRow();
	$vr=array("aid"=>$aid);
	$pages=new pages();
	$pages->cnt=$num;
	$pages->lim=$page; //records per page
	$pages->type="1";
	$pages->script="viewimg.php"; //Call only if you need to link to other document
	$pages->vars=$vr;
	$page_s = $pages->get_list();
   	?>
   	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><?=_LANG_1051?></title>
<LINK  href="fm.css" type=text/css rel=stylesheet>
</head>
   	 <script language="JavaScript">
	<!--
	function MM_showHideLayers() { //v3.0
	  var i,p,v,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	    obj.visibility=v; }
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	//-->
	</script>
	<LINK  href="template/company_004/images/css.css" type=text/css rel=stylesheet>
<body>
   	<div align=center><?=$page_s?><br><?=_LANG_1052?><br><a href="" onClick="return false"><IMG name=small alt="<?=$row[title]?>"  onmouseover="javascript:if(this.width>500)this.width=500;" style="CURSOR: hand" onClick="MM_showHideLayers('layer2','','show');MM_showHideLayers('layer','','hide');MM_showHideLayers('layer1','','hide');"  src="image.php?id=<?=$row[id]?> " onload="javascript:if(this.width>500)this.width=500;" align=absmiddle border=0></a></div>
   	<div id="layer2" style="position: absolute; left: 14px; top: 3px; width: 765; height: 202; z-index: 1; visibility: hidden"> 
  <table border="0" width="761" height="216" cellspacing="0" cellpadding="0">
    <tr bordercolor="#FFFFFF"> 
      <td width="624" valign="top" align="left"> 　 
        <div align="center"> 
          <center>
            <table border="0" width="122%" height="181" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="100%" height="151" valign="top" align="center"><a href="" onclick="return false" ><img name="big" src="image.php?id=<?=$row[id]?>" onclick="MM_showHideLayers('layer2','','hide');MM_showHideLayers('layer','','show');MM_showHideLayers('layer1','','show');return false;" border="0"></a> 
                </td>
              </tr>
              <tr> 
                <td width="100%" height="12" valign="top" align="center">　</td>
              </tr>
            </table>
          </center>
        </div>
      </td>
    </tr>
  </table>
</div>
<?
echo $page_s;

}
}
?>
