<?php
global $wpsc_cart, $wpdb, $wpsc_checkout, $wpsc_gateway, $wpsc_coupons;
$wpsc_checkout = new wpsc_checkout();
$wpsc_gateway = new wpsc_gateways();
$alt = 0;
if(isset($_SESSION['coupon_numbers']))
   $wpsc_coupons = new wpsc_coupons($_SESSION['coupon_numbers']);

if(wpsc_cart_item_count() < 1) :
   _e("Oups, il n'y a rien dans votre panier.", 'wpsc') . "<a href='http://ceramique-de-lussan.com/boutique-en-ligne/'>" . __("S'il vous plaît visitez notre boutique", 'wpsc') . "</a>";
   return;
endif;
?>

<div id="checkout_page_container" style="float:left;display:inline;clear:none;width: 850px;">

<div id="step1">
<div style="width:100%;text-align:left;color:#000;font-size:26px;"><span style="font-weight:bold;">Panier</span></div>

<div id="step1a" style="border:1px solid #000; background:#f1f1f1; padding:10px;">
<table class="checkout_cart" style="width:100%;">
   <tr class="header" style="background-color:#000;color:#fff;">
      <th colspan="2" style="text-align:center;"><?php _e('Product', 'wpsc'); ?></th>
      <th style="width:120px;"><?php _e('Quantity', 'wpsc'); ?></th>
      <th><?php _e('P. U.', 'wpsc'); ?></th>
      <th><?php _e('Total', 'wpsc'); ?></th>
        <th>&nbsp;</th>
   </tr>
   <?php while (wpsc_have_cart_items()) : wpsc_the_cart_item(); ?>
      <?php
       $alt++;
       if ($alt %2 == 1)
         $alt_class = 'alt';
       else
         $alt_class = '';
       ?>
      <?php  //this displays the confirm your order html ?>

	  <?php do_action ( "wpsc_before_checkout_cart_row" ); ?>
      <tr class="product_row product_row_<?php echo wpsc_the_cart_item_key(); ?> <?php echo $alt_class;?>">

         <td class="firstcol wpsc_product_image_<?php echo wpsc_the_cart_item_key(); ?>">
         <?php if('' != wpsc_cart_item_image()): ?>
			<?php do_action ( "wpsc_before_checkout_cart_item_image" ); ?>
            <img src="<?php echo wpsc_cart_item_image(100, 100); ?>" alt="<?php echo wpsc_cart_item_name(); ?>" title="<?php echo wpsc_cart_item_name(); ?>" class="product_image" />
			<?php do_action ( "wpsc_after_checkout_cart_item_image" ); ?>
         <?php else:
         /* I dont think this gets used anymore,, but left in for backwards compatibility */
         ?>
            <div class="item_no_image">
				<?php do_action ( "wpsc_before_checkout_cart_item_image" ); ?>
               <a href="<?php echo wpsc_the_product_permalink(); ?>">
               <span><?php _e('No Image','wpsc'); ?></span>

               </a>
				<?php do_action ( "wpsc_after_checkout_cart_item_image" ); ?>
            </div>
         <?php endif; ?>
         </td>

         <td class="wpsc_product_name wpsc_product_name_<?php echo wpsc_the_cart_item_key(); ?>">
			<?php do_action ( "wpsc_before_checkout_cart_item_name" ); ?>
            <a href="<?php echo wpsc_cart_item_url();?>" style="color:#000;text-decoration:none;"><strong><?php echo wpsc_cart_item_name(); ?></strong></a>
			<?php do_action ( "wpsc_after_checkout_cart_item_name" ); ?>
         </td>

         <td class="wpsc_product_quantity wpsc_product_quantity_<?php echo wpsc_the_cart_item_key(); ?>">
            <form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform qty">
               <div class="minus_kolicina <?php echo wpsc_the_cart_item_key(); ?>">-</div><input class="itemquantityinput" id="itemquantityinput_<?php echo wpsc_the_cart_item_key(); ?>" type="text" name="quantity" size="2" value="<?php echo wpsc_cart_item_quantity(); ?>" /><div class="plus_kolicina <?php echo wpsc_the_cart_item_key(); ?>">+</div>
               <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
               <input type="hidden" name="wpsc_update_quantity" value="true" />
               <input class="qtybutton" type="image" value="" name="submit" />
            </form>
			<script type="text/javascript">
         		jQuery('.plus_kolicina.<?php echo wpsc_the_cart_item_key(); ?>').click(function(){

				var nova_kol_<?php echo wpsc_the_cart_item_key(); ?> = parseInt(jQuery('#itemquantityinput_<?php echo wpsc_the_cart_item_key(); ?>').val())+1;
				jQuery('#itemquantityinput_<?php echo wpsc_the_cart_item_key(); ?>').val(nova_kol_<?php echo wpsc_the_cart_item_key(); ?>);
				});
				
				jQuery('.minus_kolicina.<?php echo wpsc_the_cart_item_key(); ?>').click(function(){

				var nova_kol_<?php echo wpsc_the_cart_item_key(); ?> = parseInt(jQuery('#itemquantityinput_<?php echo wpsc_the_cart_item_key(); ?>').val())-1;
				jQuery('#itemquantityinput_<?php echo wpsc_the_cart_item_key(); ?>').val(nova_kol_<?php echo wpsc_the_cart_item_key(); ?>);
				});
			</script>
		 </td>

       
            <td><?php echo wpsc_cart_single_item_price(); ?></td>
         <td><?php echo wpsc_cart_item_price(); ?></td>

         <td class="wpsc_product_remove wpsc_product_remove_<?php echo wpsc_the_cart_item_key(); ?>">
            <form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform remove">
               <input type="hidden" name="quantity" value="0" />
               <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
               <input type="hidden" name="wpsc_update_quantity" value="true" />
               <input class="removebutton" type="image" value="" name="submit" />
            </form>
         </td>
      </tr>
	  <?php do_action ( "wpsc_after_checkout_cart_row" ); ?>
   <?php endwhile; ?>
   
   <?php //this HTML displays coupons if there are any active coupons to use ?>

   <?php

   if(wpsc_uses_coupons()): ?>

      <?php if(wpsc_coupons_error()): ?>
         <tr class="wpsc_coupon_row wpsc_coupon_error_row"><td colspan="6"><?php _e('Coupon is not valid.', 'wpsc'); ?></td></tr>
      <?php endif; ?>
      <tr class="wpsc_coupon_row">
         <td colspan="2"><?php _e('Enter coupon code', 'wpsc'); ?> :</td>
         <td  colspan="4" class="coupon_code">
            <form  method="post" action="<?php echo get_option('shopping_cart_url'); ?>">
               <input type="text" name="coupon_num" id="coupon_num" value="<?php echo $wpsc_cart->coupons_name; ?>" />
               <input type="submit" value="<?php _e('Update', 'wpsc') ?>" />
            </form>
         </td>
      </tr>
      <tr class="wpsc_total_before_shipping">
	      <td colspan="3"><?php _e('Cost before shipping:','wpsc'); ?></td>
	      <td colspan="3" class="wpsc_total_amount_before_shipping"><?php echo wpsc_cart_total_widget(false,false,false);?></td>
      </tr>
   <?php endif; ?>
   </table>
		
   <!-- cart contents table close -->
