var opt1 = true;
var opt2 = true;
var opt3 = false;
var opt4 = false;
var opt5 = false;
var isPoint = false;
$(function () {

    checkhHtml5();

    $("#btn_submitExam").bind('click', function () {
        $('#btn_submitExam').linkbutton('disable');
        submitBackExam();
    });


    $('#submitDialog').dialog({
        onBeforeOpen: function () {
            $('#btn_submitExam').linkbutton('enable');
        }
    });

    $(document).bind('keydown.+', function () {
        var ff = $('#next_b');
        ff.click();
        isPoint = false;
    });

    $(document).bind('keydown.-', function () {
        var ff = $('#pre_b');
        ff.click();
        isPoint = false;
    });

    $(document).bind('keydown./', function () {
        submitExam();
        isPoint = false;
    });

    $(document).bind('keydown.0', function () {
        if ($('#submitDialog').parent().css('display') != 'none') {
            submitBackExam();
            isPoint = false;
        }
    });

    $(document).bind('keydown.1', function () {
        var qustType = $('#qustType').val();
        if (qustType == '002') {
            single('1')
            isPoint = false;
        }

        if (qustType == '003') {
            if ($("input[name='multi'][value=1]").is(':checked')) {
                $("input[name='multi'][value=1]").removeAttr("checked");
            } else {
                $("input[name='multi'][value=1]").prop("checked", true);
            }
        }
    });

    $(document).bind('keydown.2', function () {
        var qustType = $('#qustType').val();
        if (qustType == '002') {
            single('2')
        }

        if (qustType == '003') {
            if ($("input[name='multi'][value=2]").is(':checked')) {
                $("input[name='multi'][value=2]").removeAttr("checked");
            } else {
                $("input[name='multi'][value=2]").prop("checked", true);
            }
        }
    });

    $(document).bind('keydown.3', function () {
        var qustType = $('#qustType').val();
        if (qustType == '002') {
            single('3')
        }

        if (qustType == '003') {
            if ($("input[name='multi'][value=3]").is(':checked')) {
                $("input[name='multi'][value=3]").removeAttr("checked");
            } else {
                $("input[name='multi'][value=3]").prop("checked", true);
            }
        }
    });

    $(document).bind('keydown.4', function (e) {
        var qustType = $('#qustType').val();
        if (qustType == '001') {
            judge(1)
        }
        return;

    });

    $(document).bind('keydown.5', function () {
        var qustType = $('#qustType').val();
        if (qustType == '002') {
            single('4')
        }

        if (qustType == '003') {
            if ($("input[name='multi'][value=4]").is(':checked')) {
                $("input[name='multi'][value=4]").removeAttr("checked");
            } else {
                $("input[name='multi'][value=4]").prop("checked", true);
            }
        }
    });

    $(document).bind('keydown.6', function () {
        var qustType = $('#qustType').val();
        if (qustType == '001') {
            judge(2)
        }

    });

    $(document).bind('keydown.return', function () {
        var qustType = $('#qustType').val();
        if ((qustType == '003') && ($('#errorWindows').parent().css('display') == 'none')) {
            selected();
        }

    });

    $(document).bind('keydown', '.', function (e) {

        if (e.keyCode == '110') {
            if ($('#errorWindows').parent().css('display') != 'none') {
                $('#errorWindows').window('close');
                return;
            }

            if ($('#submitDialog').parent().css('display') != 'none') {
                $('#submitDialog').dialog('close');
                return;
            }
        }




    });

    my_jPlayer = $("#jquery_jplayer"),

	my_jPlayer.jPlayer({
	    /*ready: function () {
             $(this).jPlayer("setMedia", {
               mp3: "<%=basePath%>sound/BEEP1.mp3" // Defines the m4v url
             }); // Attempts to Auto-Play the media
           },*/
	    swfPath: "<%=basePath%>js",
	    cssSelectorAncestor: "#jp_container",
	    supplied: "mp3,wav",
	    wmode: "window"
	});

    $('#content').panel({
        onLoad: function () {
            if (opt1) {
                $('#result').css('display', '');
            } else {
                $('#result').css('display', 'none');
            }

            if (opt3) {
                $('#notes').css('display', '');
            } else {
                $('#notes').css('display', 'none');
            }

            if (opt4) {
                playAudio();
            }

            setHeight();
            // alert(1);
            var img = $('#showImg').val();

            //	var ps_height = $('#cc').layout('panel','south').height();

            var ps_height = '250';  //250
            var out = "<a class='example-image-link' data-lightbox='example-set' href='" + img + "'>"
			+ "<img  src='" + img + "' style='height:" + ps_height + "px;' " + 'onerror="javascript:this.src=\'res/jpg/000000.jpg\'"></a>';

            //	alert(out);

            $('#lightbox123').html(out);
            //				$('#lightbox').attr('href',img);
            //				$("#lightbox").css('display','block'); 
            //				$('#boxImg').attr('src',img);
            for (i in document.images) document.images[i].ondragstart = imgdragstart;

        }
    });


    //选择试题，刷新试题内容
    $("#questions > #qulist > div").bind("click", function () {
        event.preventDefault();
        event.stopPropagation();
        my_jPlayer.jPlayer("stop");

        //添加选择样式
        $("#questions > #qulist > div").removeClass("pointboxcurrentks");
        $(this).addClass("pointboxcurrentks");
        var mask = 0;
        //if ($(this).hasClass("pointboxwrongks") || $(this).hasClass("pointboxrightks")) {
            mask = 1;
       // }

        var dd = $(this).attr('id');
        var isred = $(this).attr('data-isred');
        var _id = $(this).html();
        if (_id.indexOf("<span>") > 0) {
            _id = _id.substring(0, _id.indexOf("<span>"));
        }
        var token = $('#token').val();

        // alert(isred);
       // debugger;
       // alert(dd);

        $('#content').panel('refresh', '/Question/GetQuestion?code=' + dd + "&token=" + token + "&id=" + _id + "&lib=" + lib + "&times=" + ts + "&isred="+isred+"&mask=" + mask);

        //选题区域滚动

        var container = $("#questions"),
		scrollTo = $(this);

        container.scrollTop(
	scrollTo.offset().top - container.offset().top + container.scrollTop()
		);

        // Or you can animate the scrolling: 
        //		container.animate({ 
        //		scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop() 
        //		});​ 
    });

    //显示答案
    $('#opt1').bind("change", function () {
        opt1 = !opt1;

        if ($('#result').length > 0) {
            //alert(opt1);
            if (opt1) {
                $('#result').css('display', '');
            } else {
                $('#result').css('display', 'none');
            }
        }
    });
    //显示对错
    $('#opt2').bind("change", function () {
        opt2 = !opt2;
        //alert(opt2);
        if (opt2) {
            $('#yesNo').css('display', '');
        } else {
            $('#yesNo').css('display', 'none');
        }
    });
    //显示讲解
    $('#opt3').bind("change", function () {
        opt3 = !opt3;
        if (opt3) {
            $('#notes').css('display', '');
        } else {
            $('#notes').css('display', 'none');
        }

    });
    //语音讲解
    $('#opt4').bind("change", function () {
        opt4 = !opt4;
        if (!opt4) {
            my_jPlayer.jPlayer("stop");
        } else {
            playAudio();
        }
    });
    //语音提示
    $('#opt5').bind("change", function () {
        opt5 = !opt5;
        alert(opt5);
    });


    formatResult(0, 0);

    $('#questions > #qulist > div:first').click();

    //timedCount();

    examTimeCount();
});

