	<div id = "cart" class = "cart">
    {if $smarty.session.cart.lesson || $smarty.session.cart.subscription}
        {if $smarty.session.cart.subscription && $smarty.get.fct != 'cartPreview'}
            {foreach name = 'cartlist' key = 'key' item = 'cartlist' from = $smarty.session.cart.subscription}
                <div class = "cartElement">
                	<div class = "cartTitle">{$cartlist.name}</div>
                    <div class = "cartDelete">
                        <span>{$cartlist.price}</span>
                        <a href = "javascript:void(0)" onclick = "ajaxPostRemove('{$cartlist.id}', this);" id = "{$cartlist.id}">
                            <img src = "images/16x16/delete.png" alt = "{$smarty.const._REMOVEFROMCART}" title = "{$smarty.const._REMOVEFROMCART}"></a>
                    </div>
                &nbsp;</div>
            {/foreach}        
    	{/if}

        {foreach name = 'cartlist' key = 'key' item = 'cartlist' from = $smarty.session.cart.lesson}
            <div class = "cartElement">
            	<div class = "cartTitle">{$cartlist.name}</div>
                <div class = "cartDelete">
                    <span>{if $cartlist.price == 0}{$smarty.const._FREEOFCHARGE}{else}{$cartlist.price} {$T_CURRENCYSYMBOLS[$T_CONFIGURATION.currency]}{/if}</span>
                    <a href = "javascript:void(0)" onclick = "ajaxPostRemove('{$cartlist.id}', this);">
                        <img src = "images/16x16/delete.png" alt = "{$smarty.const._REMOVEFROMCART}" title = "{$smarty.const._REMOVEFROMCART}"></a>
                </div>
            &nbsp;</div>
            {*assign var = "totalPrice" value = $totalPrice+$cartlist.price*}
        {/foreach}
        {if $smarty.get.fct != 'cartPreview'}
            <div id = "cart_total">              	
                {*<span>{$smarty.const._PAYPALFINALPRICE}: {if $totalPrice == 0}{$smarty.const._FREEOFCHARGE}{else}{$totalPrice} {$T_CURRENCYSYMBOLS[$T_CONFIGURATION.currency]}{/if}</span>*}
                <span>{$smarty.const._REMOVEALL}</span>
				<a href = "javascript:void(0)" onclick = "ajaxPostRemoveAll('', this);">
                	<img src = "images/16x16/delete.png" alt = "{$smarty.const._REMOVEALLFROMCART}" title = "{$smarty.const._REMOVEALLFROMCART}"></a>							
            </div>
            <div id = "submit_cart"><input class = "flatButton" type = "submit" value = "{$smarty.const._CONTINUE}&nbsp;&raquo;" onclick = "location = '{if $smarty.session.s_login}directory.php?fct=cartPreview{else}index.php?ctg=login&register_lessons=1&message='+encodeURI('{$smarty.const._PLEASELOGINTOCOMPLETEREGISTRATION}')+'{/if}'"></div>
        {else}
                <form {$T_ORDER_LESSONS_FORM.attributes}>
                    {$T_ORDER_LESSONS_FORM.hidden}            
                    <div style = "text-align:center;">{$T_ORDER_LESSONS_FORM.order.html}</div>            
                </form>
                <form {$T_ORDER_LESSONS_FORMDATA.attributes}>
                    {$T_ORDER_LESSONS_FORMDATA.hidden}
                </form>
        {/if}
	{/if}
    </div>
	
	<script type = "text/javascript">
<!--	
	{if $smarty.get.fct == 'cartPreview'}var cart_preview = true;{else}var cart_preview = false;{/if}//This variable is useful, since when previewing cart contents, we don't want them to be replaced by the transport.responseText contents
	{literal}
        function ajaxPost(id, el, subscription) {
            Element.extend(el);
            if (subscription) {
            	var url      = 'directory.php?fct=addSubscriptionToCart' + '&id='+id;
            } else {
            	var url      = 'directory.php?fct=addLessonToCart' + '&id='+id;
            }
			src = el.down().src;
			el.down().src = 'images/others/progress_big.gif';
			
            new Ajax.Request(url, {
                method:'get',
                asynchronous:true,
                onFailure: function (transport) {
                	showMessage(transport.responseText, 'failure');
                    el.down().src = src;
                },
                onSuccess: function (transport) {      
                    $('cart').innerHTML = transport.responseText;
                    el.down().src = src;
                    if (!transport.responseText) {
                    	$('cart').up().up().up().hide();
                    } else {
                    	$('cart').up().up().up().show();
                    } 
                }
            });
		}		
        function ajaxPostRemove(id, el) {
        	Element.extend(el);
            var url      = 'directory.php?fct=removeLessonFromCart' + '&id='+id;
			src = el.down().src;
			el.down().src = 'images/others/progress1.gif';
            
            new Ajax.Request(url, {
                method:'get',
                asynchronous:true,
                onFailure: function (transport) {
                	showMessage(transport.responseText, 'failure');
                    el.down().src = src;
                },
                onSuccess: function (transport) {
                	if (cart_preview) {
                		if ($('cart_'+el.id)) {
                			new Effect.Fade($('cart_'+el.id).up().up().up());
                		} else {
                			new Effect.Fade(el.up().up());
                			location.reload();
                		}
                	} else {
						$('cart').innerHTML = transport.responseText;
                	}
                    el.down().src = src;
                }
            });
        }
        function ajaxPostRemoveAll(id, el) {
        	Element.extend(el);
            var url  =  'directory.php?fct=removeLessonAllFromCart';
			src = el.down().src;
			el.down().src = 'images/others/progress1.gif';
            
            new Ajax.Request(url, {
                method:'get',
                asynchronous:true,
                onFailure: function (transport) {
                	showMessage(transport.responseText, 'failure');
                    el.down().src = src;
                },
                onSuccess: function (transport) {
					$('cart').innerHTML = transport.responseText;
                    el.down().src = src;
                    if (!transport.responseText) {
                    	//$('cart').up().up().up().hide();
                    } else {
                    	//$('cart').up().up().up().show();
                    } 
                }
            });
        }
    {/literal}
-->    
	</script>	
