﻿<!-- Begin
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now1 = new Date();
var hours1 = now1.getHours();
var minutes1 = now1.getMinutes();
var seconds1 = now1.getSeconds()
var timeValue = "" + ((hours1 >12) ? hours1 -12 :hours1)
if (timeValue == "0") timeValue = 12;
timeValue += ((minutes1 < 10) ? ":0" : ":") + minutes1
timeValue += ((seconds1 < 10) ? ":0" : ":") + seconds1
timeValue += (hours1 >= 12) ? " P.M." : " A.M."
document.form1.txtdrawclosetime.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock() {
stopclock();
showtime();
}
// End -->
//F-PREEMP.



<!-- Begin
 var time=new Array(0,15,0)  
function window_Onload()
{
    setInterval("updateTime()",1000);     
} 
 function getCombo1(sel) 
 {
  	  var combo = sel.options[sel.selectedIndex].value; 
      for(i=0;i<10;i++)
      {
      document.getElementById("txt" + i).value=combo+i;
      }
	ResultsPanel.location.href="LatestResults.aspx?Series="+ combo.substring(0,1);

 }
 
function updateTime() 
{ 
var t2,t1,t0
time[0] -- 
if (time[0] < 0) 
{ 
time[1] -- 
time[0] = 59
} 
if (time[1] < 0) 
{ 
time[2] -- 
time[1] = 59 
}

if (time[2] < 10)
 {
	t2= "0" + time[2]
 }
else
{
	t2=  time[2]	
 }
 if (time[1] < 10)
 {
	t1= "0" + time[1]
 }
 else
 {
 	t1=  time[1]
 }
 if (time[0] < 10)
 {
	t0= "0" + time[0]
 }
 else
 {
	t0= time[0]
 }
 

if (time[0] == 0 && time[1] == 0 && time[2] == 0) 
{
    document.form1.txttimer.value = " " + 00 + " : " + 00 + " : " + 00 + " " 
    document.location = "Sanjay.aspx"
 }
else 
{
   document.form1.txttimer.value = "  " + t2 + " : " + t1 + " : " + t0 
}
  
}
//  End -->
function getKeyCode(e)// v1.0
{
	if (window.event)
	   return window.event.keyCode;
	else if (e)
	   return e.which;
	else
	   return null;
}
//Randomly generate number
function stt4d1()
{
     var a1;
 
     a1=(Math.floor(Math.random()*3)+1);
     if(a1==1)
     {                     
     a1=11;
     }
     else if(a1==2)
     {
     a1=12;                     
     }
     else if(a1==3)
     {
     a1=13;
     }
     return a1;    
}
function stt4d2()
{
    var a2;
 
    a2=(Math.floor(Math.random()*4)+1);
    return a2;   
}
function stt4d3()
{
    var a3;
 
    a3=(Math.floor(Math.random()*2)+1);
    return a3;   
}
function stt4d4()
{
    var a4;
 
    a4=(Math.floor(Math.random()*5)+1);
    return a4;   
}
function stt4d5()
{
     var a5;
     var a6;
     var a7;
     var a8;
     var c1;
     a5=Math.floor(Math.random()*10);
     a6=Math.floor(Math.random()*10);
     a7=Math.floor(Math.random()*10);
     a8=Math.floor(Math.random()*10);
     c1=a5+""+a6+""+a7+""+a8
     return c1;
}
//validation for textbox
function ValidateText(i) 
{
    if(i.value.length>0) 
    {
    i.value = i.value.replace(/[^\d]+/g, ''); 
    }  
    if(i.value >= 1 && i.value >= 100)
    {
    alert('You cannot play more than 99 bets for this game. Please play again for more bets.');
    i.value="";
    Calculate();
    }    
}
function ValidateText1(i) 
{
    if(i.value.length>0) 
    {
    i.value = i.value.replace(/[^\d]+/g, ''); 
    }  
    if(i.value >= 1 && i.value >= 28)
    {
    alert('You cannot play more than 27 bets for this game. Please play again for more bets.');
    i.value="";
    Calculate();
    }    
}
function ValidateText2(i) 
{
    if(i.value.length>0) 
    {
    i.value = i.value.replace(/[^\d]+/g, ''); 
    }  
    if(i.value >= 1 && i.value >= 26)
    {
    alert('You cannot play more than 25 bets for this game. Please play again for more bets.');
    i.value="";
    Calculate();
    }    
}
function ValidateText3(i) 
{
    if(i.value.length>0) 
    {
    i.value = i.value.replace(/[^\d]+/g, ''); 
    }  
    if(i.value >= 1 && i.value >= 17)
    {
    alert('You cannot play more than 16 bets for this game. Please play again for more bets.');
    i.value="";
    Calculate();
    }    
}
function ValidateText4(i) 
{
    if(i.value.length>0) {
        i.value = i.value.replace(/[^\d]+/g, ''); 
    }  
    if(i.value >= 1 && i.value >= 11)
    {
    alert('You cannot play more than 10 bets for this game. Please play again for more bets.');
    i.value="";
    Calculate();
    }    
}
function ValidateText5(i) 
{
    if(i.value.length>0) 
    {
    i.value = i.value.replace(/[^\d]+/g, ''); 
    }  
    if(i.value >= 1 && i.value >= 6)
    {
    alert('You cannot play more than 5 bets for this game. Please play again for more bets.');
    i.value="";
    Calculate();
    }    
}
function ValidateText6(i) 
{
    if(i.value.length>0) 
    {
    i.value = i.value.replace(/[^\d]+/g, ''); 
    }  
    if(i.value >= 1 && i.value >= 3)
    {
    alert('You cannot play more than 2 bets for this game. Please play again for more bets.');
    i.value="";
    Calculate();
    }    
}
function ValidateText7(i) 
{
    if(i.value.length>0) 
    {
    i.value = i.value.replace(/[^\d]+/g, ''); 
    }  
    if(i.value >= 1 && i.value >= 2)
    {
    alert('You cannot play more than 1 bets for this game. Please play again for more bets.');
    i.value="";
    Calculate();
    }    
}
function Restrict(e,Val)
{		
    key = getKeyCode(e);
    if ( key >= 37 && key <= 40  ) {
        name = Val.replace('txt','');
        row = eval(name.substring(0,1));
        col = eval(name.substring(1,2));
        //alert( row + " : " + col )
        name=""
        if ( key == 38 && row > 0 ) {
            name = 'txt'+(row-1)+col;
        }
        if ( key == 39 && col < 9 ) {
            name = 'txt'+(row)+(col+1);
        }
        if ( key == 40 && row < 11 ) {
            name = 'txt'+(row+1)+(col);
        }
        if ( key == 37 && col > 0 ) {
            name = 'txt'+(row)+(col-1);
        }
        if ( name != "" ) {
            //alert( name )
            //document.forms.form1(name).select();
            document.getElementById(name).focus();
        }
        
    }
    else {
        if(document.getElementById(Val).value.length>0) 
        {
		        document.getElementById(Val).value = document.getElementById(Val)
		        
		        .value.replace(/[^\d]+/g, ''); 
        }    
        for(var i=0;i<10;i++)
       {
            for(var j=0;j<10;j++)
            {
                if(document.getElementById("txt"+i+j+"0").value == 0)
                    document.getElementById("txt"+i+j+"0").value = "";
            }
       }	
    }
}	

