﻿//for all game panel
function calculateremainningspotno()
{
    var spot=$("#noofspots").html();
    if(spot>=1)
    {   
       $("#noofspots").html(parseInt(spot)-1);
    }
}

function calculateThunderBallTB()
{
    var spotTB=$("#tbtogo").html();
    if(spotTB>=1)
    {   
       $("#tbtogo").html(parseInt(spotTB)-1);
    }
}
//for thunderball
function ConformORresetSpot(spotval,TBval,gameid)
{
 if(gameid==2)
    {
        $("#noofspots").html(spotval);
        $("#tbtogo").html(TBval);
    }
    if(gameid==1 || gameid==4)
    {
        $("#noofspots").html(spotval);
       
    }
   if(gameid==3)
    {
        $("#noofspots").html(spotval);
       
    }    
}

//for inner gamepanel

function Gamepanel_panelinner(gameID)
{
       var Gamepageurllotto="";
       var SpotURL="";
     //  var gameID=$("#ctl00_InnerPage_LeftMenu1_txtgameid").attr('value');
       if(gameID==14)
        {
             Gmaepageurl= "Gamepanels/Pnl_Joker.aspx";   
            // img ="images/joker-logo.jpg";     
        }       
         else if(gameID==15)
        {
             Gmaepageurl= "Gamepanels/Pnl_Joker5.aspx";  
            // img ="images/joker5-logo.jpg";          
        } else if(gameID==16)
        {
             Gmaepageurl= "Gamepanels/pnl_BadaJoker.aspx";  
            // img="images/bada-joker-logo.jpg"; 
        } else if(gameID==5)
        {
             Gmaepageurl= "Gamepanels/pnl_keno.aspx";     
             SpotURL= "AjaxPage/KenoSpot_Inner.aspx?gameID="+gameID; 
             //img="images/keno-plus-logo.jpg";         
        }else if(gameID==10)
        {
        
             Gmaepageurl= "Gamepanels/pnl_STT_container.aspx";
             //img="images/super-triple-ticket-logo.jpg";
        }else if(gameID==2)
        {
             Gmaepageurl= "Gamepanels/pnlthunderball.aspx?gameid=2&pageID=1"; 
             SpotURL= "AjaxPage/LottoGameballselector_Inner.aspx?gameID="+gameID;     
             imageURL="images/logo_tb.gif";      
        }           
        else if(gameID==1)
        {
             Gmaepageurl= "Gamepanels/pnlthursdaytsuperlotto.aspx?gameid=1&pageID=1"; 
             SpotURL= "AjaxPage/LottoGameballselector_Inner.aspx?gameID="+gameID; 
             imageURL="images/logo_tsl.gif";              
        } else if(gameID==4)
        {
             Gmaepageurl= "Gamepanels/pnlsaturdaysuperlotto.aspx?gameid=4&pageID=1"; 
             SpotURL= "AjaxPage/LottoGameballselector_Inner.aspx?gameID="+gameID;  
             imageURL="images/logo_ssl.gif";           
        } else if(gameID==3)
        {
             Gmaepageurl= "Gamepanels/pnlfastlotto.aspx?gameid=3&pageID=1"; 
             SpotURL= "AjaxPage/LottoGameballselector_Inner.aspx?gameID="+gameID; 
             imageURL="images/logo_fl.gif";              
        }  
        if(gameID==14 || gameID==15 || gameID==16 || gameID==5 || gameID==10)
        {
      
           //for default lotto game
            var DefaultGamepageur = "Gamepanels/pnlthunderball.aspx?pageID=1";
            var DefaultSpotURL= "AjaxPage/LottoGameballselector_inner.aspx?gameid=2";  

       
         
        //for daily games
        $.ajax({
              url:Gmaepageurl,
              cache: false,
              success: function(html){              
              $("#gmaepanel").html(html); 
              $("#spotkeno").css({'display':'none'});  
              if(gameID==5)
              {
              $.ajax({
                    url:SpotURL,
                    cache:false,
                    success:function(HtmlSpot)
                    {
                        $("#spotkeno").html(HtmlSpot);
                        $("#spotkeno").css({'display':'block'}); 
                    }
                 }); 
               }
                  $("#GamepanelWhite").css({'display':'none'});   
             }              
            }); 
        //for default lotto game
           $.ajax({
              url:DefaultGamepageur,
              cache: false,
              success: function(html){
              $("#gmaepanel_lotto").html(html); 
              $("#GamepanelWhite").css({'display':'none'}); 
                 $.ajax({
                            url:DefaultSpotURL,
                            cache:false,
                            success:function(HtmlSpot)
                            {
                                $("#SpotId").html(HtmlSpot);
                                $("#GamepanelWhite_lotto").css({'display':'none'});  
                            }
                      }); 
                 }              
            }); 
            
         
         }
         else if(gameID==1 || gameID==2 || gameID==3 || gameID==4)
         {
         
         //daily game Default game
        var DefaultGamepageur = "Gamepanels/pnl_joker.aspx";
        
       
        $("#wrap_lotto").css({'display':'block'});
             $.ajax({
              url:Gmaepageurl,
              cache: false,
              success: function(html){      
              $("#gmaepanel_lotto").html(html);  
               $.ajax({
                            url:SpotURL,
                            cache:false,
                            success:function(HtmlSpot)
                            {
                                $("#SpotId").html(HtmlSpot);
                                $("#innergamepanelimage").attr({'src':imageURL});
                                $("#GamepanelWhite_lotto").css({'display':'none'});  
                            }
                      }); 
              }              
            });
            
            //for daily game panel
            $.ajax({
              url:DefaultGamepageur,
              cache: false,
              success: function(html){              
              $("#gmaepanel").html(html); 
              $("#spotkeno").css({'display':'none'});  
               $("#GamepanelWhite").css({'display':'block'}); 
              }
              });
              
         }        
       
}

