/*salesTaxScript.js*/
/*Copyright 2000-2005 by EarthOdyssey, LLC. All rights reserved. The content of this file may not be copied, used, sold or distributed in whole or in part without the express written consent of EarthOdyssey, LLC.*/
<!--Hide script
function makeArray()  {
		
		return this	
		}
monthNames = new makeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"

dayNames = new makeArray(7)
dayNames[1] = "Sunday"
dayNames[2] = "Monday"
dayNames[3] = "Tuesday"
dayNames[4] = "Wednesday"
dayNames[5] = "Thursday"
dayNames[6] = "Friday"
dayNames[7] = "Saturday"

if(document.all && !document.getElementById) {
    document.getElementById = function(id) {
         return document.all[id];
    }
}

//eliminated the need to change the array values whenever there is a price change by using taxObj('cost').options[taxObj('cost').selectedIndex]').value to replace it and capture the cost. Also, on 9.21.2002 made taxInfo.js only source of tax information

//var purchaseCost = new makeArray(6)

//purchaseCost[0] = 0.00
//purchaseCost[1] = 14.95
//purchaseCost[2] = 25.10
//purchaseCost[3] = 34.95
//purchaseCost[4] = 44.50
//purchaseCost[5] = 53.75


//.....move location of focus



		
	function setCookie(name,value,expires,path,domain,secure) {
	
			document.cookie = name + "=" + escape (value) +
			((expires ==null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + (( secure == true) ? "; secure" : "");
		}
		
		
	function getCookie(name) {
		var nameLen = name.length
		var clen = document.cookie.length
		var i = 0
		var cEnd
		
		while (i <clen) {
		var j = i + nameLen;
		if (document.cookie.substring(i,j) == name) {
			cEnd = document.cookie.indexOf(";", j)
			if (cEnd == -1) {
				cEnd = document.cookie.length
			}
			return unescape(document.cookie.substring(j+1,cEnd))
				}
				i++
			}
			return ""
		}


       
				
var expireHours=1;

function taxChange2005() {
var wan = getCookie('salesTaxCookie')
if (wan != "yes") {
var expireDate = new Date ();
expireDate.setTime(expireDate.getTime() + (expireHours * 60 * 60 * 1000));
setCookie('salesTaxCookie','yes',expireDate,"/",null,false);

advisorySalesTax();

}else{}

}				
	
var taxStr = '<div style="position:absolute;z-index:1;top:100px;left:300px;visibility:visible;width:1px;height:1px;background-color:white">&nbsp;</div><div id="tempWin" style="visibility:visible"><div style="background-image: url(\'images/leftShade.jpg\');background-repeat: repeat-y;background-attachment: scroll;position:relative;z-index:10;top:12px;margin-left:10%;"><div  style="background-color: rgb(255,255,255);margin-left:100px;position:relative; top:0px;left:0px;width:85%;margin-top:10px;margin-bottom:10px;padding-bottom:20px;margin-right:4%;padding-right:40px;"><br /><br /><h3 style="font-family:arial;color:black;margin-top:10px;margin-bottom:20px;">Tax Change Notice</h3><font style="color:#800000">As of June 1, 2005, the state sales tax rate on purchases in New York State decreased from 4.125% to 4.00%. Also on June 1, 2005 the Metropolitan Commuter Transportation District (MCTD) tax increased from 0.25% to 0.375%. The total sales tax rate is still computed from the sum of the state and local rates, as well as the MCTD tax. The MCTD tax is only levied in the counties of Dutchess, Nassau, Orange, Putnam, Rockland, Suffolk, and Westchester and in New York City.</font><div ><br /><input style="width:100px;text-align:center;vertical-align:middle;color:black;font-family:  arial,times,helvetica,lucida sans,verdana,sans-serif;font-weight:bold;border-top: 2px solid #C0C0C0 ;border-left: 2px solid #808080;border-right: 2px solid #404040;border-bottom: 2px solid #202020;background-color:rgb(115,170,250);" type="button" value="Launch page" title="click to go to back to sales tax page" onclick="document.all(\'tempWin\').style.visibility=\'hidden\';parent.location.href=\'http://www.earthodyssey.com/sales_tax.html\'" onkeypress="document.all(\'tempWin\').style.visibility=\'hidden\';parent.location.href=\'http://www.earthodyssey.com/sales_tax.html\'" onmouseover="this.style.backgroundColor=\'rgb(0,0,192)\'; this.style.color=\'white\';" onfocus="this.style.backgroundColor=\'rgb(0,0,192)\'; this.style.color=\'white\';" onblur="this.style.backgroundColor=\'rgb(115,170,250)\'; this.style.color=\'black\';return true;" onmouseout="this.style.backgroundColor=\'rgb(115,170,250)\'; this.style.color=\'black\';return true;" /><br /><br /></div></div></div></div><br /><br />'

function advisorySalesTax(){
//didn't use the popUpSky.show
//	if(IE6) {

jPopUp=window.open('http://www.earthodyssey.com/taxChange2005.html','Note','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=550,height=350,top=0,left=100')

		if(jPopUp != null) {
			if (jPopUp.opener == null) {
				jPopUp.opener = self;
				}
			}


//June 1, 2003 decided not to use the popUpSky for IE6
//		}else{
//		popUpSky.show(3*screen.width/8,0,5*screen.width/8,1*screen.height/2);
//		popUpSkyBody.innerHTML = taxStr;
//
//		}
}
	
	
	function customDateString(oneDate) {
		var theDay = dayNames[oneDate.getDay() + 1]
		var theMonth = monthNames[oneDate.getMonth() + 1]
		var theYear = oneDate.getFullYear()

		return theDay + ", " + theMonth + " " + oneDate.getDate() + ", " + theYear
		}


	function dayPart(oneDate) {
		var theHour = oneDate.getHours()
		if (theHour <6 )
			return "early hours"
		if (theHour < 12)
			return "morning"
		if (theHour < 18)
			return "afternoon"
		return "evening"
		}	

		
	function jump1(form) {
	
	var re = /(.+)(\(outside the following\))/
	var re1 = /(.+)(\(city\))/
	var shorten = document.getElementById('jurisdiction').options[document.getElementById('jurisdiction').selectedIndex].text
	
	//first remove blanks
		
	//var blank = /^(   )(.+)/
	//if (blank.test(shorten)) {
	//shorten= shorten.replace(blank,"$2")
	//}
	
	
	
	if (re.test(shorten)) {
	shorten= shorten.replace(re,"$1")
	}
	
	if (re1.test(shorten)) {
	shorten=shorten.replace(re1,"the city of...$1")
	}
		
	if (makeList=="true") {
	var sample3= document.getElementById('jurisdiction').options[document.getElementById('jurisdiction').selectedIndex].text
	
	var rii = /(city)/
	if (rii.test(sample3)) {
	
	alert(sample3+" is not a county. Please select again, making sure the selection is a county.")
	var tryAgain="true"
	}
	
	if (tryAgain!="true") {
	together(form)
		}
	return sample3}
	else {
		
	if (shorten!="Please select a county") {
	alert("You have selected "+shorten+".\n\nAfter clicking OK, the focus will jump to selection of a purchase cost, based on the purchase costs listed in the order. Select a purchase, click the 'Calculate' button and the results of the calculation will appear both as a description in an alert box similar to this alert, and in the buttons below the clear button. Clicking clear will erase the entire calculation and selection. These calculations are not linked anywhere else. They remain only on this page for your reference.\n\nAs an alternative, after clicking OK, tab down the screen to input any dollar figure for calculation of sales tax.")
		document.getElementById('city').selectedIndex=0
		document.getElementById('finalCost').focus()
		document.getElementById('cost').focus()
	}
	}
	}
	
	function jumpCity(form) {
		if (skip=="true") {
		
		
		var sample= document.getElementById('city').options[document.getElementById('city').selectedIndex].value
		
		separate(form)
		
		return sample}
		else {
		if (move=="true") {
		var sampleA= document.getElementById('city').options[document.getElementById('city').selectedIndex].value
		separate1(form)
		
		return sampleA
		}
		else {
		if (document.getElementById('city').options[document.getElementById('city').selectedIndex].text!="Please select a city") {
		
		var cityNoUnderline=document.getElementById('city').options[document.getElementById('city').selectedIndex].text
		cityNoUnderline=cityNoUnderline.replace("_"," ");
		cityNoUnderline=cityNoUnderline.replace("_"," ");
		
		
		
		alert("You have selected the city of "+ cityNoUnderline+".\n\nAfter clicking OK, the focus will jump to selection of a purchase cost, based on the purchase costs listed in the order. Select a purchase, click the 'Calculate Tax' button and the results of the calculation will appear both as a description in an alert box similar to this alert, and in the buttons below the clear button. Clicking clear will erase the entire calculation and selection. These calculations are not linked anywhere else. They remain only on this page for your reference.\n\nAs an alternative, after clicking OK, scroll down the screen to input any dollar figure for calculation of sales tax.")
		document.getElementById('jurisdiction').selectedIndex=0
		document.getElementById('finalCost').focus()
		document.getElementById('cost').focus()
		
		}
		}
		}
	}


	function jumpCalc(form)  {
	if (document.getElementById('jurisdiction').selectedIndex==0 && document.getElementById('city').selectedIndex==0 && show=="Yes") {
	alert("Before selecting a purchase cost, you need to select a shipping destination.")
	document.getElementById('typeCost').value=document.getElementById('typeCost').defaultValue
	document.getElementById('jurisdiction').focus()}
	else {	

	alert("You have selected a purchase cost of "+document.getElementById('cost').options[document.getElementById('cost').selectedIndex].text+".\n\nClick OK to continue and then click the 'Calculate Tax' button.")
	document.getElementById('typeCost').value=document.getElementById('typeCost').defaultValue
	document.getElementById('finalCost').focus()
	document.getElementById('calculator').focus()
		}
	}
	
		var display
	function jumpFigure(form)  {
		if (document.getElementById('jurisdiction').selectedIndex==0 && document.getElementById('city').selectedIndex==0 && show=="Yes") {
		alert("Before inserting a purchase cost, you need to select a shipping destination.")
		document.getElementById('cost').selectedIndex=0
		document.getElementById('jurisdiction').focus()}
		else {

		if (isNumber(document.getElementById('typeCost').value)=="true") {
		alert("You have inserted a purchase cost of $"+document.getElementById('typeCost').value+".\n\nClick OK to continue.")
		
		document.getElementById('cost').selectedIndex=0
		document.getElementById('finalCost').focus()
		document.getElementById('calculator').focus()
		}else{
		display="No"
		document.getElementById('typeCost').focus()
		}
		}

	}
	
	var skip
	var move
	function taxOnly(form) {
	
	skip="true"

	
	alert("Please select a city.")
	
	}  
	
	function countyOnly(form) {
		
		move="true"
	
		
		alert("Please select a city.")
		
	} 
	
	function separate(form) {
	var ra = /(.+)(,)(.+_County)(,\d\.\d\d\d?,0\.\d\d\d?,\d\.\d\d)(,)(\d\.?\d?\d?\d?)/
	
	var ri = /(,)(\d\.\d\d\d?)(,)(0\.\d\d\d?)(,)(\d\.\d\d)(,)(\d\.?\d?\d?\d?)/
	sample1 = cityRate[document.getElementById('city').options[document.getElementById('city').selectedIndex].value]
	
	if (ra.test(sample1)) {
	city1= sample1.replace(ra,"$1")
	county1= sample1.replace(ra,"$3")
	rates = sample1.replace(ra,"$4$5$6")
	}
	if (ri.test(rates)) {
	localRate = rates.replace(ri,"$2")
	transitRate = rates.replace(ri,"$4")
	stateRate = rates.replace(ri,"$6")
	totalTaxRate = rates.replace(ri,"$8")
	}
	
	var ro = /^(\d)$/
	
	if (ro.test(totalTaxRate)) {
	totalTaxRate=totalTaxRate.replace(ro,"$1\.00")
	}
	
	if (transitRate=="0.00") {
	placeHolder1 = " There is no Metropolitan Commuter Transportation District (MCTD) sales tax."
	placeHolder2 = ""
	} else {
	placeHolder1 = ""
	placeHolder2 = "a Metropolitan Commuter Transportation District (MCTD) sales tax rate of "+ transitRate+"%,"
	}
	
		
	alert("The city of "+city1+" in "+county1+", New York has a local sales tax rate of "+localRate+"% "+placeHolder2+"and a uniform state sales tax rate of "+stateRate+"%, for a total sales tax rate of "+totalTaxRate+"%."+placeHolder1+"")
	
	alert("We appreciate your interest in the earthodyssey.com website and we hope the sales tax information has been useful. Don't forget to click the 'Home' navigation link to see the EarthOdyssey pulling tool if you haven't already done so.")
	
	if (confirm("Click 'OK' to choose another city.\n\nClick 'Cancel' to proceed with the sales tax calculator.")) {
	skip="true"}
	else { skip="false"
	document.location="#choice"}
	
		}	
		
	function separate1(form) {
		var ra = /(.+)(,)(.+_County)(,\d\.\d\d\d?,0\.\d\d\d?,\d\.\d\d)(,)(\d\.?\d?\d?\d?)/
		
		
		sample2 = cityRate[document.getElementById('city').options[document.getElementById('city').selectedIndex].value]
		if (ra.test(sample2)) {
		city2= sample2.replace(ra,"$1")
		county2= sample2.replace(ra,"$3")
		
		}
					
		alert("The city of "+city2+" is located in "+county2+", New York.")
		
		alert("We appreciate your interest in the earthodyssey.com website and we hope the sales tax information has been useful. Don't forget to click the 'Home' navigation link to see the EarthOdyssey pulling tool.")
		
		if (confirm("Click 'OK' to choose another city.\n\nClick 'Cancel' to proceed with the sales tax calculator.")) {
			move="true"}
			else { move="false"
			document.location="#choice"}
			
			
		}	
		
		var tryAgain="false"
		var makeList
	function countyList (form) {	
		
		makeList="true"
				
		alert("Please select a county.")
				
	} 
	
	
	function together(form) {
	
	var cityString = ""
	
	matchCounty = document.getElementById('jurisdiction').options[document.getElementById('jurisdiction').selectedIndex].text
	
		
	
	//alert(matchCounty)
	
	var CITY =/([\w\s?_?]+)(\(city\))(.+)?/
		if (CITY.test(matchCounty)) {
	
	
	alert ("You have selected a city within a county. Please select a county instead")
	
	document.getElementById('jurisdiction').focus()
	
	
	}
		
	var roo =/([\w\s?_?]+)(\(outside the following\))(.+)?/
	if (roo.test(matchCounty)) {
	matchCounty=matchCounty.replace(roo,"$1")
	}
		
	var raa= /(.+)( )(County)/
	
	if (raa.test(matchCounty)) {
	var matchCounty1=matchCounty.replace(raa,"$1_$3")
	
	}
	
	var rtt= /(St.)( )(Lawrence)( )(County)/
	if (rtt.test(matchCounty)) {
	var matchCounty1=matchCounty.replace(rtt,"Saint $3$5")
		
	}
	
	var ru = new RegExp(matchCounty1)

	var ree = /(.+)(,)(.+_County)(.+)/
	
	//count the number of cities in a county
	var countCities=0;
	
	for (h=1;h<=1754;h++) {
	
	var inputA = cityRate[h]
	
	//alert (h+"..."+inputA.search(ru));
	
	if (inputA.search(ru)!=-1) {
	
	//alert(h+"..."+cityRate[h]);
	
	if (ree.test(inputA)) {
	var addCity=cityRate[h].replace(ree,"$1")
	
	//for North Lawrence, remove county name
	addCity=addCity.replace("__Nassau_County_"," ")
	addCity=addCity.replace("__Saint_Lawrence_County_"," ")
	
	//remove underlines, do it twice
	addCity=addCity.replace("_"," ")
	addCity=addCity.replace("_"," ")
	var cityString = cityString+" "+addCity+","
	
	//alert(cityString);
	
	countCities=countCities+1;
	
	}
	
	}
	}
	
	//remove last comma and insert and "and" before last city
	cityString=cityString.slice(0,-1);
	var lastComma=cityString.lastIndexOf(",")
	lastCommaString=cityString.substring(lastComma,cityString.length)
	lastCommaString=lastCommaString.replace(",",", and ")
	cityString=cityString.slice(0,lastComma);
	cityString=cityString+lastCommaString;
	
	alert("Within "+matchCounty+" are the following "+countCities+" cities:\n\n"+cityString)
	
	alert("We appreciate your interest in the earthodyssey.com website and we hope the sales tax information has been useful. Don't forget to click the 'Home' navigation link to see the EarthOdyssey pulling tool.")
			
	if (confirm("Click 'OK' to choose another county.\n\nClick 'Cancel' to proceed with the sales tax calculator.")) {
		makeList="true"}
		else { makeList="false"
	document.location="#choice"}
	
	}
	
	//clear previous calculation display
	
	function clearNumbers(form) {
			
		document.getElementById('initialCost').value="               " 
		document.getElementById('insertTax').value="               " 
		document.getElementById('finalCost').value="               " 
	}
	
	
	//show lets empty function know not to show the alert box
		var show="Yes"
	function empty(form) {
		show="No"
		document.getElementById('initialCost').value="               " 
		document.getElementById('insertTax').value="               " 
		document.getElementById('finalCost').value="               " 

	alert("These calculations are meant to assist you in filling out our order document.getElementById(' If by chance you don't want to make a purchase today, but are intrigued by the sales tax calculator, there is an enhanced version, if you haven't already tried it. You can enter any cost, up to $99,999,999,999.99, and calculate the sales tax for any  location (by county or city) in New York State.")
	
		
	}
		
	//....calculate sales tax		
		
		var x
		var y
		var z
		
		function calculate(form) {
		
		if (document.getElementById('jurisdiction').selectedIndex=="0" && document.getElementById('city').selectedIndex=="0") {
		alert("Before performing the sales tax calculation, naturally you must select the shipping destination!")
		document.getElementById('jurisdiction').focus()
		return false;
		}else {
		if (document.getElementById('cost').selectedIndex=="0" && document.getElementById('typeCost').value=="") {
		alert("Before performing a sales tax calculation, naturally you must select, or input, a purchase cost!")
		document.getElementById('cost').focus()
		return false;
		}
		}
		
		
		
		if (document.getElementById('jurisdiction').selectedIndex=="0") {
		
		
		var rate = cityRate[document.getElementById('city').options[document.getElementById('city').selectedIndex].value]
		
		var place= cityRate[document.getElementById('city').options[document.getElementById('city').selectedIndex].value]
		
		//for 0.375 must allow for another decimal
		
		var re =/(.+)(,)(.+_County)(,\d\.\d\d\d?,0\.\d\d\d?,\d\.\d\d)(,)(\d\.?\d?\d?\d?)/
		
		if (re.test(rate)) {
		rate=rate.replace(re,"$6")
		
		} 
		 x = rate
		
		if (re.test(place)) {
		place = place.replace(re,"the city of $1 in $3")
		}
		z = place
		z=z.replace("_"," ");
		z=z.replace("_"," ");
		z=z.replace("_"," ");
		z=z.replace("_"," ");
		
		z=z.replace("Nassau County_"," ");
		z=z.replace("Saint Lawrence_County_"," ");
		
		} else {
		if (document.getElementById('city').selectedIndex=="0") {
		
		
		 x = totalRate[document.getElementById('jurisdiction').selectedIndex]
		 z = taxLocation[document.getElementById('jurisdiction').selectedIndex]
		}
		}
				
		if (document.getElementById('typeCost').value=="") {
		 y = document.getElementById('cost').options[document.getElementById('cost').selectedIndex].value
		 
		calcTax(form)
		}else {
		
		if (document.getElementById('cost').selectedIndex=="0") {
		 y = document.getElementById('typeCost').value
		 
		 calcTax1(form)
		}
		}				
		}
			
			
		function calcTax(form) {
//200		var b=0
		var c=0
				
		y = (Math.round(y * 100))/100		
		
		b = x * y;
		b = Math.round(b)
		b = b/100;		
		
		c = y + b;
		c = (Math.round(c * 100))/100	
		
//.. if only one decimal, add a zero
		if (((c * 10) != (Math.round(c) * 10)) &&
			 ((c * 10) == (Math.round(c * 10)))) {
			var numCCstr = c.toString()
			numCCstr = numCCstr + "0"
		}else{
		var numCCstr = c.toString()
		}
//..if no decimals, add two zeroes
		if (c == Math.round(c)) {
			var numCstr = c.toString()
			numCCstr = numCCstr + ".00"
		}
		if (((b * 10) != (Math.round(b) * 10)) &&
			 ((b * 10) == (Math.round(b * 10)))) {
			var numBBstr = b.toString()
			numBBstr = numBBstr + "0"
		}else{
		var numBBstr = b.toString()
		}
		if (b == Math.round(b)) {
			var numBBstr = b.toString()
			numBBstr = numBBstr + ".00"
		}
		if (((y * 10) != (Math.round(y) * 10)) &&
			 ((y * 10) == (Math.round(y * 10)))) {
			var numYYstr = y.toString()
			numYYstr = numYYstr + "0"
		}else{
		var numYYstr = y.toString()
		}
		if (y == Math.round(y)) {
			var numYYstr = y.toString()
			numYYstr = numYYstr + ".00"
		}
	
		
		
		alert("The sales tax rate for the selected shipping destination of " + z + ", New York is " + x + "%. For a purchase cost of $" + numYYstr + " including shipping and handling, the sales tax is $" + numBBstr + ". Therefore, the final cost including sales tax is $" + numCCstr + ". Please make a note of this information.")
		var numYYstr = "$" + numYYstr
		var numBBstr = "$" + numBBstr
		var numCCstr = "$" + numCCstr
		document.getElementById('initialCost').value = numYYstr 
		document.getElementById('insertTax').value = numBBstr 
		document.getElementById('finalCost').value = numCCstr
		
		document.getElementById('tax').reset();
		document.getElementById('finalCost').focus()
		}




		
//..........General purpose New York State sales tax calculator
			
			
	function isNumber(y1) {
		var Numeric = new Array('0','1','2','3','4','5','6','7','8','9','.')

		var decimalCount = 0; 
		for (var i = 0; i < y1.length; i++) {
		flag = false
		var oneChar = y1.substring(i, i + 1)
		for (n = 0; n<Numeric.length; n++) {

			if (oneChar == Numeric[n]) {
		flag = true
			if (oneChar == ".") {
			decimalCount++;
				}
			}

		}

		if ((flag == false) || (decimalCount >=2)) {
		alert("Please make sure your entry consists of numbers and one decimal point only!")
		
		return false
			}
			}

		return true
		}

		function calcTax1 (form) {
			var x1 = x              
			var z1 = z
			var y1 = y  
		var b1=0
		var c1=0
//...remove $ sign		
		if (y1.substring(0,1) == "$") {
				y1 = y1.substring(1,y1.length)
			}	
//..strip commas 
		
		for (var i = 0; i < y1.length; i++) {		 			
		var aChar = y1.substring(i, i + 1)	
			if (aChar == ",") {
			y1 = y1.substring(0,i) + y1.substring(i+1,y1.length)
				}	
			}

		
//.. all placeholders must be a positive number		
		
			if (!isNumber(y1)) {
			return false
		}else{
		
//..make sure y1 only has two decimal places	
		y1 = (Math.round(y1 * 100))/100		
		
		b1 = x1 * y1;
		b1 = Math.round(b1)
		b1 = b1/100;		
		
		c1 = y1 + b1;
		c1 = (Math.round(c1 * 100))/100	
//.. if only one decimal, add a zero
		if (((c1 * 10) != (Math.round(c1) * 10)) &&
			 ((c1 * 10) == (Math.round(c1 * 10)))) {
			var numCstr = c1.toString()
			numCstr = numCstr + "0"
		}else{
		var numCstr = c1.toString()
		}
//..if no decimals, add two zeroes
		if (c1 == Math.round(c1)) {
			var numCstr = c1.toString()
			numCstr = numCstr + ".00"
		}
		if (((b1 * 10) != (Math.round(b1) * 10)) &&
			 ((b1 * 10) == (Math.round(b1 * 10)))) {
			var numBstr = b1.toString()
			numBstr = numBstr + "0"
		}else{
		var numBstr = b1.toString()
		}
		if (b1 == Math.round(b1)) {
			var numBstr = b1.toString()
			numBstr = numBstr + ".00"
		}
		if (((y1 * 10) != (Math.round(y1) * 10)) &&
			 ((y1 * 10) == (Math.round(y1 * 10)))) {
			var numYstr = y1.toString()
			numYstr = numYstr + "0"
		}else{
		var numYstr = y1.toString()
		}
		if (y1 == Math.round(y1)) {
			var numYstr = y1.toString()
			numYstr = numYstr + ".00"
		}
//.. add commas every three numbers
				
		if (numBstr.length > 6) { 
			numBstr = numBstr.substring(0,numBstr.length-6)  + "," +numBstr.substring(numBstr.length-6,numBstr.length)
}
		if (numBstr.length > 10) {
			numBstr = numBstr.substring(0,numBstr.length-10)  + "," +numBstr.substring(numBstr.length-10,numBstr.length)
}
		if (numBstr.length > 14) {
			numBstr = numBstr.substring(0,numBstr.length-14)  + "," +numBstr.substring(numBstr.length-14,numBstr.length)
}
		if (numBstr.length > 18) {
			numBstr = numBstr.substring(0,numBstr.length-18)  + "," +numBstr.substring(numBstr.length-18,numBstr.length)
}
		if (numCstr.length > 6) {
			numCstr = numCstr.substring(0,numCstr.length-6)  + "," +numCstr.substring(numCstr.length-6,numCstr.length)
}
		if (numCstr.length > 10) {
			numCstr = numCstr.substring(0,numCstr.length-10)  + "," +numCstr.substring(numCstr.length-10,numCstr.length)
}
		if (numCstr.length > 14) {
			numCstr = numCstr.substring(0,numCstr.length-14)  + "," +numCstr.substring(numCstr.length-14,numCstr.length)
}
		if (numCstr.length > 18) {
			numCstr = numCstr.substring(0,numCstr.length-18)  + "," +numCstr.substring(numCstr.length-18,numCstr.length)
}
		if (numYstr.length > 6) {
			numYstr = numYstr.substring(0,numYstr.length-6)  + "," +numYstr.substring(numYstr.length-6,numYstr.length)
}
		if (numYstr.length > 10) {
			numYstr = numYstr.substring(0,numYstr.length-10)  + "," +numYstr.substring(numYstr.length-10,numYstr.length)
}
		if (numYstr.length > 14) {
			numYstr = numYstr.substring(0,numYstr.length-14)  + "," +numYstr.substring(numYstr.length-14,numYstr.length)
}
		if (numYstr.length > 18) {
			numYstr = numYstr.substring(0,numYstr.length-18)  + "," +numYstr.substring(numYstr.length-18,numYstr.length)
}
		alert("The sales tax rate for the selected shipping destination of " + z1 + ", New York is " + x1 + "%. For a purchase cost of $" + numYstr + " including shipping and handling, the sales tax is $" + numBstr + ". Therefore, the final cost including sales tax is $" + numCstr + ". Please make a note of this information.")
		document.getElementById('initialCost').value="$" + numYstr
		document.getElementById('insertTax').value="$" + numBstr
		document.getElementById('finalCost').value="$" + numCstr
		document.getElementById('tax').reset();
		document.getElementById('finalCost').focus()
			}
		}


//....calculate sales tax		
		
		function calculate1(form) {
		
		
		var choose1Location = document.getElementById('place').selectedIndex 
		var choose1Name = document.getElementById('place').selectedIndex		
		if (choose1Location == 0 ) {
		alert("Please select a tax jurisdiction!")
		document.getElementById('place').focus()
		return false;
		}else{
		
		if (document.getElementById('typeCost').value == "" || document.getElementById('typeCost').value == " " || document.getElementById('typeCost').value == null) {
		alert("Please input a purchase cost!")
		document.getElementById('typeCost').focus()
		return false;
		}else{
		
		
		var taxAmount = calcTax1(form,choose1Location,choose1Name) 
				}
			}
		}
		
		
//...go back to the order form where you started
		

//...effective6.1.2001 rate for Suffolk is 8.5		
		
	
		
//-->