﻿
/* 时时乐和值分布图 */
show_hzzs = function(n) {
    var html = "<div style=\"width:980px;margin:0 auto; \"><table class=\"wrap_body\" border=\"0\" cellpadding=\"0\" cellspacing=\"5\"><tr><td>";
    html += "<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> \
                   <tr><td align=\"center\" class=\"Title_lottery\">时时乐和值分布图</td></tr> \
                   <tr><td align=\"center\"><a href=\"?id=30\">最近30期</a> &nbsp; <a href=\"?id=50\">最近50期</a> &nbsp; <a href=\"?id=100\">最近100期</a></td></tr> \
                   <tr> \
                     <td align=\"center\" class=\"choose\"> 标注形式选择：\
                       <input type=\"checkbox\" name=\"checkbox\" id=\"c_d\" onclick=\"map.select_checkbox('gYL',this);\" /> <label for=\"c_d\">不带遗漏数据</label> \
                       <input type=\"checkbox\" name=\"checkbox\" id=\"c_x\" onclick=\"map.select_checkbox('gLine',this);\" checked=\"checked\" /> <label for=\"c_x\">带折线</label> \
                       <input type=\"checkbox\" name=\"checkbox\" id=\"c_o\" onclick=\"map.select_checkbox('gLayer',this);\" /> <label for=\"c_o\">遗漏分层</label> \
                       <input type=\"checkbox\" name=\"checkbox\" id=\"c_l\" onclick=\"map.select_checkbox('spaceLine',this);\" checked=\"checked\" /> <label for=\"c_l\">辅助线</label> \
                     </td> \
                   </tr> \
                 </table> \
                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" class=\"tab_bg\"> \
                   <tbody id=\"head\"> \
                     <tr> \
                       <td rowspan=\"2\" class=\"padd_1\"><img src=\"images/space.gif\" width=\"1\" height=\"1\" /></td> \
		               <td rowspan=\"2\" class=\"bLine\"><img src=\"images/space.gif\" width=\"60\" height=\"1\" /><br /><B>期号</B></td> \
		               <td rowspan=\"2\" class=\"padd_1\"><img src=\"images/space.gif\" width=\"1\" height=\"1\" /></td> \
		               <td rowspan=\"2\" class=\"bLine\"><img src=\"images/space.gif\" width=\"60\" height=\"1\" /><br /><B>开奖号码</B></td> \
		               <td rowspan=\"2\" class=\"padd_1\"><img src=\"images/space.gif\" width=\"1\" height=\"1\" /></td> \
					   <td rowspan=\"2\" class=\"bLine\"><img src=\"images/space.gif\" width=\"40\" height=\"1\" /><br /><B>时间</B></td> \
		               <td rowspan=\"2\" class=\"padd_1\"><img src=\"images/space.gif\" width=\"1\" height=\"1\" /></td> \
		               <td colspan=\"28\"><FONT COLOR=\"#BD5151\"><B>和值分布</B></FONT></td> \
		               <td rowspan=\"2\" class=\"padd_1\"><img src=\"images/space.gif\" width=\"1\" height=\"1\" /></td> \
		               <td colspan=\"10\"><FONT COLOR=\"#1C74AA\"><B>和尾分布</B></FONT></td> \
		               <td rowspan=\"2\" class=\"padd_1\"><img src=\"images/space.gif\" width=\"1\" height=\"1\" /></td> \
		             </tr> \
		             <tr> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />0</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />1</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />2</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />3</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />4</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />5</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />6</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />7</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />8</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />9</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />10</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />11</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />12</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />13</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />14</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />15</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />16</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />17</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />18</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />19</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />20</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />21</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />22</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />23</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />24</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />25</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />26</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />27</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />0</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />1</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />2</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />3</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />4</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />5</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />6</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />7</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />8</td> \
		               <td class=\"line_top bLine\"><img src=\"images/space.gif\" width=\"18\" height=\"1\" /><br />9</td> \
		             </tr> \
		           </tbody>";

    // 参数说明：号码(","：分割符；"-"：空列；"->"：直接输出)$背景样式$字体样式$球样式$是否连线,连线颜色,连线尺寸
    var colspan = ["0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27$cbg1$yl01$chartBall01$1,#BD5151,2", "0,1,2,3,4,5,6,7,8,9$cbg2$yl02$chartBall02$1,#1C74AA,2"];

    // 初始化图表显示类
    map = new tb.display(nameXML, colspan, true, true, "0_0_2");

    html += map.show_map(n) + "</table></td></tr>";
    html += "<tr><td colspan=\"47\" class=\"boot_css\"> \
                <div style=\"width:300px;float:left;\"> \
                 参数说明： <br/> \
                 [遗漏分层] 将当期遗漏标注出来 <br/> \
                 [辅助线] 每五期使用分隔线，使横向导航更加清晰 \
                </div> \
             </td></tr>";
    html += "</table></div>";

    document.write(html);

    map.operate();
}