<?php
      $wpec_taxes_controller = new wpec_taxes_controller();
      if($wpec_taxes_controller->wpec_taxes_isenabled()):
   ?>
     <div id="#taxtable">
	 <table class="productcart_tax">
         <tr class="total_price total_tax">
            <td colspan="3">
               TVA<?php /*echo wpsc_display_tax_label(false); */?>
            </td>
            <td colspan="2">
               <span id="checkout_tax" class="pricedisplay checkout-tax"><?php echo wpsc_cart_tax(); ?></span>
            </td>
         </tr>
      </table>
	 </div>
	<div style="clear:both;"></div>
   <?php endif; ?>
   <?php  //this HTML dispalys the calculate your order HTML   ?>

   <?php if(wpsc_has_category_and_country_conflict()): ?>
      <p class='validation-error'><?php echo $_SESSION['categoryAndShippingCountryConflict']; ?></p>
      <?php unset($_SESSION['categoryAndShippingCountryConflict']);
   endif;

   if(isset($_SESSION['WpscGatewayErrorMessage']) && $_SESSION['WpscGatewayErrorMessage'] != '') :?>
      <p class="validation-error"><?php echo $_SESSION['WpscGatewayErrorMessage']; ?></p>
   <?php
   endif;
   ?>
   <div style="display:none;width:100%;text-align:right;padding-right:5px;"><strong>Sous Total <?php echo wpsc_cart_total_widget(false,false,false);?></strong></div>
   <div style="width:100%;text-align:right;background:#000;color:#fff;padding-right:5px;"><strong>TOTAL: <?php echo wpsc_cart_total_widget(false,false,false);?></strong></div>
