function loginPanel($course_id = 0, $calledFrom = 'cart')
    {
        global $JLMS_CONFIG;
        $usersConfig =& JComponentHelper::getParams('com_users');
        $allowUserRegistration = $usersConfig->get('allowUserRegistration');
        ?>
		<script type="text/javascript" language="javascript">
			<!--
			function form_viewer(task){
				var show_reg_form = document.getElementById('show_reg_form');
				var show_login_form = document.getElementById('show_login_form');
				var show_log = document.getElementById('show_log');
				var show = document.getElementById('show');
				if (task == 'reg'){
					show_login_form.style.display = 'none';
					show_reg_form.style.display = '';
					show_log.style.display = '';
					show.style.display = 'none';
				}
				if (task == 'log'){
					show_login_form.style.display = '';
					show_reg_form.style.display = 'none';
					show_log.style.display = 'none';
					show.style.display = '';
				} 
			}
			function jlms_submitlogin( pressbutton ) {
				var form = document.JLMS_loginForm;
				form.task.value = pressbutton;			
				form.submit();			
			}
			-->
		</script>		
		<?php 
        if (JLMS_J16version()) {
            ?>
												
				<h3><a style="cursor:pointer" onclick="javascript:form_viewer('log')"><?php 
            echo _JLMS_PLEASE_LOGIN;
            ?>
</a></h3>											
				<h4><a onclick="javascript:form_viewer('log')" id="show_log" style="cursor:pointer;display:none;"><?php 
            echo _JLMS_SHOW_LOGIN;
            ?>
</a></h4>							
				<div id="show_login_form">			
						<?php 
            JLMS_UserSessions_html::login_form('com_joomla_lms', $calledFrom . '_login', $course_id);
            ?>
				</div>				
				<?php 
            if ($allowUserRegistration) {
                ?>
				
												
				<h3><a style="cursor:pointer" onclick="javascript:form_viewer('reg')" ><?php 
                echo _JLMS_PLEASE_REGISTER;
                ?>
</a></h3>					
				<h4><a style="cursor:pointer" onclick="javascript:form_viewer('reg')" id="show"><?php 
                echo _JLMS_SHOW_REGISTRATION;
                ?>
</a></h4>						
				<div id="show_reg_form"  style="display:none;">				
							<?php 
                if ($allowUserRegistration) {
                    ob_start();
                    JLMS_UserSessions_html::register_form('com_joomla_lms', $calledFrom . '_register');
                    $cont = ob_get_contents();
                    $cont = str_replace("componentheading", "contentheading", $cont);
                    ob_end_clean();
                    echo $cont;
                } else {
                    echo _JLMS_REGISTRATION_DISABLED;
                }
                ?>
				
				</div>							
			<?php 
            }
        } else {
            ?>
			<table width="100%" style="width:100%" cellpadding="0" cellspacing="0" border="0" class="contentpane">		
			<tr>
					<<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
 class="sectiontableheader">			
					<a style="cursor:pointer" onclick="javascript:form_viewer('log')"><?php 
            echo _JLMS_PLEASE_LOGIN;
            ?>
</a>
					</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
					<<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
 align="right" class="sectiontableheader">
					<a onclick="javascript:form_viewer('log')" id="show_log" style="cursor:pointer;display:none;"><?php 
            echo _JLMS_SHOW_LOGIN;
            ?>
</a>
					</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
				</tr>
				<tr id="show_login_form">
					<td colspan="2">
						<table>
							<tr>
								<td>
								<?php 
            JLMS_UserSessions_html::login_form('com_joomla_lms', $calledFrom . '_login', $course_id);
            ?>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		<?php 
            if ($allowUserRegistration) {
                ?>
		<table width="100%" style="width:100%" cellpadding="0" cellspacing="0" border="0" class="contentpane">		
			<tr>
				<<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
 class="sectiontableheader">
				<a style="cursor:pointer" onclick="javascript:form_viewer('reg')" ><?php 
                echo _JLMS_PLEASE_REGISTER;
                ?>
</a>
				</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
				<<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
 align="right" class="sectiontableheader">
				<a style="cursor:pointer" onclick="javascript:form_viewer('reg')" id="show"><?php 
                echo _JLMS_SHOW_REGISTRATION;
                ?>
</a>
				</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
			</tr>
			<tr style="display:none;" id="show_reg_form">
				<td colspan="2">
					<?php 
                if ($allowUserRegistration) {
                    ob_start();
                    JLMS_UserSessions_html::register_form('com_joomla_lms', $calledFrom . '_register');
                    $cont = ob_get_contents();
                    $cont = str_replace("componentheading", "contentheading", $cont);
                    ob_end_clean();
                    echo $cont;
                } else {
                    echo _JLMS_REGISTRATION_DISABLED;
                }
                ?>
				</td>
			</tr>
		</table>
			<?php 
            }
        }
    }
    function ShowCart($option, &$subscriptions, &$lists, $procs = array())
    {
        global $Itemid, $JLMS_CONFIG, $JLMS_SESSION, $JLMS_DB, $my;
        $jlms_tax_counting = $JLMS_CONFIG->get('enabletax');
        $sub_total = 0;
        $tax_amount = 0;
        $rows2 = array();
        $custom_code = '';
        $discounts = array();
        $app =& JFactory::getApplication();
        $coupon_code = $app->getUserStateFromRequest('com_joomla_lms_dis_coupon_code', 'dis_coupon_code', '');
        $discounts['t_coupon_disc'] = JLMS_DISCOUNTS::getTotalCouponDiscount($coupon_code, $subscriptions);
        $discounts['t_disc'] = JLMS_DISCOUNTS::getTotalDiscounts($subscriptions);
        // counting taxes
        if ($jlms_tax_counting) {
            $is_cb_installed = $JLMS_CONFIG->get('is_cb_installed', 0);
            $get_country_info = $JLMS_CONFIG->get('get_country_info', 0);
            $cb_country_filed_id = intval($JLMS_CONFIG->get('jlms_cb_country'));
            $isset_country = false;
            if ($is_cb_installed && $get_country_info && $cb_country_filed_id) {
                //by Max (get country info)
                $query = "SELECT cf.name" . "\n FROM #__comprofiler_fields as cf" . "\n WHERE 1" . "\n AND cf.fieldid = '" . $cb_country_filed_id . "'";
                $JLMS_DB->setQuery($query);
                $cb_country_field_name = $JLMS_DB->loadResult();
                $query = "SELECT " . $cb_country_field_name . "" . "\n FROM #__comprofiler" . "\n WHERE 1" . "\n AND user_id = '" . $my->id . "'";
                $JLMS_DB->setQuery($query);
                $country_name = $JLMS_DB->loadResult();
                require_once 'components' . DS . $option . DS . 'includes' . DS . 'libraries' . DS . 'lms.lib.countries.php';
                $CodeCountry = new CodeCountries();
                $code = $CodeCountry->code($country_name);
                if ($code) {
                    $user_country = $code;
                }
                $user_country_name = '';
                $us_state = '';
            } else {
                $ip_address = $_SERVER['REMOTE_ADDR'];
                //$ip_address = '213.184.248.211';
                //				$ip_address = '12.225.42.19';
                //				$ip_address = '111.215.41.12';
                if (@ini_get('allow_url_fopen')) {
                    $fn = @file('http://api.hostip.info/get_html.php?ip=' . $ip_address);
                    // country ip identified
                    if ($fn != false) {
                        $ip_info = implode('', $fn);
                        preg_match_all("(\\(..\\))", $ip_info, $dop);
                        $user_country = str_replace('(', '', str_replace(")", '', $dop[0][0]));
                        preg_match_all("(\\:.*\\()", $ip_info, $dop2);
                        $user_country_name = str_replace(': ', '', str_replace(" (", '', $dop2[0][0]));
                        preg_match_all("(\\, ..)", $ip_info, $dop3);
                        $us_state = @str_replace(', ', '', $dop3[0][0]);
                    }
                }
            }
            if (isset($user_country)) {
                $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code='" . $user_country . "' ";
                $JLMS_DB->setQuery($query);
                $rows2 = $JLMS_DB->loadObjectList();
                // if no country found
                if (!count($rows2)) {
                    // check if in EU
                    $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code='EU' AND list REGEXP '" . $user_country . "' ";
                    $JLMS_DB->setQuery($query);
                    $rows_eu = $JLMS_DB->loadObjectList();
                    if (count($rows_eu)) {
                        $isset_country = true;
                        $rows2[0]->tax_type = $rows_eu[0]->tax_type;
                        $rows2[0]->tax = $rows_eu[0]->tax;
                        $user_country_name = $rows_eu[0]->name . ' (' . $user_country_name . ')';
                    }
                } else {
                    $isset_country = true;
                }
                // additional check for US
                if ($user_country == 'US') {
                    $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code = 'US-" . $us_state . "' ";
                    $JLMS_DB->setQuery($query);
                    $rows_states = $JLMS_DB->loadObjectList();
                    if (count($rows_states)) {
                        $isset_country = true;
                        $rows2 = array();
                        $rows2[0]->tax_type = $rows_states[0]->tax_type;
                        $rows2[0]->tax = $rows_states[0]->tax;
                        $user_country_name = 'United states (' . $rows_states[0]->name . ' )';
                    }
                }
            }
            //10.01.09 (Max) default tax option
            if (!$isset_country) {
                $rows2[0]->tax_type = $JLMS_CONFIG->get('default_tax_type', 1);
                $rows2[0]->tax = $JLMS_CONFIG->get('default_tax', 0);
            }
        }
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function jq_Check_selectCheckbox(check_name, form_name) {
			selItem = eval("document."+form_name+"['"+check_name+"']");
			if (selItem) {
				if (selItem.length) { var i;
					for (i = 0; i<selItem.length; i++) {
						if (selItem[i].checked) {
							if (selItem[i].value) { return true; }
						}}
				} else if (selItem.checked) { return true; }}
			return false;
		}
		function jlms_submitbutton(pressbutton) {
			var form = document.JLMS_adminForm;
			if( pressbutton == 'remove_from_cart' ){
				var ttt = jq_Check_selectCheckbox('jlms_sub[]', 'JLMS_adminForm');
				if (ttt) {
					form.task.value = pressbutton;
					form.submit();
				} else {
					alert("<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
");
				}
			}
			if( pressbutton == 'update_cart' ){
					form.task.value = pressbutton;
					form.submit();
			}
			if (pressbutton == 'cart_login') {
				form.task.value = pressbutton;
				form.submit();
			}
			
			if (pressbutton == 'apply_coupon_code') {
				form.task.value = pressbutton;
				form.submit();
			}
		}
		//-->
		</script>	

		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="JLMS_adminForm">
		<input type="hidden" value="<?php 
        echo $option;
        ?>
" name="option">
		<input type="hidden" value="<?php 
        echo $Itemid;
        ?>
" name="Itemid">
		<input type="hidden" value="" name="task">
		<input type="hidden" value="" name="id">
		<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('cart', _JLMS_MY_CART, $params);
        JLMS_TMPL::ShowPageTip('show_cart');
        JLMS_TMPL::CloseMT();
        $count_subs = count($subscriptions);
        ?>
		<br />
		<?php 
        if ($count_subs > 0) {
            ?>
		
		<input type="text" name="dis_coupon_code" value="<?php 
            echo $coupon_code;
            ?>
" />&nbsp;
		<input type="button" value="Check coupon" onclick="jlms_submitbutton('apply_coupon_code');" />
		<?php 
        }
        ?>
	
		<table cellpadding="0" cellspacing="0" border="0" width="100%" class="jlms_cart_list_outer" style="width:100%">
		<?php 
        if ($count_subs > 0) {
            ?>
			<tr>
				<td>
				<?php 
            $need_upd_txt = false;
            for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                if (isset($subscriptions[$i]->allow_multiple) && $subscriptions[$i]->allow_multiple) {
                    $need_upd_txt = true;
                    break;
                }
            }
            $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign');
            $total_subs = 0;
            $total_disc = 0;
            $total_tax = 0;
            $discounts['total_p_disc'] = 0;
            $reccSubId = false;
            for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                JLMS_CART_html::initSubscriptionPaymentParams($subscriptions[$i], $rows2);
                if ($subscriptions[$i]->account_type == '6') {
                    $reccSubId = $i;
                }
                if (isset($subscriptions[$i]->count_items) && $subscriptions[$i]->count_items && isset($subscriptions[$i]->allow_multiple) && $subscriptions[$i]->allow_multiple) {
                    $total_subs += $subscriptions[$i]->sub_total * $subscriptions[$i]->count_items;
                    $total_tax += $subscriptions[$i]->tax_amount * $subscriptions[$i]->count_items;
                    $total_disc += $subscriptions[$i]->disc * $subscriptions[$i]->count_items;
                } else {
                    $total_subs += $subscriptions[$i]->sub_total;
                    $total_tax += $subscriptions[$i]->tax_amount;
                    $total_disc += $subscriptions[$i]->disc;
                }
                if ($subscriptions[$i]->p_coupon_disc || $subscriptions[$i]->p_disc) {
                    $params['showDiscount'] = true;
                }
            }
            if (isset($rows2[0]->tax_type) && $rows2[0]->tax_type == 2) {
                $total_tax += $rows2[0]->tax;
                // if tx is not in percentage....
            }
            $discounts['total_p_disc'] = $total_disc;
            $total_disc = $total_disc + ($discounts['t_coupon_disc'] + $discounts['t_disc']);
            $total_price = $total_subs - $total_disc;
            if ($total_price < 0) {
                $total_price = $total_tax;
            } else {
                $total_price += $total_tax;
            }
            $price_diff = $total_subs - $total_disc;
            if ($price_diff < 0) {
                $balance = abs($price_diff);
            } else {
                $balance = 0;
            }
            $recurr_total_desc = '';
            if ($reccSubId !== false) {
                $price = JLMS_RECURRENT_PAY::getPriceDesc($subscriptions[$reccSubId], 'basket_list', $balance, $total_price);
                $recurr_total_desc = JLMS_RECURRENT_PAY::getPriceDesc($subscriptions[$reccSubId], 'total', $balance, $total_price);
                if ($total_price == 0) {
                    $total_price = JLMS_RECURRENT_PAY::getAmountFromReccurentPrice($subscriptions[$reccSubId]);
                }
            }
            ?>

					<div style="float:right; padding-top:5px; padding-right:25px">
						<b><?php 
            echo _JLMS_SUBSCR_SUB_TOTAL . ' ' . $jlms_cs . sprintf('%.2f', round($total_price, 2));
            ?>
</b>
					</div>
				</td>
			</tr>
			<tr>
				<td>
				<?php 
            if ($need_upd_txt) {
                ?>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
					<tr>
					<td><div style="float:right; text-align:center"><?php 
                echo _JLMS_CART_HAVE_CHANGED_QUANTITY;
                ?>
<a href="javascript:jlms_submitbutton('update_cart');"><?php 
                echo _JLMS_CART_UPDATE;
                ?>
</a></div></td>
					</tr>
				</table>
				<?php 
            }
            ?>

<?php 
            $do_show_index = false;
            for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                $subscription = $subscriptions[$i];
                $s = 1;
                foreach ($subscription->course_names as $course_name) {
                    $course_usertype = 0;
                    if (in_array($subscription->courses[$s - 1], $JLMS_CONFIG->get('teacher_in_courses', array(0)))) {
                        $course_usertype = 1;
                    } elseif (in_array($subscription->courses[$s - 1], $JLMS_CONFIG->get('student_in_courses', array(0)))) {
                        $course_usertype = 2;
                    }
                    if ($course_usertype) {
                        $do_show_index = true;
                        break;
                    }
                    $s++;
                }
                if ($do_show_index) {
                    break;
                }
            }
            ?>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist', 'jlms_cart_list');
            ?>
