<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改活动</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/bootstrap/bootstrap.min.css" >
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>public/css/jquery.timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/select2/select2.min.css">

    <style type="text/css">
        .thumbnail {
            margin:10px;
        }

        .lang-name {
            margin-left:42px;
        }

        .upimg {
            cursor: pointer;
        }
        .fileinput-button {
            position: relative;
            top: -5px;
        }

        .fileinput-button input{
            position:absolute;
            right: 0px;
            top: 0px;
            opacity: 0;
            -ms-filter: 'alpha(opacity=0)';
        }
    </style>
</head>
<body>
<div id="msg-tip">

</div>
<div class="content_wrapper">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>礼包组</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <?php foreach ($name as $pid=>$gname) { ?>
                                        <a style="margin:5px;" class="btn btn-primary " href="#shop/gift/<?php echo $pid;?>/<?php echo $type;?>" role="button"><?php echo $gname;?></a>
                                    <?php } ?>
                                </div>
                                <div class="col-sm-12">
                                    <div class="row" style="padding-left: 15px;">
                                        <span id="filespanpro" class="btn btn-success fileinput-button">
                                            <span>导入概率</span>
                                            <input type="file" id="upfilepro">
                                        </span>
                                        <input type="button" style="display: none;margin-bottom: 10px;width: 80px;" class="btn btn-success" value="上传" id="btnpro"/>
                                        <a type="button" href="/Export/gift/<?php echo $gpid;?>/<?php echo $type;?>" style="margin-bottom: 10px;width: 80px;" class="btn btn-success">导出概率</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="goodForm" action="#" style="margin-top: 20px">
                <input type="hidden" class="form-control" name="type" value="<?php echo $type;?>">
                <header><i class="fa fa-fw fa-file"></i>礼包管理</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="goodsubmitBtn">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                        <?php foreach ($list as $key => $vl) { ?>
                            <div class="row AllTypeControl" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                                <div class="form-group" >
                                    <label class="col-sm-1 control-label">商品GID*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control" readonly name="good[<?php echo $vl['gid'];?>][gid]" value="<?php echo $vl['gid'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品名称*: </label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gname]" value="<?php echo $vl['gname'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品SKU*: </label>
                                    <div class="col-sm-2">
                                        <select class="form-control gsku" gid="<?php echo $vl['gid'];?>" name="good[<?php echo $vl['gid'];?>][gsku]">
                                        	<?php
                                        		foreach($skuPrice as $sku => $price){
                                        			echo '<option value="'.$sku.'" price="'.$price.'" '.($sku == $vl['gsku']?'selected':'').'>'.$sku.'</option>';
                                        		}
                                        	?>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">商品简介*: </label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gdesc]" value="<?php echo $vl['gdesc'];?>">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">商品价格*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control price<?php echo $vl['gid'];?>"  name="good[<?php echo $vl['gid'];?>][gprice]" value="<?php echo $vl['gprice'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品折扣*: </label>
                                    <div class="col-sm-1">
                                        <select class="form-control typeControl" name="good[<?php echo $vl['gid'];?>][gdiscount]">
                                            <option value="0.03"  <?php if($vl['gdiscount'] == "0.03") echo 'selected'; ?>>0.03</option>
                                            <option value="0.02"  <?php if($vl['gdiscount'] == "0.02") echo 'selected'; ?>>0.02</option>
                                            <option value="0.016" <?php if($vl['gdiscount'] == "0.016") echo 'selected'; ?>>0.016</option>
                                            <option value="1" <?php if($vl['gdiscount'] == "1") echo 'selected'; ?>>1</option>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">商品有效期*(秒): </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gExpire]" value="<?php echo $vl['gExpire'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品额外优惠: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gaddRatio]" value="<?php echo $vl['gaddRatio'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">商品限购次数: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gMax]" value="<?php echo $vl['gMax'];?>">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-1 control-label">展现国家: </label>
                                    <div class="col-sm-1">
                                        <button type="button" class="btn btn-success" onclick="setCountry(<?php echo $vl['gid'];?>)">添加展现国家</button>
                                    </div>
                                    <input type="hidden" class="form-control" id="gShowCountry<?php echo $vl['gid'];?>" name="good[<?php echo $vl['gid'];?>][gShowCountry]" value="<?php echo $vl['gShowCountry'];?>">
                                    <div class="col-sm-5" id="gShowCountryDiv<?php echo $vl['gid'];?>">
                                        <?php foreach (array_filter(explode(',',$vl['gShowCountry'])) as $id=>$code) { ?>
                                            <span id="<?php echo $vl['gid'];?>_<?php echo $code;?>" class="btn btn-primary" onclick="delCountry(<?php echo $vl['gid'];?>,'<?php echo $code;?>')"><?php echo array_flip($country)[$code];?></span>
                                        <?php } ?>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-1 control-label">添加RFM分组: </label> 
                                    <div class="col-sm-1">
                                      <?php $gShowGroup=isset($vl['gShowGroup']) ? array_unique(explode(',',$vl['gShowGroup'])) : [];?>
                                      <select class="form-control" onchange="AddScoreCGRGid(this,<?=$vl['gid']?>)">
                                        <option value="0">默认</option>
                                        <?php foreach($userGroup2 as $id => $group){ ?>
                                          <option value="<?=$id?>"><?=$group?></option>
                                        <?php } ?>
                                      </select>
                                    </div>
                                    <div class="col-sm-10" id="scoreCGGidDiv<?=$vl['gid']?>">
                                      <?php foreach ($gShowGroup as $id=>$group) { ?>
                                      <div class="col-sm-2" onclick="DelScoreCGRGid(this,<?=$group?>,<?=$vl['gid']?>)"><input class="btn btn-primary" type="button" value="<?=empty($group) ? '默认' : $userGroup2[$group]?>"><input class="btn btn-primary" type="hidden" name="good[<?=$vl['gid']?>][gShowGroup][]" value="<?=$group?>"></div>
                                       <?php } ?>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-1 control-label">添加数数分组: </label>
                                    <div class="col-sm-1">
                                        <?php $gShowGroupSS=isset($vl['gShowGroupSS']) ? array_unique(explode(',',$vl['gShowGroupSS'])) : [];?>
                                        <select class="form-control" onchange="AddScoreCGSSGid(this,<?=$vl['gid']?>)">
                                            <option value="0">默认</option>
                                            <?php foreach($userGroup5 as $id => $group){ ?>
                                                <option value="<?=$id?>"><?=$group?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    <div class="col-sm-10" id="scoreCGSSGidDiv<?=$vl['gid']?>">
                                        <?php foreach ($gShowGroupSS as $id=>$group) { ?>
                                            <div class="col-sm-2" onclick="DelScoreCGSSGid(this,<?=$group?>,<?=$vl['gid']?>)"><input class="btn btn-primary" type="button" value="<?=empty($group) ? '默认' : $userGroup5[$group]?>"><input class="btn btn-primary" type="hidden" name="good[<?=$vl['gid']?>][gShowGroupSS][]" value="<?=$group?>"></div>
                                        <?php } ?>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-1 control-label">商品货物*: </label>
                                    <div class="col-sm-8">
                                        <div class="container-fluid addOrDelControl" style="border: 1px solid #CCC;margin: 20px 15px;padding-top: 10px;">
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">金币*: </label>
                                                <div class="col-sm-3">
                                                    <select class="form-control typeControl" name="good[<?php echo $vl['gid'];?>][gbaseReward][coins][coins]">
                                                        <option value="coins01" <?php if($vl['gbaseReward']['coins']['coins'] == "coins01") echo 'selected'; ?>>coins01</option>
                                                        <option value="coins02" <?php if($vl['gbaseReward']['coins']['coins'] == "coins02") echo 'selected'; ?>>coins02</option>
                                                        <option value="coins03" <?php if($vl['gbaseReward']['coins']['coins'] == "coins03") echo 'selected'; ?>>coins03</option>
                                                        <option value="coins04" <?php if($vl['gbaseReward']['coins']['coins'] == "coins04") echo 'selected'; ?>>coins04</option>
                                                        <option value="coins05" <?php if($vl['gbaseReward']['coins']['coins'] == "coins05") echo 'selected'; ?>>coins05</option>
                                                        <option value="coins06" <?php if($vl['gbaseReward']['coins']['coins'] == "coins06") echo 'selected'; ?>>coins06</option>
                                                    </select>
                                                </div>
                                                <label class="col-sm-1 control-label">倍率*: </label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gbaseReward][coins][bet]" value="<?php echo $vl['gbaseReward']['coins']['bet'];?>">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-1 control-label">体力*: </label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gbaseReward][spins]" value="<?php echo $vl['gbaseReward']['spins'];?>">
                                                </div>
                                            </div>
                                            <?php foreach ($vl['gbaseReward']['props'] as $k => $reward) { ?>
                                                <div class="form-group">
                                                    <label class="col-sm-1 control-label">道具*: </label>
                                                    <div class="col-sm-3">
                                                          <select class="form-control propsSelect" data-gid="<?=$vl['gid']?>" name="good[<?php echo $vl['gid'];?>][gbaseReward][props][propsId][]">
                                                            <?php foreach ($idData as $propsId=>$props) { ?>
                                                                <option value="<?php echo $propsId;?>" <?php if($reward['propsId'] == $propsId) echo 'selected'; ?>><?php echo $props['msg'];?></option>
                                                            <?php } ?>
                                                        </select>
                                                    </div>
                                                    <label class="col-sm-1 control-label">数量*: </label>
                                                    <div class="col-sm-2">
                                                        <input type="text" class="form-control"  name="good[<?php echo $vl['gid'];?>][gbaseReward][props][num][]" value="<?php echo $reward['num'];?>">
                                                    </div>
                                                    <div class="skinSelect">
                                                    <?php if(in_array($reward['propsId'],[19,41,43])){?>
                                                    <label class="col-sm-1 control-label">皮肤*: </label>
                                                    <div class="col-sm-2">
                                                        <select class="form-control col-sm-3" name="good[<?php echo $vl['gid'];?>][gbaseReward][props][skin][]">
                                                            <?php
                                                                switch ($reward['propsId']){
                                                                    case 19:$skinsArrTemp = $chestSkin;break;
                                                                    case 41:$skinsArrTemp = $easterEggSkin;break;
                                                                    case 43:$skinsArrTemp = $treasureSkin;break;
                                                                    default:$skinsArrTemp = $chestSkin;break;
                                                                }
                                                            foreach ($skinsArrTemp as $skinId=>$name)
                                                            { ?>
                                                                <option value="<?php echo $skinId;?>" <?php if(isset($reward['skin']) && $reward['skin'] == $skinId) echo 'selected'; ?>><?php echo $reward['propsId'] == 19?$name:$name.("(活动ID：".$skinId.")");?></option>
                                                            <?php } ?>
                                                        </select>
                                                    </div>
                                                    <? } else { ?>
                                                        <input type="hidden" name="good[<?php echo $vl['gid'];?>][gbaseReward][props][skin][]" value="">
                                                    <?php } ?>
                                                    </div>
                                                    <button type="button" class="btn btn-danger deleteParent" >删除</button>
                                                </div>
                                            <?php } ?>
                                            <button type="button" class="btn btn-success addParent" gid="<?php echo $vl['gid'];?>" style="margin-left: 12px;margin-bottom: 10px;">增加</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        <?php } ?>
                    </div>
                </section>
            </form>
        </aside>
    </div>
