
// JavaScript Document

//this file is dependent of:
// java_send.js
// hide_show.js


// CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
// CCCCCCCCCCCCCCCCCCCCCCC cart.cfm CCCCCCCCCCCCCCCCCCCCCCCCC
function hideSavedWishlistDisplay(_wishlistID){
	hideByTagAndClass('div', 'wishlist' + _wishlistID);
	showByTagAndClass('div', 'wishlistShowButton' + _wishlistID);
	hideByTagAndClass('div', 'wishlistDelete' + _wishlistID);
	hideByTagAndClass('div', 'wishlistConvert' + _wishlistID);
}
function showSavedWishlistDisplay(_wishlistID){
	hideByTagAndClass('div', 'wishlistShowButton' + _wishlistID);
	showByTagAndClass('div', 'wishlist' + _wishlistID);
}
function showDeleteWishlistDisplay(_wishlistID){
	showByTagAndClass('div', 'wishlistDelete' + _wishlistID);
}
function hideDeleteWishlistDisplay(_wishlistID){
	hideByTagAndClass('div', 'wishlistDelete' + _wishlistID);
}
function deleteSavedWishlist(_wishlistID){
	loadXMLDoc(document.cart.siteURL.value + 'cart/delete_saved_wishlist.cfm?wishlistID=' + _wishlistID);
	hideByTagAndClass('div', 'wishlistContainer' + _wishlistID);
}
function showConvertWishlistDisplay(_wishlistID){
	showByTagAndClass('div', 'wishlistConvert' + _wishlistID);
}
function hideConvertWishlistDisplay(_wishlistID){
	hideByTagAndClass('div', 'wishlistConvert' + _wishlistID);
}
function convertSavedWishlist(_wishlistID){
	hideByTagAndClass('div', 'wishlistContainer' + _wishlistID);
	document.cart.convertSavedWishlistID.value = _wishlistID;
	document.cart.submit();
}

// CCCCCCCCCCCCCCCCCCCCCCC cart.cfm CCCCCCCCCCCCCCCCCCCCCCCCC
// CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC


// CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
// CCCCCCCCCCCCCCCCCCCC checkout1.cfm CCCCCCCCCCCCCCCCCCCCCCC

function updateShippingAddress(_theAddressID){
/*	Hide all divs besides the shipping address input.
	Set the hidden value updateshipping address, so we know to update the address.
	Update radio choice to the address we are updating. */
	hideByTagAndClass('div','newshippingaddress');
	hideByTagAndClass('div','shippingAddressDisplay');
	hideByTagAndClass('div','shortShippingAddressDisplay');
	showByTagAndClass('div','shippingAddressInput' + _theAddressID);
	document.orders.updateShippingAddress.value = _theAddressID;
	var theAddress  = "0";
	for(var i=0; i<document.orders.ShipTo.length; i++){
		//alert("inloop")
		if((document.orders.ShipTo[i].value == _theAddressID)) { 
			//alert("incheckedbox");checked
			document.orders.ShipTo[i].checked = true; 
			//alert('setting');
		}
	}
	
}
function shippingAddressDelete(_theAddressID){
	hideByTagAndClass('div','shippingAddressDisplay' + _theAddressID);
	showByTagAndClass('div','shippingDeleteConfirmation' + _theAddressID);
}
function confirmShippingAddressDelete(_delete, _theAddressID){
	hideByTagAndClass('div','shippingDeleteConfirmation' + _theAddressID);
	hideByTagAndClass('div','shortShippingAddressDisplay' + _theAddressID);
	if(_delete == 'true'){
		loadXMLDoc(document.orders.theSiteURL.value + 'cart/delete_shipping_address.cfm?said=' + _theAddressID);
		for(var i=0; i<document.orders.ShipTo.length; i++){
			//alert("inloop")
			if((document.orders.ShipTo[i].checked == true)) { 
				//alert("incheckedbox");checked
				document.orders.ShipTo[i + 1].checked = true; 
				break;
			}
		}			
	}else{
		showByTagAndClass('div','shortShippingAddressDisplay' + _theAddressID);
	}
}

function showShippingAddressChoices(_theAddressID){
	showByTagAndClass('div','newshippingaddress');
	showByTagAndClass('div','shortShippingAddressDisplay');
	hideByTagAndClass('div','shippingAddressInput');
	hideByTagAndClass('div','errormessage');
	document.orders.updateShippingAddress.value = 0;
}
function hideBillingAddressDisplay(){
	showByTagAndClass('div','billingaddressinput');
	countyDisplay();
	hideByTagAndClass('div','billingaddressdisplay');
	document.orders.updateBillingAddress.value = 1;
}
function showBillingAddressDisplay(){
	hideByTagAndClass('div','billingaddressinput');
	showByTagAndClass('div','billingaddressdisplay');
	document.orders.updateBillingAddress.value = 0;
}
// CCCCCCCCCCCCCCCCCCCC checkout1.cfm CCCCCCCCCCCCCCCCCCCCCCC
// CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
	

