<?php
	session_start();
	header("Content-type:text/html;charset=gb2312");
	//判断是否有默认分店,如果有则直接进入默认分店界面
	$strlocalchainno=trim($_REQUEST['chidno']);
	if(strlen($strlocalchainno)>0)
	{
		$_SESSION["main_defhotelcode"]=$strlocalchainno;
		$_SESSION["main_defhotelsel"]="1";
	}
	
	//判断是否登录系统，散客固定为会员号"00000"
	if($_SESSION["main_viploginedsk"]!="1" |$_SESSION["main_vipnosk"]=="")
	{
		//没有登录开始启动登录
		require_once("logina.php");	
	}
			
?>

<?php
	include "wechat.class.php";
	include 'errCode.php';
	
	require_once("db/db.php");	
	require_once("common/common.php");
	require_once("../Wx.Config.php");	//只加载一次
	
	$_SESSION["main_nowpageishd"]="1";		//当前位优惠活动
	$_SESSION["main_strhdlistno"]="0";
	
	//得到分店名称信息
	$selchainno="";
	$selchainname="";
	$seltelno="";
	$seladdress="";
	$selchainimg="";
?>

<!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>
		//清空登录信息资料
		var ddt=<?php echo $_SESSION["main_defvipnoflagsk"]; ?>;
		if(ddt=="1")
		{	ddt=<?php echo $_SESSION["main_vipnosk"]; ?>;
			localStorage["main_defvipno"]=ddt;
		}
	</script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	
	<!--<script language="JavaScript"> 
		//不允许进行后退
		javascript:window.history.forward(0); 
	</script>-->
</head>

<script>
	var hotel_name="";
	var hotel_img="";

	function initShare()
	{
	}
</script>

<script>	
	//隐藏维信右上角菜单
	function onBridgeReady(){
		//WeixinJSBridge.call('hideOptionMenu');
	}

	if (typeof WeixinJSBridge == "undefined")
	{
		if( document.addEventListener )
		{
			document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		}
		else if (document.attachEvent)
		{
			document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
			document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		}
	}
	else
	{
		onBridgeReady();
	}
</script>

	
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">		
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="page1">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;">
        <table width="100%" height="50" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo WxMainConfig::colHeadBkColorBook;?>">
		   	<tr>
				<td height="50" width="30" align="center"></td>
				<td height="50" align="center" valign="middle">
	                <span id="MsgTxt" style="color:<?php echo WxMainConfig::colHeadTextColorBook;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:19px;text-shadow:none;">酒店优惠活动</span>
               	</td>
				<td height="50" width="30" valign="middle"></td>
		  	</tr>
		</table>
	</header>
		
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F5F5F5">
			<tr>
				<td height="4" width="5"></td>
				<td height="4" align="left"></td>
				<td height="4" width="5"></td>
			</tr>
			
			
			<?php		 
				
				$selchainno=$_SESSION["main_defhotelcode"];
				if(strlen($selchainno)>0){
					$sql=sprintf("SELECT ListNo,News_Title,News_Text,News_Img,OrderID,Chain_No FROM TR_AppNews_List WHERE Chain_No='%s' AND Enabled>0 AND EndTime>GetDate() ORDER BY OrderID ASC",$selchainno);
				}
				else {
					$sql=sprintf("SELECT ListNo,News_Title,News_Text,News_Img,OrderID,Chain_No FROM TR_AppNews_List WHERE Enabled>0 AND EndTime>GetDate() ORDER BY OrderID ASC");
				}
				
				$result = querySql($sql);
											
				while($row = fetch_array($result))
				{
					$sellistno = $row['ListNo'];  
					$seltitle = $row['News_Title'];
					$seltext = $row['News_Text'];
					$selimg = $row['News_Img'];
					$selchainno= $row['Chain_No'];
					
					$selchainimg="images/hotel_images/".$selchainno."/".$selimg;
			?>
			
			<tr>
				<td width="5"></td>
				<td align="left">
					<div style="width:100%;height:100%;">
						<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" >
							<tr>
								<td height="33" width="10"></td>
								<td height="33" align="left"> <span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $seltitle; ?></span> </td>
								<td height="33" width="10"></td>
							</tr>
																					
							<tr>
								<td height="160" width="10"></td>
								<td height="160" align="left">
									<a href="#" onclick="window.location = 'hotelselhd.php?chidno=<?php echo $selchainno; ?>&acid=<?php echo $sellistno;?>';">
										<div id="chain_suitid">
											<IMG style="border-radius:3px;" src="<?php echo $selchainimg; ?>" width="100%" height="160" border="0">
										</div>
									</a>
								</td>
								<td height="160" width="10"></td>
							</tr>
								
							<tr>
								<td height="20" width="10"></td>
								<td height="20"> <span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;"><?php echo $seltext; ?></span> </td>
								<td height="20" width="10"></td>
							</tr>
								
							<tr>
								<td height="5" width="10"></td>
								<td height="5" ></td>
								<td height="5" width="10"></td>
							</tr>
						</table>
					</div>
				</td>
				<td width="5"></td>
			</tr>
			
			<tr>
				<td height="1" width="5" bgcolor="#F2E2E2"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="5" bgcolor="#F2E2E2"></td>
			</tr>
			<tr>
				<td height="6" width="5" bgcolor="#66FFFF"></td>
				<td height="6" align="left" bgcolor="#66FFFF"></td>
				<td height="6" width="5" bgcolor="#66FFFF"></td>
			</tr>
			<tr>
				<td height="1" width="5" bgcolor="#F2E2E2"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="5" bgcolor="#F2E2E2"></td>
			</tr>
			
			<tr>
				<td height="6" width="5"></td>
				<td height="6" align="left"></td>
				<td height="6" width="5"></td>
			</tr>
						
			<?php
				}
				//释放数据库
				freeResult($result);
				closeDb();
			 ?>
			
			<!---------------------------------------------------------------------->
			<tr>
				<td height="8" width="5"></td>
				<td height="8" align="left"></td>
				<td height="8" width="5"></td>
			</tr>
		</table>
	</article>
	
	<footer data-role="footer" data-position="fixed" data-tap-toggle="false" style="border-top:0px 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="100%" valign="top">
				<td width="25%">					
					<a class="ui-btn ui-icon-home ui-btn-icon-top" data-transition="slide" href="index2.php" data-direction="reverse" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666">主页</a>
				</td>
				<td width="25%">					
					<a class="ui-btn ui-icon-navigation ui-btn-icon-top" data-transition="slide" target="_blank" href="index.php" data-direction="reverse" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666">酒店预订</a>
				</td>
				<td width="25%">
					<a class="ui-btn ui-icon-bullets ui-btn-icon-top" data-transition="slide" target="_blank" href="orderlist.php" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666">我的订单</a>
				</td>
				<td width="25%">
					<a class="ui-btn ui-icon-tag ui-btn-icon-top" data-transition="slide" target="_blank" href="roomlist.php" style="width:100%;height:10px;margin:0px auto 0px auto;color:#666666">我的住房</a>
				</td>
			</tr>
		</table>						
	</footer>
</section>

</body>
	
</html>