
// Set activeElement for FireFox
//function init () {
//	document.activeElement = document.body;
//	var all = document.body.getElementsByTagName('*');
//	for (var i = 0; i < all.length; i++) {
//		var functionBody = 'document.activeElement = this;';
//		var oldOnFocus = all[i].getAttribute('onfocus');
//		if (oldOnFocus)
//			functionBody += oldOnFocus;
//		all[i].onfocus = new Function ('event', functionBody);
//	}
//}
//if (navigator.appName == 'Netscape') window.onload = init;

//document.onkeypress = keyhandler;

// Handle ENTER key
//function keyhandler(e) {
//	var key;
//	if(window.event)
//		key = window.event.keyCode; //IE
//	else
//		key = e.which; //firefox

//	if (key == 13)
//	{
		//If on quicksearch text field
//		if (document.activeElement.name == 'quicksearch')
//		{
			//This is needed or Servet complains too many requests
//			pausecomp(1250);

			//Press the quick search button
//			document.forms[0].quicksearch_button.click();
//		}
		//If on login or password text fields
//		else if (document.activeElement.name == 'login' || document.activeElement.name == 'password')
// 		{

			//This is needed or Servet complains too many requests
//			pausecomp(1250);

			//Press the quick login button
//			document.forms[0].login_button.click();
//		}
//		else
//		{
//			return;
//		}
//		return false;
//	}
//}

// Used to pause when ENTER key pressed to avoid multiple requests Servlet error
function pausecomp(millis) 
{
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); } 
	while(curDate-date < millis);
} 

// General Compass navigation functions...

function clickedhis(j) {

if (navigator.appName == 'Netscape') {
	lastclicked=j;
	document.sentaiform.recid.value = j.recid;
	}
else {
	lastclicked=j;
	document.all.recid.value = j.recid;
	}

};

function dotlbarclk(anAction) {

if (navigator.appName == 'Netscape') {
	document.sentaiform.action.value = anAction;
	document.sentaiform.submit();
	}
else {
	document.all.sentaiform.action.value = anAction;
	document.all.sentaiform.submit();
	}

};

function dotlnewclk(newFunction, anAction) {

if (navigator.appName == 'Netscape') {
	document.sentaiform.webfunctionid.value = newFunction;
	dotlbarclk(anAction);
	}
else {
	document.all.sentaiform.webfunctionid.value = newFunction;
	dotlbarclk(anAction);
	}

};

function dobuyclk(anAction, theRec, myRow) {

if (navigator.appName == 'Netscape') {
	document.sentaiform.qty.value =  eval("document.sentaiform.myqty"+myRow+".value");
	document.sentaiform.recid.value = theRec;
	document.sentaiform.action.value = anAction;
	document.sentaiform.submit();
	}
else {
	document.sentaiform.qty.value = eval("document.all.myqty"+myRow+".value");
	document.sentaiform.recid.value = theRec;
	document.sentaiform.action.value = anAction;
	document.all.sentaiform.submit();
	}

};

function clickwithrec(anAction, theRec) {

if (navigator.appName == 'Netscape') {
	document.sentaiform.recid.value = theRec;
	document.sentaiform.action.value = anAction;
	document.sentaiform.submit();
	}
else {
	document.all.sentaiform.recid.value = theRec;
	document.all.sentaiform.action.value = anAction;
	document.all.sentaiform.submit();
	}

};

function dosearch() {

if (navigator.appName == 'Netscape') {
	document.sentaiform.search.value=document.all.mysearch.value;
	document.sentaiform.submit();
	}
else {
	document.all.sentaiform.search.value=document.all.mysearch.value;
	document.all.sentaiform.submit();
   	}

};
var focusElement = null;

function dofocus(setup) {
if (navigator.appName == 'Netscape') {

	}
else {
	if (setup == null) setup = false;
	if (focusElement != null && focusElement != window.event.srcElement)
	focusElement.className = 'inactiveelement';
	focusElement = window.event.srcElement;
	focusElement.className = 'focuselement';
	}

};
