//mchk makes sure when a workshop is selected that a payment method is also selected
var mchk = 0

/*This function sets the price of the workshop and sets the description for the reciept.
  If an additional workshop is added (like maybe one for csfss2), make sure to add two lines like the ones between
  the dashes, under the switch(m) statement.
  ---------------------------------------------------------------------------------------------------------------
  case "BUTTON VALUE":
  desc = workshop[490000]
  ---------------------------------------------------------------------------------------------------------------
  The number inside the brackets will be determined by where you added it to the workshop descriptions at the top of the
  script.
*/
function resetForm()
{
	document.books.reset()
	textValue();
	ChangeTitle();
}
function calculatePrice()
{
	var totalPrice = 0;
		if(ecom.registration.value == 'Free')
	{
		mReg = "Free";
	}
		if(ecom.registration.value == 'CommonMan')
	{
		mReg = "CommonMan";
	}
		if(ecom.registration.value == 'DITA1.2')
	{
		mReg = "DITA1.2";
	}
		if(ecom.registration.value == 'Conref')
	{
		mReg = "Conref";
	}
		if(ecom.registration.value == 'NeverWaste')
	{
		mReg = "NeverWaste";
	}
		if(ecom.registration.value == 'DITAvsNon')
	{
		mReg = "DITAvsNon";
	}
		if(ecom.registration.value == 'UglyDITA')
	{
		mReg = "UglyDITA";
	}
		if(ecom.registration.value == 'WinANT')
	{
		mReg = "WinANT";
	}
		if(ecom.registration.value == 'SocialMedia')
	{
		mReg = "SocialMedia";
	}
		if(ecom.registration.value == 'ResourceDescriptionFramework')
	{
		mReg = "ResourceDescriptionFramework";
	}
		if(ecom.registration.value == 'MapTopic')
	{
		mReg = "MapTopic";
	}
		if(ecom.registration.value == 'StructuredPublishing')
	{
		mReg = "StructuredPublishing";
	}
		if(ecom.registration.value == 'ReleaseManagement')
	{
		mReg = "ReleaseManagement";
	}
		if(ecom.registration.value == 'DITAMetrics')
	{
		mReg = "DITAMetrics";
	}
		if(ecom.registration.value == 'Translations')
	{
		mReg = "Translations";
	}
		if(ecom.registration.value == 'SharePoint')
	{
		mReg = "SharePoint";
	}
		if(ecom.registration.value == 'Constraint')
	{
		mReg = "Constraint";
	}
		if(ecom.registration.value == 'acrolinx_cidm')
	{
		mReg = "acrolinx_cidm";
	}
		if(ecom.registration.value == 'warnings')
	{
		mReg = "warnings";
	}
		if(ecom.registration.value == 'learntrain')
	{
		mReg = "learntrain";
	}
	if(ecom.registration.value == 'ditaxliff')
	{
		mReg = "ditaxliff";
	}
	else if(ecom.registration.value == 'Collaborative')
	{
		mReg = "Collaborative";
	}
	else if(ecom.registration.value == 'RightHemisphere')
	{
		mReg = "RightHemisphere";
	}	
	else
	{
		for(i=0;i<ecom.registration.length;i++)
		{
			if(ecom.registration[i].checked == true)
			{
				mReg = ecom.registration[i].value
				break;
			}
		}
	}
	switch(mReg)

	{
					
			case "Session1":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - XML Session 1";
				break;
				
			case "Session2":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - XML Session 2";
				break;
				
			case "Session3":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - XML Session 3";
				break;
					 
			case "Session4":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - XML Session 4";
				break;
				
			case "SessionBoth":
				totalPrice = 125;
				ecom.DESCRIPTION.value = "Webinar - XML Session 1 & 2";
				break;
				
			case "SessionAll":
				totalPrice = 200;
				ecom.DESCRIPTION.value = "Webinar - XML Session 1 & 2 & 3";
				break;
				
			case "Sessionall4":
				totalPrice = 250;
				ecom.DESCRIPTION.value = "Webinar - XML Session 1 & 2 & 3 & 4";
				break;
			
			case "Collaborative":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Collaborative";
				break;
				
			case "StructuredPublishing":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Structured Publishing";
				break;
				
			case "ResourceDescriptionFramework":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Resource Description Framework";
				break;
					
			case "SocialMedia":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Social Media";
				break;
				
			case "WinANT":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - WinANT";
				break;
				
			case "DITAvsNon":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA vs. Non-Technical Authors";
				break;
				
			case "NeverWaste":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Never Waste a Good Crisis";
				break;
			
			case "DITA1.2":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - The DITA 1.2 Keyref Mechanism";
				break;
				
			case "UglyDITA":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Ugly DITA";
				break;
				
			case "CommonMan":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA for the Common Man";
				break;
			
			case "Conref":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA 1.2 Improvements to Conref";
				break;
				
			case "Constraint":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA 1.2 Constraint Mechanism";
				break;
			
			case "MapTopic":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Map and Topic Templates";
				break;
			
			case "DITAMetrics":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA Metrics in Production";
				break;
						
			case "Translations":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Taking Control of Your Translations";
				break;	
		
			case "SharePoint":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Customized DITA Documents Delivered Using SharePoint";
				break;	
		
			case "acrolinx_cidm":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Are You Ready for the New Information Revolution";
				break;	
			
			case "ditaxliff":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA and XLIFF: The Perfect Marriage Gets Stronger";
				break;	
			
			case "warnings":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Handling Warnings in User-Friendly Documentation";
				break;	
			
			case "learntrain":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA 1.2 Learning and Training: Building Reusable Learning Objects";
				break;	
			
			case "ReleaseManagement":
				totalPrice = 25;
				ecom.DESCRIPTION.value = "Webinar - Release Management";
				break;
				
			case "Eurofield":
				totalPrice = 0;
				ecom.DESCRIPTION.value = "Webinar - Free";
				break;
				
			case "RightHemisphere":
				totalPrice = 0;
				ecom.DESCRIPTION.value = "Webinar - Free";
				break;				
	}
	return totalPrice;	
}

