﻿/*
******* The following script is to prevent double postback on any of the buttons while an async post back is happening****
******* DO NOT REMOVE, IT MUST BE AT THE END OF THE CONTENT**********
******* script found on asp.net forum -- http://forums.asp.net/p/1173891/1976235.aspx#1976235
*/
var prm = Sys.WebForms.PageRequestManager.getInstance(); 
prm.add_initializeRequest(initializeRequest);
prm.add_endRequest(endRequest);

var postbackElement; 
// checks the PageRequestManager if there is already a postback being processed
// and aborts the postback (question: which postback does it abort?)
// See details here: http://microsoftmiles.blogspot.com/2006/11/maintaining-gridview-scroll-position-in.html
// and http://geekswithblogs.net/rashid/archive/2007/08/08/Asp.net-Ajax-UpdatePanel-Simultaneous-Update---A-Remedy.aspx
function initializeRequest(sender, args) 
{ 
//document.body.style.cursor = "wait";
if (prm.get_isInAsyncPostBack()) 
{
//debugger
args.set_cancel(true); 
}
}

function endRequest(sender, args) 
{
//document.body.style.cursor = "default";
}

function IsValidDate(Day,Mn,Yr){
    
    var dt = new Date(Yr + '/' + Mn + '/' +Day);

    if(dt.getDate()!=Day){        
        return false;
        }
    else if(dt.getMonth()!=Mn-1){
    //this is for the purpose JavaScript starts the month from 0
        return false;
        }
    else if(dt.getFullYear()!=Yr){
        return false;
        }
        
    return true;
 }