</div><!--- end cart contents div --->

   
<div style="width:100%;text-align:left;color:#000;font-size:26px;margin-top:30px;"><span style="font-weight:bold;">Livraison</span></div>
   <?php do_action('wpsc_before_shipping_of_shopping_cart'); ?>
	<div id="step1b" style="border:1px solid #000; background:#f1f1f1; padding:10px;margin-bottom: 20px;">
	<div id="wpsc_shopping_cart_container">
	<?php if(wpsc_uses_shipping()) : ?>
      <table class="productcart" style="width:100%">
         <tr class="wpsc_shipping_info">
            <td colspan="5" style="background-color:#000;color:#fff;text-align:left;">
               <strong><span style="margin-left:5px;"><?php _e('Choisissez la destination de livraison', 'wpsc'); ?></span></strong>
            </td>
         </tr>
         <?php if (!wpsc_have_shipping_quote()) : // No valid shipping quotes ?>
            <?php if (wpsc_have_valid_shipping_zipcode()) : ?>
                  <tr class='wpsc_update_location'>
                     <td colspan='5' class='shipping_error' >
                        <?php _e('Please provide a Zipcode and click Calculate in order to continue.', 'wpsc'); ?>
                     </td>
                  </tr>
            <?php else: ?>
               <tr class='wpsc_update_location_error'>
                  <td colspan='5' class='shipping_error' >
                     <?php _e('Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details.', 'wpsc'); ?>
                  </td>
               </tr>
            <?php endif; ?>
         <?php endif; ?>
         <tr class='wpsc_change_country'>
            <td colspan='5'>
			
               <form name='change_country' id='change_country' action='' method='post'>
				<div id="countryzip">                
					<?php echo wpsc_shipping_country_list();?>
                  <input type='hidden' name='wpsc_update_location' value='true' />
				</div>
				<div id="calculer"> 
                  <input type='submit' name='wpsc_submit_zipcode' value='Calculer' />
				 </div>
               </form>
			   </div>
            </td>
         </tr>

         <?php if (wpsc_have_morethanone_shipping_quote()) :?>
            <?php while (wpsc_have_shipping_methods()) : wpsc_the_shipping_method(); ?>
                  <?php    if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote ?>
                  <tr class='wpsc_shipping_header'><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name().__(' - Choose a Shipping Rate', 'wpsc'); ?> </td></tr>
                  <?php while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote();  ?>
                     <tr class='<?php echo wpsc_shipping_quote_html_id(); ?>'>
                        <td class='wpsc_shipping_quote_name wpsc_shipping_quote_name_<?php echo wpsc_shipping_quote_html_id(); ?>' colspan='3'>
                           <label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_name(); ?></label>
                        </td>
                        <td class='wpsc_shipping_quote_price wpsc_shipping_quote_price_<?php echo wpsc_shipping_quote_html_id(); ?>'>
                           <label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_value(); ?></label>
                        </td>
                        <td class='wpsc_shipping_quote_radio wpsc_shipping_quote_radio_<?php echo wpsc_shipping_quote_html_id(); ?>'>
                           <?php if(wpsc_have_morethanone_shipping_methods_and_quotes()): ?>
                              <input type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?>' <?php echo wpsc_shipping_quote_selected_state(); ?>  onclick='switchmethod("<?php echo wpsc_shipping_quote_name(); ?>", "<?php echo wpsc_shipping_method_internal_name(); ?>")' value='<?php echo wpsc_shipping_quote_value(true); ?>' name='shipping_method' />
                           <?php else: ?>
                              <input <?php echo wpsc_shipping_quote_selected_state(); ?> disabled='disabled' type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?>'  value='<?php echo wpsc_shipping_quote_value(true); ?>' name='shipping_method' />
                                 <?php wpsc_update_shipping_single_method(); ?>
                           <?php endif; ?>
                        </td>
                     </tr>
                  <?php endwhile; ?>
            <?php endwhile; ?>
         <?php endif; ?>

         <?php wpsc_update_shipping_multiple_methods(); ?>
		

			<?php if (!wpsc_have_shipping_quote()) : // No valid shipping quotes ?>
        </table>
	</div><!--- wpsc_shopping_cart_container --->
	</div>
			
			<?php else: ?>

		</table>
		


   <?php do_action('wpsc_before_form_of_shopping_cart'); ?>
                 
	<?php if(!empty($_SESSION['wpsc_checkout_user_error_messages'])): ?>
		<p class="validation-error">
		<?php
		foreach($_SESSION['wpsc_checkout_user_error_messages'] as $user_error )
		echo $user_error."<br />\n";
		
		$_SESSION['wpsc_checkout_user_error_messages'] = array();
		?>
	<?php endif; ?>

	<?php if ( wpsc_show_user_login_form() && !is_user_logged_in() ): ?>
			<p><?php _e('You must sign in or register with us to continue with your purchase', 'wpsc');?></p>
			<div class="wpsc_registration_form">
				
				<fieldset class='wpsc_registration_form'>
					<h2><?php _e( 'Sign in', 'wpsc' ); ?></h2>
					<?php
					$args = array(
						'remember' => false,
                    	'redirect' => home_url( $_SERVER['REQUEST_URI'] )
					);
					wp_login_form( $args );
					?>
					<div class="wpsc_signup_text"><?php _e('If you have bought from us before please sign in here to purchase', 'wpsc');?></div>
				</fieldset>
			</div>
	<?php endif; ?>	
	 
