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

include_once( "inc/conn.php" );
include_once( "inc/function.php" );
login_check( );
if ( $_GET['act'] == "save" )
{
		$ztsum = 0;
		$i = 2;
		for ( ;	$i < count( $_POST['tbNum'] ) + 2;	++$i	)
		{
				if ( $_POST['tbChk'][$i] )
				{
						$ztsum += $_POST['tbNum'][$i];
				}
		}
		if ( 200000000 < $ztsum )
		{
				echo "<script language=javascript>alert('对不起，您的投注请不要超过200000000');history.go(-1);</script>";
				exit( );
		}
		$tznum = implode( "|", $_POST['tbNum'] );
		if ( $_POST['tbID'] )
		{
				$db->query( "update ".$web_dbtop."game11_auto_tz set tzname='".str_check( $_POST['tbModelName'] )."',tzunm='".str_check( $tznum )."',tzpoints=".intval( $ztsum )." where id =".intval( $_POST['tbID'] ) );
				echo "<script language=javascript>alert('投注模式修改成功！');location.href='".( $_POST['pointerSubmitGo'] ? "joyousautoset.php" : "joyousmodel.php" )."';</script>";
				exit( );
		}
		$db->query( "INSERT INTO ".$web_dbtop."game11_auto_tz (uid,tzname,tzunm,tzpoints,tzid) VALUES (".intval( $_COOKIE['usersid'] ).",'".str_check( $_POST['tbModelName'] )."','".str_check( $tznum )."',".intval( $ztsum ).",".intval( $_POST['tbModelID'] ).")" );
		echo "<script language=javascript>alert('投注模式添加成功！');location.href='".( $_POST['pointerSubmitGo'] ? "joyousautoset.php" : "joyousmodel.php" )."';</script>";
		exit( );
}
if ( $_GET['act'] == "del" )
{
		if ( $_GET['id'] )
		{
				$db->query( "delete from ".$web_dbtop."game11_auto_tz where id=".intval( $_GET['id'] ) );
				echo "<script language=javascript>alert('投注模式删除成功！');location.href='joyousmodel.php';</script>";
				exit( );
		}
		echo "<script language=javascript>alert('没有该投注模式，无法删除！');history.go(-1);</script>";
		exit( );
}
$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 ) )
{
		$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]."\"}";
}
$tzjs = implode( ",", $game11tz_array );
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><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 class=\"current\"><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 background=\"images/game2_04.jpg\" class=\"font14\">投注模式编辑:</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=\"?act=save\" method=\"post\">\r\n                      <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">\r\n                        <tr>\r\n                          <td height=\"28\" colspan=\"4\" bgcolor=\"#FFFFFF\">&nbsp;&nbsp;<strong>选择投注模式：\r\n                                <input name=\"tbID\" id=\"hidID\" type=\"hidden\" value=\"\" />\r\n                                <select name=\"tbModelID\" id=\"tbModelID\" onchange=\"chgModel(this.selectedIndex)\">\r\n                                  ";
$tzname = array( "投注模式一", "投注模式二", "投注模式三", "投注模式四", "投注模式五", "投注模式六", "投注模式七", "投注模式八", "投注模式九", "投注模式十", "投注模式十一", "投注模式十二", "投注模式十三", "投注模式十四", "投注模式十五", "投注模式十六", "投注模式十七", "投注模式十八", "投注模式十九", "投注模式二十", "投注模式二一", "投注模式二二", "投注模式二三", "投注模式二四", "投注模式二五", "投注模式二六", "投注模式二七", "投注模式二八", "投注模式二九", "投注模式三十", "投注模式三一", "投注模式三二", "投注模式三三", "投注模式三四", "投注模式三五", "投注模式三六", "投注模式三七", "投注模式三八", "投注模式三九", "投注模式四十" );
$i = 1;
foreach ( $tzname as $tzarray )
{
		$query = $db->query( "Select tzname,tzid from ".$web_dbtop."game11_auto_tz where uid=".intval( $_COOKIE['usersid'] ).( " and tzid=".$i." Order by tzid asc" ) );
		if ( $rs = $db->fetch_array( $query ) )
		{
				echo "<option label=\"".$rs['tzname']."\" value=\"".$i."\">".$rs['tzname']."</option>";
		}
		else
		{
				echo "<option label=\"".$tzarray."\" value=\"".$i."\">".$tzarray."</option>";
		}
		++$i;
}
echo "                                </select>\r\n&nbsp;&nbsp;更改模式名称:\r\n              <input type=\"text\" maxlength=\"10\" name=\"tbModelName\" id=\"tbModelName\" value=\"\" />\r\n                            </strong>\r\n                              <input type=\"button\" value=\"复位\" onclick=\"chgModel(\$('tbModelID').selectedIndex)\" />\r\n                              <input type=\"button\" value=\"删除\" onclick=\"javascript:location.href='joyousmodel.php?act=del&id='+\$('tbID').value\" />\r\n                          </td>\r\n                        </tr>\r\n                        <tr>\r\n                          <td height=\"28\" colspan=\"4\" bgcolor=\"#FFFFFF\"><strong>&nbsp; <strong>\r\n                            <label></label>\r\n                            </strong>\r\n                                <label> </label>\r\n              投注模式详细\r\n              <label>：</label>\r\n                          </strong></td>\r\n                        </tr>\r\n                        <tr>\r\n                          <td height=\"28\" colspan=\"4\" bgcolor=\"#FFFFFF\"><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=\"\" />\r\n                              <input name=\"pointerSubmit2\" value=\" 保  存 \" type=\"submit\" />\r\n                              <input value=\"保存并进入自动投注\" type=\"submit\" name=\"pointerSubmitGo\" /></td>\r\n                        </tr>\r\n                        <tr>\r\n                          <td height=\"28\" colspan=\"4\" 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=\"30%\" height=\"28\" align=\"center\" background=\"images/joyousbj.jpg\" bgcolor=\"#FFFFFF\"  class=\"font-white\">预测结果</td>\r\n                          <td 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	)
{
		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\"><input name=\"tbChk[";
		echo $i;
		echo "]\" id=\"tbChk";
		echo $i;
		echo "\" type=\"checkbox\" onclick=\"insert(this,'tbNum";
		echo $i;
		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=\"\" onblur=\"input(this,'tbChk";
		echo $i;
		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=\"4\" align=\"center\" bgcolor=\"#FFFFFF\">我的投注总额:\r\n                              <input id=\"tbTotalG2\" readonly=\"readOnly\" value=\"\" /></td>\r\n                        </tr>\r\n                        <tr>\r\n                          <td height=\"32\" colspan=\"4\" align=\"center\" bgcolor=\"#FFFFFF\"><input name=\"btnSubmit\" value=\" 保  存 \" type=\"submit\" /></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\tdocument.getElementById(numID).value=document.getElementById(numID).value==''?0:document.getElementById(numID).value;\r\n\t\t\t\t\tdocument.getElementById(\"tbTotalG1\").value = document.getElementById(\"tbTotalG2\").value = parseInt(document.getElementById(\"tbTotalG1\").value) + insertG;\r\n\t\t\t\t\tdocument.getElementById(numID).value = parseInt(document.getElementById(numID).value) + insertG;\r\n\t\t\t\t\tdocument.getElementById(chkID).checked = true;\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).value!=''){\r\n\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\tdocument.getElementById(\"tbTotalG1\").value = document.getElementById(\"tbTotalG2\").value = parseInt(document.getElementById(\"tbTotalG1\").value) - subValue;\r\n\t\t\t\t\t\tdocument.getElementById(numID).value = parseInt(document.getElementById(numID).value) - subValue;\r\n\t\t\t\t\t\tif(document.getElementById(numID).value=='0'){\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}\r\n\t\t\t\t}\r\n\t\t\t\tfunction chgTimes(numID,times){\r\n\t\t\t\t\tif(parseInt(document.getElementById(numID).value * times) > 0){\r\n\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\tdocument.getElementById(\"tbTotalG2\").value = document.getElementById(\"tbTotalG1\").value;\r\n\t\t\t\t\t\tdocument.getElementById(numID).value = parseInt(document.getElementById(numID).value) * times;\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\tdocument.getElementById(\"tbTotalG1\").value = document.getElementById(\"tbTotalG2\").value = parseInt(document.getElementById(\"tbTotalG1\").value) - parseInt(document.getElementById(numID).value);\r\n\t\t\t\t\tdocument.getElementById(numID).value = 0;\r\n\t\t\t\t\tdocument.getElementById(chkID).checked = false;\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\tfunction chgModel(index){\r\n\t\t\t\t\tinit();\r\n\t\t\t\t\tvar modelID = document.getElementById(\"tbModelID\").options[index].value;\r\n\t\t\t\t\tdocument.getElementById(\"hidID\").value = '';\r\n\t\t\t\t\tvar flag = false;\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\tdocument.getElementById(\"tbModelName\").value = document.getElementById(\"tbModelID\").options[index].text;\t\r\n\t\t\t\t\t\tfor(i=0;i<result.arrJsonModel.length;i++){\r\n\t\t\t\t\t\t\tif(result.arrJsonModel[i].modelID==modelID){\r\n\t\t\t\t\t\t\t\tflag = true;\r\n\t\t\t\t\t\t\t\tindex = 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\tif(flag){\r\n\t\t\t\t\t\t\tfor(j=2;j<=12;j++){\r\n\t\t\t\t\t\t\t\tif(eval(\"result.arrJsonModel[index].N\"+j) > 0){\r\n\t\t\t\t\t\t\t\t\tif(document.getElementById(\"tbNum\"+j).readOnly == false){\r\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"tbChk\"+j).checked = true;\r\n\t\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\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\t}\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\tdocument.getElementById(\"tbTotalG2\").value = document.getElementById(\"tbTotalG1\").value;\r\n\t\t\t\t\t\t\tdocument.getElementById(\"hidID\").value = result.arrJsonModel[index].ID;\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\tchgModel(0);\r\n\t\t\t\tfunction chgAllTimes(times){\r\n\t\t\t\t  document.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\tfunction \$(obj){\r\n\t\t\t\t\treturn typeof(obj) == \"string\" ? document.getElementById(obj) : obj;\r\n\t\t\t\t}\r\n\t\t\t\t-->\r\n\t\t\t\t</script>\r\n\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>";
?>
