<?php
session_start();
@$userKey = $_SESSION['loginKey'];

if($userKey == "")
{
    echo "<script>window.open('login.php','_self')</script>";
}


include "control/activity.php";
$dd = new activity();

$table = "userdetails";
$condition = " where userKey='$userKey'";
$getuserdetails = $dd->single($table,$condition);
$table = "admin_calculation";
$condition = "null";
$getAdminDetails = $dd->single($table,$condition);

    
$gmn = $_REQUEST['game'];


if($gmn == 1)
{
    $gmn = "1";
}



if($gmn == 3)
{
    $gmn = "2";
}


if($gmn == 5)
{
    $gmn = "3";
}


if($gmn == 10)
{
    $gmn = "4";
}





$table = "wingo_game_runing";
$condition = " where game_number='$gmn'";
$getCountDwon = $dd->single($table,$condition);
$newSecound = $getCountDwon['time_perods']*60-date("s");
$runningPeriods = $getCountDwon['periods'];



$table = "admin_calculation";
$condition = null;
$getAdminDetails = $dd->single($table,$condition);
$notice = $getAdminDetails['notice'];
$loginImg = $getAdminDetails['login_img'];

?>


<script>
    getToStartTiming();
</script>





<!DOCTYPE html>
<html lang="en" translate="no">
<head>
    <meta charset="UTF-8">
    <link rel="icon" type="image/svg+xml" href="./images/h5setting_20230808033047vpbk.ico">
    <meta name="google" content="notranslate">
    <meta name="robots" content="noindex,nofollow">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title><?= $getAdminDetails['title']; ?></title>
    <link rel="stylesheet" href="css/slick.css" />
    <link rel="stylesheet" href="css/modules.css" />
    <link rel="stylesheet" href="css/style.css" />
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/slick.min.js" type="text/javascript"></script>
   
    <?php include "game-timer.php"; ?>
</head>
<body>
    <div id="app">
        <div class="WinGo__C">
              <div class="navbar">
                <div class="navbar-fixed" style="background: linear-gradient(90deg, rgb(206, 2, 4) 0%, rgb(242, 64, 58) 100%);">
                    <div class="navbar__content">
                        <div data-v-905dfe8c="" class="navbar__content-left" onclick="clicktoBack()"><div data-v-905dfe8c="" class="backIcon"></div></div>
                        <div data-v-905dfe8c="" class="navbar__content-center">
                            <div data-v-905dfe8c="" class="navbar__content-title">Game Hstory</div>
                        </div>
                        <div data-v-905dfe8c="" class="navbar__content-right"></div>
                    </div>
                </div>
            </div>

<script>
  function clicktoBack()
  {
    window.open('index.php','_self');
  }


</script>
          

<script>

   function getActionForwithdrawordeposit(a)
   {
      if(a == 1)
      {
          window.open('withdraw.php','_self');
      }

      
      if(a == 2)
      {
          window.open('deposit.php','_self');
      }
   }






  
   document.getElementById('winGo1m').style.display="block";
   function getTwoActivity(a)
   {
       window.open('?game='+a,'_self');
   }
   
   
   
   function gettorefresh()
   {
       window.open('?game='+<?= $_REQUEST['game']; ?>,'_self');
   }
   