function keyRestrict(e, validchars) { // v3.0    
//    alert(e);
	var key='', keychar='';
	key = getKeyCode(e);
	if (key == null) return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	validchars = validchars.toLowerCase();
	if (validchars.indexOf(keychar) != -1)
	{
	 
		return true;
	}
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
	{	    
		return true;	
	}	
	return false;
}

function Calculate()
{
    //alert( "called");
    //document.getElementById("nd").value= document.getElementById("ddlnoofdraw").value;
    tmp = "";
    totalQty = 0;      
    amtArray = [0,0,0,0,0,0,0,0,0,0]
    for ( i=0; i < 1000; i+=10 ) {
	    s = ""+i;
	    if ( i < 10 )
	    	s = "00" + i;
	    else if ( i < 100 )
	    	s = "0" + i	    	
	    xxx = document.getElementById("txt" + s ).value;	   
	    if ( xxx != "" ) {
	        zzz  = parseInt(  xxx ) ;	       
	        if ( zzz != 0 ) {
	            totalQty+=(zzz*10*2);
	            xxyy = parseInt(s.substring(0,1));
	            amtArray[xxyy] += zzz*10*2;
	        }	        
	    }
	    
    }      
    for ( x=0; x < amtArray.length; x++ )
    document.getElementById("txtamt"+x ).value = amtArray[x].toFixed(2)*document.getElementById("nd").value;
  	document.getElementById("txtfinalamt").value = totalQty.toFixed(2)*document.getElementById("nd").value;  		
}

