/* Ajax Function declaration Start */
function GetXmlHttpObject() 
{
	var xmlHttpGnl=null;
	try 
	{
		//Firefox, Opera 8.0+, Safari
		xmlHttpGnl=new XMLHttpRequest();
	} 
	catch (e) 
	{
		try 
		{
			//Internet Explorer
			xmlHttpGnl=new ActiveXObject("Msxm12.XMLHTTP");
		} 
		catch(e) 
		{
			xmlHttpGnl=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttpGnl;
}
/* Ajax Function declaration end */


// Convert the no to float with 2 decimal places
function funConvertToFloat(str, points) 
{
	str = new String(str).replace(/,/g, '');
	var num = parseFloat(str).toFixed(points || 2);
	return num;
}

// format the number 
function funNumberFormat(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}
function LTrim(str) {
   var whitespace = new String(" ");
   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {

      var j=0, i = s.length;

      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      s = s.substring(j, i);
   }
   return s;
}

function RTrim(str)	{
   var whitespace = new String(" ");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {

      var i = s.length - 1;       

      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      s = s.substring(0, i+1);
   }
   return s;
}

function Trim(str)
{

   return RTrim(LTrim(str));
}
/*[START] To check where the given element is exists or not*/
function isInDocument(el) {
	var html = document.body.parentNode;
	while (el) {
		if (el === html) {
			return true;
		}
		el = el.parentNode;
	}
	return false;
}
/*[OVER] To check where the given element is exists or not*/
