function onText(str){ window.status = str; return true }
function offText(){ window.status = ""; return true }

function isNull(s) { return ((s == null) || (s == "")); }
// Function checks whether the passed string has all printable characters.
// checks if the string contains all characters that satisfy isprint() of Standard C library fn.
function isPrintable(s) 
{
	if(s.search(/[^\x20-\x7e]/)!=-1) return false;
	return true;
}
// function to check that the subject is not composed of only spaces. 
// Will return false if the string is composed of all spaces. 
// Moreshwar 29th December, 2004. 
function trimWhiteSpace (str)
{
	// serach and remove trailing and staring blank spaces. 
	str = str.replace(/^[\s]+/,"").replace(/[\s]+$/,"");
	return str;		
}

// function to limit the maximum length of the text box. 
// Moreshwar 29th December, 2004. 
function textLimit(field, maxlen) 
{
	// make sure that the last char added is also truncated.
	// No alerts have been provided.
	if (field.value.length >= maxlen)
		field.value = field.value.substring(0, maxlen);
}

// Angrez: 19-1-2006:
// Function to check if URL is escaped or not
function isEscaped(url)
{
    return url != unescape(url);
}

function validateDateRangeOrder(fromDate, toDate)
{
    if(!(isNull(fromDate) && isNull(toDate)))
    {
        var strstartDate = fromDate.split('/');
        var startYear = strstartDate[2];
        var startMonth = strstartDate[0];
        var startDay = strstartDate[1];
        var startDate = new Date(startYear,startMonth,startDay);  
        
        var strendDate = toDate.split('/'); 
        var endYear = strendDate[2];
        var endMonth = strendDate[0];
        var endDay = strendDate[1];
        var endDate = new Date(endYear,endMonth,endDay); 
        
        var timeDifference = startDate - endDate;    
        if(timeDifference > 0)
        {
            alert("End date must be greater than start Date");
            return false;
        }
    }
    return true;
}