function calculateTax(totalPrice)
{
	var totalTax = 1;
	return totalTax;
}

function calculateShipping()
{
	var numberOfBooks = 0;
	var countryInteger, countryString       
	countryInteger=document.books.COUNTRYTOSHIP.selectedIndex
	countryString=document.books.COUNTRYTOSHIP.options[countryInteger].text 

	
	var DITA = document.books.DITA.selectedIndex;
	numberOfBooks = numberOfBooks + DITA;
	
	
	var totalShipping = 0;

	return totalShipping;
}

function price(){
	var ecom = document.books;
//m is a placeholder for the registration value
//c is the Standard Cost of the workshops
//var ecom = document.books
var totalPrice = 0;
	if(ecom.registration.value == 'Free')
		{
		mReg = "Free";
	}
		if(ecom.registration.value == 'CommonMan')
	{
		mReg = "CommonMan";
	}
		if(ecom.registration.value == 'DITA1.2')
	{
		mReg = "DITA1.2";
	}
		if(ecom.registration.value == 'Conref')
	{
		mReg = "Conref";
	}
		if(ecom.registration.value == 'NeverWaste')
	{
		mReg = "NeverWaste";
	}
		if(ecom.registration.value == 'DITAvsNon')
	{
		mReg = "DITAvsNon";
	}
		if(ecom.registration.value == 'UglyDITA')
	{
		mReg = "UglyDITA";
	}
			if(ecom.registration.value == 'WinANT')
	{
		mReg = "WinANT";
	}
		if(ecom.registration.value == 'SocialMedia')
	{
		mReg = "SocialMedia";
	}
		if(ecom.registration.value == 'ResourceDescriptionFramework')
	{
		mReg = "ResourceDescriptionFramework";
	}
		if(ecom.registration.value == 'MapTopic')
	{
		mReg = "MapTopic";
	}
		if(ecom.registration.value == 'StructuredPublishing')
	{
		mReg = "StructuredPublishing";
	}
		if(ecom.registration.value == 'ReleaseManagement')
	{
		mReg = "ReleaseManagement";
	}
		if(ecom.registration.value == 'DITAMetrics')
	{
		mReg = "DITAMetrics";
	}
		if(ecom.registration.value == 'Translations')
	{
		mReg = "Translations";
	}
		if(ecom.registration.value == 'SharePoint')
	{
		mReg = "SharePoint";
	}
		if(ecom.registration.value == 'Constraint')
	{
		mReg = "Constraint";
	}
		if(ecom.registration.value == 'acrolinx_cidm')
	{
		mReg = "acrolinx_cidm";
	}
		if(ecom.registration.value == 'warnings')
	{
		mReg = "warnings";
	}
		if(ecom.registration.value == 'learntrain')
	{
		mReg = "learntrain";
	}
		if(ecom.registration.value == 'ditaxliff')
	{
		mReg = "ditaxliff";
	}
	else if(ecom.registration.value == 'Collaborative')
	{
		mReg = "Collaborative";
	}
	else
	{
		for(i=0;i<ecom.registration.length;i++)
		{
			if(ecom.registration[i].checked == true)
			{
				mReg = ecom.registration[i].value
				break;
			}
		}
	}
	switch(mReg)

	{
					
			case "Session1":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - XML Session 1";
				break;
				
			case "Session2":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - XML Session 2";
				break;
					 
			case "Session3":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - XML Session 3";
				break;
				
			case "Session4":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - XML Session 4";
				break;	
				
			case "SessionBoth":
				totalPrice = 125;
				ecom.DESCRIPTION.value = "Webinar - XML Session 1 & 2";
				break;
				
			case "SessionAll":
				totalPrice = 200;
				ecom.DESCRIPTION.value = "Webinar - XML Session 1 & 2 & 3";
				break;
			
			case "Sessionall4":
				totalPrice = 250;
				ecom.DESCRIPTION.value = "Webinar - XML Session 1 & 2 & 3 & 4";
				break;
			
			case "Collaborative":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Collaborative";
				break;
				
			case "StructuredPublishing":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Structured Publishing";
				break;
				
			case "ResourceDescriptionFramework":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Resource Description Framework";
				break;		
					
			case "SocialMedia":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Social Media";
				break;
				
			case "WinANT":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - WinANT";
				break;
				
			case "DITAvsNon":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA vs. Non-Technical Authors";
				break;
			
			case "NeverWaste":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Never Waste a Good Crisis";
				break;
			
			case "DITA1.2":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - The DITA 1.2 Keyref Mechanism";
				break;
			
			case "UglyDITA":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Ugly DITA";
				break;
			
			case "CommonMan":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA for the Common Man";
				break;
			
			case "Conref":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA 1.2 Improvements to Conref";
				break;
			
			case "Constraint":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA 1.2 Constraint Mechanism";
				break;
				
			case "MapTopic":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Map and Topic Templates";
				break;	
			
			case "DITAMetrics":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA Metrics in Production";
				break;
				
			case "Translations":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Taking Control of Your Translations";
				break;	
				
			case "SharePoint":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Customized DITA Documents Delivered Using SharePoint";
				break;		
				
			case "acrolinx_cidm":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Are You Ready for the New Information Revolution";
				break;	
			
			case "ditaxliff":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA and XLIFF: The Perfect Marriage Gets Stronger";
				break;	
			
			case "warnings":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - Handling Warnings in User-Friendly Documentation";
				break;	
			
			case "learntrain":
				totalPrice = 75;
				ecom.DESCRIPTION.value = "Webinar - DITA 1.2 Learning and Training: Building Reusable Learning Objects";
				break;	
			
			case "ReleaseManagement":
				totalPrice = 25;
				ecom.DESCRIPTION.value = "Webinar - Release Management";
				break;
					
			case "Eurofield":
				totalPrice = 0;
				break;
	}


//get total price
//var c = ChangeTitle();
//alert(c);
//alert(totalBooks);
document.books.AMOUNT.value = totalPrice;


payment(mReg);
//form validation here

//payment validation here


}
function payment(mReg)
{

	countryShip=document.books.COUNTRYTOSHIP.value;
	if (document.books.STATETOSHIPtext.disabled == true)
	{
		stateInteger=document.books.STATETOSHIP.selectedIndex
		stateString=document.books.STATETOSHIP.options[stateInteger].text
		
		countryState="null";
	}
	else
	{
		countryState=document.books.STATETOSHIPtext.value;	
		stateInteger=1;
	}
	var ecom = document.books
	if(document.books.AMOUNT.value==0 & mReg=='Eurofield')
	{
			ecom.DESCRIPTION.value = "This person registered for a FREE webinar--" + mReg;
			ecom.action="http://www.infomanagementcenter.com/cgi/merge.pl/emerge/webinar/text.txt&display=/emerge/webinar/displayComtechEurofield.htm";
	}
	else if(document.books.AMOUNT.value==0 & mReg=='RightHemisphere')
	{
			ecom.DESCRIPTION.value = "This person registered for a FREE webinar--" + mReg;
			ecom.action="http://www.infomanagementcenter.com/cgi/merge.pl/emerge/webinar/text.txt&display=/emerge/webinar/displayComtechRightHemisphere.htm";
	}
 	else if(stateInteger != 0 && countryState !="")
	{
			//ecom.DESCRIPTION.value = "DITA Europe Conference Registration."
			ecom.action = "https://payments.verisign.com/payflowlink"
	}
	else if(countryShip != "United States")
	{
		ecom.action = "https://payments.verisign.com/payflowlink"
	}
	else
	{
		alert("You must select payment type and Country/State Information to proceed to checkout");
		return false;
	}
	ecom.submit()

}
//This function handles the payment method, whether they are going to use e-commerce or register via e-mail
/*function payment(){
var ecom = document.ditabook
var mail = document.sendmail
var bookselection= ecom.CUSTID.value

for(i=0;i<ecom.METHOD.length;i++){

	if(ecom.METHOD[i].checked==true){
		break;
	}
}

if(ecom.NAME.value != null){
	if(ecom.METHOD[i].value=='CC'){
		switch (bookselection){
		
		case "ditabook":
		ecom.DESCRIPTION.value = "This person purchased the DITA Book online."
		ecom.action = "https://payments.verisign.com/payflowlink";
		break;  
		
		case "arditabook":
		ecom.DESCRIPTION.value = "This person purchased the Abortext Edition DITA Book online."
		ecom.action = "https://payments.verisign.com/payflowlink";
		break;
		}
			
	}
		else{
			switch (bookselection){
		
		case "ditabook":
		ecom.DESCRIPTION.value = "This person did not purchase the DITA Book online.  Please contact them for an alternative payment choice"
		ecom.action="http://www.infomanagementcenter.com/cgi-bin/merge.pl/emerge/ditabook/text.txt&display=/emerge/ditabook/display.htm";
		break;  
		
		case "arditabook":
		ecom.DESCRIPTION.value = "This person did not purchase the Arbortext Edition DITA Book online.  Please contact them for an alternative payment choice"
		ecom.action="http://www.infomanagementcenter.com/cgi-bin/merge.pl/emerge/ditabook/text.txt&display=/emerge/ditabook/display.htm"
		break;
		}
			
		}
	}
	else{
		alert("You must enter your name")
	}

ecom.submit()
}*/

