/*
Description:	Information/Validation for select single, in the form of
						<select>
						  [<optgroup>]
						  <option value="?">.</option>
						  [</optgroup>]
						</select>
Author:			Tim Chan
Version:		1.0
Date:			6 May 2004
Specification:	Javascript v1.2
				Netscape 4+
				Explorer 4+
Feature:		First version.
*/

function FormSelectOne(){
  return FormSelectOne();
}

FormSelectOne.hasValue = function(obj) {
  if(Expression.isBlank(obj.options[obj.selectedIndex].value)) return false;
	return true;
}
  
FormSelectOne.isDecimal = function(obj) {
  return Expression.isDecimal(obj.options[obj.selectedIndex].value) || 
  		 Expression.isBlank(obj.options[obj.selectedIndex].value);
}
  
FormSelectOne.isPositive = function(obj) {
  return Expression.isPositive(obj.options[obj.selectedIndex].value) ||
	  	 Expression.isBlank(obj.options[obj.selectedIndex].value);
}
	
FormSelectOne.isInteger = function(obj) {
  return Expression.isInteger(obj.options[obj.selectedIndex].value) ||
	     Expression.isBlank(obj.options[obj.selectedIndex].value);
}

FormSelectOne.isEmail = function(obj) {
  return Expression.isEmail(obj.options[obj.selectedIndex].value) ||
	     Expression.isBlank(obj.options[obj.selectedIndex].value);
}
  
FormSelectOne.isPostcode = function(obj) {
  return Expression.isPostcode(obj.options[obj.selectedIndex].value) ||
	 	 Expression.isBlank(obj.options[obj.selectedIndex].value);
}

FormSelectOne.isExpression = function(obj, expr) {
  return Expression.isExpression(obj.options[obj.selectedIndex].value, expr) ||
	 	 Expression.isBlank(obj.options[obj.selectedIndex].value);
}

FormSelectOne.putValue = function(obj, value) {
//  if(value != "") {
    for(var i=0; i < obj.length; i++) {
	  if(obj.options[i].value == value) obj.selectedIndex = i;
	}
//  }
}
