function toggle(div) {
	var div = document.getElementById(div);
	if (div.style.display == 'block') {
		div.style.display = "none";
	} else {
		div.style.display = "block";
	}
}

function toggleHelp(sec,num,t1,t2) {
	for (j=1;j<t1+1;j++) {
		var section = "help" + j;
		var div = document.getElementById(section);
		if (j == sec) {
			div.style.display = "block";
		} else {
			div.style.display = "none";
		}
	}
	for (i=1;i<t2+1;i++) {
		var tip = "help" + sec + ".tip" + i;
		var temp = document.getElementById(tip);
		if (i == num) {
			temp.style.display = "block";
		} else {
			temp.style.display = "none";
		}
	}
}

function selectUserType(item) {
	var registerForm = document.getElementById('registerForm');
	var generalInfo = document.getElementById('generalInfo');
	var taxPreparer = document.getElementById('taxPreparer');
	var addressInfo = document.getElementById('addressInfo');
	var securityQuestion = document.getElementById('securityQuestion');
	var type1 = document.getElementById('type1');
	var type2 = document.getElementById('type2');
	var indinst = document.getElementById('IndInstructions');
	var ppinst = document.getElementById('PPInstructions');
	var pp = document.getElementById('PaidPreparer');
	var efin = document.getElementById('EFIN');
	var ptin = document.getElementById('PTIN');
	
	if (item == "IndividualFiler") {
		pp.value = 0;
		efin.value = "";
		ptin.value = "";
		registerForm.style.display = "block";
		generalInfo.style.display = "block";
		taxPreparer.style.display = "none";
		addressInfo.style.display = "block";
		securityQuestion.style.display = "block";
		indinst.style.display = "block";
		ppinst.style.display = "none";
		type1.style.backgroundColor = "#AAA";
		type2.style.backgroundColor = "#CCC";
		type1.style.color = "#FFF";
		type2.style.color = "#003A85";
	}
	if (item == "PaidTaxPreparer") {
		pp.value = 1;
		registerForm.style.display = "block";
		generalInfo.style.display = "block";
		taxPreparer.style.display = "block";
		addressInfo.style.display = "block";
		securityQuestion.style.display = "block";
		indinst.style.display = "none";
		ppinst.style.display = "block";
		type2.style.backgroundColor = "#AAA";
		type1.style.backgroundColor = "#CCC";
		type2.style.color = "#FFF";
		type1.style.color = "#003A85";
	}
}

function selectPaymentType(item) {
	var eftps = document.getElementById('eftps');
	var voucher = document.getElementById('voucher');
	var bankaccount = document.getElementById('bankaccount');
	
	if (item == "eftps") {
		eftps.style.display = "block";
		voucher.style.display = "none";
		bankaccount.style.display = "none";
	}
	if (item == "voucher") {
		eftps.style.display = "none";
		voucher.style.display = "block";
		bankaccount.style.display = "none";
	}
	if (item == "bankaccount") {
		eftps.style.display = "none";
		voucher.style.display = "none";
		bankaccount.style.display = "block";
	}
}

function USForeign() {
	var USAddressDIV = document.getElementById('USAddressDIV');
	var ForeignAddressDIV = document.getElementById('ForeignAddressDIV');
	
	if (document.CompanyInfoForm.ForeignAddress.value == '0') {
		USAddressDIV.style.display = "block";
		ForeignAddressDIV.style.display = "none";
	}
	if (document.CompanyInfoForm.ForeignAddress.value == '1') {
		ForeignAddressDIV.style.display = "block";
		USAddressDIV.style.display = "none";
	}
}

function AR() {
	var AmendedReturnDIV = document.getElementById('AmendedReturnDIV');
	
	if (document.CompanyInfoForm.AmendedReturn.value == '1') {
		AmendedReturnDIV.style.display = "block";
	}
	if (document.CompanyInfoForm.AmendedReturn.value == '0') {
		AmendedReturnDIV.style.display = "none";
	}
}

function CTVDD() {
	var ConsentToVINDataDisclosureDIV = document.getElementById('ConsentToVINDataDisclosureDIV');
	
	if (document.CompanyInfoForm.ConsentToVINDataDisclosure.value == '1') {
		ConsentToVINDataDisclosureDIV.style.display = "block";
	}
	if (document.CompanyInfoForm.ConsentToVINDataDisclosure.value == '0') {
		ConsentToVINDataDisclosureDIV.style.display = "none";
	}
}

function TPD() {
	var ThirdPartyDesigneeDIV = document.getElementById('ThirdPartyDesigneeDIV');
	
	if (document.CompanyInfoForm.ThirdPartyDesignee.value == '1') {
		ThirdPartyDesigneeDIV.style.display = "block";
	}
	if (document.CompanyInfoForm.ThirdPartyDesignee.value == '0') {
		ThirdPartyDesigneeDIV.style.display = "none";
	}
}

