<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site:  http://members.xoom.com/cyanide_7 -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

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 deleteConfirm(url) {
  // if the admin user clicks OK, then go to the delete URL
  if (confirm('Delete this record?'))
    window.location.href=url
}


/**
 * DHTML resetting image button forms script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function ResetForm(which){
	var pass=true;
	if (document.images){
		for (i=0;i<which.length;i++){
			var tempobj=which.elements[i]
			if (tempobj.type=="text"){
				eval(tempobj.value="")
			}
			else if (tempobj.type=="checkbox") {
				eval(tempobj.checked=0)
			}
			else if (tempobj.type=="select-one") {
				eval(tempobj.selectedIndex=0)
			}
			else if (tempobj.col!="" && !(tempobj.type=="button" || tempobj.type=="submit")) {
				eval(tempobj.value="")
			}
		}
	}
}

function check_state() {
		if (document.registration.COUNTRY.selectedIndex==2 || document.registration.COUNTRY.selectedIndex==4) document.registration.STATE.selectedIndex=0;
		if (document.registration.COUNTRY.selectedIndex==0) {alert ("Please select a country.");}
	if (document.registration.COUNTRY.selectedIndex==1 && (document.registration.STATE.selectedIndex>=55 || document.registration.STATE.selectedIndex==0)) { alert ('Please select state.'); document.registration.STATE.focus; return false;}
	if (document.registration.COUNTRY.selectedIndex==3 && document.registration.STATE.selectedIndex<55) { alert ('Please select a Canadian Province\n (Please scroll Down the States).'); document.registration.STATE.focus; return false;}
	}

function select_co() {
	if (document.registration.STATE.selectedIndex==0 &&(document.registration.COUNTRY.selectedIndex==1 || document.registration.COUNTRY.selectedIndex==3)) {alert ("Please Select a State or a Province");}
	if (document.registration.STATE.selectedIndex>0 && document.registration.STATE.selectedIndex<=55) {document.registration.COUNTRY.selectedIndex=1;}
	if (document.registration.STATE.selectedIndex>55) {document.registration.COUNTRY.selectedIndex=3;}
	}
	
</SCRIPT>
