


//////  This function is used to check if the field is empty   //////
	
	function checkIsEmpty(strField)
	{
		var bRetVal=true;
		if('' != strField)
		{
			bRetVal = (strField.length + 1 == strField.split(' ').length);
		}
		if (bRetVal==true)
		{
			return false;
		}
		else
		{
			return true;
		}	
	}
	
/////////////////////////////////////////////////////////////////////	


/////  This function is used to check the e-mail address {@,.}  /////
	
	function checkEmail(strEmail)
	{
		var bRetVal,strText,i,j;
	
		bRetVal = true ;
		strText = new String(strEmail);
		i = strText.indexOf("@");
		j = strText.indexOf(".");
		if (i==-1 || j==-1)
		{
			bRetVal = false;
		}	
	
		return bRetVal;
	}
	
/////////////////////////////////////////////////////////////////////


//// This function is used to check the URL of a web site {.,.}  ////
	
	function checkURL(strField)
	{
		var bRetVal,strURL,nPos1,nPos2;
		
		bRetVal=true;
		strURL = new String(strField);
		nPos1 = strURL.indexOf(".",0)
		if (nPos1>-1)
		{
			nPos2 = strURL.indexOf(".",nPos1+1)
		}	
		else
		{
			nPos2 = -1;
		}		
		if (strURL=="" || strURL=="http://")
		{
			bRetVal=false;
		}
		if (nPos2 == -1 && bRetVal==true) 
		{
			bRetVal=false
		}
			
		return bRetVal;			
	}
	
/////////////////////////////////////////////////////////////////////


/////  This function is used to check the length of any string  /////

	function checkFieldLength(strField,nLength)
	{
		var bRetVal;
		
		bRetVal=true;
		strText = new String(strField);
		if (strText.length<nLength)
		{
			 bRetVal=false;
		}
			 
		return bRetVal;
	}
	
/////////////////////////////////////////////////////////////////////	


///// This function is used to check the selected value of combo ////

	function checkSelection(nSelVal,nRefVal)
	{
		var bRetVal;
		
		bRetVal = true;
		if (nSelVal==nRefVal)
		{
			 bRetVal=false;
		}
		if (isNaN(nSelVal)==true)	 
		{
			bRetVal=false;
		}
		return bRetVal;
	}
	
/////////////////////////////////////////////////////////////////////	


//////  This function is used to check if the field is Number//////

	function checkIsNumber(strField)
	{
		var bRetVal,bTempVal;
		
		bRetVal = true;
		
		bTempVal = isNaN(strField)
		if (bTempVal==true)
		{
			 bRetVal = false;
		}
			 
		return bRetVal;
	}
	
/////////////////////////////////////////////////////////////////////


//////  This function is used to check if the date is correct  //////
	
	function checkIsDate(nDay,nMonth,nYear)
	{
		var nRetVal;
		
		nRetVal = 1111;
		
		if (nRetVal==1111 && nDay==0)   
		{	
			nRetVal = 1110;
		}
		
		if (nRetVal==1111 && nMonth==0)   
		{	
			nRetVal = 1101;
		}
			
		if (nRetVal==1111 && nYear==0)   
		{	
			nRetVal = 1100;
		}
		
		if (nYear==0 && (nDay>0 || nMonth>0) && nRetVal==1111)
		{
			nRetVal=1011;
		}
			 
		if (nMonth==0 && (nDay>0 || nYear>0) && nRetVal==1111)
		{
			nRetVal=1010;
		}
		
		if (nDay==0 && (nMonth>0 || nYear>0) && nRetVal==1111)
		{
			nRetVal=1001;
		}
		
		return nRetVal;
	}

//	comments :
//			nRetVal=1111;       the date is correct
//			nRetVal=1110;       check the date day
//			nRetVal=1101;       check the date month
//			nRetVal=1100;       check the date year
//			nRetVal=1011;       check the date 
//			nRetVal=1010;       check the date 
//			nRetVal=1001;       check the date 

/////////////////////////////////////////////////////////////////////


/// This function is used to check a time interval btn two dates ///
	
	function checkIsInterval(nFromDay,nFromMonth,nFromYear,nToDay,nToMonth,nToYear)
	{
		var nRetVal;
		
		nRetVal = 111;
		
		if (nToYear<nFromYear)
		{
			nRetVal=110;	
		}
		else if (nToYear==nFromYear)
		{
			if (nToMonth<nFromMonth)
			{
				nRetVal=101;	
			}
			else if (nToMonth==nFromMonth)
			{
				if (nToDay<nFromDay)
				{
					nRetVal=100;	
				}
			} 
		}
	
		return nRetVal;
	}

//	comments :
//			nRetVal=111;        the interval is correct
//			nRetVal=110;        check the start and end years
//			nRetVal=101;        check the start and end months
//			nRetVal=100;        check the start and end days 

/////////////////////////////////////////////////////////////////////