function PP() {
	var PreparerFirmDIV = document.getElementById('PreparerFirmDIV');
	
	if (document.CompanyInfoForm.PreparerFirm.value == '1') {
		PreparerFirmDIV.style.display = "block";
	}
	if (document.CompanyInfoForm.PreparerFirm.value == '0') {
		PreparerFirmDIV.style.display = "none";
	}
}

function PPUSForeign() {
	var PPUSAddressDIV = document.getElementById('PPUSAddressDIV');
	var PPForeignAddressDIV = document.getElementById('PPForeignAddressDIV');
	
	if (document.CompanyInfoForm.PPForeignAddress.value == '0') {
		PPUSAddressDIV.style.display = "block";
		PPForeignAddressDIV.style.display = "none";
	}
	if (document.CompanyInfoForm.PPForeignAddress.value == '1') {
		PPForeignAddressDIV.style.display = "block";
		PPUSAddressDIV.style.display = "none";
	}
}

function NSTT() {
	var SuspendedVINStatementDIV = document.getElementById('SuspendedVINStatementDIV');
	if (document.SuspensionCreditForm.NotSubjectToTax.value == '0') {
		SuspendedVINStatementDIV.style.display = "block";
	} else {
		SuspendedVINStatementDIV.style.display = "none";
	}
}

function SSS() {
	var StmtInSupportOfSuspensionDIV = document.getElementById('StmtInSupportOfSuspensionDIV');
	
	if (document.SuspensionCreditForm.StmtInSupportOfSuspension.value == '1') {
		StmtInSupportOfSuspensionDIV.style.display = "block";
	}
	if (document.SuspensionCreditForm.StmtInSupportOfSuspension.value == '0') {
		StmtInSupportOfSuspensionDIV.style.display = "none";
	}
}

function CAS() {
	var CreditsAmountStatementDIV = document.getElementById('CreditsAmountStatementDIV');
	
	if (document.SuspensionCreditForm.CreditsAmountStatement.value == '1') {
		CreditsAmountStatementDIV.style.display = "block";
	}
	if (document.SuspensionCreditForm.CreditsAmountStatement.value == '0') {
		CreditsAmountStatementDIV.style.display = "none";
	}
}

function TGW() {
	var TGWIncreaseWorksheetDIV = document.getElementById('TGWIncreaseWorksheetDIV');
	
	if (document.SuspensionCreditForm.TGWIncreaseWorksheet.value == '1') {
		TGWIncreaseWorksheetDIV.style.display = "block";
	}
	if (document.SuspensionCreditForm.TGWIncreaseWorksheet.value == '0') {
		TGWIncreaseWorksheetDIV.style.display = "none";
	}
}

function PPWI() {
	var PriorPeriodWeightIncreaseDIV = document.getElementById('PriorPeriodWeightIncreaseDIV');
	
	if (document.SuspensionCreditForm.PriorPeriodWeightIncrease.value == 'Yes') {
		PriorPeriodWeightIncreaseDIV.style.display = "block";
	}
	if (document.SuspensionCreditForm.PriorPeriodWeightIncrease.value == 'No') {
		PriorPeriodWeightIncreaseDIV.style.display = "none";
	}
}

function addOneTruck(curr,total) {
	var target;
	target = document.getElementById(curr);
	target.style.display = "block";
	var link = document.getElementById('addOne');
	var next = Number(curr) + 1;
	if (next < total) {
		link.href = "javascript:addOneTruck(" + next + "," + total + ")";
	} else {
		link.style.display = 'none';
	}
}
function addOneVehicle(curr,total,prefix) {
	var target;
	var current = prefix + curr;
	target = document.getElementById(current);
	target.style.display = "block";
	var addOne = prefix + 'addOne'; 
	var link = document.getElementById(addOne);
	var next = Number(curr) + 1;
	if (next < total) {
		link.href = "javascript:addOneVehicle(" + next + "," + total + ",'" + prefix + "')";
	} else {
		link.style.display = 'none';
	}
}

function createExpDate() {
	document.PaySubmitForm.ssl_exp_date.value = document.PaySubmitForm.expMonth.value + document.PaySubmitForm.expYear.value;
}

function navConfirm(step) {
	var r = confirm("If you have changed any information on this page, you must click Save and Continue at the bottom of the page for the changes to be saved. Click OK to continue or CANCEL to go back and save your changes.");
	if (r == true) {
		var page = "efile_step"+step+".php";
	  window.location = page;
	} else {
	  return r;
	}
}