function setHeight() {
    var c = $('#cc');
    var p = c.layout('panel', 'center');    // get the center panel
    var ps = c.layout('panel', 'south');
    var pw = c.layout('panel', 'west');
    var pe = c.layout('panel', 'east');
    var oldHeight = p.panel('panel').outerHeight();

    if (oldHeight < 400) {
        p.panel('resize', { height: '400' });
        ps.panel('resize', {
            height: c.height() - 400,
            top: 400
        });
        pw.panel('resize', { height: '400' });
        pe.panel('resize', { height: '400' });
        // $('#boxImg').height(c.outerHeight()-405);
    }

    if (oldHeight > 420) {
        p.panel('resize', { height: '100%' });
        ps.panel('resize', {
            height: c.height() - 400,
            top: 400
        });
        pw.panel('resize', { height: '100%' });
        pe.panel('resize', { height: '100%' });
        // $('#boxImg').height(c.outerHeight()-405);
        // alert(1);

    }



    // p.panel('resize', {height:'auto'});
    //     var newHeight = p.panel('panel').outerHeight();
    //     c.layout('resize',{
    //         height: (c.height() + newHeight - oldHeight)
    //     });
}

function submitExam() {
    var fl = $('#questions > #qulist > div').length;

    var f1 = $('#questions > #qulist > div').filter(".pointboxwrongks").length;

    var f2 = $('#questions > #qulist > div').filter(".pointboxrightks").length;

    var f3 = fl - f1 - f2;
    if (f3 > 0) {
        $('#showAlert').html('1.尚有' + f3 + '道题未做，是否交卷<br>' +
				'2.点击【确认交卷】，将提交考试成绩，结束考试！<br>' +
				'3.点击【继续考试】，将关闭提示窗口，继续考试！');

    } else {
        $('#showAlert').html('1.点击【确认交卷】，将提交考试成绩，结束考试！<br>' +
				'2.点击【继续考试】，将关闭提示窗口，继续考试！');

    }
    $('#submitDialog').dialog('open');

}

