/* Javascript Functions written for the highline Autos Site 20051128 */


function setFormValues(startTotal){
	document.getElementById('grandtotal').innerHTML = startTotal;
}


/////////////////////////////////////////////////////////
//// Functions to prepopulate the billing address  //////
//////     with the customer information    /////////////
function newWindow(theURL,winName,winWidth,winHeight,features) { //v2.0
	//winWidth = 460;
	//winHeight = 500;
	winName = 'popwindow';
	winOffX = (screen.width - winWidth - 22)/2;
	winOffY = (screen.height - winHeight)/2 - 50;
	features = "width=" + winWidth + ",height=" + winHeight + ",toolbar=0,menubar=0,scrollbars=0,resizable=0,location=0,directories=0,status=0,left=" + winOffX + ",top=" + winOffY;
	window.open(theURL,winName,features);
}
//////////////////////////////////////////////////////////



/////////////////////////////////////////////////////////
//// Functions to prepopulate the billing address  //////
//////     with the customer information    /////////////
function InitSaveVariables(form) {
	BillName = form.cc_name.value;
	BillAddress1 = form.b_address1.value;
	BillAddress2 = form.b_address2.value;
	BillCity = form.b_city.value;
	BillStateIndex = form.b_state.selectedIndex;
	BillState = form.b_state[BillStateIndex].value;
	BillProv = form.b_prov.value;
	BillZip = form.b_zip.value;
	BillCountryIndex = form.b_country.selectedIndex;
	BillCountry = form.b_country[BillCountryIndex].value;
}

function b_AddressFill(form) {
	if (form.b_same.checked) {
		InitSaveVariables(form);
		form.cc_name.value = form.firstname.value + " " + form.lastname.value;
		form.b_address1.value = form.address1.value;
		form.b_address2.value = form.address2.value;
		form.b_city.value = form.city.value;
		form.b_state.selectedIndex = form.state.selectedIndex;
		form.b_prov.value = form.prov.value;
		form.b_country.selectedIndex = form.b_country.selectedIndex;
		form.b_zip.value = form.zip.value;
	}else{
		form.cc_name.value = BillName;
		form.b_address1.value = BillAddress1;
		form.b_address2.value = BillAddress2;
		form.b_city.value = BillCity;
		form.b_state.selectedIndex = BillStateIndex;
		form.b_prov.value = BillProv;
		form.b_country.selectedIndex = BillCountryIndex;
		form.b_zip.value = BillZip;      
   }
}
//////////////////////////////////////////////////////////