function is_username ( str )
{

  if ( str.length < 4 )
	return false;
  
  return str.search ( "[^a-zA-Z0-9_]{1}" ) > -1 ? false : true;
}

function is_password ( str )
{
  if ( str.length < 6 )
	return false;
  
  return str.search ( "[^a-zA-Z0-9_]{1}" ) > -1 ? false : true;
}
function is_empty(str)
{
  if(!str)
	return true;
  return str.search("^[ \t\n\r]*$") > -1 ? true : false ;
}

function is_email(str)
{
  //return true;
  return str.search("^([a-zA-Z0-9_]|\\-|\\.)+@(([a-zA-Z0-9_]|\\-)+\\.)+[a-zA-Z]{2,4}\$") > -1 ? true : false ;
}
function is_phone ( str )
{
  if ( str.search ( "([^0-9^\\.^\\-+ ])" ) != -1 )
    return false;

  phone = str.replace ( /[^0-9]/g, "" );

  if ( phone.length < 10 )
    return false;

  return phone.search("[0-9]+$") == 0 ? true : false;
}
function is_zipcode ( str )
{
  zipcode = str.replace( /[ ]/g, "");
      
  if ( zipcode.search ( "([0-9]{5}$)" ) != 0 )
	return false;

  return true;
}
function is_number ( str )
{
  uint = str.replace( /[ ]/g, "");
  if ( str.length == 0 )
    return false;
  return uint.search ( "([^0-9]{1})" ) != -1 ? false : true;
}
function is_ip(str)
{
  return true;
}
function is_url(str)
{
  return true;
}
function is_checked(theForm, inputName)
{
  
  if ( theForm.elements[inputName] )
  {
    if ( theForm.elements[inputName].length )
    {	  
  	  for ( i = 0 ; i<theForm.elements[inputName].length; i ++)
	  {
		if ( theForm.elements[inputName][i].checked )
		{
		   return true;
		}
	  }
	}
  }
  else
  {
	  inputName2=inputName+"[]";

	  if(theForm.elements[inputName2].length)
	  {
		for ( i = 0 ; i<theForm.elements[inputName2].length; i ++)
		{
		  if ( theForm.elements[inputName2][i].checked )
		  {
		   return true;
		  }
		}
	  }
	  else		 	
	  {
		if ( theForm.elements[inputName].checked )
		  return true;		  		
	  }
  }
  
  return false;
}