function submitBackExam() {
    clearInterval(_timer);
    $('#infoWindows').panel('open').panel('refresh', '/Question/SubmitExam?examType=2&token=' + $('#token').val());
}

function tryReExam() {
    $.messager.confirm('注意', '本操作会只会展现错误数据', function (r) {
        if (r) {
            reExam();
        }
    });
}

function reExam() {

    $('#reToken').val($('#token').val());
    $("#form1").submit();
}

//下一题
function next(code) {
    var selectItem = $('#selected').val();
    var qustType = $('#qustType').val();

    if (qustType == "003" && selectItem == 1) {
        selected();
    }
    var ff = $('#' + code + '+ div');
    if (ff.length == 0) {
        $.messager.alert('Angel交规速成系统', '已经到最后一题，请点击交卷!', 'info');
    } else {
        ff.click();
    }

}

//上一题
function proe(code) {
    var fl = $('#questions > #qulist > div');
    var first = $('#questions > #qulist > div:first');
    if (first.attr('id') == code) {
        alert("已经是第一题");
        return;
    }
    var first;
    $.each(fl, function (i, n) {
        if (n.id != code) {
            first = $(n);
        } else {

            first.click();
            return;
        }

    });

}

//判断题
function judge(re) {
    var code = $('#code').val();
    if ($('#' + code).hasClass("pointboxwrongks") || $('#' + code).hasClass("pointboxrightks")) {
        return;
    }

   // alert("111111111");
    var arr = ['', '√', '×'];
    var result = $('#anwser').val();
    var out = "";
  
   // takeAnwser(arr[re]);


    if (re == result) {
        //alert("对");
        takeCSSRight();
        takeRight()
        out = '<img src="/image/chs_' + re + '.png"  style="height: 32px; width: 32px;">';
        $('#choses').html("<div style='margin-top: 10px;float: left;'>" + "您的答案:</div>" + out);
        if (opt2) {
          //  $('#yesNo').html("<img  src='/image/yes-v3.png' style='width: 32px;height: 32px;'/>");
        }
        putResult(1, re, result);
    } else {
        takeCSSWrong();
        takeError();
        setTimeout(playAudio, 1000);
        out = '<img src="/image/chs_' + re + '.png"  style="height: 32px; width: 32px;">';
        $('#choses').html("<div style='margin-top: 10px;float: left;'>" + "您的答案:</div>" + out);
        if (opt2) {
            var ff = $(".questionconents").html();
            //alert(111);
            $('#qcontents').html(ff);
            $('#isokreslut').html("<div style='margin-top: 10px;float: left;font-size:18px;'>" + "正确答案:" + "<img  src='/image/chs_" + result + ".png' style='width: 32px;height: 32px;font-size:18px;'/></div><div style='margin-top: 10px;margin-left:10px;float: left;font-size:18px;'>" + "您的答案:" + out + "</div>");
            $('#errorWindows').window('open');
            setTimeout("errorwindow()", 6000);
          //  $('#yesNo').html("<img  src='/image/red-x.png' style='width: 32px;height: 32px;'/>");
        }
        putResult(2, re, result);
        if (isAB > 1) {
            //var ff = $("#questionconents").html();
   
            //$('#qcontents').html(ff);

            //$('#errorWindows').window('open');
        }

        //if (opt1) {
         //   $('#result').html("<div style='margin-top: 10px;float: left;'>" + "正确答案:</div>" + "<img  src='/image/chs_" + result + ".png' style='width: 32px;height: 32px;'/>");
      //  }

    }
}

