 function ParseDate( str1 )
    {
        // Parse the string in DD/MM/YYYY format
        re = /(\d{1,2})\-(\d{1,2})\-(\d{4})/
        var arr = re.exec( str1 );
        return new Date( parseInt(arr[3]), parseInt(arr[2], 10) - 1, parseInt(arr[1], 10) );
    }

    function chkdate(fromobj,toobj,msg)
    {
		var fobj = document.getElementById(fromobj);
		var tobj = document.getElementById(toobj);
		var result = false;
		if((fobj.value == "") || (tobj.value == ""))
		{
			if (typeof(Page_ClientValidate) == 'function') result = Page_ClientValidate();
			result=true;
		}
		else
		{
			var fromdate = ParseDate(fobj.value);
			var todate = ParseDate(tobj.value);
			
			if ( todate >= fromdate )
			{
				result=true;
				if (typeof(Page_ClientValidate) == 'function') result = Page_ClientValidate();
			}
			else
			{
				alert(msg);
				if (typeof(Page_ClientValidate) == 'function') result = Page_ClientValidate();
				result=false;
			}
        }
        return result;
    }
    
    function PrjDate(fromobj1,toobj1,msg1,fromobj2,toobj2,msg2)
    {
		var result=false;
		var result1=false;
		result = chkdate(fromobj1,toobj1,msg1);
		result1 = chkdate(fromobj2,toobj2,msg2);
		if(result == false || result1 == false)
			return false;
		else
			return true;
    }
    
    function ChkCurrDate(fromobj,msg)
    {
		var fobj = document.getElementById(fromobj);		
		var result = false;
		if((fobj.value == ""))
		{
			if (typeof(Page_ClientValidate) == 'function') result = Page_ClientValidate();
			result=true;
		}
		else
		{
			var fromdate = ParseDate(fobj.value);
			var todate = new Date();
			

			//to.setDate( currDate.getDate() - 1 );
			if ( todate > fromdate )
			{
				result=true;
				if (typeof(Page_ClientValidate) == 'function') result = Page_ClientValidate();
			}
			else
			{
				alert(msg);
				if (typeof(Page_ClientValidate) == 'function') result = Page_ClientValidate();
				result=false;
			}
        }
        return result;
    }
    
    function prjTasks(fromobj,toobj,msg)
    {
		var result=false;
		var fobj = document.getElementById(fromobj);
		var tobj = document.getElementById(toobj);
		if((fobj.value == "") || (tobj.value == ""))
		{
			if (typeof(Page_ClientValidate) == 'function') result = Page_ClientValidate();
			result=true;
		}
		else
		{
			result = chkdate(fromobj,toobj,msg);
			var fromdate = ParseDate(fobj.value);
			var todate = ParseDate(tobj.value);
			var prjFDate = ParseDate(prjFd);
			var prjTDate = ParseDate(prjTd);
			if(fromdate >= prjFDate && todate <= prjTDate && result==true)
			{
				return true;
			}
			else
			{
				alert("Search from & to date should be between project Search & to Date");
				return false;
			}
		}
    }