<!-- 
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
} 

function emailvalidation(entered, alertbox)
{
	with (entered) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) {
			if (alertbox) {
				alert(alertbox);
			} 
			return false;
		} else {
			return true;
		}
	}
}

function valuevalidation(entered, min, max, alertbox, datatype) {
	with (entered) {
		checkvalue=parseFloat(value);
		if (datatype) {
			smalldatatype=datatype.toLowerCase();
			if (smalldatatype.charAt(0)=="i") {
				checkvalue=parseInt(value);
			}
  		}
		if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue) {
			if (alertbox!="") {
				alert(alertbox);
			}
			return false;
		} else {
			return true;
		}
	}
}

function digitvalidation(entered, min, max, alertbox, datatype) {
	with (entered) {
		checkvalue=parseFloat(value);
		if (datatype) {
			smalldatatype=datatype.toLowerCase();
   			if (smalldatatype.charAt(0)=="i") {
				checkvalue=parseInt(value); 
				if (value.indexOf(".")!=-1) {
					checkvalue=checkvalue+1;
				}
			}
  		}
		if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue) {
			if (alertbox!="") {
				alert(alertbox);
			}
			return false;
		} else {
			return true;
		}
	}
}

function emptyvalidation(entered, alertbox) {
	with (entered) {
		if (value==null || value=="") {
			if (alertbox!="") {
				alert(alertbox);
			}
			return false;
		} else {
			return true;
		}
	}
}

function emptyvalidationSelect(entered, alertbox) {
	with (entered) {
		if (options.selectedIndex==0) {
			if (alertbox!="") {
				alert(alertbox);
			}
			return false;
		} else {
			return true;
		}
	}
}

function lengthValidation(entered,lengthValue,alertbox) {
	with (entered) {
		if (value.length<lengthValue) {
			if (alertbox!="") {
				alert(alertbox);
			}
			return false;
		} else {
			return true;
		}
	}
}