function betagainlotto(Gamedata,type)
{
            $("#gmaepanel_lotto").html(""); 
            $("#SpotId").html("");
            $("#GamepanelWhite_lotto").css({'display':'block'});
              if(type==1)
              {
               $("#GamepanelWhite_lotto").attr({'class':'white_gmaescreen_Default'});
              }
              else
               {
                $("#GamepanelWhite_lotto").attr({'class':'white_gmaescreen'});
                }
            
            $("#SpotId").css({'display':'block'});
             var Gmaepageurl="";
            var SpotURL=""; 
    if(type==1)
       {
          
            if(Gamedata==2)
            {
                 Gmaepageurl= "Gamepanels/pnlthunderball.aspx?gameid=2"; 
                 SpotURL= "AjaxPage/LottoGameballselector.aspx?gameID="+Gamedata;           
            }           
            else if(Gamedata==1)
            {
                 Gmaepageurl= "Gamepanels/pnlthursdaytsuperlotto.aspx?gameid=1"; 
                 SpotURL= "AjaxPage/LottoGameballselector.aspx?gameID="+Gamedata;           
            } else if(Gamedata==4)
            {
                 Gmaepageurl= "Gamepanels/pnlsaturdaysuperlotto.aspx?gameid=4"; 
                 SpotURL= "AjaxPage/LottoGameballselector.aspx?gameID="+Gamedata;           
            } else if(Gamedata==3)
            {
                 Gmaepageurl= "Gamepanels/pnlfastlotto.aspx?gameid=3"; 
                 SpotURL= "AjaxPage/LottoGameballselector.aspx?gameID="+Gamedata;           
            }else       
            {
                Gmaepageurl="Gamepanels/BlankGmaePanel.htm";
                SpotURL= "Gamepanels/Blank.htm";
            }  
      }
      else
      {
          if(Gamedata==2)
            {
                 Gmaepageurl= "Gamepanels/pnlthunderball.aspx?gameid=2&pageID=1"; 
                 SpotURL= "AjaxPage/LottoGameballselector_Inner.aspx?gameID="+Gamedata;     
                 imageURL="images/logo/Thunderball.jpg";      
            }           
            else if(Gamedata==1)
            {
                 Gmaepageurl= "Gamepanels/pnlthursdaytsuperlotto.aspx?gameid=1&pageID=1"; 
                 SpotURL= "AjaxPage/LottoGameballselector_Inner.aspx?gameID="+Gamedata; 
                 imageURL="images/logo/ThursdaySuperLotto.jpg";              
            } else if(Gamedata==4)
            {
                 Gmaepageurl= "Gamepanels/pnlsaturdaysuperlotto.aspx?gameid=4&pageID=1"; 
                 SpotURL= "AjaxPage/LottoGameballselector_Inner.aspx?gameID="+Gamedata;  
                 imageURL="images/logo/SaturdaySuperLotto.jpg";           
            } else if(Gamedata==3)
            {
                 Gmaepageurl= "Gamepanels/pnlfastlotto.aspx?gameid=3&pageID=1"; 
                 SpotURL= "AjaxPage/LottoGameballselector_Inner.aspx?gameID="+Gamedata; 
                 imageURL="images/logo/FastLotto.jpg";              
            }else       
            {
                Gmaepageurl="Gamepanels/BlankGmaePanel.htm";
                SpotURL= "Gamepanels/Blank.htm";
            }  
      }     
            $.ajax({
              url:Gmaepageurl,
              cache: false,
              success: function(html){      
              $("#gmaepanel_lotto").html(html);  
               $.ajax({
                            url:SpotURL,
                            cache:false,
                            success:function(HtmlSpot)
                            {
                                $("#SpotId").html(HtmlSpot);
                                $("#GamepanelWhite_lotto").css({'display':'none'});  
                            }
                      }); 
                 }              
            });
      
   }