</div><!--- wpsc_shopping_cart_container --->
</div>
<div style="width:100%;text-align:right;padding-right:5px;color:#fff;margin-top:20px;margin-bottom:50px;"><span id="to_step2" style="padding:5px; background:#aaa;text-transform:uppercase;cursor:pointer;"><strong>Suivant > </strong></span></div>
			<?php endif;  ?>
			
   <?php endif;  ?>
</div><!--- end step1b div --->  

   

<div id="step2" style="display:none;">
<div style="width:100%;text-align:left;color:#000;font-size:26px;"><span style="font-weight:bold;">Informations</span></div>
<div id="step2inside" style="border:1px solid #000; background:#f1f1f1; padding:10px;">	
	
	<form class='wpsc_checkout_forms' action='<?php echo get_option('shopping_cart_url'); ?>' method='post' enctype="multipart/form-data">
	

				
      <?php
      /**
       * Both the registration forms and the checkout details forms must be in the same form element as they are submitted together, you cannot have two form elements submit together without the use of JavaScript.
      */
      ?>

    <?php if(wpsc_show_user_login_form()):
          global $current_user;
          get_currentuserinfo();   ?>

		<div class="wpsc_registration_form">
			
	        <fieldset class='wpsc_registration_form wpsc_right_registration'>
	        	<h2><?php _e('Join up now', 'wpsc');?></h2>
	      
				<label><?php _e('Username', 'wpsc'); ?>:</label>
				<input type="text" name="log" id="log" value="" size="20"/><br/>
				
				<label><?php _e('Password', 'wpsc'); ?>:</label>
				<input type="password" name="pwd" id="pwd" value="" size="20" /><br />
				
				<label><?php _e('E-mail', 'wpsc'); ?>:</label>
	            <input type="text" name="user_email" id="user_email" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" /><br />
	            
	            <div class="wpsc_signup_text"><?php _e('Signing up is free and easy! please fill out your details your registration will happen automatically as you checkout. Don\'t forget to use your details to login with next time!', 'wpsc');?></div>
	        </fieldset>
	        
        </div>
        <div class="clear"></div>
   <?php endif; // closes user login form

      if(!empty($_SESSION['wpsc_checkout_misc_error_messages'])): ?>
         <div class='login_error'>
            <?php foreach((array)$_SESSION['wpsc_checkout_misc_error_messages'] as $user_error ){?>
               <p class='validation-error'><?php echo $user_error; ?></p>
               <?php } ?>
         </div>

      <?php
      endif;
       $_SESSION['wpsc_checkout_misc_error_messages'] = array(); ?>
