// This JavaScript Document Contains Common functions

// Start :// Global Variable Declaration
   var gbl_concateOp = '^';
// End ://Global Variable Declaration Ends Here//

  // Start :// Function to replace special characters// 
	function replaceSpecialChar(str)
	{
	 	str=str.replace(/&amp;/gi, "&");
		str=str.replace(/&lt;/gi, "<");
		str=str.replace(/&gt;/gi, ">");		
		return(str);
	}
 // End :// Function Ends Here//
 
 // Start : Function to show and hide loading message  
    function showLoading(loadingDivId) {
		loadingbox = document.getElementById(loadingDivId);
		loadingbox.style.display = "block";
	}
	 
	function hideLoading(x, loadingDivId) {
	 var loadingbox = document.getElementById(loadingDivId);
	 loadingbox.style.display = "none";
	} 
	// End : Function to show and hide loading message
	function Trim(STRING){
	STRING = LTrim(STRING);
	return RTrim(STRING);
	}
	 
	function RTrim(STRING){
	while(STRING.charAt((STRING.length -1))==" "){
	STRING = STRING.substring(0,STRING.length-1);
	}
	return STRING;
	}
	 
	
	function LTrim(STRING){
	while(STRING.charAt(0)==" "){
	STRING = STRING.replace(STRING.charAt(0),"");
	}
	return STRING;
	}
	// Check Max Length
	function checkMaxLength(obj,fieldName,length){
	var txtLength = obj.value;
		if(txtLength.length >= length ){
			alert(fieldName+' should not be more than '+length+ 'characters');
			obj.focus();
			return false;
		}
		else{
			return true;
		}
	}