
//function window.confirm(str)
//{
//    execScript('n = msgbox("'+str+'","4132")', "vbscript");
//    return(n == 6);
//}



		
function funDeleteCustGrpMsg(obj)
{
    var prefix;
    prefix = '';
    prefix = obj.id.substring(0, (obj.id.lastIndexOf('_') + 1));	
	if(confirm("Are you sure, you want to delete customer group?"))
	{
		document.getElementById(prefix +'btnDel').click();
		return true;
	}
	else
	{	
	return false;
	}

}

function SelectAll(obj) 
{
    var i;
    if (obj.checked == true) 
    {
        for (i=0; i < document.forms[0].elements.length; i++)   
        {
            if ((document.forms[0].elements[i].type == 'checkbox') && (document.forms[0].elements[i].name.indexOf('dgCustomerGrid') > -1)) 
            {
                
                document.forms[0].elements[i].checked = true;
            }
        }
    } 
    else
    {
        for (i=0; i < document.forms[0].elements.length; i++) 
        {
            if ((document.forms[0].elements[i].type == 'checkbox') && (document.forms[0].elements[i].name.indexOf('dgCustomerGrid') > -1)) 
            {
                document.forms[0].elements[i].checked = false;
            }
        }
    }
}




//**************************Trim******************************************************************** 
 	// Removes leading whitespaces
       function LTrim( value ) 
       {
		var re = /\s*((\S+\s*)*)/;
	    return value.replace(re, "$1");
       }
      // Removes ending whitespaces
       function RTrim( value ) 
       {
	    var re = /((\s*\S+)*)\s*/;
	    return value.replace(re, "$1");
       }
      // Removes leading and ending whitespaces
       function Trim( value ) 
         {
	        return LTrim(RTrim(value));
         }
  //**************************************************************************************************  


//function for validating starting space

		function CheckStartSpace(tbControl)
		{	
			var ControlText=document.getElementById(tbControl).value;
			var C=ControlText.substring(0,ControlText.length);
						
			if(ControlText.charAt(0) == ' ')
			{	var pos = 0;
				for(var i=0;i<ControlText.length;i++)
				{   if(ControlText.charAt(i) == ' ' )
						pos=pos+1;
				    if(ControlText.charAt(i)!='')
						break; 
			    } 
			  document.getElementById(tbControl).value= ControlText.substring(pos,ControlText.length);
			}			
			
		}






