function changeLocation(location){
	document.location.href=location;
}

function updateMiniCart(){
	elm = $('mini_cart');
	if( elm ){
		$('mini_cart').hide();
		$('mini_cart_loading').show();
		update = new Ajax.Updater('mini_cart', 
			'shopping_cart.php?then=display_abbreviated_cart',
			{method: 'get', onComplete: function(){
				$('mini_cart_loading').hide();
				$('mini_cart').show();
				processNewLightboxes('#mini_cart a.lbOn');
			}});
	}
}

function updateCart(f){
	var elm = $('shopping_cart');
	if( elm ){
		var req;
		if( f ){
			req = createRequestString(f);
		}else{
			req = 'then=display_cart';
		}
		var target = 'shopping_cart.php' + '?' + req;
		var height = elm.getHeight();
		var elm_loading = $('shopping_cart_loading');
		elm_loading.setStyle({'height': height + 'px'});
		elm.hide();
		elm_loading.show();
		update = new Ajax.Updater('shopping_cart',
			target,
			{method: 'get', onComplete: function(){
				$('shopping_cart_loading').hide();
				$('shopping_cart').show();
				processNewLightboxes('#shopping_cart a.lbOn');
				sIFR_cooper_replace("#shopping_cart h2.cooper");
				showFlash('#shopping_cart');
				updateMiniCart();
			}});
	}else{
		updateMiniCart();
	}
	if( f ){
		return false;
	}
}

function getShippingOptions(country, elm){
	//ajax shipping radios into elm
	if( elm ){
		target = 'shopping_cart.php?then=display_shipping&country=' + country;
		update = new Ajax.Updater(elm,
			target,
			{method: 'get', onComplete: function(){
				$(elm).show();
			}});
	}
	
}

function checkoutOnSubmit(){
	f = $('checkout_form');
	c = f.country.options[f.country.selectedIndex].value;
	if( c != 'United States of America' && $('shipping_options').getStyle('display') == 'none' ){
		alert('Please hit the select button to choose your shipping country and then choose a shipping option.');
		return false;
	}else{
		/*ret = confirm('WARNING: after you have completed your order with PayPal you MUST return to the Ace Fu Website.\n\nIf you do not your order will NOT be properly completed.\n\nIf you pay using a Credit Card you will have to do this manually, otherwise you will be automatically redirected.');*/
		return true;
	}
}

debug = 0;

