	/*
	*	Check if the string has special characters
	*	return false if its a valid string
	*/	
	function isValidChar(character,mesg){
		var re = /^[\w._\s]+$/;
		if(!re.test(character.value)){
			alert(mesg);
			character.focus();
			return true;
		}
		return false;
	}

	/*
	*	Check if the string has spaces
	*	return false if its non space string
	*/
	function isNoSpace(character,mesg){
		var re = /^[aA-zZ_0-9]+$/;
		if(!re.test(character.value)){
			alert(mesg);
			character.focus();
			return true;
		}
		return false;
	}
	
	/*
	*  Check for null/empty/spaces for text input
  	*  return false if not empty
  	*/
  	function isEmpty(textfield, mesg){
		var space = /^\s/;			
		if(textfield.value.match(space)||textfield.value==""){			
			alert(mesg);
			textfield.focus();	
			return true;
		}
		return false;
  	}
	
	/*
	* Check the length of the string
	* return false if valid length
	*/
	function checkLen(textfield,low,high,mesg){
		if(textfield.value.length < low || textfield.value.length > high){
			alert(mesg);
			textfield.focus();
			return true;
		}
		return false;
	}
	
	/*
	* Check if the string is a zipcode
	* return false if its a zipcode
	*/
	function isValidZipCode(zipcode,mesg) {
  	var re = /^\d{4,5}([\-]\d{4})?$/;
   	if(!re.test(zipcode.value)){
		 	alert(mesg);
			zipcode.focus();		
			return true;
		}
		return false;
	}
	
	/*
	*	Check if the string is valid email
	*	return false if valid email
	*/
	function isValidEmail(email,mesg) {
    	var re = /^[\w._-]+@[\w._-]+\.[a-z]{2,4}(.[a-z]{2,4])?$/;
    	if(!re.test(email.value)){
    		alert(mesg);
    		email.focus();
			return true;
		}
		return false;		
	}
	
	/*
	*	Check if the string is a number
	*	return false if its a number
	*/
	function isValidNumber(number,mesg) {
		var re = /^\d+(\.\d+)?$/;
	 	if(!re.test(number.value)){
			alert(mesg);
    		number.focus();
    		return true;
	 	}
   		return false;
	}
	
	/*
	*	Check if the number is a valid mobile number
	* 	return false if its a mobile number
	*/
	function isValidMobile(mobile,mesg){
		var re = /^[\d]{3}-[\d]{3}-[\d]{10,11}$/;
		if(!re.test(mobile.value)){
			alert(mesg);
			mobile.focus();
			return true;
		}
		return false;
	}

	/*
	*	Count characters on textarea
	* 	return current counter 
	*/
	function characterCount(field, count, maxchars) {
		if (field.value.length > maxchars) {
			field.value = field.value.substring(0, maxchars);
		} else {
			count.value = maxchars - field.value.length;
		}
	}

	/*
	*	Count characters on textarea
	*	return current counter 
	*/
	function characterCount(field, count, maxchars) {
		if (field.value.length > maxchars) {
			field.value = field.value.substring(0, maxchars);
		} else {
			count.value = maxchars - field.value.length;
		}
	}	

	/*
	*	Check radio flag value
	* returns true if it find a match
	*/
	function checkRadioFlag(radio,validation){
		for(i=0;i<radio.length;i++){
			if(radio[i].checked){
				if(radio[i].value == validation){
					flag = true;	
				} else {
					flag = false;
				}
				
			}
		}
		return flag;
	}

