function EnableSelect(objParent)
{
	if (objParent==undefined)
	{
		objParent = document;
	}
	
	var aSelects = objParent.all.tags("SELECT");
	for (var i=0; i<aSelects.length; i++)
	{
		aSelects[i].disabled = false;
	}
}

function FormatTime(objInput, objValidator)
{
	var strValue = objInput.value;
	
	strValue = strValue.replace(/[.:]/g,"");
	
	if (!isNaN(strValue))
	{
		switch (strValue.length)
		{
			case 1 :
				strValue = "0" + strValue + ":00";
				break;
				
			case 2 :
				strValue = strValue + ":00";
				break;
				
			case 3 :
				strValue = "0" + strValue.substr(0,1) + ":" + strValue.substr(1,2);
				break;
				
			case 4 :
				strValue = strValue.substr(0,2) + ":" + strValue.substr(2,2);
				break;
		}
		
		objInput.value = strValue;
		
		if (objValidator!=null)
		{
			ValidatorEnable(objValidator,true);
			ValidatorValidate(objValidator);
		}
	}
}

// Set the value of the given object
function SetValue(strName,strValue)
{
	if (frm.all[strName]!=undefined) 
	{
		frm.all[strName].value = strValue;
	}
}

function SetCheckBox(strName,strValue)
{
	if (frm.all[strName]!=undefined) 
	{
		frm.all[strName].checked = strValue;
	}
}

function EnableTextBox(obj,strValue)
{
	obj.className	= "";
	obj.readOnly	= false;
	obj.tabIndex 	= 0;			
	
	if (strValue!=undefined)
	{
		obj.value	= strValue;			
	}
}

function DisableTextBox(obj,strValue)
{
	obj.className	= "ReadOnly";
	obj.readOnly	= true;
	obj.tabIndex 	= -1;			
	
	if (strValue!=undefined)
	{
		obj.value	= strValue;			
	}
}

function EnableDropDown(obj,strValue)
{
	obj.className	= "";
	obj.disabled	= false;
	obj.readOnly	= false;
	obj.tabIndex 	= 0;			
	
	if (strValue!=undefined)
	{
		obj.value	= strValue;			
	}
}

function DisableDropDown(obj,strValue)
{
	obj.className	= "ReadOnly";
	obj.disabled	= true;
	obj.readOnly	= true;
	obj.tabIndex 	= -1;			
	
	if (strValue!=undefined)
	{
		obj.value	= strValue;			
	}
}

function EnableButton(obj,strValue)
{
	obj.className	= "";
	obj.readOnly	= false;
	obj.disabled	= false;
	obj.tabIndex 	= 0;			
	
	if (strValue!=undefined)
	{
		obj.value	= strValue;			
	}
}

function DisableButton(obj,strValue)
{
	obj.className	= "ReadOnly";
	obj.readOnly	= true;
	obj.disabled	= true;
	obj.tabIndex 	= -1;			
	
	if (strValue!=undefined)
	{
		obj.value	= strValue;			
	}
}

function Trim(str)
{
	return str.replace(/^\s*|\s*$/g,"");
}

function FormatRainfall(fltRainfall)
{
	if (fltRainfall==0.01)
	{
		strRainfall = "0.01";
	}
	else
	{
		strRainfall = fltRainfall.toFixed(1);
	}
	
	return strRainfall;
}