<?php ob_start(); ?>
   <table class='wpsc_checkout_table table-1'>
      <?php $i = 0;
      while (wpsc_have_checkout_items()) : wpsc_the_checkout_item(); ?>

        <?php if(wpsc_checkout_form_is_header() == true){
               $i++;
               //display headers for form fields ?>
               <?php if($i > 1):?>
                  </table>
                  <table class='wpsc_checkout_table table-<?php echo $i; ?>'>
               <?php endif; ?>

               <tr <?php echo wpsc_the_checkout_item_error_class();?>>
                  <td <?php wpsc_the_checkout_details_class(); ?> colspan='2'>
                     <h4><?php echo wpsc_checkout_form_name();?></h4>
                  </td>
               </tr>
               <?php if(wpsc_is_shipping_details()):?>
               <tr class='same_as_shipping_row'>
                  <td colspan ='2'>
                  <?php $checked = '';
                  if(isset($_POST['shippingSameBilling']) && $_POST['shippingSameBilling'])
                  	$_SESSION['shippingSameBilling'] = true;
                  elseif(isset($_POST['submit']) && !isset($_POST['shippingSameBilling']))
                  	$_SESSION['shippingSameBilling'] = false;

                  	if( isset( $_SESSION['shippingSameBilling'] ) && $_SESSION['shippingSameBilling'] == 'true' )
                  		$checked = 'checked="checked"';
                   ?>
					<label for='shippingSameBilling'><?php _e('Same as billing address:','wpsc'); ?></label>
					<input type='checkbox' value='true' name='shippingSameBilling' id='shippingSameBilling' <?php echo $checked; ?> />
					<br/><span id="shippingsameasbillingmessage"><?php _e("Votre commande sera livr&#233;e &#224; l'adresse de facturation", 'wpsc'); ?></span>
                  </td>
               </tr>
               <?php endif;

            // Not a header so start display form fields
            }elseif(wpsc_disregard_shipping_state_fields()){
            ?>
               <tr class='wpsc_hidden'>
                  <td class='<?php echo wpsc_checkout_form_element_id(); ?>'>
                     <label for='<?php echo wpsc_checkout_form_element_id(); ?>'>
                     <?php echo wpsc_checkout_form_name();?>
                     </label>
                  </td>
                  <td>
                     <?php echo wpsc_checkout_form_field();?>
                      <?php if(wpsc_the_checkout_item_error() != ''): ?>
                             <p class='validation-error'><?php echo wpsc_the_checkout_item_error(); ?></p>
                     <?php endif; ?>
                  </td>
               </tr>
            <?php
            }elseif(wpsc_disregard_billing_state_fields()){
            ?>
               <tr class='wpsc_hidden'>
                  <td class='<?php echo wpsc_checkout_form_element_id(); ?>'>
                     <label for='<?php echo wpsc_checkout_form_element_id(); ?>'>
                     <?php echo wpsc_checkout_form_name();?>
                     </label>
                  </td>
                  <td>
                     <?php echo wpsc_checkout_form_field();?>
                      <?php if(wpsc_the_checkout_item_error() != ''): ?>
                             <p class='validation-error'><?php echo wpsc_the_checkout_item_error(); ?></p>
                     <?php endif; ?>
                  </td>
               </tr>
            <?php
            }elseif( $wpsc_checkout->checkout_item->unique_name == 'billingemail'){ ?>
               <?php $email_markup =
               "<div class='wpsc_email_address'>
                  <div style='width: 180px;float:left;display:inline;' class='" . wpsc_checkout_form_element_id() . "'>
                     <label class='wpsc_email_address' for='" . wpsc_checkout_form_element_id() . "'>
                     " . __('Couriel: *', 'wpsc') . "
                     </label></div>
                  <div style='width: 300px;float:left;display:inline;' class='wpsc_email_address_div'>" . wpsc_checkout_form_field()."</div>";
                  
                   if(wpsc_the_checkout_item_error() != '')
                      $email_markup .= "<p class='validation-error'>" . wpsc_the_checkout_item_error() . "</p>";
               $email_markup .= "</div>";
             }else{ ?>
			<tr>
               <td class='<?php echo wpsc_checkout_form_element_id(); ?>'>
                  <label for='<?php echo wpsc_checkout_form_element_id(); ?>'>
                  <?php echo wpsc_checkout_form_name();?>
                  </label>
               </td>
               <td>
                  <?php echo wpsc_checkout_form_field();?>
                   <?php if(wpsc_the_checkout_item_error() != ''): ?>
                          <p class='validation-error'><?php echo wpsc_the_checkout_item_error(); ?></p>
                  <?php endif; ?>
               </td>
            </tr>

         <?php }//endif; ?>

      <?php endwhile; ?>
 
