
function initFormControls()
{
	var tabCount = 0;
	var firstCtrl = null;
	for(f=0;f<document.forms.length;f++) {
			// iterate all the elements in the form
			for(e=0;e<document.forms[f].elements.length;e++){
				tabCount++;
				el = document.forms[f].elements[e];
				el.tabIndex = tabCount;
				
				//alert( el.id );
				switch (el.tagName.toLowerCase() )
				{
				case 'input':
					switch (el.type.toLowerCase())
					{
					case 'submit':
					case 'button':
					case 'reset':
						el.className = "ipt_btn";
						el.style.cursor = "hand";
						break;
					case 'password':
					case 'text':
						if( f==0 && e==0 ){ firstCtrl = el.id; }
						el.className = "ipt_txt";
						el.onfocus=focusIn;
						el.onblur=focusOut;
						break;
					default:
						break;
					}
					break;
				case 'textarea':
						el.className = "ipt_txt";
						el.onfocus=focusIn;
						el.onblur=focusOut;
						break;
				case 'select':
					if( f==0 && e==0 ){ firstCtrl = el.id;}
					el.className = "ipt_sel";
					el.onfocus=focusIn;
					el.onblur=focusOut;	
					break;
				default:
					break;
				}
			}
	}

	if ( firstCtrl != null )
	{
		//alert( firstCtrl );
		document.getElementById( firstCtrl ).focus();
	}
}

