<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

include_once( "inc/conn.php" );
include_once( "inc/function.php" );
login_check( );
$query = $db->query( "Select id,kj,kgtime,tzpoints from ".$web_dbtop."game11 where id=".intval( $_GET['joyousno'] ) );
if ( $rs = $db->fetch_array( $query ) )
{
		$kgqh = $rs['id'];
		$kj = $rs['kj'];
		$kgtime = datediff( $rs['kgtime'], date( "Y-m-d H:i:s" ), "s" );
		$tzsumpoints = $rs['tzpoints'];
}
if ( $_GET['act'] == "invest" )
{
		$query = $db->query( "Select * from ".$web_dbtop."game_system where id=1" );
		if ( $rs = $db->fetch_array( $query ) )
		{
				$game11_go_time = $rs['game11_go_time'];
				$game11_tz_experience = $rs['game11_tz_experience'];
				$game11_jl_experience = $rs['game11_jl_experience'];
				$game11_jl_maxexperience = $rs['game11_jl_maxexperience'];
				$game11_jl_experience_vip = $rs['game11_jl_experience_vip'];
				$game11_jl_maxexperience_vip = $rs['game11_jl_maxexperience_vip'];
		}
		$query = $db->query( "Select id from ".$web_dbtop."game11_auto where uid=".intval( $_COOKIE['usersid'] )." Order by id desc" );
		if ( $rs = $db->fetch_array( $query ) )
		{
				echo "<script language=javascript>alert('对不起，请先取消自动投注后在投注！');location.href='joyousautodetail.php';</script>";
				exit( );
		}
		if ( $kj )
		{
				echo "<script language=javascript>alert('该期已经开奖，请查看开奖结果！');location.href='joyous.php';</script>";
				exit( );
		}
		if ( $kgtime <= $game11_go_time )
		{
				echo "<script language=javascript>alert('对不起，该期正在开奖请投注下期！');location.href='joyous.php';</script>";
				exit( );
		}
		if ( $_POST['tbTotalG2'] == 0 )
		{
				echo "<script language=javascript>alert('对不起，您已经投注这期所有号码，请不要在重复投注！');location.href='".$_SERVER['HTTP_REFERER']."';</script>";
				exit( );
		}
		$sumpoints = 0;
		$i = 2;
		for ( ;	$i < 13;	++$i	)
		{
				if ( $_POST['tbChk'][$i] )
				{
						$sumpoints += zint( intval( $_POST['tbNum'][$i] ) );
				}
		}
		$experience = 0;
		$query = $db->query( "Select points,vip,dailygame11experience from ".$web_dbtop."users where id=".intval( $_COOKIE['usersid'] ) );
		if ( $rs = $db->fetch_array( $query ) )
		{
				$userspoints = $rs['points'];
				$vip = $rs['vip'];
				$dailygame11experience = $rs['dailygame11experience'];
				if ( $vip == 1 )
				{
						$game11_maxexperience = $game11_jl_maxexperience_vip;
				}
				else
				{
						$game11_maxexperience = $game11_jl_maxexperience;
				}
		}
		if ( $userspoints < $sumpoints )
		{
				echo "<script language=javascript>alert('对不起，您的".$web_moneyname."数量不足，无法投注！".$userspoints."');location.href='".$_SERVER['HTTP_REFERER']."';</script>";
				exit( );
		}
		if ( $game11_tz_experience <= $sumpoints && $dailygame11experience <= $game11_maxexperience )
		{
				if ( $vip == 1 )
				{
						$experience = $game11_jl_experience_vip;
				}
				else
				{
						$experience = $game11_jl_experience;
				}
		}
		$db->query( "update ".$web_dbtop."users set points=points-{$sumpoints},experience=experience+{$experience},maxexperience=maxexperience+{$experience},dailygame11experience=dailygame11experience+{$experience} where id=".intval( $_COOKIE['usersid'] ) );
		$db->query( "update ".$web_dbtop."game_log set game11_hd=game11_hd-{$sumpoints} where uid=".intval( $_COOKIE['usersid'] ) );
		$x = 0;
		$i = 2;
		for ( ;	$i < 13;	++$i	)
		{
				if ( !$_POST['tbChk'][$i] )
				{
						continue;
				}
				$query = $db->query( "Select id from ".$web_dbtop."game11_kg_users_tz where NO=".intval( $_GET['joyousno'] )." and tznum=".$i." and uid=".intval( $_COOKIE['usersid'] )." Order by id desc" );
				if ( !( $rs = $db->fetch_array( $query ) ) )
				{
						++$x;
						$db->query( "INSERT INTO ".$web_dbtop."game11_kg_users_tz (uid,NO,tznum,tzpoints,time) VALUES (".intval( $_COOKIE['usersid'] ).",".$kgqh.",".$i.",".zint( intval( $_POST['tbNum'][$i] ) ).",'".date( "Y-m-d H:i:s" )."')" );
				}
				else
				{
						echo "<script language=javascript>alert('".$i."号码您已经投注过,请不要重复投注！');location.href='happy.php';</script>";
						exit( );
				}
		}
		$db->query( "update ".$web_dbtop."game11 set tznum=tznum+{$x},tzpoints=tzpoints+{$sumpoints},sdtz=sdtz+1 where id =".intval( $_GET['joyousno'] ) );
		echo "<script language=javascript>alert('投注成功，扣除您".$sumpoints.$web_moneyname."！');location.href='joyous.php';</script>";
		exit( );
}
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n<HTML xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<title>欢乐11-游戏中心-";
echo $web_name;
echo "</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\r\n<meta name=\"keywords\" content=\"";
echo $web_keywords;
echo "\" />\r\n<meta name=\"description\" content=\"";
echo $web_description;
echo "\" />\r\n<META http-equiv=X-UA-Compatible content=IE=EmulateIE7>\r\n<link href=\"style/default.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n</head>\r\n";
include_once( "top.php" );
echo "<script language=\"javascript\">\r\nqiehuan(2);\r\ndocument.getElementById(\"qh_con2\").getElementsByTagName('li')[4].className=\"current\";</script>\r\n<DIV class=\"wrapper\">\r\n\t<DIV class=\"page_content\">\r\n\t\t<DIV class=\"webgame-info-title\">\r\n\t\t  <UL>\r\n\t\t\t<LI class=\"current\"><A href=\"joyous.php\">欢乐11首页</A></LI>\r\n\t\t\t<LI><A href=\"joyoushelp.php\">欢乐11规则</A></LI>\r\n\t\t\t<LI><A href=\"joyousmylist.php\">我的投注记录</A></LI>\r\n\t\t\t<LI><A href=\"joyousmodel.php\">投注模式编辑</A></LI>\r\n\t\t\t<LI><A href=\"joyousautoset.php\">自动投注</A></LI>\r\n\t\t\t<LI><A href=\"joyousdirection.php\">欢乐11走势图</A></LI>\r\n\t\t  </UL>\r\n\t\t</DIV>\r\n\t\t<DIV class=\"webgame-info\">\r\n\t\t\t<DIV class=\"webgame-info-tabs\">\t\t  \r\n\t\t\t  <table width=\"940\" height=\"27\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n                <tr>\r\n                  <td width=\"12\"><img src=\"images/game2_03.jpg\" width=\"12\" height=\"27\" /></td>\r\n                  <td width=\"50%\" background=\"images/game2_04.jpg\" class=\"font14\">当前<span class=\"STYLE1\">\r\n                    ";
echo $kgqh;
echo "                    </span>期　　";
echo $web_moneyname;
echo "总数:<font color=\"red\">\r\n                    ";
echo number_format( $tzsumpoints );
echo "                  </font></td>\r\n                  <td width=\"50%\" align=\"right\" background=\"images/game2_04.jpg\" class=\"font14\"><span  class=\"rf\" id=\"fHappy\"></span></td>\r\n                  <td width=\"13\"><img src=\"images/game2_06.jpg\" width=\"13\" height=\"27\" /></td>\r\n                </tr>\r\n              </table>\r\n\t\t\t  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n                <tr>\r\n                  <td height=\"5\"></td>\r\n                </tr>\r\n              </table>\r\n\t\t\t  <table width=\"940\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n                <tr>\r\n                  <td bgcolor=\"#FFB91F\"><form action=\"?joyousno=";
echo $kgqh;
echo "&act=invest\" name=\"form\" method=\"post\">\r\n                      <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">\r\n                        <tr>\r\n                          <td height=\"28\" colspan=\"5\" bgcolor=\"#FFFFFF\">&nbsp;&nbsp;<strong>自动投注模式：</strong>\r\n                              ";
$i = 0;
$game11tz_array = array( );
$query = $db->query( "Select * from ".$web_dbtop."game11_auto_tz where uid=".intval( $_COOKIE['usersid'] )."  Order by tzid asc" );
while ( $rs = $db->fetch_array( $query ) )
{
		echo "&nbsp;&nbsp;<span class=\"pointer\" onclick=\"chgModel('".$i."')\">".$rs['tzname']."</span>";
		$tzunm = explode( "|", $rs['tzunm'] );
		$game11tz_array[] = "{\"ID\":\"".$rs['id']."\",\"modelID\":\"".$rs['tzid']."\",\"modelName\":\"".$rs['tzname']."\",\"N2\":\"".$tzunm[0]."\",\"N3\":\"".$tzunm[1]."\",\"N4\":\"".$tzunm[2]."\",\"N5\":\"".$tzunm[3]."\",\"N6\":\"".$tzunm[4]."\",\"N7\":\"".$tzunm[5]."\",\"N8\":\"".$tzunm[6]."\",\"N9\":\"".$tzunm[7]."\",\"N10\":\"".$tzunm[8]."\",\"N11\":\"".$tzunm[9]."\",\"N12\":\"".$tzunm[10]."\"}";
		++$i;
}
$tzjs = implode( ",", $game11tz_array );
echo "</td>\r\n                        </tr>\r\n                        <tr>\r\n                          <td height=\"28\" colspan=\"5\" bgcolor=\"#FFFFFF\">&nbsp;&nbsp;<strong>快捷投注\r\n                                <label>：</label>\r\n                            </strong>\r\n                              <input type=\"hidden\" id=\"hidTimes\" value=\"1\" />\r\n                              <input value=\"0.5倍\" onclick=\"chgAllTimes(0.5)\" type=\"button\" />\r\n                              <input value=\"0.8倍\" onclick=\"chgAllTimes(0.8)\" type=\"button\" />\r\n                              <input value=\"1.2倍\" onclick=\"chgAllTimes(1.2)\" type=\"button\" />\r\n                              <input value=\"1.5倍\" onclick=\"chgAllTimes(1.5)\" type=\"button\" />\r\n                              <input value=\"2倍\" onclick=\"chgAllTimes(2)\" type=\"button\" />\r\n                              <input value=\"10倍\" onclick=\"chgAllTimes(10)\" type=\"button\" />\r\n                              <input name=\"tbTotalG1\" id=\"tbTotalG1\" readonly=\"readOnly\" value=\"0\" />\r\n                              <input value=\"确认投注\" id=\"pointerSubmit1\" type=\"submit\" onclick=\"javascript:this.disabled = true;this.document.form.submit();\" />\r\n&nbsp;&nbsp;\r\n              <input name=\"pointer\" type=\"button\" value=\"刷新当前赔率\" class=\"rf\" onclick=\"location.reload();\" />\r\n                          </td>\r\n                        </tr>\r\n                        <tr>\r\n                          <td height=\"28\" colspan=\"5\" bgcolor=\"#FFFFFF\" class=\"rf\">&nbsp;&nbsp;<strong>标准投注模式：</strong><span class=\"pointer\" onclick=\"init()\">取消</span>&nbsp;&nbsp;<span class=\"pointer\" onclick=\"useModel(1)\">全包</span>&nbsp;&nbsp;<span class=\"pointer\" onclick=\"useModel(2)\">单</span>&nbsp;&nbsp;<span class=\"pointer\" onclick=\"useModel(3)\">双</span>&nbsp;&nbsp;<span class=\"pointer\" onclick=\"useModel(4)\">大</span>&nbsp;&nbsp;<span class=\"pointer\" onclick=\"useModel(5)\">小</span>&nbsp;&nbsp;<span class=\"pointer\" onclick=\"useModel(6)\">中</span>&nbsp;&nbsp;<span class=\"pointer\" onclick=\"useModel(7)\">边</span></td>\r\n                        </tr>\r\n                        <tr>\r\n                          <td width=\"20%\" height=\"28\" align=\"center\" background=\"images/joyousbj.jpg\" bgcolor=\"#FFFFFF\" class=\"font-white\">预测结果</td>\r\n                          <td width=\"15%\" height=\"28\" align=\"center\" background=\"images/joyousbj.jpg\" bgcolor=\"#FFFFFF\" class=\"font-white\">标准赔率</td>\r\n                          <td width=\"15%\" height=\"28\" align=\"center\" background=\"images/joyousbj.jpg\" bgcolor=\"#FFFFFF\" class=\"font-white\">当前赔率</td>\r\n                          <td width=\"20%\" align=\"center\" background=\"images/joyousbj.jpg\" bgcolor=\"#FFFFFF\" class=\"font-white\" style=\"cursor:pointer;\" onclick=\"subSelect();\">全选/<font color=\"#FF0000\">反选</font></td>\r\n                          <td width=\"30%\" align=\"center\" background=\"images/joyousbj.jpg\" bgcolor=\"#FFFFFF\" class=\"font-white\">投注</td>\r\n                        </tr>\r\n                        ";
$i = 2;
for ( ;	$i < 13;	++$i	)
{
		$query = $db->query( "Select sum(tzpoints) as sumnumtzpoints from ".$web_dbtop."game11_kg_users_tz where NO=".intval( $_GET['joyousno'] ).( " and tznum=".$i." Order by id desc" ) );
		if ( $rs = $db->fetch_array( $query ) )
		{
				$sumnumtzpoints = $rs['sumnumtzpoints'];
		}
		$tzpoints = 0;
		$query = $db->query( "Select tzpoints from ".$web_dbtop."game11_kg_users_tz where NO=".intval( $_GET['joyousno'] ).( " and tznum=".$i." and uid=" ).intval( $_COOKIE['usersid'] )." Order by id desc" );
		if ( $rs = $db->fetch_array( $query ) )
		{
				$tzpoints = $rs['tzpoints'];
		}
		echo "                        <tr>\r\n                          <td height=\"32\" align=\"center\" bgcolor=\"#FFFAC7\" class=\"font12game\"><img src=\"images/joyous/number_";
		echo $i;
		echo ".gif\" /></td>\r\n                          <td align=\"center\" bgcolor=\"#FFFFFF\" class=\"font12game\">";
		echo game11pl( $i );
		echo "</td>\r\n                          <td align=\"center\" bgcolor=\"#FFFFFF\" class=\"font12game\">";
		echo $sumnumtzpoints ? round( $tzsumpoints / $sumnumtzpoints, 2 ) : game11pl( $i );
		echo "</td>\r\n                          <td align=\"center\" bgcolor=\"#FFFFFF\"><input name=\"tbChk[";
		echo $i;
		echo "]\" id=\"tbChk";
		echo $i;
		echo "\" type=\"checkbox\" onclick=\"insert(this,'tbNum";
		echo $i;
		echo "')\" ";
		if ( $tzpoints )
		{
				echo "CHECKED disabled";
		}
		echo "/></td>\r\n                          <td align=\"center\" bgcolor=\"#FFFFFF\"><input type=\"text\" size=\"8\" name=\"tbNum[";
		echo $i;
		echo "]\" id=\"tbNum";
		echo $i;
		echo "\" value=\"";
		echo $tzpoints;
		echo "\" onblur=\"input(this,'tbChk";
		echo $i;
		echo "')\" ";
		if ( $tzpoints )
		{
				echo "readonly=\"true\"";
		}
		echo " />\r\n                              <input type=\"button\" value=\"+\" onclick=\"addNum('tbNum";
		echo $i;
		echo "','tbChk";
		echo $i;
		echo "')\" />\r\n                              <input type=\"button\" value=\"-\" onclick=\"subtractNum('tbNum";
		echo $i;
		echo "','tbChk";
		echo $i;
		echo "')\" />\r\n                              <input type=\"button\" value=\"x2\" onclick=\"chgTimes('tbNum";
		echo $i;
		echo "',2)\" />\r\n                              <input type=\"button\" value=\"x0\" onclick=\"clearNum('tbNum";
		echo $i;
		echo "','tbChk";
		echo $i;
		echo "')\" /></td>\r\n                        </tr>\r\n                        ";
}
echo "                        <tr>\r\n                          <td height=\"32\" colspan=\"5\" align=\"center\" bgcolor=\"#FFFFFF\">我的投注总额:\r\n                              <input id=\"tbTotalG2\" name=\"tbTotalG2\" readonly=\"readOnly\" value=\"0\" /></td>\r\n                        </tr>\r\n                        <tr>\r\n                          <td height=\"32\" colspan=\"5\" align=\"center\" bgcolor=\"#FFFFFF\"><label>\r\n                            <input name=\"按钮\" type=\"button\" id=\"btnSubmit\" value=\"确认投注\" onclick=\"javascript:this.disabled = true;this.document.form.submit();\" />\r\n                          </label></td>\r\n                        </tr>\r\n                      </table>\r\n                  </form></td>\r\n                </tr>\r\n              </table>\r\n\t\t\t  <script type=\"text/javascript\">\r\n\t\t\t\t<!--\r\n\t\t\t\tvar arrModel1 = new Array();\r\n\t\t\t\tvar arrModel2 = new Array();\r\n\t\t\t\tvar arrModel3 = new Array();\r\n\t\t\t\tvar arrModel4 = new Array();\r\n\t\t\t\tvar arrModel5 = new Array();\r\n\t\t\t\tvar arrModel6 = new Array();\r\n\t\t\t\tvar arrModel7 = new Array();\r\n\t\t\t\t\r\n\t\t\t\tarrModel1[2] = 1;\r\n\t\t\t\tarrModel1[3] = 2;\r\n\t\t\t\tarrModel1[4] = 3;\r\n\t\t\t\tarrModel1[5] = 4;\r\n\t\t\t\tarrModel1[6] = 5;\r\n\t\t\t\tarrModel1[7] = 6;\r\n\t\t\t\tarrModel1[8] = 5;\r\n\t\t\t\tarrModel1[9] = 4;\r\n\t\t\t\tarrModel1[10] = 3;\r\n\t\t\t\tarrModel1[11] = 2;\r\n\t\t\t\tarrModel1[12] = 1;\r\n\t\t\t\t\r\n\t\t\t\tarrModel2[2] = 0;\r\n\t\t\t\tarrModel2[3] = 2;\r\n\t\t\t\tarrModel2[4] = 0;\r\n\t\t\t\tarrModel2[5] = 4;\r\n\t\t\t\tarrModel2[6] = 0;\r\n\t\t\t\tarrModel2[7] = 6;\r\n\t\t\t\tarrModel2[8] = 0;\r\n\t\t\t\tarrModel2[9] = 4;\r\n\t\t\t\tarrModel2[10] = 0;\r\n\t\t\t\tarrModel2[11] = 2;\r\n\t\t\t\tarrModel2[12] = 0;\r\n\t\t\t\t\r\n\t\t\t\tarrModel3[2] = 1;\r\n\t\t\t\tarrModel3[3] = 0;\r\n\t\t\t\tarrModel3[4] = 3;\r\n\t\t\t\tarrModel3[5] = 0;\r\n\t\t\t\tarrModel3[6] = 5;\r\n\t\t\t\tarrModel3[7] = 0;\r\n\t\t\t\tarrModel3[8] = 5;\r\n\t\t\t\tarrModel3[9] = 0;\r\n\t\t\t\tarrModel3[10] = 3;\r\n\t\t\t\tarrModel3[11] = 0;\r\n\t\t\t\tarrModel3[12] = 1;\r\n\t\t\t\t\r\n\t\t\t\tarrModel4[2] = 0;\r\n\t\t\t\tarrModel4[3] = 0;\r\n\t\t\t\tarrModel4[4] = 0;\r\n\t\t\t\tarrModel4[5] = 0;\r\n\t\t\t\tarrModel4[6] = 0;\r\n\t\t\t\tarrModel4[7] = 6;\r\n\t\t\t\tarrModel4[8] = 5;\r\n\t\t\t\tarrModel4[9] = 4;\r\n\t\t\t\tarrModel4[10] = 3;\r\n\t\t\t\tarrModel4[11] = 2;\r\n\t\t\t\tarrModel4[12] = 1;\r\n\t\t\t\t\r\n\t\t\t\tarrModel5[2] = 1;\r\n\t\t\t\tarrModel5[3] = 2;\r\n\t\t\t\tarrModel5[4] = 3;\r\n\t\t\t\tarrModel5[5] = 4;\r\n\t\t\t\tarrModel5[6] = 5;\r\n\t\t\t\tarrModel5[7] = 0;\r\n\t\t\t\tarrModel5[8] = 0;\r\n\t\t\t\tarrModel5[9] = 0;\r\n\t\t\t\tarrModel5[10] = 0;\r\n\t\t\t\tarrModel5[11] = 0;\r\n\t\t\t\tarrModel5[12] = 0;\r\n\t\t\t\t\r\n\t\t\t\tarrModel6[2] = 0;\r\n\t\t\t\tarrModel6[3] = 0;\r\n\t\t\t\tarrModel6[4] = 0;\r\n\t\t\t\tarrModel6[5] = 4;\r\n\t\t\t\tarrModel6[6] = 5;\r\n\t\t\t\tarrModel6[7] = 6;\r\n\t\t\t\tarrModel6[8] = 5;\r\n\t\t\t\tarrModel6[9] = 4;\r\n\t\t\t\tarrModel6[10] = 0;\r\n\t\t\t\tarrModel6[11] = 0;\r\n\t\t\t\tarrModel6[12] = 0;\r\n\t\t\t\t\r\n\t\t\t\tarrModel7[2] = 1;\r\n\t\t\t\tarrModel7[3] = 2;\r\n\t\t\t\tarrModel7[4] = 3;\r\n\t\t\t\tarrModel7[5] = 0;\r\n\t\t\t\tarrModel7[6] = 0;\r\n\t\t\t\tarrModel7[7] = 0;\r\n\t\t\t\tarrModel7[8] = 0;\r\n\t\t\t\tarrModel7[9] = 0;\r\n\t\t\t\tarrModel7[10] = 3;\r\n\t\t\t\tarrModel7[11] = 2;\r\n\t\t\t\tarrModel7[12] = 1;\r\n\t\t\t\t\r\n\t\t\t\tvar insertG = 10;\r\n\t\t\t\tfunction init(){\r\n\t\t\t\t\tfor(i=2;i<=12;i++){\r\n\t\t\t\t\t\tif(document.getElementById(\"tbNum\"+i).readOnly == false){\r\n\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+i).checked = false;\r\n\t\t\t\t\t\t\tdocument.getElementById(\"tbNum\"+i).value = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdocument.getElementById(\"hidTimes\").value = 1;\r\n\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = 0;\r\n\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = 0;\r\n\t\t\t\t}\r\n\t\t\t\tfunction addNum(numID,chkID){\r\n\t\t\t\t\tif(document.getElementById(numID).readOnly == false){\r\n\t\t\t\t\t\tdocument.getElementById(numID).value=document.getElementById(numID).value==''?0:document.getElementById(numID).value;\r\n\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = document.getElementById(\"tbTotalG2\").value = parseInt(document.getElementById(\"tbTotalG1\").value) + insertG;\r\n\t\t\t\t\t\tdocument.getElementById(numID).value = parseInt(document.getElementById(numID).value) + insertG;\r\n\t\t\t\t\t\tdocument.getElementById(chkID).checked = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction subtractNum(numID,chkID){\r\n\t\t\t\t\tif(document.getElementById(numID).readOnly == false){\r\n\t\t\t\t\t\tif(document.getElementById(numID).value!=''){\r\n\t\t\t\t\t\t\tvar subValue = parseInt(document.getElementById(numID).value) > insertG ? insertG : parseInt(document.getElementById(numID).value)\r\n\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = document.getElementById(\"tbTotalG2\").value = parseInt(document.getElementById(\"tbTotalG1\").value) - subValue;\r\n\t\t\t\t\t\t\tdocument.getElementById(numID).value = parseInt(document.getElementById(numID).value) - subValue;\r\n\t\t\t\t\t\t\tif(document.getElementById(numID).value=='0'){\r\n\t\t\t\t\t\t\t\tdocument.getElementById(chkID).checked = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction chgTimes(numID,times){\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\tif(document.getElementById(numID).readOnly == false){\r\n\t\t\t\t\t\tif(parseInt(document.getElementById(numID).value * times) > 0){\r\n\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = parseInt(document.getElementById(\"tbTotalG1\").value) + parseInt(document.getElementById(numID).value) * times - parseInt(document.getElementById(numID).value);\r\n\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = document.getElementById(\"tbTotalG1\").value;\r\n\t\t\t\t\t\t\tdocument.getElementById(numID).value = parseInt(document.getElementById(numID).value) * times;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction clearNum(numID,chkID){\r\n\t\t\t\t\tif(document.getElementById(numID).readOnly == false){\r\n\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = document.getElementById(\"tbTotalG2\").value = parseInt(document.getElementById(\"tbTotalG1\").value) - parseInt(document.getElementById(numID).value);\r\n\t\t\t\t\t\tdocument.getElementById(numID).value = 0;\r\n\t\t\t\t\t\tdocument.getElementById(chkID).checked = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction insert(obj,numID){\r\n\t\t\t\t\tif(obj.checked){\r\n\t\t\t\t\t\tdocument.getElementById(numID).value = insertG;\r\n\t\t\t\t\t\tif(document.getElementById(\"tbTotalG1\").value == \"\"){\r\n\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = parseInt(document.getElementById(\"tbTotalG1\").value) + insertG;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tif(document.getElementById(\"tbTotalG1\").value == \"\"){\r\n\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = parseInt(document.getElementById(\"tbTotalG1\").value) - parseInt(document.getElementById(numID).value);\r\n\t\t\t\t\t\tdocument.getElementById(numID).value = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = document.getElementById(\"tbTotalG1\").value;\r\n\t\t\t\t}\r\n\t\t\t\tfunction input(obj,chkID){\r\n\t\t\t\t\tif(obj.value<=0){\r\n\t\t\t\t\t\tobj.value=0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(obj.readOnly == false){\r\n\t\t\t\t\t\tvar tmpMoney=0;\r\n\t\t\t\t\t\tif(obj.value != \"\"){\r\n\t\t\t\t\t\t\tif(chkInt(obj.value)==false){\r\n\t\t\t\t\t\t\t\tobj.value = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(obj.value != 0){\r\n\t\t\t\t\t\t\t\tdocument.getElementById(chkID).checked = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\tdocument.getElementById(chkID).checked = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tdocument.getElementById(chkID).checked = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tfor(i=2;i<=12;i++){\r\n\t\t\t\t\t\t\tvar id = document.getElementById(\"tbNum\"+i);\r\n\t\t\t\t\t\t\tif(id.readOnly == false){\r\n\t\t\t\t\t\t\t\tif(id.value != \"\"){\r\n\t\t\t\t\t\t\t\t\ttmpMoney += parseInt(id.value);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = document.getElementById(\"tbTotalG2\").value = tmpMoney;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction useModel(index){\r\n\t\t\t\t\tinit();\r\n\t\t\t\t\tvar arrModel = eval(\"arrModel\"+index);\r\n\t\t\t\t\tfor(i=2;i<arrModel.length;i++){\r\n\t\t\t\t\t\tif(document.getElementById(\"tbNum\"+i).readOnly == false){\r\n\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+i).checked = false;\r\n\t\t\t\t\t\t\tif(arrModel[i] > 0){\r\n\t\t\t\t\t\t\t\tdocument.getElementById(\"tbNum\"+i).value = arrModel[i];\r\n\t\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+i).checked = true;\r\n\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = parseInt(document.getElementById(\"tbTotalG1\").value) + arrModel[i];\r\n\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = parseInt(document.getElementById(\"tbTotalG2\").value) + arrModel[i];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction subSelect(){\r\n\t\t\t\t\tvar arrModel = eval(\"arrModel1\");\r\n\t\t\t\t\tfor(i=2;i<arrModel.length;i++){\r\n\t\t\t\t\t\tif(document.getElementById(\"tbNum\"+i).readOnly == false){\r\n\t\t\t\t\t\t\tif(arrModel[i] > 0){\r\n\t\t\t\t\t\t\t\tif(document.getElementById(\"tbChk\"+i).checked==false){\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbNum\"+i).value = Math.floor(arrModel[i] * document.getElementById(\"hidTimes\").value);\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+i).checked = true;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = Math.floor(parseInt(document.getElementById(\"tbTotalG1\").value) + arrModel[i] * document.getElementById(\"hidTimes\").value);\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = Math.floor(parseInt(document.getElementById(\"tbTotalG2\").value) + arrModel[i] * document.getElementById(\"hidTimes\").value);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+i).checked = false;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = parseInt(document.getElementById(\"tbTotalG1\").value) - document.getElementById(\"tbNum\"+i).value;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = parseInt(document.getElementById(\"tbTotalG2\").value) - document.getElementById(\"tbNum\"+i).value;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbNum\"+i).value = 0;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tfunction chgModel(index){\r\n\t\t\t\t\tinit();\r\n\t\t\t\t\tvar result = {\"arrJsonModel\":[";
echo $tzjs;
echo "]};\r\n\t\t\t\t\tif(result.arrJsonModel != null){\r\n\t\t\t\t\t\tfor(j=2;j<=12;j++){\r\n\t\t\t\t\t\t\tif(eval(\"result.arrJsonModel[index].N\"+j) > 0){\r\n\t\t\t\t\t\t\t\tif(document.getElementById(\"tbNum\"+j).readOnly == false){\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+j).checked = true;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbNum\"+j).value = eval(\"result.arrJsonModel[index].N\"+j);\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = parseInt(document.getElementById(\"tbTotalG1\").value) + parseInt(eval(\"result.arrJsonModel[index].N\"+j));\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = document.getElementById(\"tbTotalG1\").value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfunction chgAllTimes(times){\r\n\t\t\t\t\tdocument.getElementById(\"hidTimes\").value=document.getElementById(\"hidTimes\").value * times;\r\n\t\t\t\t\tfor(i=2;i<=12;i++){\r\n\t\t\t\t\t\tif(document.getElementById(\"tbNum\"+i).readOnly == false){\r\n\t\t\t\t\t\t\tif(parseInt(document.getElementById(\"tbNum\"+i).value) * times > 1){\r\n\t\t\t\t\t\t\t\tif(document.getElementById(\"tbNum\"+i).value > 0){\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = parseInt(document.getElementById(\"tbTotalG1\").value) + Math.floor(parseInt(document.getElementById(\"tbNum\"+i).value) * times) - parseInt(document.getElementById(\"tbNum\"+i).value);\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = document.getElementById(\"tbTotalG1\").value;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbNum\"+i).value = Math.floor(parseInt(document.getElementById(\"tbNum\"+i).value) * times);\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+i).checked = true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\tif(document.getElementById(\"tbNum\"+i).value > 0){\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = parseInt(document.getElementById(\"tbTotalG1\").value) - parseInt(document.getElementById(\"tbNum\"+i).value);\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbTotalG2\").value = document.getElementById(\"tbTotalG1\").value;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbNum\"+i).value = 0;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+i).checked = false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tfunction chkInt(int,minLength,maxLength,pattern){\r\n\t\t\t\t\tpattern = typeof(pattern) == 'undefined' ? '^-?[1-9]+[0-9]*\$' : pattern;\r\n\t\t\t\t\tpattern = new RegExp(pattern);\r\n\t\t\t\t\tif(pattern.test(int)==false){\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn chkStrLen(int,minLength,maxLength);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tfunction chkStrLen(str,minLength,maxLength){\r\n\t\t\t\t\tif(str.length < minLength) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(maxLength != null && str.length > maxLength) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tvar joyousno = \"";
echo $kgqh;
echo "\";\r\n\t\t\t\tfunction ShowSecond(cDate){\r\n\t\t\t\t\tif(joyousno != \"\"){\r\n\t\t\t\t\t\tif(cDate > 1){\r\n\t\t\t\t\t\t\tdocument.getElementById(\"fHappy\").innerHTML = \"离第\"+joyousno+\"期开奖还有\"+(--cDate)+\"秒\";\r\n\t\t\t\t\t\t\tsetTimeout(\"ShowSecond(\"+cDate+\")\",1000);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tdocument.getElementById(\"fHappy\").innerHTML = \"第\"+joyousno+\"期正在开奖，请刷新页面查看开奖号码。\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tShowSecond(parseInt(\"";
echo $kgtime;
echo "\"));\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t-->\r\n\t\t\t\t</script>\r\n\t\t\t</DIV>\r\n\t\t\t<DIV class=cl></DIV>\r\n\t\t</DIV>\r\n\t\t<DIV class=\"area960-b h5px\"></DIV>\r\n\t<!--Flink End-->\r\n\t<div class=\"blank10\"></div>\r\n\t<!--Footer Start-->\r\n";
include_once( "footer.php" );
echo "</DIV>";
?>