function billing(){
var ecom = document.books
if(ecom.samebill.checked == true){
	ecom.NAME.value = ecom.NAMETOSHIP.value
	ecom.ADDRESS.value = ecom.ADDRESSTOSHIP.value
	ecom.CITY.value = ecom.CITYTOSHIP.value
	
	ecom.ZIP.value = ecom.ZIPTOSHIP.value
	
	ecom.EMAIL.value = ecom.EMAILTOSHIP.value
	ecom.PHONE.value = ecom.PHONETOSHIP.value
	
	if(document.books.STATETOSHIP.disabled == false)
	{
	var countryInteger, countryString       
	countryInteger=document.books.COUNTRYTOSHIP.selectedIndex
	stateInteger=document.books.STATETOSHIP.selectedIndex 
	
	ecom.COUNTRY.selectedIndex = countryInteger
	ecom.STATEBill.selectedIndex = stateInteger;
	
	//
	countryString=document.books.COUNTRYTOSHIP.options[countryInteger].text
	if(countryString == "Canada")
	{		
		var STATETOSHIPList = new Array("Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon Territory");
		document.books.STATEBill.options.length=0;
		for (i=0;i<=STATETOSHIPList.length -1;i++)
		{
		document.forms['books'].STATEBill.options[i] = new Option(STATETOSHIPList[i],STATETOSHIPList[i]);
		}
		ecom.STATEBill.selectedIndex = stateInteger;
	}
	//
	}
	else
	{
		var countryInteger, countryString       
		countryInteger=document.books.COUNTRYTOSHIP.selectedIndex
		ecom.COUNTRY.selectedIndex = countryInteger		
		document.books.STATEBill.options.length=0;
		document.books.STATEBill.disabled = true;
		document.books.STATEBill.style.visibility='hidden';
		
		
		document.books.STATEBilltext.style.visibility='visible';
		document.books.STATEBilltext.style.width='170px';
		ecom.STATEBilltext.value = ecom.STATETOSHIPtext.value;
	}
	
	ecom.NAME.disabled = true;
	ecom.ADDRESS.disabled = true;
	ecom.CITY.disabled = true;
	ecom.STATEBill.disabled = true;
	ecom.ZIP.disabled = true;
	ecom.COUNTRY.disabled = true;
	ecom.EMAIL.disabled = true;
	ecom.PHONE.disabled = true;
	
}
else{
	ecom.NAME.value = ""
	ecom.ADDRESS.value = ""
	ecom.CITY.value = ""
	ecom.STATEBill.value = ""
	ecom.ZIP.value = ""
	ecom.COUNTRY.value = ""
	ecom.EMAIL.value = ""
	ecom.PHONE.value = ""
	
	ecom.NAME.disabled = false;
	ecom.ADDRESS.disabled = false;
	ecom.CITY.disabled = false;
	ecom.STATEBill.disabled = false;
	ecom.STATEBilltext.disabled = false;
	ecom.ZIP.disabled = false;
	ecom.COUNTRY.disabled = false;
	ecom.EMAIL.disabled = false;
	ecom.PHONE.disabled = false;
	
	ecom.COUNTRY.selectedIndex = 0
	ecom.STATEBill.selectedIndex = 0
		document.books.STATEBill.style.visibility='visible';
	document.books.STATEBill.disabled = false;
	
	
	document.books.STATEBilltext.disabled = true;
	document.books.STATEBilltext.style.visibility='hidden';
	document.books.STATEBilltext.style.width='0px';
	
	var STATEBillList =  new Array("Alabama","Alaska","American Samoa","Arizona","Arkansas","Armed Forces America","Armed Forces Other Areas","Armed Forces Pacific","California","Colorado","Connecticut","Delaware","District of Columbia","Federated States of Micronesia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Marshall Islands","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Mariana Islands","Ohio","Oklahoma","Oregon","Palau","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","U.S. Virgin Islands","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
	document.books.STATEBill.options.length=0;
	for (i=0;i<=STATEBillList.length -1;i++)
	{
	document.forms['books'].STATEBill.options[i] = new Option(STATEBillList[i],STATEBillList[i]);
	}
}
}


function textValue() 
{   
var countryInteger, countryString       
countryInteger=document.books.COUNTRYTOSHIP.selectedIndex
countryString=document.books.COUNTRYTOSHIP.options[countryInteger].text  

if(countryString == "Canada")
{
	document.books.STATETOSHIP.style.visibility='visible';
	document.books.STATETOSHIP.disabled = false;
	
	
	document.books.STATETOSHIPtext.disabled = true;
	document.books.STATETOSHIPtext.style.visibility='hidden';
	document.books.STATETOSHIPtext.style.width='0px';
	
	var STATETOSHIPList = new Array("Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon Territory");
	document.books.STATETOSHIP.options.length=0;
	for (i=0;i<=STATETOSHIPList.length -1;i++)
	{
	document.forms['books'].STATETOSHIP.options[i] = new Option(STATETOSHIPList[i],STATETOSHIPList[i]);
	}
}
else if (countryString == "United States")
{
	document.books.STATETOSHIP.style.visibility='visible';
	document.books.STATETOSHIP.disabled = false;
	
	
	document.books.STATETOSHIPtext.disabled = true;
	document.books.STATETOSHIPtext.style.visibility='hidden';
	document.books.STATETOSHIPtext.style.width='0px';
	
	var STATETOSHIPList =  new Array("Alabama","Alaska","American Samoa","Arizona","Arkansas","Armed Forces America","Armed Forces Other Areas","Armed Forces Pacific","California","Colorado","Connecticut","Delaware","District of Columbia","Federated States of Micronesia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Marshall Islands","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Mariana Islands","Ohio","Oklahoma","Oregon","Palau","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","U.S. Virgin Islands","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
	document.books.STATETOSHIP.options.length=0;
	for (i=0;i<=STATETOSHIPList.length -1;i++)
	{
	document.forms['books'].STATETOSHIP.options[i] = new Option(STATETOSHIPList[i],STATETOSHIPList[i]);
	}
}
else
{
	document.books.STATETOSHIP.options.length=0;
	document.books.STATETOSHIP.disabled = true;
	document.books.STATETOSHIP.style.visibility='hidden';
	
	document.books.STATETOSHIPtext.disabled = false;
	document.books.STATETOSHIPtext.style.visibility='visible';
	document.books.STATETOSHIPtext.style.width='170px';
}

/*var STATETOSHIPList = new Array("Australian Capital Territory","New South Wales","Northern Territory","Queensland","South Australia","Tasmania","Victoria","Western Australia","Acre","Alagoas","Amapa","Amazonas","Bahia","Ceara","Distrito Federal","Espirito Santo","Goias","Maranhao","Mato Grosso","Mato Grosso do Sul","Minas Gerais","Para","Paraiba","Parana","Pernambuco","Piaui","Rio de Janeiro","Rio Grande do Norte","Rio Grande do Sul","Rondonia","Roraima","Santa Catarina","Sao Paulo","Sergipe","Tocantins","Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon Territory","Aichi","Akita","Aomori","Chiba","Ehime","Fukui","Fukuoka","Fukushima","Gifu","Gumma","Hiroshima","Hokkaido","Hyogo","Ibaraki","Ishikawa","Iwate","Kagawa","Kagoshima","Kanagawa","Kouchi","Kumamoto","Kyoto","Mie","Miyagi","Miyazaki","Nagano","Nagasaki","Nara","Niigata","Oita","Okayama","Okinawa","Osaka","Saga","Saitama","Shiga","Shimane","Shizuoka","Tochigi","Tokushima","Tokyo","Tottori","Toyama","Wakayama","Yamagata","Yamaguchi","Yamanashi","Aguascalientes","Baja California","Baja California Sur","Campeche","Chiapas","Chihuahua","Coahuila","Colima","Distrito Federal","Durango","Guanajuato","Guerrero","Hidalgo","Jalisco","Mexico","Michoacan","Morelos","Nayarit","Nuevo Leon","Oaxaca","Puebla","Queretaro","Quintana Roo","San Luis Potosi","Sinaloa","Sonora","Tabasco","Tamaulipas","Tlaxcala","Veracruz","Yucatan","Zacatecas","Alabama","Alaska","American Samoa","Arizona","Arkansas","Armed Forces America","Armed Forces Other Areas","Armed Forces Pacific","California","Colorado","Connecticut","Delaware","District of Columbia","Federated STATETOSHIPs of Micronesia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Marshall Islands","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Mariana Islands","Ohio","Oklahoma","Oregon","Palau","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","U.S. Virgin Islands","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");*/


/*stationString=document.stationform.stationselect.options[stationInteger].text   
document.stationform.stationtext.value = "A " + stationString +" A"
document.stationform.stationtext2.value = "B " + stationString +" B"
document.stationform.stationtext3.value = "C " + stationString +" C"*/



}
function textValueBill() 
{   

var countryInteger, countryString       
countryInteger=document.books.COUNTRY.selectedIndex
countryString=document.books.COUNTRY.options[countryInteger].text  

if(countryString == "Canada")
{
	document.books.STATEBill.style.visibility='visible';
	document.books.STATEBill.disabled = false;
	
	
	document.books.STATEBilltext.disabled = true;
	document.books.STATEBilltext.style.visibility='hidden';
	document.books.STATEBilltext.style.width='0px';
	
	var STATEBillList = new Array("Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon Territory");
	document.books.STATE.options.length=0;
	for (i=0;i<=STATEBillList.length -1;i++)
	{
	document.forms['books'].STATEBill.options[i] = new Option(STATEBillList[i],STATEBillList[i]);
	}
}
else if (countryString == "United States")
{
	document.books.STATEBill.style.visibility='visible';
	document.books.STATEBill.disabled = false;
	
	
	document.books.STATEBilltext.disabled = true;
	document.books.STATEBilltext.style.visibility='hidden';
	document.books.STATEBilltext.style.width='0px';
	
	var STATEBillList =  new Array("Alabama","Alaska","American Samoa","Arizona","Arkansas","Armed Forces America","Armed Forces Other Areas","Armed Forces Pacific","California","Colorado","Connecticut","Delaware","District of Columbia","Federated States of Micronesia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Marshall Islands","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Mariana Islands","Ohio","Oklahoma","Oregon","Palau","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","U.S. Virgin Islands","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
	document.books.STATEBill.options.length=0;
	for (i=0;i<=STATEBillList.length -1;i++)
	{
	document.forms['books'].STATEBill.options[i] = new Option(STATEBillList[i],STATEBillList[i]);
	}
}
else
{
	document.books.STATEBill.options.length=0;
	document.books.STATEBill.disabled = true;
	document.books.STATEBill.style.visibility='hidden';
	
	document.books.STATEBilltext.disabled = false;
	document.books.STATEBilltext.style.visibility='visible';
	document.books.STATEBilltext.style.width='170px';
}

/*var STATETOSHIPList = new Array("Australian Capital Territory","New South Wales","Northern Territory","Queensland","South Australia","Tasmania","Victoria","Western Australia","Acre","Alagoas","Amapa","Amazonas","Bahia","Ceara","Distrito Federal","Espirito Santo","Goias","Maranhao","Mato Grosso","Mato Grosso do Sul","Minas Gerais","Para","Paraiba","Parana","Pernambuco","Piaui","Rio de Janeiro","Rio Grande do Norte","Rio Grande do Sul","Rondonia","Roraima","Santa Catarina","Sao Paulo","Sergipe","Tocantins","Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon Territory","Aichi","Akita","Aomori","Chiba","Ehime","Fukui","Fukuoka","Fukushima","Gifu","Gumma","Hiroshima","Hokkaido","Hyogo","Ibaraki","Ishikawa","Iwate","Kagawa","Kagoshima","Kanagawa","Kouchi","Kumamoto","Kyoto","Mie","Miyagi","Miyazaki","Nagano","Nagasaki","Nara","Niigata","Oita","Okayama","Okinawa","Osaka","Saga","Saitama","Shiga","Shimane","Shizuoka","Tochigi","Tokushima","Tokyo","Tottori","Toyama","Wakayama","Yamagata","Yamaguchi","Yamanashi","Aguascalientes","Baja California","Baja California Sur","Campeche","Chiapas","Chihuahua","Coahuila","Colima","Distrito Federal","Durango","Guanajuato","Guerrero","Hidalgo","Jalisco","Mexico","Michoacan","Morelos","Nayarit","Nuevo Leon","Oaxaca","Puebla","Queretaro","Quintana Roo","San Luis Potosi","Sinaloa","Sonora","Tabasco","Tamaulipas","Tlaxcala","Veracruz","Yucatan","Zacatecas","Alabama","Alaska","American Samoa","Arizona","Arkansas","Armed Forces America","Armed Forces Other Areas","Armed Forces Pacific","California","Colorado","Connecticut","Delaware","District of Columbia","Federated STATETOSHIPs of Micronesia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Marshall Islands","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Mariana Islands","Ohio","Oklahoma","Oregon","Palau","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","U.S. Virgin Islands","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");*/


/*stationString=document.stationform.stationselect.options[stationInteger].text   
document.stationform.stationtext.value = "A " + stationString +" A"
document.stationform.stationtext2.value = "B " + stationString +" B"
document.stationform.stationtext3.value = "C " + stationString +" C"*/



}
function ChangeTitle() {
	var totalPrice = calculatePrice();
	var totalCost = totalPrice;
	//create Price variable
	return totalCost;

}
function properRound(num, digits) {
        //if no decimal places needed, we're done
        if (digits <= 0) {
                return Math.round(num); 
        } 
        //round the number to specified decimal places
        //e.g. 12.3456 to 3 digits (12.346) -> mult. by 1000, round, div. by 1000
        var tenToPower = Math.pow(10, digits);
        var cropped = String(Math.round(num * tenToPower) / tenToPower);

        //add decimal point if missing
        if (cropped.indexOf(".") == -1) {
                cropped += ".0";  //e.g. 5 -> 5.0 (at least one zero is needed)
        }

        //finally, force correct number of zeroes; add some if necessary
        var halves = cropped.split("."); //grab numbers to the right of the decimal
        //compare digits in right half of string to digits wanted
        var zerosNeeded = digits - halves[1].length; //number of zeros to add
        for (var i=1; i <= zerosNeeded; i++) {
                cropped += "0";
        }
        return(cropped);
} 

