function toggleNewDestination(selectElement)
{var orderItemDestinationId=selectElement.id.split("_")[1];if($F(selectElement)=="new"){Element.removeClassName("new_destination_"+orderItemDestinationId,'hidden');}else{Element.addClassName("new_destination_"+orderItemDestinationId,'hidden');}}
function addDestination(){var destinationSelectionRow=$('destination_1').cloneNode(true);var newDestinationRow=$('new_destination_1').cloneNode(true);var num=($$('#destination_table tr.destination_row').length/2)+1;destId='destination_'+num;newDestId='new_destination_'+num;destinationSelectionRow.id=destId;newDestinationRow.id=newDestId;$('destination_table').appendChild(destinationSelectionRow);$('destination_table').appendChild(newDestinationRow);var destinationQuantity=$$('#'+destId+' input.number')[0];destinationQuantity.value=1;destinationQuantity.name="destinations["+num+"][quantity]";var destinationSelector=$$('#'+destId+' select')[0];destinationSelector.selectedIndex=0;destinationSelector.id="dropdown_"+num;destinationSelector.name="destinations["+num+"][address_id]";$$('#'+newDestId+' input')[0].name.replace('[1]','['+num+']');$$('#'+newDestId+' input')[0].value='';};function toggleCC()
{$('reset_credit_card_number_input').value=1;Effect.toggle('changeNumber','appear',{duration:0.60});Effect.toggle('numberDisplay','blind',{duration:0.30});}
function toggleCCDisappear()
{$('reset_credit_card_number_input').value=0;Effect.toggle('changeNumber','blind',{duration:0.30});Effect.toggle('numberDisplay','appear',{duration:0.60});};function toggleDestinationOther(selectElement){selectElement=$(selectElement);if($F(selectElement)=="other"){if($('container_'+selectElement.id).style.display=='none'){selectElement.selectedIndex=0;}
Effect.toggle('container_'+selectElement.id,'appear',{duration:0.30});Effect.toggle('other_container_'+selectElement.id,'appear',{duration:0.30});}
if(selectElement.selectedIndex==0){$('ship_to_self_'+selectElement.id).value=1;}else{$('ship_to_self_'+selectElement.id).value=0;}}
function removeDestinationRow(increment){$('row_'+increment).remove();}
function addDestinationRow(){var newRow=$$('#destination_rows .row')[0].cloneNode(true);var destinationRows=$('destination_rows');var totalRows=$$('#destination_rows .row').length;var increment=parseInt($$('#destination_rows .row')[totalRows-1].id.split('_')[1])+1;newRow.id="row_"+increment;destinationRows.appendChild(newRow);var removeImage=$$('#'+newRow.id+' img')[0];removeImage.id="remove_"+increment;removeImage.removeClassName("hidden");$$('#'+newRow.id+' img')[1].addClassName("hidden");var quantity=$$('#'+newRow.id+' input.quantity')[0];quantity.id="quantity"+increment;quantity.name="items["+increment+"][qty]";quantity.value=1;var shipToSelf=$$('#'+newRow.id+' input.ship_to_self')[0];shipToSelf.id="ship_to_self_destination"+increment;shipToSelf.name="items["+increment+"][shipToSelf]";shipToSelf.value=1;var productId=$$('#'+newRow.id+' input.product_id')[0];productId.id="product_id_destination"+increment;productId.name="items["+increment+"][product_id]";var destinationContainer=$$('#'+newRow.id+' div.container_destination')[0];destinationContainer.id="container_destination"+increment;Element.setStyle(destinationContainer,{display:''});var otherDestinationContainer=$$('#'+newRow.id+' div.other_container_destination')[0];otherDestinationContainer.id="other_container_destination"+increment;Element.setStyle(otherDestinationContainer,{display:'none'});var destinationSelect=$$('#'+newRow.id+' select')[0];destinationSelect.id="destination"+increment;destinationSelect.name="items["+increment+"][address_id]";destinationSelect.selectedIndex=0;var otherDestination=$$('#'+newRow.id+' input.other_destination')[0];otherDestination.id="other_destination"+increment;otherDestination.name="items["+increment+"][name]";otherDestination.value='';var toggleLink=$$('#'+newRow.id+' div.other_container_destination a')[0];toggleLink.id="link_toggle_destination"+increment;};function changeShipping(){Element.removeClassName('shipping_method','hidden');Element.addClassName('current_shipping_method','hidden');Element.removeClassName('complete_order_disabled','hidden');Element.addClassName('complete_order_enabled','hidden');}
function changeCoupon(){Element.removeClassName('new_coupon','hidden');Element.addClassName('add_coupon','hidden');}