</script>    




            <div class="wingo-tab-content">

                <div class="wingoGame active" id="one_Min">
                  
    


 




    
                    <div class="record_tabs">
                        <div class="GameRecord__C active" id="game_history">
                            <div class="GameRecord__C-head">
                                <div class="van-row">
                                    <div data-v-c74f4bba="" class="van-col van-col--8">Period</div>
                                    <div data-v-c74f4bba="" class="van-col van-col--5">Number</div>
                                    <div data-v-c74f4bba="" class="van-col van-col--5">Big Small</div>
                                    <div data-v-c74f4bba="" class="van-col van-col--6">Color</div>
                                </div>
                            </div>
                            
                            
                            
                            <div class="list-wrapper GameRecord__C-body">
                               
                            
                                <?php
                                   if($_REQUEST['game'] == "1")
                                   {
                                       $gm = "1";
                                   }
                                   
                                    if($_REQUEST['game'] == "3")
                                   {
                                       $gm = "2";
                                   }
                                   
                                   
                                    if($_REQUEST['game'] == "5")
                                   {
                                       $gm = "3";
                                   }
                                   
                                    if($_REQUEST['game'] == "10")
                                   {
                                       $gm = "4";
                                   }
                                
                                
                                 $table = "existing_game_wingo";
                                 $condition = " where game_number='$gm' ORDER BY 1 DESC";
                                 $getExistingDetails = $dd->fetch_multi($table,$condition);
                                 foreach($getExistingDetails as $key){

                                    if($key->color == "red,voilet")
                                    {
                                         $colorZone = "1";
                                    }

                                    if($key->color == "red")
                                    {
                                        $colorZone = "2";
                                    }

                                    if($key->color == "voilet")
                                    {
                                        $colorZone = "3";
                                    }

                                    if($key->color == "green")
                                    {
                                        $colorZone = "4";
                                    }

                                    if($key->color == "green,voilet")
                                    {
                                        $colorZone = "5";
                                    }
                                ?>

                                <div class="van-row list-item">
                                    <div data-v-c74f4bba="" class="van-col van-col--8"><?= $key->periods; ?></div>
                                    <div data-v-c74f4bba="" class="van-col van-col--5 numcenter"><div data-v-c74f4bba="" class="GameRecord__C-body-num defaultColor clr<?= $colorZone; ?>"><?= $key->number; ?></div></div>
                                    <div data-v-c74f4bba="" class="van-col van-col--5"><span data-v-c74f4bba=""><?= ucfirst($key->bigorsmall); ?></span></div>
                                    <div class="van-col van-col--6">
                                        <div class="GameRecord__C-origin">
                                            <?php if($colorZone == "1"){ ?>
                                            <div style="border-radius: 40%; width:9px; height:9px; background:#F32510; border: 1px solid #000;"></div>
                                            <div style="border-radius: 40%; width:9px; height:9px; background:#C04AFA; border: 1px solid #000; margin-left:3px;"></div>
                                            <?php } ?>

                                            <?php if($colorZone == "2"){ ?>
                                                <div style="border-radius: 40%; width:9px; height:9px; background:#F32510; border: 1px solid #000;"></div>
                                            <?php } ?>

                                            <?php if($colorZone == "3"){ ?>
                                                <div style="border-radius: 40%; width:9px; height:9px; background:#C04AFA; border: 1px solid #000;"></div>
                                            <?php } ?>

                                            <?php if($colorZone == "4"){ ?>
                                                <div style="border-radius: 40%; width:9px; height:9px; background:#3ECB05; border: 1px solid #000;"></div>
                                            <?php } ?>

                                            <?php if($colorZone == "5"){ ?>
                                                <div style="border-radius: 40%; width:9px; height:9px; background:#3ECB05; border: 1px solid #000;"></div>
                                            <div style="border-radius: 40%; width:9px; height:9px; background:#C04AFA; border: 1px solid #000; margin-left:3px;"></div>
                                            <?php } ?>
                                        </div>
                                    </div>
                                </div>
                                <?php } ?>
                                <!--<div class="GameRecord__C-foot">-->
                                <!--    <div class="GameRecord__C-foot-previous disabled">-->
                                <!--        <i data-v-29739fc6="" class="van-badge__wrapper van-icon van-icon-arrow-left GameRecord__C-icon" style="font-size: 20px;"></i>-->
                                <!--    </div>-->
                                <!--    <div data-v-29739fc6="" class="GameRecord__C-foot-page"></div>-->
                                <!--    <div class="GameRecord__C-foot-next">-->
                                <!--        <i data-v-29739fc6="" class="van-badge__wrapper van-icon van-icon-arrow GameRecord__C-icon" style="font-size: 20px;"></i>-->
                                <!--    </div>-->
                                <!--</div>-->
                            </div>

                           


                            <!--<div class="GameRecord__C-foot">-->
                            <!--    <div class="GameRecord__C-foot-previous disabled">-->
                            <!--        <i data-v-c74f4bba="" class="van-badge__wrapper van-icon van-icon-arrow-left GameRecord__C-icon" style="font-size: 20px;"></i>-->
                            <!--    </div>-->
                            <!--    <div data-v-c74f4bba="" class="GameRecord__C-foot-page"></div>-->
                            <!--    <div class="GameRecord__C-foot-next">-->
                            <!--        <i data-v-c74f4bba="" class="van-badge__wrapper van-icon van-icon-arrow GameRecord__C-icon" style="font-size: 20px;"></i>-->
                            <!--    </div>-->
                            <!--</div>-->
                        </div>
                         <div id="pagination-container"></div>
                        <div class="GameRecord__C" id="my_history">
                            <!--div class="GameRecord__C-head ">
                                <div class="van-row">
                                    <div data-v-c74f4bba="" class="van-col van-col--8">Period</div>
                                    <div data-v-c74f4bba="" class="van-col van-col--5">Number</div>
                                    <div data-v-c74f4bba="" class="van-col van-col--5">Big Small</div>
                                    <div data-v-c74f4bba="" class="van-col van-col--6">Color</div>
                                </div>
                            </div-->
                            <div class="GameRecord__C-body my_history">
                                <div class="van-row my_history_item">
                                    
                                     <?php
                                          $table = "wingo_order_details";
                                          $condition = " where userKey='$userKey' AND status='pending' AND game_number='$gm' ORDER BY 1 DESC";
                                          $getWingo = $dd->fetch_multi($table,$condition);
                                          foreach($getWingo as $key){
                                              
                                      ?>
                                    
                                    
                                      <div class="item c-row">
                                        <div class="result">
                                            <div class="select select-red">
                                                <span><?= $key->select_number; ?></span>
                                            </div>
                                        </div>
                                        <div class="c-row c-row-between info">
                                            <div class="period_id">
                                                <div data-v-a9660e98="" class="issueName">
                                                    <?= $key->periods; ?> 
                                                    <span data-v-a9660e98="" class="state : Pending</span>
                                                </div>
                                                <div data-v-a9660e98="" class="tiem">Pending</div>
                                            </div>
                                            <div class="money">
                                                <span data-v-a9660e98="" class="<?= $amcolor; ?>"><?= $key->amount; ?></span>
                                            </div>
                                        </div>
                                    </div>
                                    <?php } ?>
                                    
                                    
                                   <?php
                                     $table = "account_history";
                                     $condition = " where userKey='$userKey' AND game_name='Wingo' AND gameNumber='$gm' ORDER BY 1 DESC";
                                     $getMyHistory = $dd->fetch_multi($table,$condition);
                                     foreach($getMyHistory as $key){
                                        if($key->lossorprofit >1){
                                            $status = "success";
                                        }
                                        else{
                                            $status = "failed";
                                        }

                                        if($status == "success"){
                                             $statusColor = "green";
                                             $comment = "success";
                                             $amcolor = "success";
                                             $amount = $key->lossorprofit;
                                        }

                                        if($status == "failed"){
                                            $statusColor = "red";
                                            $comment = "failed";
                                            $amcolor = "fail";
                                            $amount = $key->lossorprofit;
                                        }

                                       if($key->selected_number == "red")
                                       {
                                           $cardColor = "red";
                                           $showColor = "1";
                                           $slctNumber = null;
                                       }elseif($key->selected_number == "green")
                                       {
                                           $cardColor = "green";
                                           $showColor = "1";
                                           $slctNumber = null;
                                       }elseif($key->selected_number == "voilet")
                                       {
                                           $cardColor = "violet";
                                           $showColor = "1";
                                           $slctNumber = null;
                                       }elseif($key->selected_number == "big"){
                                         $cardColor = "big";
                                         $showColor = "0";
                                       }elseif($key->selected_number == "small")
                                       {
                                            $cardColor = "small";
                                            $showColor = "0";
                                       }else{
                                           if($key->selected_number == "0"){
                                             $cardColor = "red-violet";
                                             $slctNumber = $key->selected_number;
                                             $showColor = "1";
                                           }else{
                                            $cardColor = "small";
                                            $showColor = "1";
                                            $slctNumber = $key->selected_number;
                                           }
                                       }
                                     ?>

                                    <div class="item c-row">
                                        <div class="result">
                                            <div class="select select-<?= $cardColor; ?>">
                                               <?php if($showColor == "0"){ ?>
                                                <div class="van-image">
                                                    <img src="./images/<?= $cardColor; ?>.png" class="van-image__img">
                                                </div>
                                                <?php }else{ ?>
                                                <span><?= $slctNumber; ?></span>
                                                <?php } ?>
                                            </div>
                                        </div>
                                        <div class="c-row c-row-between info">
                                            <div class="period_id">
                                                <div data-v-a9660e98="" class="issueName">
                                                    <?= $key->periods; ?> 
                                                    <span data-v-a9660e98="" class="state <?= $statusColor; ?>"><?= $comment; ?></span>
                                                </div>
                                                <div data-v-a9660e98="" class="tiem"><?= $key->action_date; ?></div>
                                            </div>
                                            <div class="money">
                                                <span data-v-a9660e98="" class="<?= $amcolor; ?>"><?= round($amount,2); ?></span>
                                            </div>
                                        </div>
                                    </div>

                                  <?php } ?>
                                </div>
                               
                            <!--div class="GameRecord__C-foot">
                                <div class="GameRecord__C-foot-previous disabled">
                                    <i data-v-c74f4bba="" class="van-badge_wrapper van-icon van-icon-arrow-left GameRecord_C-icon" style="font-size: 20px;"></i>
                                </div>
                                <div data-v-c74f4bba="" class="GameRecord__C-foot-page">1/1691</div>
                                <div class="GameRecord__C-foot-next">
                                    <i data-v-c74f4bba="" class="van-badge_wrapper van-icon van-icon-arrow GameRecord_C-icon" style="font-size: 20px;"></i>
                                </div>
                            </div-->
                            
                        </div>
                    </div>
                </div>
            </div>


           

           
        </div>
    </div>

    <!------------------FORM FOR GAME ORDER------------>
    <input name="selectedNumber" id="snumber" type="hidden" />
    <input name="amount" id="amount" value="1"  type="hidden"/>
    <input name="quantity" id="qty" value="1" type="hidden"/>
    <input name="requestType" id="reqtype" type="hidden"/>
    <input name="duration" id="duration_zone" value="1" type="hidden"/>