<?php 
	$buffer_contents = ob_get_contents();
	ob_end_clean();
	if(isset($email_markup))
		echo $email_markup;
	echo $buffer_contents;
?>

      <?php if (wpsc_show_find_us()) : ?>
      <tr>
         <td><label for='how_find_us'><?php _e('How did you find us' , 'wpsc'); ?></label></td>
         <td>
            <select name='how_find_us'>
               <option value='Word of Mouth'><?php _e('Word of mouth' , 'wpsc'); ?></option>
               <option value='Advertisement'><?php _e('Advertising' , 'wpsc'); ?></option>
               <option value='Internet'><?php _e('Internet' , 'wpsc'); ?></option>
               <option value='Customer'><?php _e('Existing Customer' , 'wpsc'); ?></option>
            </select>
         </td>
      </tr>
      <?php endif; ?>
      <?php do_action('wpsc_inside_shopping_cart'); ?>

      <?php  //this HTML displays activated payment gateways   ?>
      <?php if(wpsc_gateway_count() > 1): // if we have more than one gateway enabled, offer the user a choice ?>
         <tr>
         <td colspan='2' class='wpsc_gateway_container'>
            <h3><?php _e('Payment Type', 'wpsc');?></h3>
            <?php while (wpsc_have_gateways()) : wpsc_the_gateway(); ?>
               <div class="custom_gateway">
                     <label><input type="radio" value="<?php echo wpsc_gateway_internal_name();?>" <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway"/><?php echo wpsc_gateway_name(); ?> 
                     	<?php if( wpsc_show_gateway_image() ): ?>
                     	<img src="<?php echo wpsc_gateway_image_url(); ?>" alt="<?php echo wpsc_gateway_name(); ?>" style="position:relative; top:5px;" />
                     	<?php endif; ?>
                     </label>

                  <?php if(wpsc_gateway_form_fields()): ?>
                     <table class='wpsc_checkout_table <?php echo wpsc_gateway_form_field_style();?>'>
                        <?php echo wpsc_gateway_form_fields();?>
                     </table>
                  <?php endif; ?>
               </div>
            <?php endwhile; ?>
            </td></tr>
         <?php else: // otherwise, there is no choice, stick in a hidden form ?>
            <tr><td colspan="2" class='wpsc_gateway_container'>
            <?php while (wpsc_have_gateways()) : wpsc_the_gateway(); ?>
               <input name='custom_gateway' value='<?php echo wpsc_gateway_internal_name();?>' type='hidden' />

                  <?php if(wpsc_gateway_form_fields()): ?>
                     <table class='wpsc_checkout_table <?php echo wpsc_gateway_form_field_style();?>'>
                        <?php echo wpsc_gateway_form_fields();?>
                     </table>
                  <?php endif; ?>
            <?php endwhile; ?>
         </td>
         </tr>
         <?php endif; ?>

      <?php if(wpsc_has_tnc()) : ?>
         <tr>
            <td colspan='2'>
                <label for="agree"><input id="agree" type='checkbox' value='yes' name='agree' /> <?php printf(__("I agree to the <a class='thickbox' target='_blank' href='%s' class='termsandconds'>Terms and Conditions</a>", "wpsc"), site_url("?termsandconds=true&amp;width=360&amp;height=400")); ?> <span class="asterix">*</span></label>
               </td>
         </tr>
      <?php endif; ?>
      </table>





   <table  class='wpsc_checkout_table table-4'>
      <?php if(wpsc_uses_shipping()) : ?>
	     <tr class="total_price total_shipping">
	         <td class='wpsc_totals'>
	            <?php _e('Frais de port', 'wpsc'); ?>:
	         </td>
	         <td class='wpsc_totals'>
	            <span id="checkout_shipping" class="pricedisplay checkout-shipping"><?php echo wpsc_cart_shipping(); ?></span>
	         </td>
	      </tr>
      <?php endif; ?>

     <?php if(wpsc_uses_coupons() && (wpsc_coupon_amount(false) > 0)): ?>
      <tr class="total_price">
         <td class='wpsc_totals'>
            <?php _e('Discount', 'wpsc'); ?>:
         </td>
         <td class='wpsc_totals'>
            <span id="coupons_amount" class="pricedisplay"><?php echo wpsc_coupon_amount(); ?></span>
          </td>
         </tr>
     <?php endif ?>



   <tr class='total_price'>
      <td class='wpsc_totals'>
      <?php _e('Prix total', 'wpsc'); ?>:
      </td>
      <td class='wpsc_totals'>
         <span id='checkout_total' class="pricedisplay checkout-total"><?php echo wpsc_cart_total(); ?></span>
      </td>
   </tr>
   </table>