</div>


<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="top: 20%;width: 30%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">国家设置</h4>
            </div>
            <div class="modal-body" style="text-align: center;">
                <input type="hidden" class="form-control"  id="goodId" value="0">
                <select class="form-control" id="country" name="country">
                    <?php foreach ($country as $name=>$code) { ?>
                        <option value="<?php echo $code;?>"><?php echo $name;?></option>
                    <?php } ?>
                </select>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="submit">保存</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

</body>

<script>
    var scoreCGGidArr = {
        <?php foreach ($list as $key => $vl) { ?>
            <?php $gShowGroup=isset($vl['gShowGroup']) ? (array)array_unique(explode(',',$vl['gShowGroup'])) : [];?>
            <?php echo $vl['gid'];?>:<?php echo json_encode($gShowGroup, JSON_NUMERIC_CHECK);?>,
        <?php }?>
    };

    //数数分组
    var scoreCGSSGidArr = {
    <?php foreach ($list as $key => $vl) { ?>
    <?php $gShowGroupSS=isset($vl['gShowGroupSS']) ? (array)array_unique(explode(',',$vl['gShowGroupSS'])) : [];?>
    <?php echo $vl['gid'];?>:<?php echo json_encode($gShowGroupSS, JSON_NUMERIC_CHECK);?>,
    <?php }?>
    };

    $(function () {
        var idData = JSON.parse('<?php echo json_encode($idData); ?>');

        $('.addOrDelControl').on("click",'.deleteParent',function(){
            $(this).parent().remove();
        });

        $('.addParent').on("click",function(){
            var gid = $(this).attr('gid');
            var str = "";
            str += '<div class="form-group"><label class="col-sm-1 control-label">道具*: </label><div class="col-sm-3"><select class="form-control propsSelect" data-gid="'+gid+'" name="good['+gid+'][gbaseReward][props][propsId][]"">';
            for(var x in idData) {
                str += '<option value="'+x+'">'+idData[x]['msg']+'</option>';
            }
            str += '</select></div><label class="col-sm-1 control-label">数量*: </label><div class="col-sm-2"><input type="text" class="form-control"  name="good['+gid+'][gbaseReward][props][num][]" value="1"></div>';
            str += '<div class="skinSelect"><input type="hidden" name="good['+gid+'][gbaseReward][props][skin][]" value=""></div>';
            str += '<button type="button" class="btn btn-danger deleteParent" >删除</button></div>';
            $(this).before(str);
        });

        var chestArr = JSON.parse('<?php echo json_encode($chestSkin) ?>');
        var easterEggSkin = JSON.parse('<?php echo json_encode($easterEggSkin) ?>');
        var treasureSkin = JSON.parse('<?php echo json_encode($treasureSkin) ?>');
        var crazyCardGroup = JSON.parse('<?php echo json_encode($crazyCardGroup) ?>');
        var skinsArr = {
            19: chestArr,
            41: easterEggSkin
            , 43: treasureSkin
            , 46: crazyCardGroup
        }
        var skinsArrKeys = Object.keys(skinsArr)
        for(var rtype in skinsArrKeys){
            skinsArrKeys[rtype] = parseInt(skinsArrKeys[rtype])
        }

        $(document).on("change",".propsSelect",function(){
            var value = parseInt($(this).val());
            var gid = $(this).attr("data-gid");
            var str = '';
            if(skinsArrKeys.includes(value)){
                str = '<label class="col-sm-1 control-label">皮肤*: </label>';
                str += '<div class="col-sm-2">';
                str += '<select class="col-sm-3 form-control" name="good['+gid+'][gbaseReward][props][skin][]">';
                var skinsArrTmp = skinsArr[value]
                for(var x in skinsArrTmp) {
                    str += '<option value="'+x+'">'+skinsArrTmp[x]+'</option>';
                }

                // if(value == 19){
                //     for(var x in chestSkin) {
                //         str += '<option value="'+x+'">'+chestSkin[x]+'</option>';
                //     }
                // }else{
                //     for(var x in easterEggSkin) {
                //         str += '<option value="'+x+'">'+easterEggSkin[x]+"(活动ID:"+x+")"+'</option>';
                //     }
                // }
                str += '</select></div>';
            }else{
                str = '<input type="hidden" name="name" value="">';
            }
            $(this).parent("div").parent("div").find(".skinSelect").html(str);
        });

        $('#goodsubmitBtn').click(function () {
            var data = new FormData(document.getElementById("goodForm"));
            $.ajax({
                url: rootPath + 'shop/actionGift',
                type: 'POST',
                data: data,
                dataType: 'json',
                contentType: false, //必须
                processData: false, //必须
                success: function (data) {
                    alert(data.msg);
                    window.location.reload();
                },
                error: function (msg) {
                    alert(data.msg);
                }
            });
        });
        
        $(document).on("change",".gsku",function(){
        	var gid = $(this).attr("gid");
        	var value = $(this).val();
        	var price = $(this).find("option:selected").attr('price');
        	$(".price"+gid).val(price);
        	console.log($(this).attr("gid"));
        });

    });
    
    
    function setCountry(id) {
        $("#goodId").val(id);
        $('#myModal').modal('show');
    }

    //添加rfm分组
    function AddScoreCGRGid(obj,index) {
        var name  = $(obj).find("option:selected").text();
        var value = parseInt($(obj).val());
        for (var i = 0;scoreCGGidArr[index].length>i;i++){
            if(scoreCGGidArr[index][i] == value){
                //alert("分组冲突");
                return;
            }
        }

        scoreCGGidArr[index].push(value);
        //if(value != 0){
            var html ='<div class="col-sm-2" onclick="DelScoreCGRGid(this,'+value+','+index+')"><input class="btn btn-primary" type="button" value="'+name+'"><input class="btn btn-primary" type="hidden" name="good['+index+'][gShowGroup][]" value="'+value+'"></div>';
            $("#scoreCGGidDiv"+index).append(html);
        //}
    }

    //添加数数分组
    function AddScoreCGSSGid(obj,index) {
        var name  = $(obj).find("option:selected").text();
        var value = parseInt($(obj).val());
        for (var i = 0;scoreCGSSGidArr[index].length>i;i++){
            if(scoreCGSSGidArr[index][i] == value){
                //alert("分组冲突");
                return;
            }
        }

        scoreCGSSGidArr[index].push(value);
        //if(value != 0){
        var html ='<div class="col-sm-2" onclick="DelScoreCGSSGid(this,'+value+','+index+')"><input class="btn btn-primary" type="button" value="'+name+'"><input class="btn btn-primary" type="hidden" name="good['+index+'][gShowGroupSS][]" value="'+value+'"></div>';
        $("#scoreCGSSGidDiv"+index).append(html);
        //}
    }

    //删除RFM分组
    function DelScoreCGRGid(obj,value,index) {
        $(obj).remove();
        scoreCGGidArr[index] = scoreCGGidArr[index].filter(v=>{
            return v != value;
        });
    }

    //删除数数分组
    function DelScoreCGSSGid(obj,value,index) {
        $(obj).remove();
        scoreCGSSGidArr[index] = scoreCGSSGidArr[index].filter(v=>{
            return v != value;
        });
    }

    function delCountry(id,code){
        var cur= $("#gShowCountry"+id).val();
        arr = cur.split(',');
        arr = arr.filter(v=>{
            return v != code;
        });
        var str = "";
        for(var i = 0; i < arr.length; i++) {
            str += arr[i]+ ",";
        }
        if(str.length > 0) {
            str = str.substr(0, str.length - 1);
        }
        $("#gShowCountry"+id).val(str);
        $("#"+id+"_"+code).remove();
    }

    $('#submit').click(function () {
        var id = $("#goodId").val();
        var cur= $("#gShowCountry"+id).val();
        var code = $("#country").val();
        arr = cur.split(',');
        for(var i = 0; i < arr.length; i++) {
            if(arr[i] == code){
                $('#myModal').modal('hide');
                return false;
            }
        }
        arr.push(code);
        arr = arr.filter(v=>{
            return v != "";
        });
        var str = "";
        for(var i = 0; i < arr.length; i++) {
            str += arr[i]+ ",";
        }
        if(str.length > 0) {
            str = str.substr(0, str.length - 1);
        }
        var text = $("#country").find("option:selected").text();
        $("#gShowCountry"+id).val(str);
        $("#gShowCountryDiv"+id).append('<span id="'+id+'_'+code+'" class="btn btn-primary" onclick="delCountry('+id+',\''+code+'\')">'+text+'</span>');
        $('#myModal').modal('hide');
    });

    $("#btnpro").click(function(){
        var formData = new FormData();
        formData.append("file",document.getElementById("upfilepro").files[0]);
        $.ajax({
            type: "POST", // 数据提交类型
            url: "Import/gift", // 发送地址
            data: formData, //发送数据
            async: true, // 是否异步
            processData: false, //processData 默认为false，当设置为true的时候,jquery ajax 提交的时候不会序列化 data，而是直接使用data
            contentType: false, //
            success: function(data) { // 成功回调
                data = JSON.parse(data);
                if(data.ret == 0){
                    window.location.reload();
                }else {
                    msgTip = $('#msg-tip');
                    msgTip.messager().warn('上传失败');
                }
            }
        });
    });

    $("#filespanpro").on("change", "input[type='file']", function() {
        var filePath = $(this).val();
        //如果仅上传图片 if(filePath.indexOf("jpg") != -1 || filePath.indexOf("png") != -1) {
        if (filePath) {
            $('#filespanpro').hide();
            $('#btnpro').show();
        } else {
            return false
        }
    });
</script>
</html>