">
					<tr>
						<?php 
            if ($do_show_index) {
                ?>
<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center" width="16">#</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
><?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="left" width="20">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="left"><?php 
            echo _JLMS_SUBSCRIBE_SUB_COURSES;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="left"><?php 
            echo _JLMS_DETAILS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center" width="170"><?php 
            echo _JLMS_COURSES_PRICE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>						
						<?php 
            if (isset($params['showDiscount']) && $params['showDiscount']) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center" width="40" nowrap="nowrap"><?php 
                echo _JLMS_CART_DISCOUNT;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            if (isset($rows2[0]) && $rows2[0]->tax_type == 1 && $rows2[0]->tax) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center" width="40" nowrap="nowrap"><?php 
                echo _JLMS_CART_TAX;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center" width="40" nowrap="nowrap"><?php 
            echo _JLMS_CART_QUANTITY;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                $subscription = $subscriptions[$i];
                $tax_amount = 0;
                $disc = 0;
                if ($subscription->account_type != '6') {
                    $price = $jlms_cs . sprintf('%.2f', round($subscriptions[$i]->sub_total, 2));
                }
                $price_sub = $price;
                $custom_code .= JLMS_CART_html::ShowSub($subscription, $i + 1, '', $price_sub, $do_show_index, false, $params);
            }
            ?>
				</table>
				</td>
			</tr>
			<tr>
				<td>
					<div style="float:right; padding-top:5px; padding-right:25px; text-align:right;">
						<?php 
            if ($total_tax || $total_disc) {
                echo '<b>' . $jlms_cs . sprintf('%.2f', round($total_subs, 2)) . '</b><br />';
                if ($total_disc) {
                    echo '<b>' . _JLMS_SUBSCR_DISCOUNT_AMOUNT . ' ' . $jlms_cs . sprintf('%.2f', round($total_disc, 2)) . '</b><br />';
                }
                if ($total_tax) {
                    echo '<b>' . _JLMS_SUBSCR_TAX_AMOUNT . ' ' . $jlms_cs . sprintf('%.2f', round($total_tax, 2)) . '</b><br />';
                }
            }
            echo '<b>' . _JLMS_SUBSCR_SUB_TOTAL . ' ' . $jlms_cs . sprintf('%.2f', round($total_price, 2)) . '</b><br />';
            echo '<b>' . $recurr_total_desc . '</b>';
            ?>
					</div>
				</td>
			</tr>