function errorwindow(){
    $('#errorWindows').window('close');
}

function single(re) {
    var code = $('#code').val();
    if ($('#' + code).hasClass("pointboxwrongks") || $('#' + code).hasClass("pointboxrightks")) {
        return;
    }
    var arr = ['', 'A', 'B', 'C', 'D'];
    var result = $('#anwser').val();
    var out = "";
    //takeAnwser(arr[re]);
    if (re == result) {
        //alert("对");
        takeRight()
        takeCSSRight();
        out = '<img src="/image/b_' + arr[re] + '.png"  style="height: 32px; width: 32px;">';
        $('#choses').html("<div style='margin-top: 10px;float: left;'>" + "您的答案:</div>" + out);
        if (opt2) {
           // $('#yesNo').html("<img  src='/image/yes-v3.png' style='width: 32px;height: 32px;'/>");
        }
        putResult(1, re, result);
    } else {

        takeError()
        takeCSSWrong();
        out = '<img src="/image/b_' + arr[re] + '.png"  style="height: 32px; width: 32px;">';
        $('#choses').html("<div style='margin-top: 10px;float: left;'>" + "您的答案:</div>" + out);
        if (opt2) {
            var ff = $(".questionconents").html();
            //alert(111);
            $('#qcontents').html(ff);
            $('#isokreslut').html("<div style='margin-top: 10px;float: left;font-size:18px;'>" + "正确答案:" + "<img  src='/image/b_" + arr[result] + ".png' style='width: 32px;height: 32px;'/></div><div style='margin-top: 10px;float: left;font-size:18px;margin-left:10px;'>" + "您的答案:" + out + "</div>");
            $('#errorWindows').window('open');
            setTimeout("errorwindow()", 6000);
          //  $('#yesNo').html("<img  src='/image/red-x.png' style='width: 32px;height: 32px;'/>");
        }
        putResult(2, re, result);

        if (opt1) {
          //  $('#result').html("<div style='margin-top: 10px;float: left;'>" + "正确答案:</div>" + "<img  src='/image/b_" + arr[result] + ".png' style='width: 32px;height: 32px;'/>");
        }

        if (isAB > 1) {
            //var ff = $("#notes > span:first").html();

            //$('#qresult').html("正确答案：<img  src='"+basePath+"/image/b_"+arr[result]+".jpg' style='width: 32px;height: 32px;'/>");
            //  $('#qcontents').html(ff);    //关闭错误讲解
            // $('#errorWindows').window('open');
        }
    }


}

function takeAnwser(as) {
    var code = $('#code').val();
   // $('#' + code + ' > span').html(as);
}

function takeCSSRight() {
    var code = $('#code').val();
    $('#' + code).removeClass();
    $('#' + code).toggleClass("pointboxks pointboxrightks");
    if ($('#' + code).attr("isW") == 1) {
         $('#' + code).toggleClass("kaocssisok");
    }
}

function takeCSSWrong() {
    var code = $('#code').val();
    $('#' + code).removeClass();
    $('#' + code).attr("isW", 1);
    $('#' + code).toggleClass("pointboxks pointboxwrongks");
}

//正确语音提示
function takeRight() {
    my_jPlayer.jPlayer("setMedia", {
        mp3: basePath + "sound/right.wav"
    });

    my_jPlayer.jPlayer("play");
}

//错误语音提示
function takeError() {
    my_jPlayer.jPlayer("setMedia", {
        mp3: basePath + "sound/wrong.wav"
    });

    my_jPlayer.jPlayer("play");
    setTimeout(playAudio, 1000);
}

function playAudio() {
    //var ff = $('#audio').val();
    if (opt4) {
        /* my_jPlayer.jPlayer("setMedia", {
			 	mp3:$('#audio').val()
		      }); 
		
		my_jPlayer.jPlayer("play");*/
        audioPlay();
    }

}

function audioPlay() {
    my_jPlayer.jPlayer("setMedia", {
        mp3: $('#audio').val()
    });

    my_jPlayer.jPlayer("play");
}

