/*
	3.5.5.9 (2004/06/07)
	The button is pressed with the function key.
	The allocation has already been done on the Windows side, 
	and use F1, F3, F4 , F5 and F11, please.
	<input type="submit" value="F2 press"  accessKey="F2"  /><br/>

	It is not possible to use it similarly with returnFocus.js of the movement of focus by 
	the return key simultaneously. 

	3.5.6.0 (2004/06/18) It corresponded to two or more form. 
*/
document.onkeydown = accessFunctionKey ;

function accessFunctionKey(){
	var kc = event.keyCode ;
	// F1(0x70) ～ F12(0x7B) Only
	if( kc >= 0x70 && kc <= 0x7B ) {
		var fnkey = "F" + (kc - 0x70 + 1) ;

		for( k=0;k<document.forms.length; k++ ) {
			var f = document.forms[k];
			if ( f != null ) {
				for (i = 0; i < f.elements.length; i++) {

					var oAttrColl = f.elements[i].attributes;
					for (j = 0; j < oAttrColl.length; j++)  {
						var oAttr = oAttrColl.item(j);
						if( oAttr.specified && 
							oAttr.nodeName == "accessKey" &&
							oAttr.nodeValue == fnkey ) {
							f.elements[i].click();
							return true;
						}
					}
				}
			}
		}
		event.returnValue=false;
	}
	else {
		event.returnValue=true;
	}
}
