function trim(x){
	while((x.length>0) && (x.charAt(0)==' '))
		x = x.substring(1,x.length)
	while((x.length>0) && (x.charAt(x.length-1)==' '))
		x = x.substring(0,x.length-1)
	return x
}


function isInt(str){
	var iFor
	if (trim(str)=="")
	  return false;
	
	for ( iFor=0;iFor<str.length;iFor++){
	  if ((str.charAt(iFor)<"0")||(str.charAt(iFor)>"9"))
	     return false;
	}
	return true;
}

function isFloat(str){
	var iPos = str.indexOf(".")
	if (iPos == -1){
	  if (isInt(str)) 
	    return true;
	  else
            return false;
	}
	else{
	  if (!isInt(str.substring(iPos+1))) 
             return false;
	  else if (!isInt(str.substring(0,iPos)))
	     return false; 		
	}
	return true;
}

function isDate(strDate,strSep){
	var strYear,strMonth,strDay,iSecSep
	strYear = strDate.substring(0,4)
	if (!isInt(strYear)) {return false;}
	if ((parseInt(strYear)<1949)||(parseInt(strYear)>3000)) {return false;}
	if (strSep!=strDate.charAt(4)) {return false;}
	iSecSep = strDate.indexOf(strSep,5)
	if (iSecSep==-1) {return false;}
	strMonth = strDate.substring(5,iSecSep)
	if (!isInt(strMonth)) {return false;}
	if ((parseInt(strMonth)<1)||(parseInt(strMonth)>12)) {return false;}
	strDay = strDate.substring(iSecSep+1,strDate.length)
	if (!isInt(strDay)) {return false;}
	if ((parseInt(strDay)<1)||(parseInt(strDay)>31)) {return false;}
	return true;
}

function isEmail(strEmail){
	var iPos,strTemp
	strTemp = trim(strEmail)
	if (strTemp.length==0) {return false;}
	iPos = strTemp.indexOf("@")
	if ((iPos <= 0)||(iPos == strTemp.length-1)) {return false;}
	if (strTemp.indexOf("@",iPos+1)!=-1){return false;}
	strTemp = strTemp.substring(iPos+1,strTemp.length);
	iPos = strTemp.indexOf(".");
	if (iPos<=0){return false;}
	if (strTemp.charAt(strTemp.length-1)=="."){return false;}
	return true;
}

