//后台写入结果
function putResult(result, doAnswer, answer) {
 
    $.ajax({

        url: '/Question/PutResult',
        data: {
            'code': $('#code').val(),
            'token': $('#token').val(),
            'times': ts,
            'isAB': isAB,
            'result': result,
            'doAnswer': doAnswer,
            'answer': answer,
            'orderlist': $('#orderlist').val()
        },
        cache: false,
        dataType: "json",
        success: function (data) {

            if (data.success) {
                formatResult(data.firstOk.wrong, data.firstOk.first + data.firstOk.wrong, data.score);
                lib = data.lib;
                firstOk = data.firstOk;

                if ((isAB == 2) && (data.finishScore < data.targetScore)) {

                    //submitBackExam();
                }
            }




            //		console.info(data);

        }

    });
}

function formatResult(num, total, score) {
    var fl = $('#questions > #qulist > div').length;
    $("#allQ").html(fl);

    var f1 = $('#questions > #qulist > div').filter(".pointboxwrongks").length;
    $("#WQ").html(f1);

    var f2 = $('#questions > #qulist > div').filter(".pointboxrightks").length;
    $("#RQ").html(f2);

    var f3 = fl - f1 - f2;
    $("#UQ").html(f3);

    //$('#firstOK').html(GetPercent(num, total));
    $('#firstOK').html(GetPercent(fl - num, fl));
    $('#score').html(score);

}

function GetPercent(num, total) {
    var _num = 0;
    var _total = 0;
    if (_first > 0 || _all > 0) {
        var _num = _first;
        var _total = _all;
        _first = 0;
        _all = 0;
    } else {
        _num = parseFloat(num);
        _total = parseFloat(total);
    }

    if (isNaN(_num) || isNaN(_total)) {
        return "-";
    }
    return _total <= 0 ? "0%" : (Math.round(_num / _total * 10000) / 100.00 + "%");
}


function multi(obj) {
    var code = $('#code').val();
    if ($('#' + code).hasClass("pointboxwrongks") || $('#' + code).hasClass("pointboxrightks")) {
        return;
    }

    var p = $(obj).parent();
    //$(p).toggleClass("pointboxright");

    if ($("input[name='multi'][value=" + $(p).data("v") + "]").is(':checked')) {
        $("input[name='multi'][value=" + $(p).data("v") + "]").removeAttr("checked");
    } else {
        $("input[name='multi'][value=" + $(p).data("v") + "]").prop("checked", true);
    }

    //$("input[name='multi'][value="+$(p).data("v")+"]").attr("checked",'checked');
}

function sort1(obj) {
    var arr = obj;
    arr.sort(function (a, b) { return a < b ? 1 : -1 });
    return arr;
}

function chilckMe(me) {
    if (me.checked) {
        $(me).prop("checked", true);
    }
    else {
        $(me).removeAttr("checked");
    }
}



//http://localhost:8080/exam//image/balloon_A.png
//http://localhost:8080/exam//image/balloon_A.png

function selected() {
    var code = $('#code').val();

    //alert(code);
    if ($('#' + code).hasClass("pointboxwrongks") || $('#' + code).hasClass("pointboxrightks")) {
        //alert("当前题已做过");
        return;
    }

    $('#selected').val("2");
    var items = $("input[name='multi']:checked");
    if (items.length == 0) {
        alert("请选择答案");
        return;
    }
    var arr = ['', 'A', 'B', 'C', 'D'];
    var a = [];// 创建数组
     out = "";
   // debugger;
   // console.log(items);

    items.each(function () {
        a.push($(this).val());
        //out=out+'<img src="'+basePath+'/image/b_'+arr[$(this).val()]+'.jpg"  style="height: 32px; width: 32px;">';
        out = out + arr[$(this).val()];
        //alert($(this).val());

    });
    re = a.join("");

   // takeAnwser(out); 正常考试是带正确和错误标识的，考试就显示成功失败绿色或者红色！
    var result = $('#anwser').val();

    if (re == result) {
        takeRight()
        takeCSSRight();

        $('#choses').html("<div style='margin-top: 10px;float: left;'>" + "您的答案:" + out + "</div>");
        if (opt2) {
         //   $('#yesNo').html("<img  src='/image/yes-v3.png' style='width: 32px;height: 32px;'/>");
        }
        putResult(1, re, result);
    } else {
       // takeError()
        takeCSSWrong();
        $('#choses').html("<div style='margin-top: 10px;float: left;'>" + "您的答案:" + out + "</div>");

        /*正确答案strat*/
        var rout = "";
        rb = result.split("");
        $.each(rb, function (i, rn) {
            rout = rout + arr[rn];
        });
        /*正确答案end*/

        //alert(opt2);
        if (opt2) {
            //  $('#yesNo').html("<img  src='/image/red-x.png' style='width: 32px;height: 32px;'/>");

            var ff = $(".questionconents").html();
            $('#qcontents').html(ff);
            $("#qcontents > input").remove();
            $('#isokreslut').html("<div style='margin-top: 10px;float: left;font-size:18px;'>" + "正确答案:" +rout+ "</div><div style='margin-top: 10px;float: left;font-size:18px;margin-left:10px;'>" + "您的答案:" + out + "</div>");
            $('#errorWindows').window('open');
           // setTimeout("errorwindow()", 6000);
        }
        putResult(2, re, result);

        //if (isAB > 1) {
        //    var ff = $("#notes > span:first").html();
        //    $('#qcontents').html(ff);
        //    $('#qresult').html("正确答案："+rout);
        //    //$('#errorWindows').window('open');
        //}
    }


}