function betagaindailygame(Gamedata,type)
{

        $("#gmaepanel").html(""); 
        $("#GamepanelWhite").css({'display':'block'});
          if(type==1)
          {
            $("#GamepanelWhite_lotto").attr({'class':'white_gmaescreen_Default'});
          }
          else
          {
            $("#GamepanelWhite").attr({'class':'white_gmaescreen'});
          }
        $("#spotkeno").css({'display':'none'}); 
        var Gmaepageurl="";
        var SpotURL=""; 
        if(type==1)
        {
        if(Gamedata==14)
        {
             Gmaepageurl= "Gamepanels/Pnl_Joker.aspx";             
        }       
         else if(Gamedata==15)
        {
             Gmaepageurl= "Gamepanels/Pnl_Joker5.aspx";             
        } else if(Gamedata==16)
        {
             Gmaepageurl= "Gamepanels/pnl_BadaJoker.aspx";             
        } else if(Gamedata==5)
        {
             Gmaepageurl= "pnl_keno.aspx";     
             SpotURL= "AjaxPage/KenoSpot.aspx?gameID="+Gamedata;          
        }else if(Gamedata==10)
        {
             Gmaepageurl= "Gamepanels/pnl_STT_container.aspx";           
        }
        else
        {
            Gmaepageurl="Gamepanels/BlankGmaePanel.htm";
        }    
            
     }
     else
     {
         if(Gamedata==14)
        {
             Gmaepageurl= "Gamepanels/Pnl_Joker.aspx";   
             imageURL ="images/Logo/joker.jpg";     
        }       
         else if(Gamedata==15)
        {
             Gmaepageurl= "Gamepanels/Pnl_Joker5.aspx";  
             imageURL="images/Logo/joker5.jpg";          
        } else if(Gamedata==16)
        {
             Gmaepageurl= "Gamepanels/pnl_BadaJoker.aspx";  
             imageURL="images/Logo/BadaJoker.jpg"; 
        } else if(Gamedata==5)
        {
             Gmaepageurl= "pnl_keno.aspx";     
             SpotURL= "AjaxPage/KenoSpot_Inner.aspx?gameID="+Gamedata; 
             imageURL="images/Logo/Keno.jpg";         
        }else if(Gamedata==10)
        {
        
             Gmaepageurl= "Gamepanels/pnl_STT_container.aspx";
             imageURL="images/Logo/SuperTripleTicket.jpg";
        }
        else
        {
            Gmaepageurl="Gamepanels/BlankGmaePanel.htm";
        }   
     } 
            $.ajax({
              url:Gmaepageurl,
              cache: false,
              success: function(html){              
              $("#gmaepanel").html(html);  
              $("#spotkeno").css({'display':'none'});  
              if(Gamedata==5)
              {
              $.ajax({
                    url:SpotURL,
                    cache:false,
                    success:function(HtmlSpot)
                    {
                        $("#spotkeno").html(HtmlSpot);
                        $("#spotkeno").css({'display':'block'}); 
                       
                    }
                }); 
              }
                  $("#GamepanelWhite").css({'display':'none'});        
           }              
       });
}