function validateForm1 (thisform) {
	with (thisform) {
		errorFlag = 'no';
		if (lengthValidation(Name_FIRST_NAME,2,"Your First Name is not valid.")==false) {errorFlag = 'yes';Name_FIRST_NAME.focus();return false;}
		if (lengthValidation(Name_LAST_NAME,2,"Your Last Name is not valid.")==false) {errorFlag = 'yes';Name_LAST_NAME.focus();return false;}
		if (digitvalidation(Name_HOME_PHONE1,3,3,"Your Phone Number is not valid")==false) {errorFlag = 'yes';Name_HOME_PHONE1.focus(); return false;}
		if (digitvalidation(Name_HOME_PHONE2,3,3,"Your Phone Number is not valid")==false) {errorFlag = 'yes';Name_HOME_PHONE2.focus(); return false;}
		if (digitvalidation(Name_HOME_PHONE3,4,4,"Your Phone Number is not valid")==false) {errorFlag = 'yes';Name_HOME_PHONE3.focus(); return false;}
		if (emptyvalidationSelect(Name_BIRTH_DATE1,"Your Birth Date is not valid.")==false) {errorFlag = 'yes';Name_BIRTH_DATE1.focus(); return false;}
		if (emptyvalidationSelect(Name_BIRTH_DATE2,"Your Birth Date is not valid.")==false) {errorFlag = 'yes';Name_BIRTH_DATE2.focus(); return false;}
		if (digitvalidation(Name_BIRTH_DATE3,2,2,"Your Birth Date is not valid.")==false) {errorFlag = 'yes';Name_BIRTH_DATE3.focus(); return false;}
		if (emptyvalidationSelect(Name_BIRTH_DATE4,"Your Birth Date is not valid.")==false) {errorFlag = 'yes';Name_BIRTH_DATE4.focus(); return false;}
		if (lengthValidation(Name_Address_ADDRESS_1,2,"Your Address is not valid.")==false) {errorFlag = 'yes';Name_Address_ADDRESS_1.focus();return false;}
		if (lengthValidation(Name_Address_CITY,2,"Your City is not valid.")==false) {errorFlag = 'yes';Name_Address_CITY.focus();return false;}
		if (emptyvalidationSelect(Name_Address_STATE_PROVINCE,"Your State is not valid.")==false) {errorFlag = 'yes';Name_Address_STATE_PROVINCE.focus();return false;}
		if (digitvalidation(Name_Address_ZIP1,5,5,"Your Zipcode is not valid.")==false) {errorFlag = 'yes';Name_Address_ZIP1.focus(); return false;}
		if (digitvalidation(Name_ID1,3,3,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';Name_ID1.focus(); return false;}
		if (digitvalidation(Name_ID2,2,2,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';Name_ID2.focus(); return false;}
		if (digitvalidation(Name_ID3,4,4,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';Name_ID3.focus(); return false;}
	}
	if (errorFlag == 'no') {
		compileForm1();
	}
}

function validateForm1a (thisform) {
	with (thisform) {
		errorFlag = 'no';
		if (lengthValidation(Name_FIRST_NAME,2,"Your First Name is not valid.")==false) {errorFlag = 'yes';Name_FIRST_NAME.focus();return false;}
		if (lengthValidation(Name_LAST_NAME,2,"Your Last Name is not valid.")==false) {errorFlag = 'yes';Name_LAST_NAME.focus();return false;}
		if (digitvalidation(Name_HOME_PHONE1,3,3,"Your Phone Number is not valid")==false) {errorFlag = 'yes';Name_HOME_PHONE1.focus(); return false;}
		if (digitvalidation(Name_HOME_PHONE2,3,3,"Your Phone Number is not valid")==false) {errorFlag = 'yes';Name_HOME_PHONE2.focus(); return false;}
		if (digitvalidation(Name_HOME_PHONE3,4,4,"Your Phone Number is not valid")==false) {errorFlag = 'yes';Name_HOME_PHONE3.focus(); return false;}
		if (emptyvalidationSelect(Name_BIRTH_DATE1,"Your Birth Date is not valid.")==false) {errorFlag = 'yes';Name_BIRTH_DATE1.focus(); return false;}
		if (emptyvalidationSelect(Name_BIRTH_DATE2,"Your Birth Date is not valid.")==false) {errorFlag = 'yes';Name_BIRTH_DATE2.focus(); return false;}
		if (digitvalidation(Name_BIRTH_DATE3,2,2,"Your Birth Date is not valid.")==false) {errorFlag = 'yes';Name_BIRTH_DATE3.focus(); return false;}
		if (emptyvalidationSelect(Name_BIRTH_DATE4,"Your Birth Date is not valid.")==false) {errorFlag = 'yes';Name_BIRTH_DATE4.focus(); return false;}
		if (lengthValidation(Name_Address_ADDRESS_1,2,"Your Address is not valid.")==false) {errorFlag = 'yes';Name_Address_ADDRESS_1.focus();return false;}
		if (lengthValidation(Name_Address_CITY,2,"Your City is not valid.")==false) {errorFlag = 'yes';Name_Address_CITY.focus();return false;}
		if (emptyvalidationSelect(Name_Address_STATE_PROVINCE,"Your State is not valid.")==false) {errorFlag = 'yes';Name_Address_STATE_PROVINCE.focus();return false;}
		if (digitvalidation(Name_Address_ZIP1,5,5,"Your Zipcode is not valid.")==false) {errorFlag = 'yes';Name_Address_ZIP1.focus(); return false;}
		if (digitvalidation(Name_ID1,3,3,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';Name_ID1.focus(); return false;}
		if (digitvalidation(Name_ID2,2,2,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';Name_ID2.focus(); return false;}
		if (digitvalidation(Name_ID3,4,4,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';Name_ID3.focus(); return false;}
	}
	if (errorFlag == 'no') {
		compileForm1a();
	}
}




	
	
	
	
	

function validateForm2() {
	if (document.APPLICATION.Name_Info_SPOUSE_FNAME.length == 0) {
		alert('Please fill in your First Name');
		document.APPLICATION.Name_FIRST_NAME.focus;
		exit;
	}

	compileForm2();
	spousedatevalidation();
	
	
}






function spousedatevalidation() {
	if (document.APPLICATION.Name_Info_SPOUSE_FNAME.value != "") {

		if (document.APPLICATION.Name_Info_SPOUSE_DOB1.value == "") {
			alert("Please choose the day on which you were born");
			document.APPLICATION.Name_Info_SPOUSE_DOB1.focus;
			return false;
			}
		
		if (document.APPLICATION.Name_Info_SPOUSE_DOB2.value == "") {
			alert("Please choose the month on which you were born");
			document.APPLICATION.Name_Info_SPOUSE_DOB2.focus;
			return false;
			}

		if (document.APPLICATION.Name_Info_SPOUSE_DOB3.value == "" || document.APPLICATION.Name_Info_SPOUSE_DOB4.value == "" ) {
			alert("Please enter the year on which you were born");
			document.APPLICATION.Name_Info_SPOUSE_DOB3.focus;
			return false;
			}				
			
	

	}
	document.APPLICATION.submit();
}	




function childdatevalidation() {
	if (document.APPLICATION.Name_Info_DEP_CHILD_FNAME.value != "") {

		if (document.APPLICATION.Name_Info_DEP_CHILD_DOB1.value == "") {
			alert("Please choose the day on which you were born");
			document.APPLICATION.Name_Info_DEP_CHILD_DOB1.focus;
			return false;
			}
		
		if (document.APPLICATION.Name_Info_DEP_CHILD_DOB2.value == "") {
			alert("Please choose the month on which you were born");
			document.APPLICATION.Name_Info_DEP_CHILD_DOB2.focus;
			return false;
			}

		if (document.APPLICATION.Name_Info_DEP_CHILD_DOB3.value == "" || document.APPLICATION.Name_Info_DEP_CHILD_DOB4.value == "" ) {
			alert("Please enter the year on which you were born");
			document.APPLICATION.Name_Info_DEP_CHILD_DOB3.focus;
			return false;
			}				
			
	

	}
//	document.APPLICATION.submit();
	return true;
}	





function validateForm3() {
	if (document.APPLICATION.Name_Info_DEP_CHILD_FNAME.length == 0) {
		alert('Please fill in your First Name');
		document.APPLICATION.Name_FIRST_NAME.focus;
		exit;
	}
	compileForm3();
}

function validateRepForm (thisform) {
	with (thisform) {
		errorFlag = 'no';
		if (lengthValidation(firstname,2,"Your First Name is not valid.")==false) {errorFlag = 'yes';firstname.focus();return false;}
		if (lengthValidation(lastname,2,"Your Last Name is not valid.")==false) {errorFlag = 'yes';lastname.focus();return false;}
		if (digitvalidation(ssnum1,3,3,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';ssnum1.focus(); return false;}
		if (digitvalidation(ssnum2,2,2,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';ssnum2.focus(); return false;}
		if (digitvalidation(ssnum3,4,4,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';ssnum3.focus(); return false;}
		if (lengthValidation(badd1,2,"Your Address is not valid.")==false) {errorFlag = 'yes';badd1.focus();return false;}
		if (lengthValidation(bcity,2,"Your City is not valid.")==false) {errorFlag = 'yes';bcity.focus();return false;}
		if (emptyvalidationSelect(bstate,"Your State is not valid.")==false) {errorFlag = 'yes';bstate.focus();return false;}
		if (digitvalidation(bzip1,5,5,"Your Zipcode is not valid.")==false) {errorFlag = 'yes';bzip1.focus(); return false;}
		if (digitvalidation(phone1,3,3,"Your Phone Number is not valid")==false) {errorFlag = 'yes';phone1.focus(); return false;}
		if (digitvalidation(phone2,3,3,"Your Phone Number is not valid")==false) {errorFlag = 'yes';phone2.focus(); return false;}
		if (digitvalidation(phone3,4,4,"Your Phone Number is not valid")==false) {errorFlag = 'yes';phone3.focus(); return false;}
	}
	if (errorFlag == 'no') {
		document.repInfo.submit();
	}
}

function validateRepUpForm (thisform) {
	with (thisform) {
		errorFlag = 'no';
		if (lengthValidation(firstname,2,"Your First Name is not valid.")==false) {errorFlag = 'yes';firstname.focus();return false;}
		if (lengthValidation(lastname,2,"Your Last Name is not valid.")==false) {errorFlag = 'yes';lastname.focus();return false;}
		if (lengthValidation(taxid,9,"Your Social Security Number is not valid.")==false) {errorFlag = 'yes';taxid.focus(); return false;}
		if (lengthValidation(badd1,2,"Your Address is not valid.")==false) {errorFlag = 'yes';badd1.focus();return false;}
		if (lengthValidation(bcity,2,"Your City is not valid.")==false) {errorFlag = 'yes';bcity.focus();return false;}
		if (emptyvalidationSelect(bstate,"Your State is not valid.")==false) {errorFlag = 'yes';bstate.focus();return false;}
		if (lengthValidation(bzip,5,"Your Zipcode is not valid.")==false) {errorFlag = 'yes';bzip.focus(); return false;}
		if (lengthValidation(pphone,10,"Your Phone Number is not valid")==false) {errorFlag = 'yes';pphone.focus(); return false;}
	}
	if (errorFlag == 'no') {
		document.repInfo.submit();
	}
}


function compileForm1() {

	// Compile DOB
	document.APPLICATION.Name_BIRTH_DATE.value = document.APPLICATION.Name_BIRTH_DATE1.options[document.APPLICATION.Name_BIRTH_DATE1.selectedIndex].value + '/';
	document.APPLICATION.Name_BIRTH_DATE.value = document.APPLICATION.Name_BIRTH_DATE.value + document.APPLICATION.Name_BIRTH_DATE2.options[document.APPLICATION.Name_BIRTH_DATE2.selectedIndex].value + '/';
	document.APPLICATION.Name_BIRTH_DATE.value = document.APPLICATION.Name_BIRTH_DATE.value + document.APPLICATION.Name_BIRTH_DATE3.value;
	document.APPLICATION.Name_BIRTH_DATE.value = document.APPLICATION.Name_BIRTH_DATE.value + document.APPLICATION.Name_BIRTH_DATE4.options[document.APPLICATION.Name_BIRTH_DATE4.selectedIndex].value;

	// Compile Work Phone
	document.APPLICATION.Name_WORK_PHONE.value = document.APPLICATION.Name_WORK_PHONE1.value + document.APPLICATION.Name_WORK_PHONE2.value + document.APPLICATION.Name_WORK_PHONE3.value;

	// Compile Home Phone
	document.APPLICATION.Name_HOME_PHONE.value = document.APPLICATION.Name_HOME_PHONE1.value + document.APPLICATION.Name_HOME_PHONE2.value + document.APPLICATION.Name_HOME_PHONE3.value;

	// Compile fAX Phone
	document.APPLICATION.Name_FAX.value = document.APPLICATION.Name_FAX1.value + document.APPLICATION.Name_FAX2.value + document.APPLICATION.Name_FAX3.value;

	// Compile zip
	document.APPLICATION.Name_Address_ZIP.value = document.APPLICATION.Name_Address_ZIP1.value + document.APPLICATION.Name_Address_ZIP2.value;

	// Compile Social Security Number
	document.APPLICATION.Name_ID.value = document.APPLICATION.Name_ID1.value + document.APPLICATION.Name_ID2.value + document.APPLICATION.Name_ID3.value;

	// Compile plan type and member options from query text
	document.APPLICATION.Name_PURCHASE_TYPE.value = srchData["Name_PURCHASE_TYPE"];

	// Submit form
	document.APPLICATION.submit();
}

function compileForm1a() {

	// Compile DOB
	document.APPLICATION.Name_BIRTH_DATE.value = document.APPLICATION.Name_BIRTH_DATE1.options[document.APPLICATION.Name_BIRTH_DATE1.selectedIndex].value + '/';
	document.APPLICATION.Name_BIRTH_DATE.value = document.APPLICATION.Name_BIRTH_DATE.value + document.APPLICATION.Name_BIRTH_DATE2.options[document.APPLICATION.Name_BIRTH_DATE2.selectedIndex].value + '/';
	document.APPLICATION.Name_BIRTH_DATE.value = document.APPLICATION.Name_BIRTH_DATE.value + document.APPLICATION.Name_BIRTH_DATE3.value;
	document.APPLICATION.Name_BIRTH_DATE.value = document.APPLICATION.Name_BIRTH_DATE.value + document.APPLICATION.Name_BIRTH_DATE4.options[document.APPLICATION.Name_BIRTH_DATE4.selectedIndex].value;

	// Compile Work Phone
	document.APPLICATION.Name_WORK_PHONE.value = document.APPLICATION.Name_WORK_PHONE1.value + document.APPLICATION.Name_WORK_PHONE2.value + document.APPLICATION.Name_WORK_PHONE3.value;

	// Compile Home Phone
	document.APPLICATION.Name_HOME_PHONE.value = document.APPLICATION.Name_HOME_PHONE1.value + document.APPLICATION.Name_HOME_PHONE2.value + document.APPLICATION.Name_HOME_PHONE3.value;

	// Compile fAX Phone
	document.APPLICATION.Name_FAX.value = document.APPLICATION.Name_FAX1.value + document.APPLICATION.Name_FAX2.value + document.APPLICATION.Name_FAX3.value;

	// Compile zip
	document.APPLICATION.Name_Address_ZIP.value = document.APPLICATION.Name_Address_ZIP1.value + document.APPLICATION.Name_Address_ZIP2.value;

	// Compile Social Security Number
	document.APPLICATION.Name_ID.value = document.APPLICATION.Name_ID1.value + document.APPLICATION.Name_ID2.value + document.APPLICATION.Name_ID3.value;


	// Submit form
//	document.APPLICATION.submit();
}

function compileForm2() {

	// Compile DOB
	document.APPLICATION.Name_Info_SPOUSE_DOB.value = document.APPLICATION.Name_Info_SPOUSE_DOB1.options[document.APPLICATION.Name_Info_SPOUSE_DOB1.selectedIndex].value + '/';
	document.APPLICATION.Name_Info_SPOUSE_DOB.value = document.APPLICATION.Name_Info_SPOUSE_DOB.value + document.APPLICATION.Name_Info_SPOUSE_DOB2.options[document.APPLICATION.Name_Info_SPOUSE_DOB2.selectedIndex].value + '/';
	document.APPLICATION.Name_Info_SPOUSE_DOB.value = document.APPLICATION.Name_Info_SPOUSE_DOB.value + document.APPLICATION.Name_Info_SPOUSE_DOB3.value;
	document.APPLICATION.Name_Info_SPOUSE_DOB.value = document.APPLICATION.Name_Info_SPOUSE_DOB.value + document.APPLICATION.Name_Info_SPOUSE_DOB4.options[document.APPLICATION.Name_Info_SPOUSE_DOB4.selectedIndex].value;


	// Submit form

}


function compileForm3() {

	// Compile DOB
	document.APPLICATION.Name_Info_DEP_CHILD_DOB.value = document.APPLICATION.Name_Info_DEP_CHILD_DOB1.options[document.APPLICATION.Name_Info_DEP_CHILD_DOB1.selectedIndex].value + '/';
	document.APPLICATION.Name_Info_DEP_CHILD_DOB.value = document.APPLICATION.Name_Info_DEP_CHILD_DOB.value + document.APPLICATION.Name_Info_DEP_CHILD_DOB2.options[document.APPLICATION.Name_Info_DEP_CHILD_DOB2.selectedIndex].value + '/';
	document.APPLICATION.Name_Info_DEP_CHILD_DOB.value = document.APPLICATION.Name_Info_DEP_CHILD_DOB.value + document.APPLICATION.Name_Info_DEP_CHILD_DOB3.value;
	document.APPLICATION.Name_Info_DEP_CHILD_DOB.value = document.APPLICATION.Name_Info_DEP_CHILD_DOB.value + document.APPLICATION.Name_Info_DEP_CHILD_DOB4.options[document.APPLICATION.Name_Info_DEP_CHILD_DOB4.selectedIndex].value;

	// Submit form
	document.APPLICATION.submit();
}

function gotoPayment(sessionid,form_cmd) {

	document.location.href='http://www.nbaabenefits.com/cgi-bin/NBAACommerce.cgi?sessionid='+sessionid+'&form_cmd='+form_cmd;
}

function compileCCExpire() {
	
	validateCard(document.APPLICATION.Name_Card_CC_CARDNUMBER.value,document.APPLICATION.Name_Card_CC_CARDTYPE.value,document.APPLICATION.Name_Card_CC_CARDEXPIRES1.value,document.APPLICATION.Name_Card_CC_CARDEXPIRES2.value);
	
	if (validcardflag == "no") {
		return false }
		
	
	errorFlag = 'no';
	
	if (document.APPLICATION.Name_Card_CC_Name.value == "") {
		alert('Please fill in your Name on Card');
		document.APPLICATION.Name_Card_CC_Name.focus();
		errorFlag = 'yes';
	} 


	if (document.APPLICATION.ccFlag.value == "true") {
		document.APPLICATION.Name_Card_CC_CARDEXPIRES.value = document.APPLICATION.Name_Card_CC_CARDEXPIRES1.options[document.APPLICATION.Name_Card_CC_CARDEXPIRES1.selectedIndex].value;
		document.APPLICATION.Name_Card_CC_CARDEXPIRES.value = document.APPLICATION.Name_Card_CC_CARDEXPIRES.value + document.APPLICATION.Name_Card_CC_CARDEXPIRES2.options[document.APPLICATION.Name_Card_CC_CARDEXPIRES2.selectedIndex].value;
	}
	if (errorFlag == 'no') {
		document.APPLICATION.submit();
	}
}

function doPaymentType() {
	var radio_value = "";
	var check = 0;
	var num_radio = 0;
	if (document.APPLICATION.flag.value == "true") {
		num_radio = 6;
	} else {
		num_radio = 2;
	}
	for (var i = 0; i < num_radio; i++)
   	{
      		var checked = document.APPLICATION.Name_CATEGORY[i].checked;
      		if (checked) {
         		radio_value = document.APPLICATION.Name_CATEGORY[i].value;
      		}
	}

	if (radio_value == "MB") {
		document.APPLICATION.Name_MEMBER_TYPE.value = "NB";
	} else if (radio_value == "CU") {
		document.APPLICATION.Name_MEMBER_TYPE.value = "NB";
	} else if (radio_value == "CD") {
		document.APPLICATION.Name_MEMBER_TYPE.value = "NC";
	} else if (radio_value == "DB") {
		document.APPLICATION.Name_MEMBER_TYPE.value = "N";
	} else if (radio_value == "QD") {
		document.APPLICATION.Name_MEMBER_TYPE.value = "N";
	} else if (radio_value == "SA") {
		document.APPLICATION.Name_MEMBER_TYPE.value = "N";
	}
	document.APPLICATION.submit();
}

function gotoPaymentType(sessionid,form_cmd) {
	document.location.href='https://www.nbaabenefits.com/cgi-bin/NBAACommerce.cgi?sessionid='+sessionid+'&form_cmd='+form_cmd;
}

function pushPlatinum() {
	document.location.href='https://www.nbaabenefits.com/purchase2.html?Name_PURCHASE_TYPE='+document.PLATINUM_PLAN.Name_PURCHASE_TYPE.options[document.PLATINUM_PLAN.Name_PURCHASE_TYPE.selectedIndex].value;
}

function pushGold() {
	document.location.href='https://www.nbaabenefits.com/purchase2.html?Name_PURCHASE_TYPE='+document.GOLD_PLAN.Name_PURCHASE_TYPE.options[document.GOLD_PLAN.Name_PURCHASE_TYPE.selectedIndex].value;
}


function getNVP() {
	var minNav3 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3)
	var minIE4 = (navigator.appName.indexOf("Microsoft") >= 0 && parseInt(navigator.appVersion) >= 4)
	var minDOM = minNav3 || minIE4
	var results = new Array()
	if (minDOM) {
		var input = unescape(location.search.substring(1))
		if (input) {
			var srchArray = input.split("&")
			var tempArray = new Array();
			for (i = 0; i < srchArray.length; i++) {
				tempArray = srchArray[i].split("=")
				results[tempArray[0]] = tempArray[1]
			}
		}
	}
	return results;
}

var srchData = getNVP();

function doStateCheck() {
	var platFlag = "yes";
	if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "HI") {
		platFlag = "no";
	}
//	if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "IN") {
//		platFlag = "no";
//	} else if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "ME") {
//		platFlag = "no";
//	} else if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "MD") {
//		platFlag = "no";
//	} else if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "MA") {
//		platFlag = "no";
//	} else if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "MN") {
//		platFlag = "no";
//	} else if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "NY") {
//		platFlag = "no";
//	} else if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "OR") {
//		platFlag = "no";
//	} else if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "SD") {
//		platFlag = "no";
//	} else if (document.purchase.state.options[document.purchase.state.selectedIndex].value == "WA") {
//		platFlag = "no";
//	}

	if (platFlag == "yes") {
		document.location.href="https://www.nbaabenefits.com/purchase_plat.html";
	} else {
		document.location.href="https://www.nbaabenefits.com/purchase_noplat.html";
	}
}

function mod10( cardNumber ) { // LUHN Formula for validation of credit card numbers.
	var ar = new Array( cardNumber.length );
	var i = 0,sum = 0;

    	for( i = 0; i < cardNumber.length; ++i ) {
    		ar[i] = parseInt(cardNumber.charAt(i));
    	}
    	for( i = ar.length -2; i >= 0; i-=2 ) { 
    		ar[i] *= 2;	
    		if( ar[i] > 9 ) ar[i]-=9;
    	}				
       	for( i = 0; i < ar.length; ++i ) {
		sum += ar[i];					
        }
        return (((sum%10)==0)?true:false);	 	
}

function expired( month, year ) {
	var now = new Date();
	year='20'+year;	
        var expiresIn = new Date(year,month,0,0,0);		
        expiresIn.setMonth(expiresIn.getMonth()+1);
        if( now.getTime() < expiresIn.getTime() ) return false;
        return true;									
}

function validateCard(cardNumber,cardType,cardMonth,cardYear) {
       	validcardflag = "yes"
       	
       	if( cardNumber.length == 0 ) {	
       		alert("Please enter a valid card ## number.");
       		document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();       		
        	validcardflag = "no"
        	return false;
        	
        }
      
        for( var i = 0; i < cardNumber.length; ++i ) {		
        	var c = cardNumber.charAt(i);

       		if( c < '0' || c > '9' ) {
      			document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
      			alert("Please enter a valid card number. Use only digits. do not use spaces or hyphens.");
       			validcardflag = "no"
       			return false;
       		}
       		 	
       	}
      
       	var length = cardNumber.length;		
       	switch( cardType ) {
       		case 'AMEX':

		if( length != 15 ) {
			alert("Please enter a valid American Express Card number.");
			document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
			validcardflag = "no"
			return;
		}
	
		var prefix = parseInt( cardNumber.substring(0,2));

		if( prefix != 34 && prefix != 37 ) {
			alert("Please enter a valid American Express Card number.");
			document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
                        validcardflag = "no"
                        return;
                }
                break;
                case 'DISC':

		if( length != 16 ) {
                	alert("Please enter a valid Discover Card number.");
                	document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
                	validcardflag = "no"
                	return;
               	}
                var prefix = parseInt( cardNumber.substring(0,4));

                if( prefix != 6011 ) {
                	alert("Please enter a valid Discover Card number.");
                	document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
                        validcardflag = "no"
                        return;
                }
                break;
                case 'Mast':

                if( length != 16 ) {
                	alert("Please enter a valid MasterCard number.");
                	document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
                        validcardflag = "no"
                        return;
                }
		var prefix = parseInt( cardNumber.substring(0,2));

		if( prefix < 51 || prefix > 55) {
			alert("Please enter a valid MasterCard Card number.");
			document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
			validcardflag = "no"
			return;
		}
		break;
		case 'Visa':

		if( length != 16 && length != 13 ) {
			alert("Please enter a valid Visa Card number.");
			document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
			validcardflag = "no"
			return;
		}
		var prefix = parseInt( cardNumber.substring(0,1));

		if( prefix != 4 ) {
			alert("Please enter a valid Visa Card number.");
			document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
			validcardflag = "no"
			return;
		}
		break;
	}
	if( !mod10( cardNumber ) ) { 
		alert("Sorry! this is not a valid credit card number.");
		document.APPLICATION.Name_Card_CC_CARDNUMBER.focus();
		validcardflag = "no"
		return false;
		
	}
	
	if( expired( cardMonth, cardYear ) ){
		alert("Sorry! The expiration date you have entered would make this card invalid.");
		validcardflag = "no"
		return false;
	}
                                                	
	return true;
	
}

// Boolean variable specified if alert should be displayed if cookie exceeds 4KB
var caution = false

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "")
	if (!caution || (name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie
	else
		if (confirm("Cookie exceeds 4KB and will be cut!"))
	document.cookie = curCookie
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist

function getCookie(name) {
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)
		return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds

function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" + 
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT"
	}
}

function fixDate(date) {
	var base = new Date(0)
	var skew = base.getTime()
	if (skew > 0)
		date.setTime(date.getTime() - skew)
}

function getRepNum() {
	var repNumber = getCookie("repnum");
	if (repNumber == null) 
		document.APPLICATION.Name_REP_NUMBER.value = "";
	else
		document.APPLICATION.Name_REP_NUMBER.value = repNumber;
}

function getRepURL() {
	var repURL = getCookie("repURL");
	if (repURL != null) 
		document.location.href = repURL;
}


function setRepCookie() {
	var repNumber = document.REPNUMBER.repnum.value;
	var repURL = window.location.pathname;
	var reptype = "main";
	setCookie("reptype",reptype,"","","","");
	setCookie("repnum",repNumber,"","","","");
	setCookie("repURL",repURL,"","","","");
}
function setRepCookieCor() {
	var repNumber = document.REPNUMBER.repnum.value;
	var repURL = window.location.pathname;
	var reptype = "cor";
	setCookie("reptype",reptype,"","","","");
	setCookie("repnum",repNumber,"","","","");
	setCookie("repURL",repURL,"","","nbaabenefits.com/florida/","");
}
function setRepCookie401() {
	var repNumber = document.REPNUMBER.repnum.value;
	var repURL = window.location.pathname;
	var reptype = "401";
	setCookie("reptype",reptype,"","","","");
	setCookie("repnum",repNumber,"","","","");
	setCookie("repURL",repURL,"","","","");
}
function setRepCookieUni() {
	var repNumber = document.REPNUMBER.repnum.value;
	var repURL = window.location.pathname;
	var reptype = "uni";
	setCookie("reptype",reptype,"","","","");
	setCookie("repnum",repNumber,"","","","");
	setCookie("repURL",repURL,"","","","");
}


function setRepCookieA() {
	var repNumber = document.APPLICATION.Name_REP_NUMBER.value;
	setCookie("repnum",repNumber,"","","","");
}

//-->
