function isComboNull(fldName,strMsg)
{
/*---------------------------------------------------------------------
'Input Parameter	:Combobox control Name,Field Name to display
'OutPut Parameter	:True / False
'Purpose			:To check if the combobox value is blank or not
'Comments			:If combobox value is blank then display alert , 
					 set focus on the control and return True 
					 else return False
'---------------------------------------------------------------------*/

	
	if((fldName.options[fldName.selectedIndex].value=="0") || (fldName.options[fldName.selectedIndex].value==null) || (fldName.options[fldName.selectedIndex].value==""))
	{
		alert(strMsg + " Cannot be Blank");
		fldName.focus();
		return true;
	}
}

function isElementNull(fldName,strMsg)
{
/*---------------------------------------------------------------------
'Input Parameter	:Text box control Name,Field Name to display
'OutPut Parameter	:True / False
'Purpose			:To check if the textbox value is blank or not
'Comments			:If textbox value is blank then display alert , 
					 set focus on the control and return True 
					 else return False
'---------------------------------------------------------------------*/

	if(fldName.value=="")
	{
		alert(strMsg + " Cannot be Blank");
		fldName.focus();
		return true;
	}
}
function isAvailable(fldName,strMsg)
{
/*---------------------------------------------------------------------
'Input Parameter	:Text box control Name,Field Name to display
'OutPut Parameter	:True / False
'Purpose			:To check if the textbox value is blank or not
'Comments			:If textbox value is blank then display alert , 
					 set focus on the control and return True 
					 else return False
'---------------------------------------------------------------------*/

	if(fldName.value==0)
	{
		alert(strMsg + " you typed is already in Use");
		document.form.UserId.focus();
		return true;
	}
}

function isNumeric(fldName,strMsg)
{
/*---------------------------------------------------------------------
'Input Parameter	:Form control Name,Field Name to display
'OutPut Parameter	:True / False
'Purpose			:To check if the control value is numeric
'Comments			:If contol value is not numeric then display alert , 
					 select the control text,set focus on the control 
					 and return True else return False
'---------------------------------------------------------------------*/

	strValue = fldName.value
	if(strValue != "")
	{
		flag = true;
		for(i=0; i<strValue.length; i++)
		{	
			if(!(strValue.charAt(i)>="0" && strValue.charAt(i)<="9"))
			{
				flag=false;
			}
		}
		if(flag==false)
		{
			alert(strMsg+" Should be Numeric ");
			fldName.select();
			fldName.focus();
			return false;
		}
		return true;
	}
		return true;
}


function isEmailId(fldName,strMsg) 
{
/*---------------------------------------------------------------------
'Input Parameter	:Form control Value,Field Name to display
'OutPut Parameter	:True / False
'Purpose			:To check the value of Email ID 
'					1) For occurance of @, ".".
'					2) @.,.@ or ".." should not appear.
'					2) For Position of @ , "_","-" and "." values.
'					3) For number of characters after "."
'					4) For characters input for email address
'Comments			:If email ID value is proper then return True 					 			 else return False
'---------------------------------------------------------------------*/

	var eMailId = fldName.value;
	if(eMailId.indexOf("@") == 0 || eMailId.indexOf("@") == -1 ||  eMailId.indexOf(".") == 0 || eMailId.indexOf(".") == -1 || eMailId.indexOf("@.") != -1 || eMailId.indexOf(".@") != -1 || eMailId.indexOf("..") != -1)
	{
		flag=false;	
	}
	else
	{
		flag=true;
	}
	flag2=false;
	flag1=false;
	count=0;

	end_var=eMailId.length-1;
	last3_var=eMailId.length-3;
	last4_var=eMailId.length-4;

	if(flag)
	{
		if(!(eMailId.charAt(end_var)=="@" || eMailId.charAt(end_var)== "." || eMailId.charAt(end_var)=="_" || eMailId.charAt(end_var)=="-" || !(eMailId.charAt(last3_var)=="." || eMailId.charAt(last4_var)== ".")))
		{
			flag1=true;
		}
		else
		{
			flag1=false;
		}
		if(flag1)
		{
			for(i=0;i < eMailId.length;i++)
			{
				if(!((eMailId.charAt(i) >= "a" && eMailId.charAt(i) <= "z") || (eMailId.charAt(i) >= "A" && eMailId.charAt(i) <= "Z") || (eMailId.charAt(i) >= "0" && eMailId.charAt(i) <= "9") || eMailId.charAt(i) =="-" || eMailId.charAt(i) =="_" || eMailId.charAt(i) =="@" || eMailId.charAt(i) =="."))
				{
					flag2=false;
					break;
				}
				else
				{
					if(eMailId.charAt(i) =="@")
					{
						count++;
					}
					if(count >1)
					{
						flag2=false;
						break;
					}
					else
					{
						flag2=true;
					}
				}
			}
		}
	}

	if(!(flag && flag1 && flag2))
	{
		alert("Please Check the " + strMsg ) ;
		fldName.select();
		fldName.focus();
		return false;
	}
	else
	{
		return true;
	}
}

