﻿//-------------------------------------------------------------------
// IsNull(value)
//   Returns true if value is null
//-------------------------------------------------------------------
function IsNull(val)
{
    return(val==null);
}

//-------------------------------------------------------------------
// IsEmpty(str)
//  return true if given string is empty other wise return false
// Function to check whether string is Null or not
//-------------------------------------------------------------------    
function IsEmpty(str) 
{
   
    return ((str == null) || (str.length == 0))
}

//-------------------------------------------------------------------
// IsBlank(value)
//   Returns true if value only contains spaces
//-------------------------------------------------------------------
function IsBlank(val)
{
	if(val==null){return true;}
	for(var i=0;i<val.length;i++)
	{
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r"))
		    {
		        return false;
		    }
	}
	return true;
}   
     
//-------------------------------------------------------------------
// Trim functions
//   Returns string with whitespace trimmed
// Function to replace the blank space to 
//-------------------------------------------------------------------
function Trim(objValue)
{
	// Trims the blank space from the start and end of string
	var lRegExp = /^\s*/;
	var rRegExp = /\s*$/;
	objValue = objValue.replace(lRegExp, ""); //Perform LTRim
	objValue = objValue.replace(rRegExp, ""); //perform RTrim
	return objValue; 
}

//-------------------------------------------------------------------

function LTrim(objValue)
{
	// Trims the blank space from the start of string
	
	var lRegExp = /^\s*/;
	objValue = objValue.replace(lRegExp, ""); //Perform LTRim
	return objValue; 
}
		
//-------------------------------------------------------------------

function RTrim(objValue)
{
	// Trims the blank space from the end of string		
	
	var rRegExp = /\s*$/;
	objValue = objValue.replace(rRegExp, ""); //perform RTrim
	return objValue;
}


// Name: createXMLDocument
// Input: String
// Output: XML Document
jQuery.createXMLDocument = function(string)
{
var browserName = navigator.appName;
var doc;
if (browserName == 'Microsoft Internet Explorer')
{
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false'
doc.loadXML(string);
} else {
doc = (new DOMParser()).parseFromString(string, 'text/xml');
}
return doc;
}

