﻿

    

/****************Functions***************************/
         	function SelectState()
		{
			var StateID = "";
			StateID = cboState.getValue();	
			
			ob_post.post(null, "SetState", SetState, {"StateID":StateID});
			
			document.getElementById("divArrow").style.visibility= "hidden";
                document.getElementById("imgArrow").style.width="0";
                
             document.getElementById("divEmail").style.visibility="visible";   
                
                var oTxtEvents = document.getElementById("dlHeader");
               oTxtEvents.innerHTML = "<p>&nbsp;</p><p>&nbsp;</p>You are viewing " + StateID+" State Lottery Remaining Prizes<hr width='550px'/>"; 
			document.getElementById("divCheckBox").style.visibility= "visible";	
			
		}
		function SetState()
		{
			ob_post.UpdatePanel("cpPriceInfo");
			displayDetailInfo();
			
		}
		 function loadInPricefo() 
		 {
                var sContactId = cboPrice.getValue();
                ob_post.AddParam("Price", sContactId);
                ob_post.post(null, "OnPriceSelect", displayDetailInfo);
                
                displayDetailInfo();
         }
        
        function checkedAllChange()
        {
            
            if(document.getElementById('cbAll').checked)
            {
             ob_post.post(null, "SetAll", SetAll, {"IsChecked":true});
              document.getElementById("cpPriceInfo").style.visibility= "hidden";
            
            }
            else
            {
               ob_post.post(null, "SetAll", SetAll, {"IsChecked":false});
               document.getElementById("cpPriceInfo").style.visibility= "visible";
            }
            
            displayDetailInfo();
            
        }
         
         function SetAll()
		{
			ob_post.UpdatePanel("cpPriceInfo");
		}
		
		
		 function displayDetailInfo() {
            
                ob_post.UpdatePanel("cpLotteryResults");
              

            }
            
       function ImageLoadFailed()
       {
         window.event.srcElement.src = "images/NoPicFound.gif"
       }
       
       
       
    function getPrint(print_area)
		{	
			//Creating new page
			var pp = window.open();
			//Adding HTML opening tag with <HEAD> … </HEAD> portion 
			pp.document.writeln('<HTML><HEAD><title>Print Preview</title><LINK href=Styles.css  type="text/css" rel="stylesheet">')
			pp.document.writeln('<LINK href=PrintStyle.css  type="text/css" rel="stylesheet" media="print"><base target="_self"></HEAD>')
			//Adding Body Tag
			pp.document.writeln('<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
			//Adding form Tag
			pp.document.writeln('<form  method="post">');
			//Creating two buttons Print and Close within a table
			pp.document.writeln('<div align="center"  style="width:100%;"><TABLE width="600" border="0" cellpadding="0" cellspacing="0"><TR><TD valign ="top" align=right><INPUT ID="PRINT" type="button" value="Print" onclick="javascript:location.reload(true);window.print();"><INPUT ID="CLOSE" type="button" value="Close" onclick="window.close();"></TD></TR><TR><TD></TD></TR><TR><TD valign ="top">');
			//Writing print area of the calling page
			pp.document.writeln(document.getElementById(print_area).innerHTML);
			//Ending Tag of </form>, </body> and </HTML>
			pp.document.writeln('</TD></TR></TABLE></div></form></body></HTML>');			
			
		}		
		
		function displayEmailInfo(print_area) {
                                
              var message =  document.getElementById(print_area).innerHTML;
                ob_post.post(null, "SetEmailMessage", SetEmailMessage, {"message":message});
                
            }
		function SetEmailMessage()
		{
				displayDetailInfo();	
					window.location = "email.aspx"
		}
		
		 function SendEmail() {
               var sEmail = document.getElementById("txtEmail").value;
               if (checkEmail(sEmail) == false) {
                   document.getElementById("txtEmail").focus();
                   alert("Please Enter your valid Email ID")
                   return false;
               }
               
               ob_post.AddParam("sEmail", sEmail);
               ob_post.post(null, "OnSendEmail", displayEmailInfo);
           }
           
           	function BackToHome()
		{
				window.location = "default.aspx";
		}
		