
/* Function to show the confirm message to delete the record*/
function confirmMsg()
	{
	if(confirm("Do you want to Delete this record")==true)
	return(true);
	else
	return(false);
	} 
	
//Check Maximum Characters
		function max_chars(strcontrol,maxlimit)
		{
			if(document.getElementById(strcontrol).value.length >= parseInt(maxlimit) )
			{
				return false;
			}
			else
			{
				return true;
			}
		}
		
//check maximum character on paste
		function chk_onpaste(strcontrol,maxlimit)
		{
			if(document.getElementById(strcontrol).value.length >= parseInt(maxlimit) )
			{
				return false;
			}
			else
			{
				return true;
			}
		}
		
		function unCheckHeader(chkAllHeader)
	/*
	chkAllHeader		:	Name of Header CheckBox as  "String"	
	*/

{
	var chkVarAll = document.getElementById(chkAllHeader)
	if (chkVarAll.checked==true)
		{				
			chkVarAll.checked=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 setFocusOnLoad(firstEle, secondEle)
{
	var ele = document.getElementById(firstEle)
	if (ele.disabled == false && ele.readOnly == false)
	{
			ele.focus();
	}
	else
		document.getElementById(secondEle).focus();
}
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;
						if (eval(chkVarInner)!=null)
						 eval(chkVarInner).checked=true;
						
				}
			}				

			else
				{
				for(i=iStartItemIndex;i<parseInt(intRowCount)+ parseInt(iStartItemIndex) ;i++)
					
					{
						chkVarInner="document.Form1." + dg + "__ctl" + i + "_" + chkInner;
						if (eval(chkVarInner)!=null)
						eval(chkVarInner).checked=false;
					}
							
				}

	}
	
	//created by Rajesh to set focus to the particular control
function focusToBtn(id)//id is the name of control where focus has to set
		{	
			if (window.event.keyCode==13)
			{
				
				document.getElementById(id).focus();						
				return false;
			}
			
			/*document.getElementById('TopHeader1_txtkeyword').focus();						*/
		}


	//created by Rajesh to set focus and execute click event the particular control
function focusToBtnGo(id)//id is the name of control where focus has to set
		{	
			if (window.event.keyCode==13)
			{
				//alert('hi')
				document.getElementById(id).click();						
				return false;
			}
			
			/*document.getElementById('TopHeader1_txtkeyword').focus();						*/
		}

	
	
//check Valid Email
function validEmail(email) 
{
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var checkend=/\.[a-zA-Z]{2,3}$/;

	if((email.search(exclude) != -1) || (email.search(checkend) == -1))	return false;

	atPos = email.indexOf("@",0);
	pPos1 = email.indexOf(".",0);
	periodPos = email.indexOf(".",atPos);
	pos1 = pPos1;
	pos2 = 0;
	while (pos2 > -1) 
	{
		pos2 = email.indexOf(".",pos1+1);
		if (pos2 == pos1+1)  return false;
		else  pos1 = pos2;
	}
	if (atPos == -1)	return false;
	if (atPos == 0)	return false;
	if (pPos1 == 0)	return false;
	if(email.indexOf("@",atPos+1) > -1)	return false;
	if (periodPos == -1)	return false;
	if (atPos+1 == periodPos)	return false;
	if (periodPos+3 > email.length)	
	return false;

	return true;
}

//by rajesh for controlling size of image at run time
 function resizeImg()
		{
			var j
			j=parseInt(document.Form1.hidImgMax.value)
		
			//alert('<%=imgmax%>');
		
				for (var x = 1; x<=parseInt(j); x++)
				{
		/*		alert(x);
					alert(parseInt(document.getElementById(x).height));
					alert(parseInt(document.getElementById(x).width));
		*/			
						if(parseInt(document.getElementById(x).width)>parseInt(document.getElementById(x).height))
						{
							document.getElementById(x).width=120
						}
						else
						{
							document.getElementById(x).width=120;
							document.getElementById(x).height=160;
						}
								
				}
			
			
			return false;
			
		}

























