<?php
	session_start();
	require_once("../Wx.Config.php");	//只加载一次

	ini_set('session.gc_maxlifetime', 99999999); //设置时间 永不过期
	
	$strselChainNo=trim($_REQUEST['chid']);
	$strwxid = trim($_SESSION["main_wxudid"]);
	$_SESSION["main_wxudid"] = $strwxid;
	
	include 'loginauto.php';
	
	$strdefcartid=trim($_REQUEST['cartid']);
	if(strlen($strdefcartid)>16)
	{
		$_SESSION["main_defcarttempid"] = $strdefcartid;
	}
	$strdefcartid = trim($_SESSION["main_defcarttempid"]);
	if(strlen($strdefcartid) < 16)
	{
		header('Location: loadpage.php?chid='.$strselChainNo);
	}
?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="gb2312">	
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
	<meta name="apple-mobile-web-app-capable" content="1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=0">
	<meta name="apple-touch-fullscreen" content="1">

	<title>微信点单</title>
	
	<link rel="stylesheet" href="css/mycss.css"> 
	<script src="jsp4/jquery.js"></script>
	<!--<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">-->
	<!--<script src="jsp4/jquery.mobile-1.4.3.min.js"></script>-->
	<script src="jsp5/jquery.mobile-1.4.5.min.js"></script>
	<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">
	
	
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	  
    
	<script language="JavaScript"> 
		//不允许进行后退
		javascript:window.history.forward(0); 
	</script>
	
	<style type="text/css">     
		.clear{overflow:hidden; clear:both; width:0px; height:0px; }     
		.imgbox{width:640px; margin:0 auto; text-align:center; }     
		ul{padding:0px; margin:0px;}     
		ul li{float:left; list-style:none; }     
		ul li.select{display:block;}     
		.imgnum span{border-radius:12px; font:normal normal bold 12px/15px 微软雅黑; color:#FFF; margin-left:6px; padding:3px 6px 3px 6px; background-color:#F90; cursor:pointer;}
		.imgnum span.onselect{background-color:#F00;}     
		.imgnum{text-align:center; float:right; margin:-32px 30px; position:relative;}   
	</style>
	
</head>

<?php
	//加载系统参数信息
	require_once("db/db.php");	
	require_once("common/common.php");
	//分店号
	//$_SESSION["main_posChainNo"]='';
	//$_SESSION["main_posChainName"]='';
	//$_SESSION["main_posChainDListNo"]='';
	
	if(strlen($strselChainNo)<1)
	{
		$strselChainNo = trim($_SESSION["main_posChainNo"]);
	}
	
	//如果未穿入分店号，则启动分店选择界面
	if(strlen($strselChainNo)<1)
	{
		$strselChainNo=WxMainConfig::defChainNo;
		//header('Location: selhotel.php');
	}
	
	//获取分店信息
	$sql=sprintf("SELECT Chain_No,Chain_Name FROM Chain_Infor Where Chain_No='%s'",$strselChainNo);
	$result = querySql($sql);
	if($row = fetch_array($result))
	{
		$_SESSION["main_posChainNo"] = trim($row['Chain_No']);
		$_SESSION["main_posChainName"] = trim($row['Chain_Name']);
	}
	freeResult($result);	//释放数据库
	
	$intBannerHeight = 160;
?>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">		
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="page1" style="background-color:#fff;">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="height:<?php echo $intBannerHeight;?>px;border-top-width:0px;border-bottom-width:0px;">	
		<div class="imgbox" style="width:100%;height:<?php echo $intBannerHeight;?>px;align:center;">       
			<ul id="banner_img">         
				<li><img width="100%" style="height:<?php echo $intBannerHeight;?>px;" border="0" src="images/b1.png"/></li>
				<li><img width="100%" style="height:<?php echo $intBannerHeight;?>px;" border="0" src="images/b2.png"/></li>
				<li><img width="100%" style="height:<?php echo $intBannerHeight;?>px;" border="0" src="images/b3.png"/></li>
				<li><img width="100%" style="height:<?php echo $intBannerHeight;?>px;" border="0" src="images/b4.png"/></li>
			</ul>   
			<div class="clear"></div>   
			<div class="imgnum" style="width:100%; align:center;">     
				<span class="onselect">1</span>
				<span>2</span>
				<span>3</span>
				<span>4</span>
			</div> 
		</div> 
	
		<script type="text/javascript">      
			var time = "";      
			var index = 1;      
			$(function () 
			{        
				showimg(index);        //鼠标移入移出        
				$(".imgnum span").hover(function () 
				{         
					clearTimeout(time);         
					var icon=$(this).text();         
					$(".imgnum span").removeClass("onselect").eq(icon-1).addClass("onselect");         
					$("#banner_img li").hide().stop(true,true).eq(icon-1).fadeIn("slow");        
				}, function () 
				{         
					index=$(this).text()> 3 ? 1 :parseInt($(this).text())+1;         
					time = setTimeout("showimg(" + index + ")", 3000);        
				});      
			});         
				
			function showimg(num) 
			{        
				index = num;        
				$(".imgnum span").removeClass("onselect").eq(index-1).addClass("onselect");
				$("#banner_img li").hide().stop(true,true).eq(index-1).fadeIn("slow");
				index = index + 1 > 4 ? 1 : index + 1; 
				time = setTimeout("showimg(" + index + ")", 3000);
			}   
		</script> 
	</header>
	
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                
                <?php 
					$intRowIndex = 0;
					
					$lngDListNo1 = 0;
					$strDepartName1 = '';
					$strDepartTel1 = '';
					$strDAddress1 = '';
					$strDRemarks1 = '';
					
					$lngDListNo2 = 0;
					$strDepartName2 = '';
					$strDepartTel2 = '';
					$strDAddress2 = '';
					$strDRemarks2 = '';
						
					$sql = sprintf("SELECT ListNo,DepartName,DepartTelNo,DepartAddress,Remarks FROM TCP_Depart_Inform Where Chain_No='%s' And wxmall=1",$strselChainNo);
					
					$result = querySql($sql);
	
					while($row = fetch_array($result))
					{
						$lngDListNo1 = $row['ListNo'];
						$strDepartName1 = $row['DepartName'];
						$strDepartTel1 = trim($row['DepartTelNo']);
						$strDAddress1 = trim($row['DepartAddress']);
						$strDRemarks1 = trim($row['Remarks']);
						
						if(strlen($strDRemarks1)>26)
						{
							$strDRemarks1 = mb_substr($strDRemarks1,0,26,'gb2312').'...';
						}
					
						//判断第二个
						if($row = fetch_array($result))
						{
							$lngDListNo2 = $row['ListNo'];
							$strDepartName2 = $row['DepartName'];
							$strDepartTel2 = trim($row['DepartTelNo']);
							$strDAddress2 = trim($row['DepartAddress']);
							$strDRemarks2 = trim($row['Remarks']);
							
							if(strlen($strDRemarks2)>26)
							{
								$strDRemarks2 = mb_substr($strDRemarks2,0,26,'gb2312').'...';
							}
						}
						else
						{
							$lngDListNo2 = 0;
							$strDepartName2 = '';
							$strDepartTel2 = '';
							$strDAddress2 = '';
							$strDRemarks2 = '';
						}
				?>
				
                <tr><td height="5" colspan="3"></td></tr>
				
				<tr>
					<td height="15" width="5"></td>
					<td height="15" align="left">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td height="10" width="48%">
									<div onClick="bmtSelDepart(<?php echo $lngDListNo1;?>)" style="border-color:#E9DFDF; border-style:solid; border-width:1px;border-radius:5px; background-color:#F4EFEF;">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td height="100" width="100%">
													<IMG src="mall_images/hotelimg/xct1.jpg" width="100%" height="100%" border="0" >
												</td>
											</tr>	
											
											<tr>
												<td height="24" width="100%" align="center">
													<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strDepartName1; ?></span> 
												</td>
											</tr>	
										</table>
									</div>
								</td>
								<td height="10" width="8"></td>
								<td height="10" >
									<?php if(strlen($strDepartName2)>0) { ?>
									<div onClick="bmtSelDepart(<?php echo $lngDListNo2;?>)" style="border-color:#E9DFDF; border-style:solid; border-width:1px;border-radius:5px;background-color:#F4EFEF">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td height="100" width="100%">
													<IMG src="mall_images/hotelimg/xct1.jpg" width="100%" height="100%" border="0">
												</td>
											</tr>	
											<tr>
												<td height="24" width="100%" align="center">
													<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strDepartName2; ?></span> 
												</td>
											</tr>	
										</table>
									</div>
									<?php } ?>
								</td>
							</tr>
						</table>
					</td>
					<td height="15" width="5"></td>
				</tr>
				
                <tr><td height="3" colspan="3"></td></tr>
                                
                <?php	
						
					}
					freeResult($result);	//释放数据库
					closeDb();				//关闭数据库
				?>
                
		</table>
	</article>
	    
    <script type="text/javascript">
				
		//相应提交按钮事件处理部分
		function bmtSelDepart(selDListNo)
		{			
			window.location="index.php?dlistno=" + selDListNo;										
		}
		
	</script>
	
	<footer data-role="footer" data-position="fixed" data-tap-toggle="false" style="border-top:1px solid #F2E2E2;border-bottom:1px solid #F2E2E2;border-left:1px solid #F2E2E2;border-right:1px solid #F2E2E2;">
		<table width="100%" height="10" border="0" cellpadding="0" cellspacing="0">
        	<tr height="10" valign="top">
				<td height="10">					
				</td>
			</tr>
		</table>						
	</footer>
	
</section>




</body>
	
</html>