function GetAllValues()
{
   var drawid="";
   if (document.forms.form1.accountno.value == "")
   {
        alert("Enter Cash Card Number.");
        document.forms.form1.accountno
        return false;
   }
   else if (document.forms.form1.password.value == "")
   {
        alert("Enter Password.");
        return false;
   }  
   var Output; 
    tmp = "";
    totalQty = 0;
    for ( i=0; i < 1000; i+=10 ) {
	    s = ""+i;
	    if ( i < 10 )
	    	s = "00" + i;
	    else if ( i < 100 )
	    	s = "0" + i
	    xxx = document.getElementById("txt" + s ).value;
	    if ( xxx != "" ) {
	        zzz  = parseInt(  xxx ) ;
	        if ( zzz != 0 ) {
	            if ( tmp != "" )
	                tmp = tmp + "|";
	            tmp = tmp +document.getElementById("Select1" ).value+s+",1,"+(xxx*10) ;	            
	        }
	    }
	    
    }     
      Output=tmp;      
      //alert(Output);     
   if (Output != "")
   {
        //alert("output " + Output);
        document.forms.form1.Output.value = Output;        
        document.getElementById("Submit1").disabled = true; 
        document.form1.action = "LuckylottTicketDetail.aspx";
        document.form1.submit();
   }           
}

function ChangeGameName()
{
    for(i=1; i<=10; i++)
    {        
            document.getElementById("lbllott"+i).innerHTML = document.getElementById("ddllevelId").value;
    }    
}

function selectedtime()
{
    var i=0;
    while ((document.form1.ddllevelId.options[i].value != document.getElementById("ddllevelId").value) && (i < document.form1.ddllevelId.options.length))
    {
    i++;
    }
        if (i < document.form1.ddllevelId.options.length)
        {
            if (i == 0 )
	        {
		     document.getElementById("txtdrawid").value='0';   
	        }
	        else
	        {
		     document.getElementById("txtdrawid").value=document.form1.ddllevelId.options[i].value;   
	        }	      
        }
        if (i != 0)
        {       
	     document.getElementById("nd").value=1;
         document.form1.ddlnoofdraw.disabled = true;
         document.form1.ddlnoofdraw.value=1;   
          tmp = "";
    totalQty = 0;      
    amtArray = [0,0,0,0,0,0,0,0,0,0]
    for ( i=0; i < 1000; i+=10 ) {
	    s = ""+i;
	    if ( i < 10 )
	    	s = "00" + i;
	    else if ( i < 100 )
	    	s = "0" + i	    	
	    xxx = document.getElementById("txt" + s ).value;	   
	    if ( xxx != "" ) {
	        zzz  = parseInt(  xxx ) ;	       
	        if ( zzz != 0 ) {
	            totalQty+=(zzz*10*2);
	            xxyy = parseInt(s.substring(0,1));
	            amtArray[xxyy] += zzz*10*2;
	        }	        
	    }
	    
    }      
    for ( x=0; x < amtArray.length; x++ )
    document.getElementById("txtamt"+x ).value = amtArray[x].toFixed(2)*document.getElementById("nd").value;
  	document.getElementById("txtfinalamt").value = totalQty.toFixed(2)*document.getElementById("nd").value;  		

        }
        else
        {
        document.form1.ddlnoofdraw.disabled = false; 
        }

} 
function noofdraw()
{	
	 document.getElementById("nd").value= document.getElementById("ddlnoofdraw").value;		
	  tmp = "";
    totalQty = 0;      
    amtArray = [0,0,0,0,0,0,0,0,0,0]
    for ( i=0; i < 1000; i+=10 ) {
	    s = ""+i;
	    if ( i < 10 )
	    	s = "00" + i;
	    else if ( i < 100 )
	    	s = "0" + i	    	
	    xxx = document.getElementById("txt" + s ).value;	   
	    if ( xxx != "" ) {
	        zzz  = parseInt(  xxx ) ;	       
	        if ( zzz != 0 ) {
	            totalQty+=(zzz*10*2);
	            xxyy = parseInt(s.substring(0,1));
	            amtArray[xxyy] += zzz*10*2;
	        }	        
	    }
	    
    }      
    for ( x=0; x < amtArray.length; x++ )
    document.getElementById("txtamt"+x ).value = amtArray[x].toFixed(2)*document.getElementById("nd").value;
  	document.getElementById("txtfinalamt").value = totalQty.toFixed(2)*document.getElementById("nd").value;  		

}

function flasher() 
{             
            var d = document.getElementById("lbl") ;                       
            d.style.color= (d.style.color=='black'?'white':'black');            
            setTimeout('flasher()', 1000);            

}