// JScript File
 var objGetdate = null;
    function ajaxGetDate(SelectVal) 
    {
        if(window.ActiveXObject)
        {    
            try
            {
                objGetdate = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch(e)
            {
                try
                {
	                objGetdate = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch(e1)
                {
	                objGetdate = null;
                }
            }
        }  
        else if(window.XMLHttpRequest)
        {
            try
            {
                objGetdate = new XMLHttpRequest("Msxml2.XMLHTTP");
            }
            catch(e)
            {
                try
                {
	                objGetdate = new XMLHttpRequest("Microsoft.XMLHTTP");
                }
                catch(e1)
                {
	                objGetdate = null;
                }
            }
        }
        if(objGetdate!=null)
        {              
            var k=Math.floor(Math.random()*111);
            if(window.ActiveXObject)
            {                                    
                objGetdate.onreadystatechange=Process_Response_GetDate;
                objGetdate.open("GET","GetWeekMonthDate.aspx?Type=" + SelectVal ,false);
                objGetdate.send(null); 
            } 
            else if(window.XMLHttpRequest)
            {
                objGetdate.open("GET","GetWeekMonthDate.aspx?Type=" + SelectVal ,false);
                objGetdate.send(null); 
                objGetdate.onreadystatechange=Process_Response_GetDate(SelectVal);
            }                           
        }
        return false;
    }
     function Process_Response_GetDate(SelectVal) 
    {
        if(objGetdate.readyState == 4)
		{
            if(objGetdate.status == 200)
			{
			    var retval=objGetdate.responseText;	
			    if(retval.length < 40)
			    {
				    if (retval.length > 0 && retval!="Fail")
				    {
				       var arr=retval.split('$');
				        document.getElementById('ctl00_BodyContentPH_txtFromDate').value=arr[0];
				        document.getElementById('ctl00_BodyContentPH_txtToDate').value=arr[1];
				    }
				    if(SelectVal=="3")
				    {
				        document.getElementById('ctl00_BodyContentPH_txtFromDate').readOnly=false;
				        document.getElementById('ctl00_BodyContentPH_txtToDate').readOnly=false;
				    }
				    else
				    {
				        document.getElementById('ctl00_BodyContentPH_txtFromDate').readOnly=true;
				        document.getElementById('ctl00_BodyContentPH_txtToDate').readOnly=true;
				    }
				}
				else
				{
				    window.top.location.href="../Index.aspx";
				}
			}
		}
	}
	function PageOnloadDate()
	{
	    if(document.getElementById('ctl00_BodyContentPH_rbCustom').checked)
	    {
	          document.getElementById('ctl00_BodyContentPH_txtFromDate').readOnly=false;
			  document.getElementById('ctl00_BodyContentPH_txtToDate').readOnly=false;
	    }
	    else
	    {
	        document.getElementById('ctl00_BodyContentPH_txtFromDate').readOnly=true;
			document.getElementById('ctl00_BodyContentPH_txtToDate').readOnly=true;
	    }
	}