<?php 
            $controls = array();
            if ($JLMS_CONFIG->get('under_ssl') && $JLMS_CONFIG->get('real_live_site')) {
                $temp_href = $JLMS_CONFIG->get('real_live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=subscription";
            } else {
                $temp_href = $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=subscription";
            }
            $controls[] = array('href' => $temp_href, 'title' => _JLMS_CART_BACK_TO_SHOP, 'img' => 'back');
            $controls[] = array('href' => "javascript:jlms_submitbutton('remove_from_cart');", 'title' => _JLMS_CART_REMOVE, 'img' => 'cartremove');
            JLMS_TMPL::ShowControlsFooter($controls, '', false);
            ?>
		</table>
<?php 
            if ($my->id && !empty($procs)) {
                JLMS_TMPL::OpenMT('jlms_table_no_borders');
                JLMS_TMPL::OpenTS();
                $sub_proc = $JLMS_SESSION->get('sub_proc');
                if (isset($_COOKIE['proc_id'])) {
                    $sub_proc = $_COOKIE['proc_id'];
                }
                $temp2 = "";
                foreach ($procs as $proc) {
                    $checked = '';
                    if (count($procs) == 1) {
                        $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');";
                        $checked = 'checked="checked"';
                    }
                    if ($sub_proc) {
                        if ($sub_proc == $proc->id) {
                            $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');";
                            $checked = 'checked="checked"';
                        }
                    } else {
                        if ($proc->default_p) {
                            $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');";
                            $checked = 'checked="checked"';
                        }
                    }
                    echo '<input type="radio" name="proc_id" value="' . $proc->id . '" onclick="checkProcessor(\'' . $proc->id . '\',\'' . $proc->filename . '\');" id="proc_' . $proc->id . '" ' . $checked . ' />&nbsp;<label class="msspro_sel_proc2" for="proc_' . $proc->id . '">' . $proc->name . '</label><br />';
                }
                if ($temp2) {
                    echo '<script type="text/javascript" language="javascript"><!--' . "\r\n";
                    echo $temp2;
                    echo "\r\n--></script>";
                }
                JLMS_TMPL::CloseTS();
                JLMS_TMPL::CloseMT();
            }
            ?>
	
	<?php 
            echo "</form>";
            if (!$my->id) {
                JLMS_UserSessions_html::loginPanel();
            }
        } else {
            echo "<tr><td><div class='joomlalms_sys_message'>";
            echo _JLMS_CART_IS_EMPTY;
            echo '<br />';
            if ($JLMS_CONFIG->get('under_ssl') && $JLMS_CONFIG->get('real_live_site')) {
                $temp_href = $JLMS_CONFIG->get('real_live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=subscription";
            } else {
                $temp_href = $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=subscription";
            }
            echo '<a href="' . $temp_href . '" title="' . _JLMS_CART_BACK_TO_SHOP . '">[' . _JLMS_CART_BACK_TO_SHOP . ']</a>';
            echo "</div></td></tr></table>";
            echo "</form>";
        }
        return $custom_code;
    }
    function JLMS_free_subscriptions($option, $course_info, $course_id, $multi_sub = false)
    {
        /*if ($multi_sub) {
        			$course_info = $course_info[0];
        		}*/
        global $Itemid, $JLMS_CONFIG, $my;
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function jlms_submitbutton(pressbutton) {
			var form = document.JLMS_adminForm;
			<?php 
        if ($JLMS_CONFIG->get('enableterms')) {
            ?>
			if( (pressbutton == 'course_subscribe') && (document.getElementById('agreement').checked == false) ){
				alert( "<?php 
            echo addslashes(_JLMS_AGREEMENT);
            ?>
" );
			}
			else{
				form.task.value = pressbutton;
				form.submit();
			}
			<?php 
        } else {
            ?>
				form.task.value = pressbutton;
				form.submit();
			<?php 
        }
        ?>
		}
		//-->
		</script>
<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('subscription', _JLMS_HEAD_SUBSCRIPTION_STR, $params);
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        //echo "Sub name: "."<input type='text' class='inputbox' name='sub_name' />"."&nbsp;&nbsp;";
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="JLMS_adminForm">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
				<td colspan="2">
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
					<tr>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="left" width="200"><?php 
        echo _JLMS_SUBSCRIBE_COURSE_NAME;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="left" width="70" ><?php 
        echo _JLMS_COURSES_FEE_TYPE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					</tr>
					<?php 
        if ($multi_sub) {
            $k = 1;
            foreach ($course_info as $course_info1) {
                ?>
							<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
								<td align="left" valign="middle"><?php 
                echo $course_info1->course_name;
                ?>
</td>
								<td align="left" valign="middle"><?php 
                echo _JLMS_COURSES_FREE;
                ?>
</td>
							</tr>
						<?php 
                $k = 3 - $k;
            }
        } else {
            ?>
					<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry1');
            ?>
">
						<td align="left" valign="middle"><?php 
            echo $course_info->course_name;
            ?>
</td>
						<td align="left" valign="middle"><?php 
            echo _JLMS_COURSES_FREE;
            ?>
</td>
					</tr>
					<?php 
        }
        ?>
				</table>
				</td>
			</tr>
			<?php 
        if ($JLMS_CONFIG->get('enableterms')) {
            if ($my->id) {
                echo "<tr><td colspan='2'><table align='center' class='jlms_table_no_borders'><tr><td width='20'>\n\t\t\t\t\t\t\t<input type='checkbox' name='agreement' id='agreement' />\n\t\t\t\t\t\t</td><td style='text-align:left'>\n\t\t\t\t\t\t\t<label for='agreement'>" . $JLMS_CONFIG->get('jlms_terms') . "</label>\n\t\t\t\t\t\t</td></tr></table></td></tr>";
            } else {
                /*	echo "<tr><td colspan='2'><br /><table align='center'><tr><td width='20'>
                				<input type='checkbox' name='agreement' id='agreement' disabled='disabled' />
                			</td><td style='text-align:left'>
                				<label for='agreement'>" . $JLMS_CONFIG->get('jlms_terms')."</label>
                			</td></tr></table></td></tr>";*/
            }
            /*
            
            				?>
            			<tr>
            				<td class="sectiontableheader">Terms and conditions</td>
            			</tr>
            			<tr>
            				<td>
            				<?php 
            				echo "<input type='checkbox' name='agreement' id='agreement' />";
            				echo $JLMS_CONFIG->get('jlms_terms');
            				?>			
            				</td>
            			</tr>
            			<?php */
        }
        ?>
	
			<tr>
				<td colspan="2" align="center">
				<?php 
        $toolbar = array();
        if ($my->id) {
            $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:jlms_submitbutton('course_subscribe','');");
            echo JLMS_ShowToolbar($toolbar, true, 'center');
        } else {
            //$toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:void(0);");
            //echo JLMS_ShowToolbar($toolbar, true, 'center');
        }
        ?>
				<noscript>
					<div class="joomlalms_sys_message">
					<?php 
        echo _JLMS_JS_COOKIES_REQUIRES;
        ?>
					</div>
				</noscript>
				</td>
			</tr>		
		</table>	
 		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
		<input type="hidden" name="state" value="0" />
		</form>		
		<?php 
        if (!$my->id) {
            JLMS_UserSessions_html::loginPanel($course_id, 'subs');
        }
    }