function selected_bak() {
    var arr = ['', 'A', 'B', 'C', 'D'];
    var a = [];// 创建数组
    var items = $('#anwsers > div ').filter(".pointboxrightks");
    out = "";
    $(items).each(function () {
        a.unshift($(this).data("v")); // 添加到第一个位置
        out = '<img src="/image/balloon_' + arr[$(this).data("v")] + '.png"  style="height: 32px; width: 32px;">' + out;
    });
    //alert(a.join("")); 
    re = a.join("");
    var result = $('#anwser').val();
    if (re == result) {
        takeRight()
        takeCSSRight();

        putResult(1);
    } else {
        takeError()
        takeCSSWrong();

        putResult(2);

        var ff = $("#contents > span:first").html();
        $('#qcontents').html(ff);
        var out = ""
        b = result.split("");
        $.each(b, function (i, n) {
            out = out + '<img src="/image/balloon_' + arr[n] + '.png"  style="height: 32px; width: 32px;">';
        });
        $('#qresult').html("正确答案：" + out);
        $('#errorWindows').window('open');
    }
}

function unSelect() {
    //	var items = $('#anwsers > div ').filter(".pointboxright");
    //	$(items).each(function(){
    //		$(this).toggleClass("pointboxright");
    //		
    //	});
    var items = $("input[name='multi']:checked");

    $(items).each(function () {
        $(this).attr("checked", false);
    });
}

function timedCount() {
    hour = parseInt(c / 3600);// 小时数  
    min = parseInt(c / 60);// 分钟数  
    if (min >= 60) {
        min = min % 60
    }
    lastsecs = c % 60;


    $('#timeCount').html(hour + "时" + min + "分" + lastsecs + "秒");
    c = c + 1
    _timer = setTimeout("timedCount()", 1000)

}

function examTimeCount() {

    var end = new Date()
    var d = end.getTime();
    if (ts > 0) {
        examTime = new Date(d + ts);
    } else {
        examTime = new Date(d + 45 * 60 * 1000);
    }

    end = null;
    timer();
    _timer = setInterval("timer()", 1000);
}

function timer() {
    var _now = new Date()
    ts = examTime.getTime() - _now.getTime();//计算剩余的毫秒数  

    // var dd = parseInt(ts / 1000 / 60 / 60 / 24, 10);//计算剩余的天数  
    // var hh = parseInt(ts / 1000 / 60 / 60 % 24, 10);//计算剩余的小时数  
    var mm = parseInt(ts / 1000 / 60 % 60, 10);//计算剩余的分钟数  
    var ss = parseInt(ts / 1000 % 60, 10);//计算剩余的秒数  
    // dd = checkTime(dd);  
    // hh = checkTime(hh);  
    mm = checkTime(mm);
    ss = checkTime(ss);
    $('#timeCount').html(mm + "分" + ss + "秒");

    _now = null;

    if (ts <= 0) {
        submitExam();
    }



}
function checkTime(i) {
    if (i < 10) {
        i = "0" + i;
    }
    return i;
}

function checkhHtml5() {
    if (typeof (Worker) !== "undefined") {
        //alert("支持HTML5");   
    } else {
        alert("您的浏览器不支持HTML5,请退回更换浏览器或浏览模式（安全360浏览器切换为极速模式）");
    }
}

function imgdragstart() { return false; }