<!-- div for make purchase button -->
      <div class='wpsc_make_purchase'>
         <span id="checkout_button_container">
            <?php if(!wpsc_has_tnc()) : ?>
               <input type='hidden' value='yes' name='agree' />
            <?php endif; ?>
               <input type='hidden' value='submit_checkout' name='wpsc_action' />
               <input type='submit' value='<?php _e('Confirmer ma commande', 'wpsc');?>' name='submit' class='make_purchase wpsc_buy_button checkout' />
         </span>
      </div>

<div class='clear'></div>
</form>
</div>
<div style="float:left;display:inline;width:40%;text-align:left;padding-right:5px;color:#fff;margin-top:20px;margin-bottom:50px;"><span id="backto_step1" style="text-transform:uppercase;cursor:pointer;padding:5px; background:#aaa;"><strong> <  Pr&#233;c&#233;dent</strong></span></div>
</div>
</div><!--close checkout_page_container-->

<div class="progressbar" style="margin-bottom:30px;width:840px;height:49px;clear:both;background-color:#eee;">
	<div class="progressbar_inside" style="width:840px;height:49px;background:url(<?php echo get_bloginfo(stylesheet_directory); ?>/img/progressbar_step1.jpg);"></div>
</div>

<div style="clear:both;"></div>
<?php
do_action('wpsc_bottom_of_shopping_cart');

?>