<audio id="myAudio">
  <!-- <source src="horse.ogg" type="audio/ogg"> -->
  <source src="newSound.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

</body>
<script src="js/jquery.simplePagination.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
</html>


<script>


   window.onload = function() {
   var getfulltime = <?= $newSecound; ?>;

  var sec = getfulltime;
  setInterval(function() {
    
    if(sec <= 0 )
    {
        document.getElementById("myAudio").pause();
        var minn = 00;
        getProccessedForResult('<?= $runningPeriods; ?>');
    }else{
        if(sec > 60){
          var minn = 1;  
        }else{
            var minn = 0;   
        }

        
        if(sec > 120){
            var minn = 2;  
        }

        
        if(sec > 180){
            var minn = 3;  
        }

        
        if(sec > 240){
            var minn = 4;  
        }

        if(sec > 300){
            var minn = 5;  
        }

        if(sec > 360){
            var minn = 6;  
        }

        if(sec > 420){
            var minn = 7;  
        }


        if(sec > 480){
            var minn = 8;  
        }


        if(sec > 540){
            var minn = 9;  
        }

        if(sec > 600){
            var minn = 10;  
        }


        

        sec--;
    }
    var sssss = sec-minn*60;
    
    if(sssss < 10)
    {
        sssss = sssss;
        sssss1 = "0";
    }else{
        var tytyty = sssss.toString();
        sssss1 = tytyty.substr(0, 1);
        sssss = tytyty.substr(1, 1);
    }


    if(sec <=5 && sec>=1)
    {
        document.getElementById("myAudio").play(); 
        
        document.getElementById('orderpopup').style.display = "none";
        document.getElementById('outareazone').style.display = "none";
        
        document.getElementById("ertyuisdfghjk45678").style.display = "block";
        document.getElementById("setCountdwonTimeForBlock").innerHTML = sec;
    }
   else{
      document.getElementById("myAudio").pause();
      document.getElementById("ertyuisdfghjk45678").style.display = "none";
    }
           document.getElementById("min_1").innerHTML = "0";
           document.getElementById("min_2").innerHTML = minn;
           document.getElementById("midleDott").innerHTML = ":";
           document.getElementById("sec_1").innerHTML = sssss1;
           document.getElementById("sec_2").innerHTML = sssss; 
    
  }, 1000);
   }

   


   function getManualAmountChange(){
        var getLiveQuantity = document.getElementById('van-field-9-input').value;
           var getAmountFrom = document.getElementById("amount").value;
           var ttttt = parseInt(document.getElementById("qty").value);
           document.getElementById("qty").value = getLiveQuantity;
        //    document.getElementById("van-field-9-input").value = getAmountFrom;
           document.getElementById("secalculateAmount").innerHTML = "Total amount ₹"+getAmountFrom*getLiveQuantity;
   }



   function getactivititoAddormin(a)
   {
       if(a == "1"){
           var getAmountFrom = document.getElementById("amount").value;
           var ttttt = parseInt(document.getElementById("qty").value);
           var ttttt2 = ttttt+1;
           document.getElementById("qty").value = ttttt2;
           document.getElementById("van-field-9-input").value = ttttt2;
           document.getElementById("secalculateAmount").innerHTML = "Total amount ₹"+getAmountFrom*ttttt2;
       }


       if(a == "0"){
           var getAmountFrom = document.getElementById("amount").value;
           var ttttt = parseInt(document.getElementById("qty").value);
           if(ttttt > 1){
            var ttttt2 = ttttt-1;
            document.getElementById("qty").value = ttttt2;
            document.getElementById("van-field-9-input").value = ttttt2;
            document.getElementById("secalculateAmount").innerHTML = "Total amount ₹"+getAmountFrom*ttttt2;
           }
       }
   }


  if("<?= $_REQUEST['game']; ?>" == "1")
   {
            document.getElementById("duration_zone").value = "1";
            
            document.getElementById("setingColoe1").setAttribute("class", "GameList__C-item active");
            document.getElementById("setingColoe2").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe3").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe4").setAttribute("class", "GameList__C-item");
            
            document.getElementById("setWingoSectionInGameSection").innerHTML = "Win Go 1Min";
            
   }
   
   
   if("<?= $_REQUEST['game']; ?>" == "3")
   {
            document.getElementById("duration_zone").value = "2";
            
            
            document.getElementById("setingColoe1").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe2").setAttribute("class", "GameList__C-item active");
            document.getElementById("setingColoe3").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe4").setAttribute("class", "GameList__C-item");
            
            document.getElementById("setWingoSectionInGameSection").innerHTML = "Win Go 3Min";
   }
   
   
   if("<?= $_REQUEST['game']; ?>" == "5")
   {
            document.getElementById("duration_zone").value = "3";
            
            document.getElementById("setingColoe1").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe2").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe3").setAttribute("class", "GameList__C-item active");
            document.getElementById("setingColoe4").setAttribute("class", "GameList__C-item");
            document.getElementById("setWingoSectionInGameSection").innerHTML = "Win Go 5Min";
   }
   
   
   if("<?= $_REQUEST['game']; ?>" == "10")
   {
            document.getElementById("duration_zone").value = "4";
            
            document.getElementById("setingColoe1").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe2").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe3").setAttribute("class", "GameList__C-item");
            document.getElementById("setingColoe4").setAttribute("class", "GameList__C-item active");
            
            document.getElementById("setWingoSectionInGameSection").innerHTML = "Win Go 10Min";
   }





   
   ///////////////----------GET TO PICK NUMBER'S AND OPEN POPUP------------------///////////
   function gotopicData(a)
   {
         if(document.getElementById('duration_zone').value == 1){
             var mmm = 1;
         }
         
         if(document.getElementById('duration_zone').value == 2){
             var mmm = 3;
         }
         
         if(document.getElementById('duration_zone').value == 3){
             var mmm = 5;
         }
         
         if(document.getElementById('duration_zone').value == 4){
             var mmm = 10;
         }
       
        
        document.getElementById('orderpopup').style.display = "block";
        document.getElementById('outareazone').style.display = "block";
        document.getElementById('betPupupTiming').innerHTML = "Win Go "+mmm+"min";
        
        if(a==0 || a==1 || a==2 || a==3 || a==4 || a==5 || a==6 || a==7 || a==8 || a==9){
            document.getElementById('setpopupcolor').setAttribute("class", "Betting__Popup-"+a);
           document.getElementById("snumber").value =a;
        }

        if(a=='green')
        {
            document.getElementById("snumber").value = "green";
            document.getElementById('setpopupcolor').setAttribute("class", "Betting__Popup-"+a);
            
        }
        
        if(a=='voilet'){
            document.getElementById('setpopupcolor').setAttribute("class", "Betting__Popup-"+a);
            document.getElementById("snumber").value = "voilet";
        }

        if(a=='red'){
            document.getElementById('setpopupcolor').setAttribute("class", "Betting__Popup-"+a);
            document.getElementById("snumber").value = "red";
        }

        if(a=='big'){
            document.getElementById('setpopupcolor').setAttribute("class", "Betting__Popup-"+a);
            document.getElementById("snumber").value = "big";
        }

        if(a=='small'){
            document.getElementById('setpopupcolor').setAttribute("class", "Betting__Popup-"+a);
            document.getElementById("snumber").value = "small";
        }

       
        
         document.getElementById("setnumber").innerHTML = a;

        setamounttoPopupForUser();
   }




   ///////////////////////////--------------GET TO PICK MULTIPLE NUMBER-------------------////////////////
   function gettoMultipli(a)
   {
        if(a==1)
        {
            document.getElementById("qty").value = 1;
            document.getElementById('mulpleId0').setAttribute("class", "Betting__C-multiple-r active");
            document.getElementById('mulpleId1').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId2').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId3').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId4').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId5').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId6').setAttribute("class", "Betting__C-multiple-r");


            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");
            
        }

        
        if(a==2)
        {
            document.getElementById("qty").value = 5;
            document.getElementById('mulpleId0').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId1').setAttribute("class", "Betting__C-multiple-r active");
            document.getElementById('mulpleId2').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId3').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId4').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId5').setAttribute("class", "Betting__C-multiple-r");

            
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");
        }

        
        if(a==3)
        {
            document.getElementById("qty").value = 10;
            document.getElementById('mulpleId0').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId1').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId2').setAttribute("class", "Betting__C-multiple-r active");
            document.getElementById('mulpleId3').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId4').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId5').setAttribute("class", "Betting__C-multiple-r");


            
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");
        }

        
        if(a==4)
        {
            document.getElementById("qty").value = 20;
            document.getElementById('mulpleId0').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId1').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId2').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId3').setAttribute("class", "Betting__C-multiple-r active");
            document.getElementById('mulpleId4').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId5').setAttribute("class", "Betting__C-multiple-r");

            
            
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");
        }

        
        if(a==5)
        {
            document.getElementById("qty").value = 50;
            document.getElementById('mulpleId0').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId1').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId2').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId3').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId4').setAttribute("class", "Betting__C-multiple-r active");
            document.getElementById('mulpleId5').setAttribute("class", "Betting__C-multiple-r");

            
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");
        }

        
        if(a==6)
        {
            document.getElementById("qty").value = 100;
            document.getElementById('mulpleId0').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId1').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId2').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId3').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId4').setAttribute("class", "Betting__C-multiple-r");
            document.getElementById('mulpleId5').setAttribute("class", "Betting__C-multiple-r active");

            
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
        }
       
   }




   /////////////////////////----------------SELECT AMOUNT FROM POPUP-------------////////////

   function selecteAmount(a)
   {
     if(a == 1){
        document.getElementById('setActiveColorAmount1').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
        document.getElementById('setActiveColorAmount2').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount3').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount4').setAttribute("class", "Betting__Popup-body-line-item");

        document.getElementById("amount").value = 1;
        setamounttoPopupForUser();
     }

     if(a == 10){
        document.getElementById('setActiveColorAmount1').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount2').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
        document.getElementById('setActiveColorAmount3').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount4').setAttribute("class", "Betting__Popup-body-line-item");

        document.getElementById("amount").value = 10;
        setamounttoPopupForUser();
     }

     if(a == 100){
        document.getElementById('setActiveColorAmount1').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount2').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount3').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
        document.getElementById('setActiveColorAmount4').setAttribute("class", "Betting__Popup-body-line-item");
        
        document.getElementById("amount").value = 100;
        setamounttoPopupForUser();
     }


     if(a == 1000){
        document.getElementById('setActiveColorAmount1').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount2').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount3').setAttribute("class", "Betting__Popup-body-line-item");
        document.getElementById('setActiveColorAmount4').setAttribute("class", "Betting__Popup-body-line-item bgcolor");

        
        document.getElementById("amount").value = 1000;
        setamounttoPopupForUser();
     }
   }
   




   //////////////////////////-------------------SELECT MULTIPLE INSIDE POPUP---------------//////////
   function getmultiplybyPopup(a)
   {
      if(a == 1)
      {
        
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");

            document.getElementById("qty").value = 1;
            setamounttoPopupForUser();
      }


      if(a == 2)
      {
        
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");

            document.getElementById("qty").value = 5;
            setamounttoPopupForUser();
      }


      if(a == 3)
      {
        
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");

            document.getElementById("qty").value = 10;
            setamounttoPopupForUser();
      }


      
      if(a == 4)
      {
        
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");

            document.getElementById("qty").value = 20;
            setamounttoPopupForUser();
      }


      if(a == 5)
      {
        
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item");

            document.getElementById("qty").value = 50;
            setamounttoPopupForUser();
      }


      if(a == 6)
      {
        
            document.getElementById('popupmultipleColor1').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor2').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor3').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor4').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor5').setAttribute("class", "Betting__Popup-body-line-item");
            document.getElementById('popupmultipleColor6').setAttribute("class", "Betting__Popup-body-line-item bgcolor");
            
            document.getElementById("qty").value = 100;
            setamounttoPopupForUser();
      }
   }






   ///////////////////////--------------------CANCEL POPUP------------////////////
   function cancelPopup()
   {
    
        document.getElementById('orderpopup').style.display = "none";
        document.getElementById('outareazone').style.display = "none";
   }

   

   function setamounttoPopupForUser()
   {
      var getAmountFrom = document.getElementById("amount").value;
      var qty = document.getElementById("qty").value;
      document.getElementById("van-field-9-input").value = qty;
      document.getElementById("secalculateAmount").innerHTML = "Total amount ₹"+getAmountFrom*qty;
   }





   ////////////////////////////-----------------Place An Order--------------//////////////
   function placeAnOrder()
   {
        var SlNumber = document.getElementById("snumber").value;
        var amountGet = document.getElementById("amount").value;
        var qtyGet = document.getElementById("qty").value;
        var gameNumber = document.getElementById("duration_zone").value;
        var totalAmount = amountGet*qtyGet;
    
        const xhttp = new XMLHttpRequest();
        xhttp.onload = function() {
            var demo_show = this.responseText;
            console.log(demo_show);
            const myArr = JSON.parse(demo_show);
            if(myArr.status == "success")
            {
                document.getElementById("responceFrom").style.display = "block";
                document.getElementById("responceFrom").innerHTML = "success";
                document.getElementById('orderpopup').style.display = "none";
                document.getElementById('outareazone').style.display = "none";
                setInterval(function() {
                   window.open('?game='+<?= $_REQUEST['game']; ?>,'_self');
                }, 1000);
            }
            else{
                document.getElementById('orderpopup').style.display = "none";
                document.getElementById('outareazone').style.display = "none";
                
                document.getElementById("responceFrom").style.display = "block";
                document.getElementById("responceFrom").innerHTML = myArr.remark;
                setInterval(function() {
                   document.getElementById("responceFrom").style.display = "none";
                }, 1000);
            }
        }
        xhttp.open("GET", "Wingo_placeorderApi.php?snumber="+SlNumber+"&amount="+totalAmount+"&gameNumber="+gameNumber+"&qty"+qtyGet+"&periods="+<?= $runningPeriods; ?>);
        xhttp.send(); 

   }












