/*  *************************
    Adds the auto-tab feature
    *************************   */
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;
}







/*  *************************************************************
    Changes the color of a text box when it's focused and blurred
    *************************************************************   */
function ChangeColor(x) 
{
	x.style.border = "1px solid #4ED136";
}

function RevertColor(x) 
{
	x.style.border = "1px solid #666666";
}







/*	*************************************************
	Disable button and display upload progress script
	*************************************************	*/
function UploadFile(ButtonToHide, ButtonToShow, UploadProgress) {
	
	if (document.getElementById) {
		document.getElementById(ButtonToHide).style.display = "none";
		document.getElementById(ButtonToShow).style.display = "inline";
		document.getElementById(UploadProgress).style.display = "inline";
	} else {
		if (document.layers) {
			document.ButtonToHide.display = "none";
			document.ButtonToShow.display = "inline";
			document.UploadProgress.display = "inline";
		} else {
			document.all.ButtonToHide.style.display = "none";
			document.all.ButtonToShow.style.display = "inline";
			document.all.UploadProgress.style.display = "inline";
		}
	}
	
}






/*	********************
	Confirmation script
	********************	*/
function UploadConfirm(obj) {
	
	var x = window.confirm("Are you sure you're done uploading all your files?  You cannot upload any more files after this point.");
	var z;
	
	if (x) {
		z = "True";
	} else {
		z = "False";
	}
	
	
	if (document.getElementById) {
		document.getElementById(obj).value = z;	
	} else {
		if (document.layers) {
			document.obj.value = z;
		} else {
			document.all.obj.value = z;
		}
	}
	
	
}
	
	
	
	
	
	
	
	
	