﻿

    var updateProgressDiv;
    function pageLoad(sender, args)
    {
       
        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);    

        updateProgressDiv = $get('updateProgressDiv');
        //  add our handler to the document's //  keydown event

        if(!args.get_isPartialLoad())
        {
            $addHandler(document, "keydown", onKeyDown);
        }
    }
   
    function beginRequest(sender, args)
    {
       
       var updateProgressDivBounds = Sys.UI.DomElement.getBounds(updateProgressDiv);
       var x = Math.round(screen.width/2) - Math.round(updateProgressDivBounds.width / 2);
       var y = Math.round(screen.height/2)  - Math.round(updateProgressDivBounds.height / 2);         
       updateProgressDiv.style.display = '';             
       updateProgressDiv.style.zindex = 999;
       Sys.UI.DomElement.setLocation(updateProgressDiv, x, y);     
    }
   
    function endRequest(sender, args) {updateProgressDiv.style.display = 'none'; }
    
    function overlay(curobj, subobj)
    {
        if (document.getElementById)
        {
            var subobj = document.getElementById(subobj);
            subobj.style.left= "150px";         /*  "300px";        /* getposOffset(curobj, "left")+"px" */
            subobj.style.top= "370px";         /*  "195px";        /*getposOffset(curobj, "top")+"px" */
            subobj.style.display="block" ;
            subobj.style.zIndex=99999 ;
            return false;   
        }
        else
        {
            return true;
        }
    }

    function overlayclose(subobj)
    { document.getElementById(subobj).style.display="none"; return false; }
    
    function onKeyDown(e)
    {
        if(e && e.keyCode == Sys.UI.Key.esc){     // if the key pressed is the escape key, dismiss the dialog
            $find('mdlpp').hide();
        }
    } 
    
//----- Note: -----------------Prashant Kumar
// (1) To display ajax loading, you have to include this js file in your aspx file and script manager also.
// (2) <div id="updateProgressDiv" class="updateProgress" style="display:none;z-index:999999;">
//      <div align="center" class="Progress"><img  alt="" src="../images/loading1.gif" align="absmiddle" /> Loading...</div>
//     </div>
// (3) Put above code just before closing form tag.
// (4) Add update panel in your form as well.
// (5) EnablePartialRendering="true"  ScriptMode="Release" <-- include this code in script manager also.
//-----------------------------    

/*
    function lockCol(tblID,sender,cssname) 
	{	
	    var table = document.getElementById(tblID);
	    //var button = document.getElementById(sender);//('toggle');
	    var cTR = table.getElementsByTagName('tr');  //collection of rows
    	
    	//table.rows[0].className = cssname;
    	
    	 
	    if (table.rows[0].cells[0].className == '') 
	    {   	         	
		    for (i = 0; i < cTR.length; i++)
			{
			    var tr = cTR.item(i);
			    tr.cells[0].className = cssname//'locked'
    			
			}    		
		    //button.innerText = "Unlock First Column";		    
		 }		  	
		 else 
		 {    		
		    for (i = 0; i < cTR.length; i++)
			{
			    var tr = cTR.item(i);
			    tr.cells[0].className = '';    			
			}
		    //button.innerText = "Lock First Column";
		    
		 }
		 
		
	}
	*/