<style type="text/css">
 #calculer {
  display: inline;
  float: left;
  margin: 6px 0 0 10px;
  display: none;
}
#zipcode {
	display: inline;
    float: left;
    margin-top: 10px;
	display:none;
}
#step1a .qtybutton {
	border: 0;
	display: inline-block !important;
    margin-top: 0px !important;
    width: 20px !important;
	height:20px;
	background: url(http://ceramique-de-lussan.com/wp-content/themes/ceramique-de-lussan/img/icon-reload.gif) no-repeat top center;
	cursor: pointer;
	}
#step1a .removebutton {
	border: 0;
	display: inline-block !important;
    margin-top: 0px !important;
    width: 20px !important;
	height:20px;
	background: url(http://ceramique-de-lussan.com/wp-content/themes/ceramique-de-lussan/img/item-remove.png) no-repeat top center;
	cursor: pointer;
	}
#checkout_page_container img.product_image {
    float: left;
}
div#step1b td.wpsc_shipping_quote_price {
	text-align: left;
    width: 70px;
}
div#step1a table.checkout_cart tbody tr.product_row td.firstcol{
	width: 110px;
	}
.productcart_tax {
	float: right;
}
#taxtable {
}
#wpsc_checkout_form_9 { width:300px;}
.wpsc_checkout_table {clear:both;}
.wpsc_checkout_table input.text, .wpsc_checkout_table textarea, .wpsc_checkout_table select { width:300px;}
</style>

<script type="text/javascript">

	jQuery("#to_step2").click(function() {
		jQuery("div#step1").delay(300).slideToggle();
		jQuery("div#step2").delay(300).slideToggle();
		jQuery("div.progressbar_inside").css('background','url(<?php echo get_bloginfo(stylesheet_directory); ?>/img/progressbar_step2.jpg)');
	});
	
	jQuery("#backto_step1").click(function() {
		jQuery("div#step1").delay(300).slideToggle();
		jQuery("div#step2").delay(300).slideToggle();
		jQuery("div.progressbar_inside").css('background','url(<?php echo get_bloginfo(stylesheet_directory); ?>/img/progressbar_step1.jpg)');
    });
	
	var str = jQuery("p.validation-error").text();
	if (str !==''){
	jQuery("div#step1").delay(300).slideToggle();
	jQuery("div#step2").delay(300).slideToggle();
	};
	
	jQuery(document).ready(function() {
	
	if (jQuery('#shippingSameBilling').is(':checked')){
			jQuery('#backto_step1').css('display', 'none');
		}
	
	jQuery('#shippingSameBilling').click(function(){
		location.reload();
	});
	
	var selectedcountry = jQuery('#current_country option:selected').html();
	jQuery('.wpsc_shipping_header .shipping_header').css('display', 'none');
	

    	if (selectedcountry != 'France') {
		jQuery("#wpcb_livraison_1").attr("checked", "checked");
		jQuery('tr.wpcb_livraison_0').css('display', 'none');

        jQuery(".productcart input:radio[name='shipping_method']:checked").click();

	 }
	
	if (selectedcountry === 'France') {
		jQuery("#wpcb_livraison_0").attr("checked", "checked");
		jQuery('tr.wpcb_livraison_1').css('display', 'none');
		jQuery('.wpsc_shipping_quote_name label[for=wpcb_livraison_0]').html('Frais de port offert pour la france');
        jQuery(".productcart input:radio[name='shipping_method']:checked").click();
		}
	});
	
	jQuery('select#wpsc_checkout_form_7').change(function(){
		var selected_billing_country = jQuery('#wpsc_checkout_form_7 option:selected').html();	
		var selected_shipping_country = jQuery('#current_country option:selected').html();	
		if (selected_billing_country != 'France' && selected_shipping_country != 'France') {
			jQuery("#wpcb_livraison_1").delay(1000, "myQueue").queue("myQueue", function(){ 
			jQuery(this).trigger("click"); 
			}).dequeue("myQueue");
		}
		if (selected_billing_country == 'France' && selected_shipping_country != 'France') {
			jQuery("#wpcb_livraison_1").delay(1000, "myQueue").queue("myQueue", function(){ 
			jQuery(this).trigger("click"); 
			}).dequeue("myQueue");
		}
		
	});
 
</script>