

//Function to check whether the data has been entered into the control

function f_CheckForBlank(objTemp)
	{
		if (typeof(objTemp)=="object")
			
			{
				if (((objTemp.type)=="text")||((objTemp.type)=="password"))
					{
						strText=(objTemp.value);
						strText=strText.replace(/(^\s)|(\s+$)/g,"");
						intTxtLen=strText.length;
						if (intTxtLen==0)
							{
								alert("Enter '" + 
									(objTemp.title)+"'");
								objTemp.focus();
								return false;
							}
						return true;
					}
				
			} 
	}
	
//Function to check for alphanumeric entries

function f_Alphanumeric(objTemp)
		{
			var strText, strIndtext;
			var intTotCnt, intCnt;
			
			strText=objTemp.value;
			intTotCnt=strText.length;
			for(intCnt=0; intCnt<intTotCnt; intCnt++)
				{
					strIndtext=strText.substring(intCnt,intCnt+1);
					
					if (((strIndtext<'a')||(strIndtext>'z')) && ((strIndtext<'A')||(strIndtext>'Z')) && ((strIndtext<'0')||(strIndtext>'9')) && (strIndtext!='_'))
					  	{
							alert("\nThe " + objTemp.title + " accepts letters,numbers and underscore.\n\nPlease re-enter the values.");
							objTemp.focus();
							
							return false;
						}
				 }	
				 return true;
		}

//Function to check for alphanumeric + Space entries

function f_Alphanumericandblank(objTemp)
		{
			var strText, strIndtext;
			var intTotCnt, intCnt;
			
			strText=objTemp.value;
			intTotCnt=strText.length;
			for(intCnt=0; intCnt<intTotCnt; intCnt++)
				{
					strIndtext=strText.substring(intCnt,intCnt+1);
					
					if (((strIndtext<'a')||(strIndtext>'z')) && ((strIndtext<'A')||(strIndtext>'Z')) && ((strIndtext<'0')||(strIndtext>'9')) && (strIndtext!=' ') && (strIndtext!='_') && (strIndtext!='-'))
						{
							alert("\nThe " + objTemp.title + " accepts letters,numbers and underscore.\n\nPlease re-enter the value.");
							objTemp.focus();
							return false;
						}
				 }	
				 return true;
		}

		
//Function to get the system date

function f_CurrentDate()
		{
			var varDateObj,varCurDate,varMonth;
						
			varDateObj=new Date();
			varCurDate=varDateObj.getDate()+ "/";
			varMonth=(varDateObj.getMonth()+1);
			if (String(varMonth).length==1)
				{
					varCurDate+="0" + varMonth+ "/";
				}
			else
				{
					varCurDate+=varMonth+ "/";
				}
			varCurDate+=varDateObj.getYear();
			
			return (varCurDate);
		}
		
//Function to check for numeric and dot entries

function f_CheckforDecimalNumbers(objTemp)
		{
			var strText, strIndtext;
			var intTotCnt, intCnt;
			
			strText=objTemp.value;
			intTotCnt=strText.length;
			for(intCnt=0; intCnt<intTotCnt; intCnt++)
				{
					strIndtext=strText.substring(intCnt,intCnt+1);
					
					if (((strIndtext<'0')||(strIndtext>'9')) && (strIndtext!='.'))
						{
							alert("\nThe " + objTemp.title + " accepts Real numbers.\n\nPlease re-enter the value.");
							objTemp.focus();
							return false;
						}
				 }	
				 return true;
		}

//Function to check for numeric 

function f_CheckforNumbersonly(objTemp)
		{
			var strText, strIndtext;
			var intTotCnt, intCnt;
			
			strText=objTemp.value;
			intTotCnt=strText.length;
			for(intCnt=0; intCnt<intTotCnt; intCnt++)
				{
					strIndtext=strText.substring(intCnt,intCnt+1);
					
					if (((strIndtext<'0')||(strIndtext>'9')))
						{
							alert("\nThe " + objTemp.title + " accepts numbers.\n\nPlease re-enter the value.");
							objTemp.focus();
							return false;
						}
				 }	
				 return true;
		}	

//Function to check for single dot entries
		
function f_CheckForSingleDec(objTemp)
		{
			var intTotCnt,intCnt;
			var strActText, strSplitText;
			var intDot;
			strActText=objTemp.value;
			intTotCnt=strActText.length;
			intDot=0;
			for (intCnt=0;intCnt<intTotCnt;intCnt++)
				{
					strSplitText=strActText.substring(intCnt,(intCnt+1));
					if (strSplitText=='.')
						{
							intDot=intDot+1;
						}
				}
			if (intDot>1)
				{
					alert("\nThe " + objTemp.title + " accepts Real numbers.\n\nPlease re-enter the value.");
							objTemp.focus();
							return false;
				}
			return true;
		}
		
//Function for Month Validation

function f_MonthValidation(objVal,objDate)
				{
					var lstrDate,lstrMonth,lstrYear;
					var lstrValue;
					var lintNoOfDays=new Array('31','28','31','30','31','30','31','31','30','31','30','31')
					
					lstrDate=objDate;
					lstrMonth=lstrDate.substr(9,2);
					lstrYear=lstrDate.substr(12,4);
					lstrValue=objVal.value;
					lstrMonth=(parseFloat(lstrMonth)-1);	
					
					if (lstrMonth==1)
						{
							if (lstrYear%4==0)
								{
									lintNoOfDays=parseInt(lintNoOfDays[lstrMonth])+1;
								}
							else
								{
									lintNoOfDays=lintNoOfDays[lstrMonth];
								}
						}
					else
						{
							lintNoOfDays=lintNoOfDays[lstrMonth];
						}
						
					if (parseInt(lstrValue)>parseInt(lintNoOfDays))
						{
							return true;
						}
					else
						{
							return false;
						}
				}
				
//Function To format Numbers

function f_FormatNumbers(objText)
				{
					
					var strText=new String();
					var strSubText=new String();
					var intPos;
										
					strText=objText.value;
					if(isNaN(strText)==false)
					{						
						intPos=strText.indexOf(".",0)  
						if (intPos==-1)
							{
								strText=strText + ".00";
							}
						else
							{
								intPos=intPos+1;
								strSubText=strText.substr(intPos);
								if(strSubText.length==1)
									{
										strText=strText + "0";
									}
							}
							
					}
					return strText;
				}