
/* Function to show the confirm message to delete the record*/
function ConfirmDelete(strMsg)	    
{   
		    if(confirm(strMsg)==true)
					return(true);
			else
					return (false);
}			
/* Function to show the confirm message to Permanent deletion of record*/
function ConfirmPerDelete(strMsg1)	    
{   
var strmsg=''

strmsg = document.getElementById("hidDelMsg1").value
strmsg = strmsg + '\n' + document.getElementById("hidDelMsg2").value
strmsg = strmsg + '\n\n' + document.getElementById("hidDelMsg3").value
for (i=0 ;i<document.all.length;i++)
{
	if (document.all[i].id.substring(0,9) ==  'hidModule')
	{
		strmsg =strmsg +  "\n- " + document.all[i].value
	}
}
		    if(confirm(strmsg)==true)
				{
					if(confirm(strMsg1)==true)
					return(true);
					else
					return false;
				}
			else
					return (false);
					
					return false;
}	
/*To set focus to the first specified element but if the first element is disabled or readonly 
then set the focus to the second specified element */
function setFocusOnStartup(firstEle, secondEle)
{
	var ele = document.getElementById(firstEle)
	if (ele.disabled == false && ele.readOnly == false)
	{
			ele.focus();
	}
	else
		document.getElementById(secondEle).focus();
}

//to make the controls readonly
function readonlyControls(arr) 
// Just Pass the Array of the  Name of Controls as "String" Argument List, you want to make read only
	{		
		for(i=0;i<=arr.length-1;i++)
		{
			document.getElementById(arr[i]).readOnly=true;
		}
		
	}	

//restrict the speacial characters on key press
function CheckOnKeyPress(event)
    {
         
         var keyChar = window.event.keyCode;
		  if ((keyChar==33) || (keyChar == 96)||(keyChar == 126)||(keyChar == 64)||(keyChar == 35)||(keyChar == 36)||(keyChar == 37)||(keyChar == 94)||(keyChar == 38)||(keyChar == 6)||(keyChar == 40)||(keyChar == 123)||(keyChar == 91)||(keyChar == 59)||(keyChar == 58)||(keyChar == 39)||(keyChar == 34 )|(keyChar == 44)||(keyChar == 63)||(keyChar == 47)||(keyChar == 42)||(keyChar == 45)||(keyChar == 43)||(keyChar == 61)||(keyChar == 124)||(keyChar == 60)||(keyChar == 46)||(keyChar == 41)||(keyChar == 125)||(keyChar == 93)||(keyChar == 92)||(keyChar == 62)) 
		   		return(false);
			else
				return true;
    }
    
//restrict the speacial characters on paste
function CheckOnPaste(event)
    {
         var clipData=window.clipboardData.getData("Text");
         var clipDataLen=parseInt(window.clipboardData.getData("Text").length);
        
		for(i=0;i<=parseInt(clipDataLen)-1;i++)
		{
			var charCode=window.clipboardData.getData("Text").charCodeAt(i);
			if ((charCode==33) || (charCode == 96)||(charCode == 126)||(charCode == 64)||(charCode == 35)||(charCode == 36)||(charCode == 37)||(charCode == 94)||(charCode == 38)||(charCode == 6)||(charCode == 40)||(charCode == 123)||(charCode == 91)||(charCode == 59)||(charCode == 58)||(charCode == 39)||(charCode == 34 )|(charCode == 44)||(charCode == 63)||(charCode == 47)||(charCode == 42)||(charCode == 45)||(charCode == 43)||(charCode == 61)||(charCode == 124)||(charCode == 60)||(charCode == 46)||(charCode == 41)||(charCode == 125)||(charCode == 93)||(charCode == 92)||(charCode == 62)) 
			{
			   		return(false); //speacial character found
			   		
		   	}
		
		}
		return(true); //speacial character not found!
	}
	function checkAllOnGrid(intRowCount, iStartItemIndex,dg ,chkAllHeader,chkInner)
/*
intRowCount			:	Number of Items or Rows in Grid 
iStartItemIndex		:	Start index of very first Item in Grid
dg					:	Name of the Grid as "String"
chkAllHeader		:	Name of Header CheckBox as  "String"	
chkInner			:	Name of Inner CheckBox as  "String"	

*/
		{
		        

			var chkVarAll = document.getElementById(chkAllHeader)
			if (chkVarAll.checked==true)
			{
				for(i=iStartItemIndex;i<parseInt(intRowCount)+ parseInt(iStartItemIndex) ;i++)
				{
						chkVarInner="document.Form1." + dg + "__ctl" + i + "_" + chkInner;
						 eval(chkVarInner).checked=true;
						
				}
			}				

			else
				{
				for(i=iStartItemIndex;i<parseInt(intRowCount)+ parseInt(iStartItemIndex) ;i++)
					
					{
						chkVarInner="document.Form1." + dg + "__ctl" + i + "_" + chkInner;
						eval(chkVarInner).checked=false;
					}
							
				}

	}		

function unCheckHeader(chkAllHeader)
	/*
	chkAllHeader		:	Name of Header CheckBox as  "String"	
	*/

{
	var chkVarAll = document.getElementById(chkAllHeader)
	if (chkVarAll.checked==true)
		{				
			chkVarAll.checked=false;
		}
}

//disallow the entry of text in a textbox
function makeReadOnly()
{
	return false;
}
function UnauthorizedAccess()
{
	alert("You are not authorized user to access this functionality, Contact your Administrator");
	return false;
}


//don't accept user input in a text box if the specified limit exceeds.
function maxChars(textControl, limit)
{
           if(document.getElementById(textControl).value.length >= parseInt(limit))
 	{			 
	   return false;			  
                 }
}
