
var focusControlName = null;
var selectControl = false;

function miSetFocus(controlName, select){
	focusControlName = controlName;
	selectControl = select;
	window.setTimeout('setControlFocus()', 200);
}

function setControlFocus(){
	var theControl = document.forms[0][focusControlName];

	if (theControl){
		if (theControl.focus){
			theControl.focus();
			if(selectControl)theControl.select();			
		}else if (theControl.length && theControl[0].focus){
			theControl[0].focus();
			if(selectControl)theControl[0].select();
		}
	}
}
