<? $sql="select * from ".$BIAOTOU."activity order by id desc";
$rs_mall=mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<?php include(DDROOTPATH.'/cache/title/'.$pagetag.'_title.php');?>
<LINK rel=stylesheet type=text/css href="/template/<?=MOBAN?>/css/mall.css" />
<LINK rel=stylesheet type=text/css href="/template/<?=MOBAN?>/css/common.css" />
<script type="text/javascript" src="/template/<?=MOBAN?>/js/jquery-1.3.2.min.js"></script>
<SCRIPT type="text/javascript" src="/template/<?=MOBAN?>/js/function.js"></SCRIPT>
<script language="javascript">
$.ajaxSetup ({
    cache: false //关闭AJAX相应的缓存
});

function imgAuto(img, maxW, maxH) {
	var oriImg = document.createElement("img");
	oriImg.onload = function(){
		if (oriImg.width == 0 || oriImg.height == 0)
			return;
		var oriW$H = oriImg.width / oriImg.height;
		// var maxW$H = maxW / maxH;

		if (oriImg.height > maxH) {
			img.height = maxH;
			// img.removeAttribute("width");
			img.width = maxH * oriW$H;
		}
		if (img.width > maxW) {
			img.width = maxW;
			// img.removeAttribute("height");
			img.height = maxW / oriW$H;
		}

		if (maxH) {// if it defined the maxH argument
			if (img.height > 0)
				img.style.marginTop = (maxH - img.height) / 2 + "px";
		}
	};
	oriImg.src = img.src;
}
    </script>
</head>

<body>
<?php
include("header.tpl.php");
?>
<?php
include("nav.tpl.php");
?>
<div class="index">
<div id="weizhi">当前位置：<a href="/">首页</a> > <a href="coupons<?=$end?>">优惠券</a></div>
<div class="wrap"></div>
<div id="main">
<div class="white_top"><div class="white_top_left"></div><div class="white_top_middle"></div><div class="white_top_right"></div></div>
<div class="white_bg">
	<div id="left">
		<!--促销开始-->
	<div class="actRecom">
			<div class="actRecom_top1">
				<div class="clear"></div>
			</div>
			<div class="actRecom_con">
            <?php if($activity[0]['mallname']==''){?>
             <p style=" width:150px; text-align:center; margin:auto; margin-top:20px; color:#F00; font-size:16px"><b>暂无促销活动</b></p>
		 <?php }?>
         <?php foreach($activity as $row){?>
                <ul>
					<li>
                 <div class="actRecom_con_l" style="height:210px;">
                 <a target="_blank" href="cuxiao<?=$url_head_id?><?=$row['id']?><?=$url_end?>" title="<?=$row['name']?> - <?=$row['mallname']?>"><img  onload="imgAuto(this,450,210);"  src="<?=$row['pic']?>" width="450" height="210" alt="<?=$row['name']?> - <?=$row['mallname']?>" /></a>	
				 </div>    
                  <div class="actRecom_con_r">
		                	<div>
                            <?  $sql="select * from ".$BIAOTOU."mall where id=$row[mallid]";$query=mysql_query($sql);$rows=mysql_fetch_array($query); ?>
		                   	  <table width="100%" cellspacing="0" cellpadding="0" border="0">
		                   	  		<tbody><tr>
		                            	<td width="50%">
		                            		<div class="actLogo" title="<?=$row['mallname']?>">
                                            <a href="cuxiao<?=$url_head_id?><?=$row['id']?><?=$url_end?>" target="_blank"><img width="90" height="40" src="<?=$rows['logo']?>"></a>
		                            		</div>
                                        </td>
		                        		<td width="50%" class="act_color1">
		                        			<span style="color:#4d4d4d;">
		                        				<a href="mall<?=$url_head_id?><?=$rows['id']?><?=$url_end?>" target="_blank"><?=$row['mallname']?></a><br>
		                        				<span style="color:#FF5500;">最高返<?=$rows['fan']?></span>
		                        			</span>
		                        		</td>
                                        </tr>
		                        </tbody></table>
		                    </div><!--还剩下3个DIV 一个U 一个li-->
					        <h2>
                            <a href="cuxiao<?=$url_head_id?><?=$row['id']?><?=$url_end?>" target="_blank" title="<?=$row['name']?> - <?=$row['mallname']?>"><font style="color: #4D4D4D;font-family: Microsoft yahei,Verdana;    font-size: 18px;font-weight: bold;height: 44px;line-height: 22px;margin: 10px 0;overflow: hidden;"><?=$row['name']?></font></a>        	
					        </h2>
                            <a target="_blank" href="mall<?=$url_head_id?><?=$rows['id']?><?=$url_end?>"><img src="template/<?=MOBAN?>/images/sales_go.gif"></a>
		                    <div class="actTime">活动时间：<span><?=$row['stime']?>至<?=$row['etime']?>（<?=sjc(date('Y-m-d'),$row['etime'])?>）</span>
		                     </div>
		                     </div>
					     <div class="clear"></div>
					</li>
                    <li>
		            	<div class="actLine"><img src="template/<?=MOBAN?>/images/act_10.png"></div>
		            	<div class="clear"></div>
		            </li>
		        </ul>
                <div class="clear"></div>
                    <?php }?>
                    </div>
		</div>
		<!--促销结束-->
     <div style="height:10px">&nbsp;</div>               
      <div class="megas512" style="text-align:center; margin:5px"><?php 
				pageft($total,$pagesize,1,0,0,10,$page_coupons);
				echo $pagenav;?>
		</div>
    <!--right_other结束-->
 </div>
 <div id="right_other">
	
		<div class="r_box">
			<div class="title"><span>热门促销</span></div>
			<div class="hc">
				<ul>
                <?php while ($row2 = mysql_fetch_array($rs_mall)) {?>
								<li><a href="cuxiao.php?id=<?=$row2['id']?>" target="_blank">[<?=$row2['mallname']?>] <?=$row2['name']?></a></li>
                               <?php }?>
                        </ul>
				<div class="clear"></div>
			</div>
			<div class="clear"></div>
		</div>

	</div>
</div>
<div class="white_bottomm"><div class="white_bottom_left"></div><div class="white_bottom_middle"></div><div class="white_bottom_right"></div>
</div>
	<!--<div id="right"><div id="ad4"><?AD(4)?></div></div>-->
	<?php include("footer.tpl.php");?>
</div>
</body>
</html>
