// Check for multiple submit

var ONE = false;
var RSAAppletEnable = false;

function clickOnce(Set)
{
	var result;
	if (ONE)
	{
		result = false;
	}  
	else
		result = true;    
	
	if (Set)
		ONE = true;
	return result;
}

function send(form)
{
	if (clickOnce(true))
	{
		return true;
	}
	else
		return false;
}

//open new window for help menu
function newWindow(param) {
	catWindow = window.open(param, 'catWin', 'toolbar=no,scrollbars=yes,resizable=no,width=500,height=400');
}

//disable right click
function right(e) 
{
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) 
	{
		alert("Maaf, fungsi klik tombol kanan (right click) telah dinonaktifkan.");
		return false;
	}
	
	return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;


var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) 
{
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) {
	input.value = input.value.slice(0, len);
	input.form[(getIndex(input)+1) % input.form.length].focus();
}

function containsElement(arr, ele) 
{
	var found = false, index = 0;
	while(!found && index < arr.length)
	if(arr[index] == ele)
	found = true;
	else
	index++;
	return found;
}

function getIndex(input) 
{
	var index = -1, i = 0, found = false;
	while (i < input.form.length && index == -1)
	if (input.form[i] == input)index = i;
	else i++;
	return index;
	}
	return true;
}

function setFocus(theObject) 
{
	if (theObject) {
		if (theObject.type!="hidden") {
			if (!theObject.disabled) {
				theObject.focus();
			}
		}
	}
}