show_hzzs(nExpect(30, 20, 100));

/************************ 以下为图表选号 ************************/

/* 预选区选号事件 */
select_singleball = function(css, obj) {
    var cols = 3;
    if (map.showNumber) cols += 2;
	if (map.showTime) cols += 2;

    if (obj.cellIndex - cols > 28) {
        if ((tb.ball).test(obj.className)) {
            obj.className = obj.className.replace(" " + css, "");
        } else {
            obj.className += " " + css;
        }
    } else {
        var flag = true;
        var tr_vote = obj.parentNode.cells;
        if ((tb.ball).test(obj.className)) flag = false;
        for (var i = 0; i < 28; i++) {
            var td_vote = tr_vote.item(i + cols);
            if ((tb.ball).test(td_vote.className)) {
                td_vote.className = td_vote.className.replace(" " + css, "");
            }
        }
        if (flag) obj.className += " " + css;
    }
}

/* 处理行选号 */
function docompose_code(temp) {
    var s = [];
    var code = temp.split("|");
    if (code[0] == "") {
        s.push("未选择");
        s.push("");
        s.push("");
        s.push("");
        s.push("<a href=\"javascript:void(0);\" onclick=\"change_code(this);\">添加</a>");
        s.push("");
    } else {
        var select = code[0];
        var choice = select_choice();
		var zhu = getnzhu(select, choice);
        if (zhu > 0) {
            s.push("√");
            s.push(select);
            s.push(zhu);
        } else {
            s.push("玩法不符");
            s.push(select);
            s.push("");
        }
        s.push("和值投注");
        s.push("<a href=\"javascript:void(0);\" onclick=\"change_code(this);\">修改</a>");
        s.push("<img src=\"images/close.gif\" style=\" cursor:pointer;\" onclick=\"delete_code(this);\" />");
    }
    return s;
}

/* 计算注数 */
var zhi = new Array(1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 63, 69, 73, 75, 75, 73, 69, 63, 55, 45, 36, 28, 21, 15, 10, 6, 3, 1);
var zu3 = new Array(0, 1, 2, 1, 3, 3, 3, 4, 5, 4, 5, 5, 4, 5, 5, 4, 5, 5, 4, 5, 4, 3, 3, 3, 1, 2, 1, 0);
var zu6 = new Array(0, 0, 0, 1, 1, 2, 3, 4, 5, 7, 8, 9, 10, 10, 10, 10, 9, 8, 7, 5, 4, 3, 2, 1, 1, 0, 0, 0);
function getnzhu(code, choice) {
    var zhu = 0;
    code = parseInt(code, 10);
    switch (choice) {
        case "直选":
            zhu = zhi[code];
            break;
        case "组选":
            zhu = zu3[code] + zu6[code];
            break;
        case "组三":
            zhu = zu3[code];
            break;
        case "组六":
            zhu = zu6[code];
            break;
    }
    return zhu;
}

show_layerHTML();