function getProccessedForResult(a)
{
   setInterval(function() {
        const xhttp = new XMLHttpRequest();
        xhttp.onload = function() {
            var demo_show = this.responseText;
            const myArr = JSON.parse(demo_show);
            if(myArr.status == "success" && myArr.userorder == "1")
            {
               
               
               if(myArr.result == "0"){
                  var rrcolor = "Red-Violet";
               }
               
               if(myArr.result == "5"){
                  var rrcolor = "Green-Violet";
               }
               
               
               if(myArr.result == "1" || myArr.result == "3" || myArr.result == "7" || myArr.result == "9"){
                  var rrcolor = "Green";
               }
               
               if(myArr.result == "2" || myArr.result == "4" || myArr.result == "6" || myArr.result == "8"){
                  var rrcolor = "Red";
               }
               
               if(myArr.result < 5){
                 rrBigSmall = "Small";
               }else{
                 rrBigSmall = "Big";
               }
               
               
               if(myArr.winorloss == "1"){
                    document.getElementById('isnumber').innerHTML = myArr.result;
                   document.getElementById('iscolor').innerHTML = rrcolor;
                   document.getElementById('isbigsmall').innerHTML = rrBigSmall;
                   document.getElementById('congorloss').innerHTML = "Congratulations";
                   document.getElementById('ifwin').innerHTML = "Bonus";
                   document.getElementById('amountWhenWinn').innerHTML = myArr.amount;
                   document.getElementById("gameClosedPopupZone").style.display = "block";
                   document.getElementById('showPeriods').innerHTML = "Period:1 minute "+myArr.periods;
                   document.getElementById("changeClass").setAttribute("class", "WinningTip__C-body");
               }else{
                   document.getElementById('isnumber').innerHTML = myArr.result;
                   document.getElementById('iscolor').innerHTML = rrcolor;
                   document.getElementById('isbigsmall').innerHTML = rrBigSmall;
                   document.getElementById('isloss').innerHTML = "Loss";
                   document.getElementById('congorloss').innerHTML = "Sorry";
                   document.getElementById("gameClosedPopupZone").style.display = "block";
                   document.getElementById('showPeriods').innerHTML = "Period:1 minute "+myArr.periods;
                   document.getElementById("changeClass").setAttribute("class", "WinningTip__C-body isL");
                   
               }
               
              
                
            }else{
               window.open('?game='+<?= $_REQUEST['game']; ?>,'_self');
            }
        }
        xhttp.open("GET", "getLiveResult.php?periods="+a+"&userkey="+<?= $userKey; ?>);
        xhttp.send(); 

  }, 1000);        
}



function congpopupZoneForCloseFunction()
{
  document.getElementById("gameClosedPopupZone").style.display = "none";
  window.open('?game='+<?= $_REQUEST['game']; ?>,'_self');
}


</script>
