function jlms_booking_edit($course_id, $option, &$rows, &$lists, $en_book)
    {
        global $Itemid, $my, $JLMS_DB, $JLMS_CONFIG;
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true);
        JLMS_TMPL::ShowHeader('conference', _JLMS_HEAD_CONF_STR, $params);
        JLMS_TMPL::OpenTS();
        $row = $rows[0];
        ?>
	<script type="text/javascript" language="javascript">
	<!--//--><![CDATA[//><!--
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'period_cancel'){
			form.mode.value = pressbutton;
			form.submit();
		}
		else if (pressbutton == 'save_period'){
			if(form.p_name.value == '')
			{
				alert("Specify name");
			}
			else
			if(form.sel_option[1].checked)
			{
			
			var w_sel = 0;
			var m_sel = 0;	
			   var element = eval(document.adminForm['weekday[]']);
			   for (var i=0; i<element.length; i++) {
					var o = element[i];
					 if(o.checked)
						w_sel = 1;
				}
				var element2 = eval(document.adminForm['monthday[]']);
			   for (var i=0; i<element2.length; i++) {
					var o = element2[i];
					 if(o.checked)
						m_sel = 1;
				}
		
				if(m_sel && w_sel)
				{
					form.mode.value = pressbutton;
					form.submit();
				}
				else
				{
					alert("Please Specify week day and month");
				}
			}
			else
			{
				form.mode.value = pressbutton;
				form.submit();
			}
		}	
	}
	function getObj(name) {
				if (document.getElementById) { return document.getElementById(name); }
				else if (document.all) { return document.all[name]; }
				else if (document.layers) { return document.layers[name]; }
			}
	function Choose_option(opt)
	{
		if (opt)
		{
			getObj("sel_date").style.display = "block";
			getObj("sel_period").style.display = "none";
		}
		else
		{
			getObj("sel_period").style.display = "block";
			getObj("sel_date").style.display = "none";
		}
	}
	//--><!]]>
	</script>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<tr>
				<td colspan="2">&nbsp;
					
				</td>
				<td style="text-align:right;"><br />
					<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_period');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=conference&amp;mode=booking&amp;id={$course_id}"));
        echo JLMS_ShowToolbar($toolbar);
        ?>
				</td>
			</tr>
		</table>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td class="sectiontableheader">
						Main options
					</td>
				</tr>
			</table>
			<table cellpadding="2" cellspacing="0" border="0" width="100%">
				<tr>
					<td width="170">
						Name
					</td>
					<td>
						<input type="text" name="p_name" maxlenght="100" value="<?php 
        echo $row->p_name;
        ?>
" />
					</td>
				</tr>
				<tr>
					<td width="170">
						Professor
					</td>
					<td>
						<?php 
        echo $lists['teacher_id'];
        ?>
					</td>
				</tr>
				<tr>
					<td>
						Description
					</td>
					<td>
						<textarea name="p_description" cols="40" rows="7"><?php 
        echo $row->p_description;
        ?>
</textarea>
					</td>
				</tr>
			</table>
			<table  cellpadding="1" cellspacing="0" border="0" width="100%">
				<tr>
					<td width="170"> Start Time </td>
					<td>	
						<table>
							<tr>		
								<td>
									<?php 
        echo $lists['from_time'];
        ?>
								</td>
								<td>
									<?php 
        echo $lists['from_minutes'];
        ?>
								</td>
							</tr>
						</table>
					</td>			
				</tr>
				<tr>	
					<td width="170"> End Time </td>
					<td>	
						<table>
							<tr>			
								<td>
									<?php 
        echo $lists['to_time'];
        ?>
								</td>
								<td>
									<?php 
        echo $lists['to_minutes'];
        ?>
								</td>
							</tr>
						</table>
					</td>		
				</tr>
			</table>

			<table cellpadding="1" <?php 
        if ($row->p_id) {
            echo 'style="display:none;"';
        }
        ?>
 cellspacing="0" border="0" width="100%">
				<tr>
					<td width="170">
						Select Date
					</td>
					<td>
						<input type="radio" name="sel_option" checked value="0" onchange="Choose_option(1);" />
					</td>
				</tr>
				<tr>
					<td>
						Select period
					</td>
					<td>
						<input type="radio" name="sel_option" value="1" onchange="Choose_option(0);" />
					</td>
				</tr>
			</table>
			<table  cellpadding="1" cellspacing="0" border="0" id="sel_date" width="100%">
				<tr>		
					<td width="170"> Choose Date </td>
					<td  valign="middle" style="vertical-align:middle ">
						<?php 
        echo JLMS_HTML::_('calendar.calendar', $row->cur_date, 'start', 'start');
        ?>
					</td>
				</tr>
			</table>
			<table  cellpadding="1" cellspacing="0" border="0" id="sel_period" style="display:none;" width="100%">	
				<tr>
					<td width="170"> Select days of week </td>
					<td valign="top">
						
							<?php 
        $weekday = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
        for ($i = 0; $i < 7; $i++) {
            echo '<br /><input type="checkbox" name="weekday[]"  value="' . $i . '" />' . $weekday[$i];
        }
        ?>
						
					</td>
				</tr>	
				<tr>
					<td width="170"> Select months </td>	
					<td valign="top">

							<?php 
        for ($i = 0; $i < 7; $i++) {
            $month_num = date("m_Y", mktime(0, 0, 0, date("m") + $i, 1, date("Y")));
            $month_text = date("F Y", mktime(0, 0, 0, date("m") + $i, 1, date("Y")));
            echo '<br /><input type="checkbox" name="monthday[]" value="' . $month_num . '" />' . $month_text;
        }
        ?>
						
					</td>
					
				</tr>
			</table>
			<table  cellpadding="1" cellspacing="0" border="0" width="100%">				
				<tr>
					<td width="170">Public</td>
					<td>
						<?php 
        echo mosHTML::yesnoRadioList('c_public', 'class="inputbox" ', $row->public);
        ?>
					</td>
				</tr>
			</table>
				
			</table>
			<input type="hidden" name="task" value="conference" />
			<input type="hidden" name="mode" value="" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="p_id" value="<?php 
        echo $row->p_id;
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="state" value="0" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        /*$controls = array();
        		$controls[] = array('href' => "javascript:submitbutton('period_cancel');", 'title' => _JLMS_CANCEL_ALT_TITLE, 'img' => 'cancel');
        		$controls[] = array('href' => "javascript:submitbutton('save_period');", 'title' => _JLMS_SAVE_ALT_TITLE, 'img' => 'save');
        		
        		JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option=$option&amp;Itemid=$Itemid&amp;task=conference&amp;mode=booking&amp;id=$course_id"));
        */
        JLMS_TMPL::CloseMT();
    }
    function ShowCartCheckOut($option, &$subscriptions, &$lists, &$procs, $user)
    {
        global $JLMS_SESSION, $JLMS_CONFIG;
        if (count($subscriptions)) {
            ?>
<script language="javascript" type="text/javascript">
	<!--
	var global_sub_proc_name = '';
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	
	function eraseCookie(name) {
		createCookie(name,"",-1);
	}
	var ProcAr = Array(<?php 
            $i = 0;
            foreach ($procs as $proc) {
                if ($i != 0 && $i != count($procs)) {
                    echo ",";
                }
                echo $proc->id;
                $i++;
            }
            ?>
);
	function jq_Check_selectRadio(rad_name, form_name) {
		var tItem = eval('document.'+form_name);
		if (tItem) {
			var selItem = eval('document.'+form_name+'.'+rad_name);
			if (selItem) {
				if (selItem.length) { var i;
					for (i = 0; i<selItem.length; i++) {
						if (selItem[i].checked) {
							if (selItem[i].value > 0 || 0 > selItem[i].value) { return selItem[i].value; } } }
				} else if (selItem.checked) { return selItem.value; } }
			return false; }
		return false;
	}
	function checkProcessor(currentProc, ProcName){
		global_sub_proc_name = ProcName;
		createCookie('proc_id', currentProc);
		createCookie('checked_proc', ProcName);
		for(i=0; i< ProcAr.length; i++){
			if (document.getElementById('billing_form'+ProcAr[i])) {
				document.getElementById('billing_form'+ProcAr[i]).style.display = 'none';
			}
		}
		if (document.getElementById('billing_form'+currentProc)) {
			document.getElementById('billing_form'+currentProc).style.display = 'block';
		}
	}
	function jlms_checkout(pressbutton) {
		var form = document.JLMS_adminForm;
		if (pressbutton == 'checkout_cart') {
			var ppp = jq_Check_selectRadio('proc_id', 'JLMS_adminForm');
			if (!ppp ) {
				alert( "<?php 
            echo 'Select payment method';
            ?>
" );
			} else {
			<?php 
            if ($JLMS_CONFIG->get('enableterms')) {
                ?>
				if (!form){
					checkProcessor(ppp, '');
				}
				if( (pressbutton == 'checkout_cart') && (document.getElementById('agreement').checked == false) ){
					alert( "<?php 
                echo addslashes(_JLMS_AGREEMENT);
                ?>
" );
				}else{
					processor = global_sub_proc_name;//readCookie('checked_proc');					
					if (eval('document.JLMS_'+processor+'')){
						eval('JLMS_'+processor+'_submit();');
					}else{						
						form.task.value = pressbutton;
						form.submit();
					}
				}
			<?php 
            } else {
                ?>
				processor = global_sub_proc_name;//readCookie('checked_proc');
				if (eval('document.JLMS_'+processor+'')){
					eval('JLMS_'+processor+'_submit();');
				}else{										
					form.task.value = pressbutton;
					//form.id.value = ttt;
					form.submit();
				}
			<?php 
            }
            ?>
			}
		}
	}
	//-->
</script>
<?php 
        }
        $custom_code = JLMS_CART_html::ShowCart($option, $subscriptions, $lists, $procs);
        if (count($subscriptions)) {
            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'];
            }
            foreach ($procs as $proc) {
                $display = 'none';
                if (count($procs) == 1) {
                    $display = 'block';
                }
                if ($sub_proc) {
                    if ($sub_proc == $proc->id) {
                        $display = 'block';
                    }
                } else {
                    if ($proc->default_p) {
                        $display = 'block';
                    }
                }
                echo '<div id="billing_form' . $proc->id . '" style="display:' . $display . ' ">';
                require_once _JOOMLMS_FRONT_HOME . '/includes/processors/' . $proc->filename . '.php';
                $newClass = "JLMS_" . $proc->filename;
                if (class_exists($newClass)) {
                    $newProcObj = new $newClass();
                    $newProcObj->show_billing_form($option, $proc, $user, $custom_code);
                } else {
                }
                echo "</div>";
            }
            JLMS_TMPL::CloseTS();
            JLMS_TMPL::OpenTS();
            ?>
			 
					<br /><?php 
            if ($JLMS_CONFIG->get('enableterms')) {
                echo "<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>";
            }
            ?>
<br />
					<?php 
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'checkout', 'btn_str' => _JLMS_CHECKOUT_ITEMS, 'btn_js' => "javascript:jlms_checkout('checkout_cart');");
            echo JLMS_ShowToolbar($toolbar, true, 'center');
            JLMS_TMPL::CloseTS();
            JLMS_TMPL::CloseMT();
        }
    }
    function show_add_event($course_id, $option, &$agenda_item, $lists)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $content = $title = '';
        $start_date = $end_date = date('Y-m-d');
        if ($agenda_item) {
            $content = $agenda_item->content;
            $title = $agenda_item->title;
            $start_date = $agenda_item->start_date;
            $end_date = $agenda_item->end_date;
            $is_time_related = $agenda_item->is_time_related;
            $show_period = $agenda_item->show_period;
        }
        ?>

<script language="javascript" type="text/javascript">
<!--
var start_date = '';
function setgood() {
	return true;
}
function submitbutton(task){
	elem = document.forms.adminForm;
	try {
		elem.onsubmit();
	} catch(e) {
		//alert(e);
	}
	if (task == 'save_agenda'){
		if (elem.jlms_agenda_title.value.length < 1){
			alert ('<?php 
        echo _JLMS_AGENDA_TITLE_INCORRECT;
        ?>
');
			elem.jlms_agenda_title.focus();
		}
		else {
			elem.submit();
		}
	}
	else{
		elem.mode.value = task;
		elem.submit();
	}	
}
//-->
</script>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="adminForm" onsubmit="setgood();">
		<table width="100%" cellpadding="2" cellspacing="0" border="0" id="jlms_item_properties">
			<tr>
				<td colspan="2">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
						<tr>
							<td width="100%" valign="middle" style="vertical-align:middle " rowspan="2" class="contentheading">
								<?php 
        echo _JLMS_AGENDA_ADD_ITEM;
        ?>
							</td>
							<td align="right" valign="top" style="vertical-align:top ">
								<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_agenda');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_agenda');");
        echo JLMS_ShowToolbar($toolbar);
        ?>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td valign="middle"><br /><?php 
        echo _JLMS_START_DATE;
        ?>
</td>
				<td valign="middle" style="vertical-align:middle "><br />
					<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr>
					<td valign="middle" style="vertical-align:middle ">
					<?php 
        echo JLMS_HTML::_('calendar.calendar', $start_date, 'start', 'start');
        ?>
					</td></tr></table>
				</td>
			</tr>
			<tr>
				<td><br /><?php 
        echo _JLMS_END_DATE;
        ?>
</td>
				<td valign="middle" style="vertical-align:middle "><br />
					<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr>
					<td valign="middle" style="vertical-align:middle ">
					<?php 
        echo JLMS_HTML::_('calendar.calendar', $end_date, 'end', 'end');
        ?>
					</td></tr></table>
				</td>
			</tr>
			<tr>
					<td valign="top" style="vertical-align:top "><br /><?php 
        echo _JLMS_IS_TIME_RELATED;
        ?>
</td>
					<td><br />
						<?php 
        if (isset($is_time_related)) {
            JLMS_HTML::_('showperiod.field', $is_time_related, $show_period);
        } else {
            JLMS_HTML::_('showperiod.field');
        }
        ?>
					</td>
				</tr>
			<tr>
				<td colspan="2" height="20"></td>
			</tr>
			
			<tr>
				<td>
				<?php 
        echo _JLMS_LIMIT_RESOURCE_TO_GROUPS;
        ?>
				</td>
				<td>
					<?php 
        echo $lists['is_limited'];
        ?>
				</td>
			</tr>

			<tr>
				<td colspan="2" height="20"></td>
			</tr>

			<tr>
				<td valign="top">
				<?php 
        echo _JLMS_LIMIT_RESOURCE_USERGROUPS;
        ?>
				</td>
				<td>
				<?php 
        echo $lists['groups'];
        ?>
				</td>
			</tr>
			<tr>
				<td valign="top" align="left"  width="20%" colspan="2">
				<?php 
        echo _JLMS_AGENDA_TITLE;
        ?>
				</td>
			</tr>	
			<tr>	
				<td colspan="2">
				<input  type="text" name="jlms_agenda_title"  size="60" value="<?php 
        echo $title;
        ?>
"  class="inputbox" />
				</td>
			</tr>
			<tr>
				<td colspan="2">
				<?php 
        echo _JLMS_DESCRIPTION;
        ?>
				</td>
			</tr>	
			<tr>
				<td  colspan="2">
				<?php 
        echo jlms_editorArea('editor1', $content, 'jlms_agenda_detail', '100%;', '250', '40', '20');
        ?>
				</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="agenda" />
		<input type="hidden" name="mode" value="event_save" />
		<?php 
        if (isset($agenda_item->agenda_id)) {
            echo "<input type='hidden' name='edit' value='yes' />";
            echo "<input type='hidden' name='agenda_id' value='" . $agenda_item->agenda_id . "' />";
        }
        ?>
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
		</form>
	<?php 
    }
    function showLPath_MainPage($course_id, $lpath_id, $option, &$lpath_data, &$lpath_contents, &$quizzes_data)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $lp_params = new JLMSParameters($lpath_data->lp_params);
        $show_lpath_contents_at_the_left = $lp_params->get('navigation_type', 0) ? true : false;
        $is_quiz = count($quizzes_data) ? true : false;
        $is_drag_drop = false;
        $c_time_limit = 0;
        $inside_lp = 1;
        $c_slide = false;
        //pri starte quiza
        $c_generated_panel = true;
        // Contents of quiz will be generated on 'satrt' action
        $c_slide_update = false;
        $quiz_id = 0;
        foreach ($quizzes_data as $qd) {
            $quiz_id = $qd->c_id;
            foreach ($qd->panel_data as $q) {
                if ($q->c_type == 4) {
                    $is_drag_drop = true;
                    break;
                }
            }
        }
        require_once _JOOMLMS_FRONT_HOME . "/includes/ajax_features.class.php";
        // preloading QUIZ languge (28.02.2007 new method) (all quizzes messages now in global quiz language)
        global $JLMS_LANGUAGE;
        JLMS_require_lang($JLMS_LANGUAGE, 'quiz.lang', $JLMS_CONFIG->get('default_language'));
        require dirname(__FILE__) . '/includes/quiz/quiz_language.php';
        global $jq_language;
        $e = true;
        // enable force echo
        $AF = new JLMS_Ajax_Features();
        $AF->set('c_slide', $c_slide);
        $AF->set('c_generated_panel', $c_generated_panel);
        $AF->set('c_slide_update', $c_slide_update);
        $AF->set('quiz_id', $quiz_id);
        if ($is_quiz) {
            $AF->GetInclude_Msgs($e);
        }
        $AF->JS_open($e);
        $AF->GetFunc_JS_in_array($e);
        $AF->GetFunc_RFE($e);
        if ($is_quiz) {
            $document =& JFactory::getDocument();
            $document->addStyleSheet($JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms/includes/quiz/templates/joomlaquiz_lms_template/jq_template.css');
            echo "function jlms_gotoQuestion(qid) { if (stu_step_type == 5 && user_unique_id && quiz_id) { jlms_SwitchOpenedContents();JQ_gotoQuestionOn(qid);} }";
            $AF->QUIZ_JS_DrDr_Code($e);
            $AF->QUIZ_preloadMsgs($e, $jq_language);
            $AF->QUIZ_doInitialize($e, $JLMS_CONFIG->getCfg('live_site') . "/index.php?tmpl=component&option={$option}&inside_lp={$inside_lp}&Itemid={$Itemid}&jlms=1&task=quiz_ajax_action&id={$course_id}", '');
            /* We must override this func (to reduce JS weigth)
            			$AF->QUIZ_MakeRequest($e); */
            ?>
function jq_MakeRequest(url, do_clear) {
	if (do_clear == 1) {
		jq_showLoading();
	}
	quiz_blocked == 1;
	jlms_MakeRequest('jq_AnalizeRequest', url, 'quiz');
}			
<?php 
            $req_tasks = array('start', 'seek_quest', 'review_start', 'review_next', 'review_finish', 'next', 'no_attempts', 'email_results', 'time_is_up', 'finish', 'results', 'failed');
            $AF->QUIZ_AnalizeRequest($e, 'jq_AnalizeRequest', $req_tasks);
            $AF->QUIZ_releaseblock($e);
            $AF->QUIZ_StartTickTack($e);
            $AF->QUIZ_ContinueTickTack($e);
            //$AF->QUIZ_StartQuizOn($e);
            $AF->QUIZ_StartQuizOn($e);
            $AF->QUIZ_StartQuiz($e);
            $AF->QUIZ_GoToQuestionOn($e);
            $AF->QUIZ_GoToQuestion($e);
            $AF->QUIZ_EmailResults($e);
            $AF->QUIZ_StartReview($e);
            $AF->QUIZ_ReviewNext($e);
            $AF->QUIZ_ReviewPrev($e);
            $AF->QUIZ_Check_selectRadio($e);
            $AF->QUIZ_Check_selectCheckbox($e);
            $AF->QUIZ_Check_valueItem($e);
            $AF->QUIZ_QuizNextOn($e);
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
            if ($inside_lp && !$show_lpath_contents_at_the_left) {
                $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');");
            } else {
                if ($c_slide && !$show_lpath_contents_at_the_left) {
                    $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
                }
            }
            $m_str_no_skip = JLMS_ShowToolbar($toolbar);
            //8.10.08 - (Max) - dva toolbars dlia skip i standart
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
            $toolbar[] = array('btn_type' => 'skip', 'btn_js' => "javascript:JQ_gotoQuestion(__skip__);void(0);");
            if ($inside_lp && !$show_lpath_contents_at_the_left) {
                $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');");
            } else {
                if ($c_slide && !$show_lpath_contents_at_the_left) {
                    $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
                }
            }
            $m_str_skip = JLMS_ShowToolbar($toolbar);
            $AF->QUIZ_QuizContinue($e, $m_str_no_skip, $m_str_skip);
            $cf_url = "'&atask=finish_stop&quiz='+quiz_id+'&stu_quiz_id='+stu_quiz_id";
            $AF->QUIZ_QuizContinueFinish($e, $cf_url);
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
            if ($inside_lp && !$show_lpath_contents_at_the_left) {
                $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');");
            } else {
                if ($c_slide && !$show_lpath_contents_at_the_left) {
                    $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
                }
            }
            $m_str = JLMS_ShowToolbar($toolbar);
            $AF->QUIZ_QuizBack($e, $m_str);
            $AF->QUIZ_Next($e);
            $AF->QUIZ_showLoading($e);
            /*
            			$AF->QUIZ_UpdateTaskDiv_htm($e);
            			$AF->QUIZ_UpdateTaskDiv($e, $c_slide);*/
            // We must override task div functionality for quiz
            ?>
function jq_UpdateTaskDiv_htm(htm_txt) {
	getObj('jlms_lpath_menu').innerHTML = htm_txt;
}
function jq_UpdateTaskDiv(task) {

	switch (task) {
		case 'start':
			getObj('jlms_lpath_menu').innerHTML = jq_StartButton('jq_StartQuizOn()', mes_quiz_start);
		break;
		case 'next':
			getObj('jq_quest_num_container').innerHTML = mes_quest_number.replace("{X}", cur_quest_num).replace("{Y}", quiz_count_quests);
			getObj('jq_quest_num_container').style.visibility = "visible";
			getObj('jq_points_container').innerHTML = mes_quest_points.replace("{X}", cur_quest_score);
			getObj('jq_points_container').style.visibility = "visible";
			<?php 
            if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
                ?>
			if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; }
			<?php 
            }
            ?>
		break;
		case 'review_next':
			getObj('jq_quest_num_container').innerHTML = mes_quest_number.replace("{X}", cur_quest_num).replace("{Y}", quiz_count_quests);
			getObj('jq_quest_num_container').style.visibility = "visible";
			getObj('jq_points_container').innerHTML = mes_quest_points.replace("{X}", cur_quest_score);
			getObj('jq_points_container').style.visibility = "visible";
		break;
		case 'continue':
			<?php 
            if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
                ?>
			if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; }
			<?php 
            }
            ?>
		break;
		case 'continue_finish':
			<?php 
            if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
                ?>
			if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; }
			<?php 
            }
            ?>
		break;
		case 'finish':
			getObj('jlms_lpath_menu').innerHTML = lp_menu_item_contents;
			getObj('jq_quest_num_container').style.visibility = 'hidden';
			getObj('jq_points_container').style.visibility = 'hidden';
			<?php 
            if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
                ?>
			if (getObj('progress_bar')) { getObj('progress_bar').style.display = "none"; }
			<?php 
            }
            ?>
		break;
		case 'clear':
			getObj('jlms_lpath_menu').innerHTML = '';
			getObj('jq_quest_num_container').style.visibility = 'hidden';
			getObj('jq_points_container').style.visibility = 'hidden';
		break;
	}
<?php 
            if ($c_slide) {
                ?>
	
	if (result_is_shown == 1) { jq_ShowPanel(); }
<?php 
            }
            ?>
}
<?php 
            $AF->QUIZ_NextButton($e);
            $AF->QUIZ_ContinueButton($e);
            $AF->QUIZ_StartButton($e);
            $AF->QUIZ_BackButton($e);
            if ($c_slide) {
                $AF->QUIZ_ShowPanel_go($e);
                $AF->QUIZ_HidePanel_go($e);
                $AF->QUIZ_ShowPanel($e);
            }
        }
        $AF->GetFunc_JS_URLencode($e);
        $AF->GetFunc_JS_TRIM_str($e);
        $AF->JS_close($e);
        $lpc_btn = $AF->Get_LPContents_btn(false);
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'next', 'btn_js' => "javascript:ajax_action('next_lpathstep');");
        if (!$show_lpath_contents_at_the_left) {
            $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');");
        }
        $rs = JLMS_ShowToolbar($toolbar);
        $rs = str_replace('"components/com_joomla_lms', '"' . $JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms', $rs);
        $lpc_btn = str_replace('/', '\\/', str_replace('"', "\\\"", $rs));
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var timer_KeepAL = 990066;
<?php 
        /* variable timer_keepAl was added 21.08.2007 - for keeping joomla session whilst SCORM playing */
        ?>
var lp_menu_item_contents = "<?php 
        echo $lpc_btn;
        ?>
";
var jlms_contents_visible = 0;
var jlms_contents_visible_only = 0;
var jlms_lpath = <?php 
        echo $lpath_id;
        ?>
;
var jlms_course = <?php 
        echo $course_id;
        ?>
;
function ajax_action(pressbutton) {
	if ((jlms_blocked == 1) && (pressbutton != 'contents_lpath') && (pressbutton != 'get_document')) {
		if (jlms_allow_pending_task == 1) {
			if (jlms_is_pending_task == 0) {
				jlms_is_pending_task = 1;
				jlms_pending_task = pressbutton;
			}
		}
	} else {
		jlms_blocked = 1;
		if ((pressbutton != 'contents_lpath') && (pressbutton != 'get_document')) {
			$('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'});
		}
		switch (pressbutton) {
			case 'lpath_restart':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=restart_lpath&id='+jlms_lpath, 'lpath');
			break;
			case 'start_lpath':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=start_lpath&id='+jlms_lpath, 'lpath');
			break;
			case 'next_lpathstep':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=next_lpathstep&id='+jlms_lpath+'&step_id='+stu_step_id, 'lpath');
			break;
			case 'prev_lpathstep':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=prev_lpathstep&id='+jlms_lpath+'&step_id='+stu_step_id, 'lpath');
			break;
			case 'lpath_seek':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=seek_lpathstep&id='+jlms_lpath+'&step_id='+seek_step_id, 'lpath');
			break;
			case 'contents_lpath':
				jlms_blocked = 0;
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchContents();
<?php 
        } else {
            ?>
				jlms_SwitchContents2();
<?php 
        }
        ?>
			break;
			case 'get_document':
				jlms_blocked = 0;
				/*window.open('index.php?tmpl=component&no_html=1&option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
&task=show_lpath&action=get_lpath_doc&user_unique_id=' + user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course+'&doc_id='+get_doc_id+'&step_id='+stu_step_id
				,null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");*/
				window.location.href = '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/index.php?tmpl=component&no_html=1&option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
&task=show_lpath&action=get_lpath_doc&user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course+'&doc_id='+get_doc_id+'&step_id='+stu_step_id;
				//return true;
				void(0);
			break;
			default:
				jlms_blocked = 0;
			break;
		}
	}
}
<?php 
        if (JLMS_mootools12()) {
            $fxFunc = 'Tween';
        } else {
            $fxFunc = 'Style';
        }
        $additon_js = '
var mySlide_contents2;
var mySlide_contents2_width_start = 0;
var mySlide_contents2_width_end = 0;
var mySlide_contents3;
var mySlide_contents2_mode = 2;
var mySlide_contents3_margin_start = 0;
var mySlide_contents3_margin_end = 10;
var mySlide_contents4;
var winScroller2 = new Fx.Scroll(window);
function jlms_prepare_el_mySlide_contents2() {
	mySlide_contents2 = new Fx.' . $fxFunc . '(\'jlms_lpath_contents_container\', \'width\');
	mySlide_contents2_width_start = $(\'jlms_lpath_contents_container\').getStyle(\'width\');
	mySlide_contents3_margin_start = $(\'jlms_lpath_descr\').getStyle(\'margin-left\');
	mySlide_contents3 = new Fx.' . $fxFunc . '(\'jlms_lpath_descr\', \'margin-left\');
	mySlide_contents4 = new Fx.' . $fxFunc . '(\'jlms_lpath_completion_msg_container\', \'margin-left\');
	$(\'jlms_lpath_completion_msg_container\').setStyles({\'margin-left\': \'0\'});
	$(\'jlms_lpath_descr\').setStyles({\'margin-left\': \'0\'});
	//mySlide_contents2.hide();
	//$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'});
}
function jlms_SwitchContents2() {
	if (mySlide_contents2_mode == 2) {
		$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'});
		mySlide_contents2.start(0, mySlide_contents2_width_start);
		mySlide_contents3.start(0, mySlide_contents3_margin_start);
		mySlide_contents4.start(0, mySlide_contents3_margin_start);
		mySlide_contents2_mode = 1;
		$(\'left_nav_collapser_container\').setStyles({visibility: \'visible\',display: \'\'});
	} else if (mySlide_contents2_mode == 1) {
		mySlide_contents2.start(mySlide_contents2_width_end);
		mySlide_contents3.start(mySlide_contents3_margin_end);
		mySlide_contents4.start(mySlide_contents3_margin_end);
		$(\'left_nav_collapser_container\').setStyles({visibility: \'hidden\',display: \'none\'});
		mySlide_contents2_mode = 0;
	} else {
		$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'});
		mySlide_contents2.start(mySlide_contents2_width_start);
		mySlide_contents3.start(mySlide_contents3_margin_start);
		mySlide_contents4.start(mySlide_contents3_margin_start);
		mySlide_contents2_mode = 1;
		$(\'left_nav_collapser_container\').setStyles({visibility: \'visible\',display: \'\'});
	}
}
';
        if (JLMS_mootools12()) {
            $setHTML = 'set(\'html\',';
        } else {
            $setHTML = 'setHTML(';
        }
        $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js);
        $domready = '
jlms_prepare_el_mySlide_contents2();
';
        $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
        ?>


<?php 
        if ($JLMS_CONFIG->get('web20_effects', true) && !$show_lpath_contents_at_the_left) {
            $additon_js = '
var mySlide_contents;
function jlms_prepare_el_mySlide_contents() {
	mySlide_contents = new Fx.Slide(\'jlms_lpath_contents_container\');
	mySlide_contents.hide();
	$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'});
}
';
            $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js);
            $domready = '
jlms_prepare_el_mySlide_contents();
';
            $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
            ?>

function jlms_SwitchOpenedContents() {
	if ($defined(mySlide_contents)) {
		var type = typeof mySlide_contents;
		if (type == 'object') {
			mySlide_contents.hide();
		}
	} else {
		jlms_prepare_el_mySlide_contents();
	}
}
function jlms_SwitchContentsOnly(par) {
	if (par == 'show') {
		mySlide_contents.slideIn();
	} else {
		mySlide_contents.hide();
	}
}
function jlms_SwitchContents() {
	mySlide_contents.toggle();
}
<?php 
        } elseif ($show_lpath_contents_at_the_left) {
            ?>
function jlms_SwitchOpenedContents() {
	jlms_SwitchContents();
}
function jlms_SwitchContentsOnly(par) {
	if (par == 'show') {
		if (jlms_contents_visible == 1) {
			
		} else {
			var vis_style1 = 'visible';
			var disp_style1 = '';
			var jlcc = getObj('jlms_lpath_contents_container');
			jlcc.style.visibility = vis_style1;
			jlcc.style.display = disp_style1;
		}
	}
}
function jlms_SwitchContents() {
	if (jlms_contents_visible == 1) {
		
	} else {
		var vis_style1 = 'visible';
		var disp_style1 = '';
		var vis_style2 = 'visible';
		var disp_style2 = '';
		var jlcc = getObj('jlms_lpath_contents_container');
		var jldc = getObj('jlms_lpath_descr');
		jlcc.style.visibility = vis_style1;
		jlcc.style.display = disp_style1;
		jldc.style.visibility = vis_style2;
		jldc.style.display = disp_style2;
		if (jlms_contents_visible == 1) { jlms_contents_visible = 0;}
		else { jlms_contents_visible = 1; }
	}
}
<?php 
        } else {
            ?>
function jlms_SwitchOpenedContents() {
	if (jlms_contents_visible == 1) {
		jlms_SwitchContents();
	}
}
function jlms_SwitchContentsOnly(par) {
	if (par == 'show') {
		var vis_style1 = 'visible';
		var disp_style1 = '';
	} else {
		var vis_style1 = 'hidden';
		var disp_style1 = 'none';
	}
	var jlcc = getObj('jlms_lpath_contents_container');
	jlcc.style.visibility = vis_style1;
	jlcc.style.display = disp_style1;
}
function jlms_SwitchContents() {
	var vis_style1 = 'visible';
	var disp_style1 = '';
	var vis_style2 = 'hidden';
	var disp_style2 = 'none';
	if (jlms_contents_visible == 1) {
		var vis_style2 = 'visible';
		var disp_style2 = '';
		var vis_style1 = 'hidden';
		var disp_style1 = 'none';
	}
	var jlcc = getObj('jlms_lpath_contents_container');
	var jldc = getObj('jlms_lpath_descr');
	jlcc.style.visibility = vis_style1;
	jlcc.style.display = disp_style1;
	jldc.style.visibility = vis_style2;
	jldc.style.display = disp_style2;
	if (jlms_contents_visible == 1) { jlms_contents_visible = 0;}
	else { jlms_contents_visible = 1; }
}
<?php 
        }
        ?>
function jlms_SwitchContentsOnly2(par) {
	if (par == 'show') {
		mySlide_contents2.slideIn();
	} else {
		mySlide_contents2.hide();
	}
}
var stu_step_id = 0;
var stu_last_cur_id = 0;
var stu_step_type = 0;
var jlms_blocked = 0;
var jlms_is_pending_task = 0;
var jlms_pending_task = '';
var jlms_allow_pending_task = 1;
var seek_step_id = 0;
var get_doc_id = 0;
var lp_url_prefix = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/index.php?option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
';
var lp_user_unique_id = '';
var user_start_id = 0;
var mCfg_live_site = '';
function jlms_MakeRequest(onstate, url, mr_type) {
	var http_request = false;
	if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	} else if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { eval(onstate+'(http_request);') };
	var lp_url_prefix2 = '';
	var post_target = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/index.php?jlms=1';
	if (mr_type == 'lpath') {
		jlms_blocked == 1;
		jlms_showLoading();
		lp_url_prefix2 = 'jlms=1&option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
&task=show_lpath&user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course;
		post_target = mCfg_live_site + lp_url_prefix;
	} else if (mr_type == 'quiz'){
		lp_url_prefix2 = 'user_unique_id=' + user_unique_id + '&lp_user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&lpath_id='+jlms_lpath+'&step_id='+stu_step_id;
		post_target = mCfg_live_site + url_prefix;
	}
	//http_request.open('GET', mCfg_live_site + lp_url_prefix + lp_url_prefix2 + url, true);
	//http_request.send(null);
	http_request.open("POST", post_target, false);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", lp_url_prefix2.length + url.length);
	//http_request.setRequestHeader("Connection", "close"); - if close - bug in IE7 - it hungs up
	http_request.send(lp_url_prefix2 + url);
	if (mr_type == 'lpath') {
		jlms_allow_pending_task = 0;
	}
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			jlms_WStatus('');
			
			if(http_request.responseXML.documentElement == null){
				try {
					//alert(http_request.responseXML.parseError.reason);
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response = http_request.responseXML.documentElement;
			var task = jlms_RFE(response,'task');
			jlms_blocked = 1;
			jlms_allow_pending_task = 1;
			setTimeout("jlms_releaseBlock()", 1000);
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
			jlms_SwitchOpenedContents();
<?php 
        }
        ?>
			switch (task) {
				case 'start_restart':
				case 'start':
					if ($('joomlalms_sys_message_container')) {
		                //hide course enrollment message (if autoredirect to lpath enabled)
		                $('joomlalms_sys_message_container').setStyles({visibility: 'hidden',display: 'none'});
					}
					lp_user_unique_id = jlms_RFE(response,'user_unique_id');
					user_start_id = jlms_RFE(response,'user_start_id');
					stu_step_type = jlms_RFE(response,'step_type');
					if (stu_step_type == 5) {
						quiz_blocked = 0;
						timer_sec = 0;
						stop_timer = 0;
						quiz_id = jlms_RFE(response,'step_item_id');
					}
					prev_step_type = stu_step_type;
					stu_step_id = jlms_RFE(response,'step_id');
					stu_last_cur_id = stu_step_id;
					prev_step_id = stu_step_id;
					jlms_ChangeFrontPage(response);
					if (task == 'start_restart') {
						$('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'});
						jlms_setPendingSteps('cancel',response);
						jlms_setPendingSteps('quiz',response);
					}
					jlms_setPendingSteps('pending',response);
					jlms_setPendingSteps('accept',response);
				break;
				case 'restart':
					$('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'});
					jlms_ChangeFrontPage(response);
					getObj('jlms_lpath_contents').innerHTML = jlms_RFE(response,'contents_data');
					jlms_setPendingSteps('pending',response);
				break;
				case 'check_cond':
					lp_user_unique_id = jlms_RFE(response,'user_unique_id');
					user_start_id = jlms_RFE(response,'user_start_id');	
				
					//stu_step_id = jlms_RFE(response,'step_id');
					//prev_step_id = stu_step_id;
					jlms_ChangeFrontPage(response);
					jlms_changePendingSteps();
					//jlms_setPendingSteps('pending',response);
					jlms_setPendingSteps('accept',response);
				break;
				case 'seek_step':
				case 'next_step':
					user_unique_id = '';
					quiz_id = 0;
					stu_step_type = jlms_RFE(response,'step_type');
					if (stu_step_type == 5) {
						quiz_id = jlms_RFE(response,'step_item_id');
					}
					prev_step_type = stu_step_type;
					stu_step_id = jlms_RFE(response,'step_id');
					prev_step_id = stu_step_id;
					jlms_ChangeFrontPage(response);
					jlms_setPendingSteps('pending',response);
					jlms_setPendingSteps('accept',response);
				break;
				case 'finish_lpath_quick':// without break;
					lp_user_unique_id = jlms_RFE(response,'user_unique_id');
					user_start_id = jlms_RFE(response,'user_start_id');
				case 'finish_lpath':
					jlms_ChangeFrontPage(response);

					var is_show_cmsg = jlms_RFE(response,'show_completion_msg');
					if (is_show_cmsg == 1 || is_show_cmsg == '1') {
						var cmsg_txt = jlms_RFE(response,'lpath_completion_msg');
						$('jlms_lpath_completion_msg_container').<?php 
        echo $setHTML;
        ?>
cmsg_txt);
						$('jlms_lpath_completion_msg_container').setStyles({visibility: 'visible',display: ''});
					}

					jlms_setPendingSteps('accept',response);
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
					jlms_SwitchContentsOnly('show');
<?php 
        }
        ?>
				break;
				case 'failed':
					getObj('jlms_lpath_descr').innerHTML = '<div class="joomlalms_sys_message"><?php 
        echo str_replace('/', '\\/', _JLMS_LPATH_LOAD_DATA_ERROR);
        ?>
<\/div>';
					//getObj('jlms_lpath_menu').innerHTML = jlms_RFE(response,'menu_contents');
				break;
				default:
					getObj('jlms_lpath_descr').innerHTML = '<div class="joomlalms_sys_message"><?php 
        echo str_replace('/', '\\/', _JLMS_LPATH_LOAD_DATA_ERROR);
        ?>
<\/div>';
					getObj('jlms_lpath_menu').innerHTML = '';
				break;
			}
		} else {
			alert('Bad Request status');
		}
	}
}
function jlms_RFE(response,elem_name) {
	return response.getElementsByTagName(''+elem_name)[0].firstChild ? response.getElementsByTagName(''+elem_name)[0].firstChild.data : 0;
}
var is_collapser_timer = 0;
<?php 
        echo JLMSCSS::h2_js();
        //JLMSCSS_h2_js function
        ?>
function jlms_ChangeFrontPage(response) {
	var head_data = jlms_RFE(response,'step_name');
	if (head_data != '') {
		getObj('jlms_lpath_head').innerHTML = JLMSCSS_h2_js(head_data);
	}
	var tmp_div = document.createElement("div");
	tmp_div.id = 'temporary_div_tst';
	tmp_div.innerHTML = jlms_RFE(response,'step_descr');
	tmp_div.style.width = '100%';
	getObj('jlms_lpath_descr').innerHTML = '';
	getObj('jlms_lpath_descr').appendChild(tmp_div);

	//getObj('jlms_lpath_descr').innerHTML = jlms_RFE(response,'step_descr');
	getObj('jlms_lpath_menu').innerHTML = jlms_RFE(response,'menu_contents');
	var temp_script = jlms_RFE(response,'step_exec_script');
	if (temp_script == 1 || temp_script == '1') {
		var exec_script = jlms_RFE(response,'step_exec_script_contents');
		var new_script_el = document.createElement("script");
		new_script_el.text = exec_script;
		new_script_el.type="text/javascript";
		document.getElementsByTagName("head")[0].appendChild(new_script_el);
		//eval(exec_script);
	}
<?php 
        if ($show_lpath_contents_at_the_left) {
            ?>
	jlms_ChangeCollapserHeight(0);
<?php 
        }
        ?>
	if (window.set_height) {
		set_height();
	}
	jlms_ScrollBrowserWindow();
	setTimeout("jlms_ScrollBrowserWindow()", 300);
}
function jlms_ScrollBrowserWindow() {
	window.scrollTo(0,$('jlms_topdiv').getTop());
}
function jlms_ChangeCollapserHeight(by_timer) {
	var leftnav_h, main_st_h = 0;
	leftnav_h = $('jlms_lpath_contents_container').getStyle('height').toInt();
	main_st_h = $('jlms_lpath_descr').getStyle('height').toInt();
	if (leftnav_h < main_st_h) {
		leftnav_h = main_st_h;
	}
	$('left_nav_collapser_container').setStyle('height', leftnav_h+'px');
	if (is_collapser_timer == 1) {
		if (by_timer == 1) {
			setTimeout("jlms_ChangeCollapserHeight(1)", 300);
		}
	} else {
		is_collapser_timer = 1;
		setTimeout("jlms_ChangeCollapserHeight(1)", 300);
	}
}
function jlms_releaseBlock() {
	jlms_blocked = 0;
	if (jlms_is_pending_task == 1) {
		if (jlms_pending_task != '') {
			jlms_is_pending_task = 0;
			eval("ajax_action('"+jlms_pending_task+"')");
			jlms_pending_task = '';
		}
	}
}
function jlms_showLoading() {
	jlms_SwitchContentsOnly('hide');
	getObj('jlms_lpath_descr').innerHTML = '<br \/><br \/><center><img src="<?php 
        echo str_replace('/', '\\/', $JLMS_CONFIG->get('live_site'));
        ?>
\/components\/com_joomla_lms\/lms_images\/loading.gif" height="32" width="32" border="0" alt="loading" \/><\/center>';
}
function jlms_setPendingSteps(step_type, response) {
	var st = 'pending_steps';
	var prfx = 'jlms_step_';
	var is_lp = true;
	switch (step_type) {
		case 'pending': st = 'pending_steps'; break;
		case 'accept': st = 'completed_steps'; break;
		case 'cancel': st = 'incompleted_steps'; break;
		case 'quiz': st = 'incompleted_quests'; prfx = 'quest_result_'; is_lp = false; break;
	}
	if (is_lp) {
		var steps_ids;
		steps_ids = jlms_RFE(response,st);
		var arr = steps_ids.split(',');
		var i = 0;
		while (i < arr.length ) {
			if (getObj(prfx+arr[i])) {
				getObj(prfx+arr[i]).innerHTML = '<img class=\'JLMS_png\' src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'.png" height="16" width="16" border="0" alt="'+step_type+'" />';
			}
			i ++;
		}
		if (step_type == 'pending') {
			var r = getObj(prfx+stu_step_id);
			if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'_cur.png" height="16" width="16" border="0" alt="'+step_type+'" />';}
			if (stu_last_cur_id != stu_step_id) {
				r = getObj(prfx+stu_last_cur_id);
				if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'.png" height="16" width="16" border="0" alt="'+step_type+'" />';}
			}
			stu_last_cur_id = stu_step_id;
		}
	} else {
		var steps_ids;
		steps_ids = jlms_RFE(response,st);
		var arr = steps_ids.split(',');
		var i = 0;
		while (i < arr.length ) {
			if (getObj(prfx+arr[i])) {
				getObj(prfx+arr[i]).innerHTML = '-';
			}
			i ++;
		}
	}
}
function jlms_changePendingSteps() {
	r = getObj('jlms_step_'+stu_last_cur_id);
	if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending.png" height="16" width="16" border="0" alt="pending" />';}
}
JLMS_preloadImages('<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/loading.gif','<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/buttons/btn_back.png','<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/buttons/btn_restart.png', '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending.png', '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png');
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        //$toolbar = array();
        //$toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:ajax_action('start_lpath');");
        JLMS_TMPL::ShowHeader('lpath', '', $hparams);
        //JLMS_TMPL::ShowToolbar($toolbar, 'right', true, $lpath_data->lpath_name, 2);
        //JLMS_TMPL::CloseMT();
        JLMS_TMPL::OpenTS();
        ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
				<td align="left" valign="middle" id="jlms_lpath_head" width="100%">
					<?php 
        echo JLMSCSS::h2($lpath_data->lpath_name);
        ?>
				</td>
				<td align="right" style="text-align:right " valign="middle" id="jlms_lpath_menu">
					<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:void(0);");
        //$toolbar[] = array('btn_type' => 'start', 'btn_js' => sefrelToAbs("index.php?option=$option&amp;Itemid=$Itemid&amp;task=show_lpath_nojs&amp;course_id=$course_id&amp;id=$lpath_id&amp;action=start_lpath"));
        //no-js functionality commented (version 1.1.0) due to the lots of bugs, lack of usage/testing
        echo JLMS_ShowToolbar($toolbar);
        ?>
				</td>
			</tr>
		</table>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::OpenTS();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:ajax_action('start_lpath');");
        $rs = JLMS_ShowToolbar($toolbar);
        $rs = str_replace('"components/com_joomla_lms', '"' . $JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms', $rs);
        $lpc_btn = str_replace('/', '\\/', str_replace('"', "\\\"", $rs));
        $additon_js = '
var lp_menu_item_contents_pre = "' . $lpc_btn . '";
';
        $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js);
        $domready = '
$(\'jlms_lpath_menu\').innerHTML = lp_menu_item_contents_pre;

if (document.constructor) {
	document.constructor.prototype.write = function() { };
} else {
	document.write = function() { };
}
';
        $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
        if ($show_lpath_contents_at_the_left) {
            ?>
		<div id="jlms_lpath_contents_container" style="visibility:hidden; display:none; width:203px; float:left; overflow-x:hidden; margin-right: -1px">
		<?php 
            global $JLMS_CONFIG;
            $JLMS_CONFIG->set('show_lpath_contents_at_the_left', $show_lpath_contents_at_the_left);
            ?>

			<?php 
            JLMS_course_lpathstu_html::showLPath_contents($lpath_contents, $quizzes_data);
            ?>
<br />
		</div>
		<div id="left_nav_collapser_container" style="width:7px; float:left; overflow-x:hidden; visibility:hidden; display:none ">
			<a id="left_nav_collapser" href="javascript:jlms_SwitchContents2();"><img class="collapse_button_maximized_xxx" border="1" width="1" height="1" src="<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/spacer.png"/></a>
		</div>
		<div id="jlms_lpath_completion_msg_container" class="jlms_lpath_completion_message" style="visibility:hidden; display:none; margin-left:210px; width:auto;">
			<!--x-->
		</div>
		<div id="jlms_lpath_descr" style="margin-left:210px; width:auto;">
			<?php 
            $text = JLMS_ShowText_WithFeatures($lpath_data->lpath_description);
            echo $text;
            ?>
		</div>
		<br />
<?php 
        } else {
            ?>
		<div id="jlms_lpath_completion_msg_container" class="jlms_lpath_completion_message" style="visibility:hidden; display:none">
			<!--x-->
		</div>
		<div id="jlms_lpath_contents_container" style="visibility:hidden; display:none; width:100%">
			<?php 
            JLMS_course_lpathstu_html::showLPath_contents($lpath_contents, $quizzes_data);
            ?>
<br />
		</div>
		<div id="jlms_lpath_descr" style="width:100%">
			<?php 
            $text = JLMS_ShowText_WithFeatures($lpath_data->lpath_description);
            echo $text;
            ?>
		</div>
<?php 
        }
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function addItemToLPath($lpath_id, $course_id, $option, &$my_documents, &$my_links, &$my_quizzes, &$my_scorms, &$lists, $parent)
    {
        global $Itemid, $JLMS_CONFIG;
        ?>
<script language="javascript" type="text/javascript">
<!--
function jlms_get_kol_selected(fff) {
	var kol_sel=0;
	selItem=fff['cid[]'];
	var rrr='';
	if (selItem) {
		if (selItem.length) { var i;
			for (i = 0; i<selItem.length; i++) {
				if (selItem[i].checked) { kol_sel++; }
			}
		} else if (selItem.checked) { kol_sel++; }
	}
	return kol_sel;
}
function submitbutton_doc(pressbutton) {
	var form = document.docForm;
	var kol_docs = jlms_get_kol_selected(form);
	if ( (pressbutton == 'lpath_add_doc') && (kol_docs == 0) ) {
		alert( "<?php 
        echo _JLMS_LPATH_SELECT_DOCS;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_link(pressbutton) {
	var form = document.linkForm;
	var kol_links = jlms_get_kol_selected(form);
	if ( (pressbutton == 'lpath_add_link') && (kol_links == 0) ) {
		alert( "<?php 
        echo _JLMS_LPATH_SELECT_LINKS;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_quiz(pressbutton) {
	var form = document.quizForm;
	var kol_quizzes = jlms_get_kol_selected(form);
	if ( (pressbutton == 'lpath_add_quiz') && (kol_quizzes == 0) ) {
		alert( "<?php 
        echo _JLMS_LPATH_SELECT_QUIZZES;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_scorm(pressbutton) {
	var form = document.scormForm;
	var kol_scorms = jlms_get_kol_selected(form);
	if ( (pressbutton == 'lpath_add_scorm') && (kol_scorms == 0) ) {
		alert( "<?php 
        echo _JLMS_LPATH_SELECT_SCORMS;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}

function submitbutton_chap(pressbutton) {
	var form = document.chapForm;
	if ( (pressbutton == 'lpath_add_chapter') && (form.step_name.value == '') ) {
		alert( "<?php 
        echo _JLMS_LPATH_ENTER_CHAP_NAME;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_content(pressbutton) {
	var form = document.contentForm;
	try {
		form.onsubmit();
	} catch(e) {
		//alert(e);
	}
	if ( (pressbutton == 'lpath_add_content') && (form.step_name.value == '') ) {
		alert( "<?php 
        echo _JLMS_LPATH_ENTER_CONTENT_NAME;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
//-->
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('lpath', '', $hparams);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="swapParent">
			<input name="parent" type="hidden" value="<?php 
        echo $parent;
        ?>
" />
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="add_lpath_step" />
			<input type="hidden" name="id" value="<?php 
        echo $lpath_id;
        ?>
" />
			<input type="hidden" name="lpath_id" value="<?php 
        echo $lpath_id;
        ?>
" />
			<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
		</form>
	<?php 
        echo JLMSCSS::h2(_JLMS_LPATH_TITLE_ADD_ITEMS);
        $tabs = new JLMSTabs(0);
        echo $tabs->startPane("JLMS");
        echo $tabs->startTab(_JLMS_LPATH_CONTENT, "jlmstab6");
        echo JLMSCSS::h2(_JLMS_LPATH_TITLE_ADD_CONTENT);
        ?>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
		<tr>
			<td align="right">
			<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton_content('lpath_add_content');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton_content('cancel_lpath_step');");
        echo JLMS_ShowToolbar($toolbar);
        ?>
			</td>
		</tr>
	</table>
				<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="contentForm" onsubmit="setgood();">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_item_properties">
						<tr>
							<td width="15%"><br /><?php 
        echo _JLMS_ENTER_NAME;
        ?>
</td>
							<td>
								<br /><input type="text" name="step_name" style="width:260px" value="" />
							</td>
						</tr>
						<tr>
							<td width="15%"><br /><?php 
        echo _JLMS_PLACE_IN;
        ?>
</td>
							<td><br /><?php 
        echo $lists['lpath_chaps1'];
        ?>
</td>
						</tr>
						<tr>
							<td><br /><?php 
        echo _JLMS_ORDERING;
        ?>
</td>
							<td colspan="2"><br /><?php 
        echo $lists['lpath_order'];
        ?>
</td>
						</tr>
						<tr>
							<td align="left" valign="top" style="vertical-align:top "><br /><?php 
        echo _JLMS_SHORT_DESCRIPTION;
        ?>
</td>
							<td colspan="2"><br /><textarea class="inputbox" name="step_shortdescription" cols="50" rows="3"></textarea></td>
						</tr>
						<tr>
							<td colspan="3" align="left" style="text-align:left "><br /><?php 
        echo _JLMS_DESCRIPTION;
        ?>
</td>
						</tr>
						<tr>
							<td colspan="3">
							<?php 
        JLMS_editorArea('editor1', '', 'step_description', '100%', '250', '40', '20');
        ?>
							</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="lpath_add_content" />
					<input type="hidden" name="id" value="<?php 
        echo $lpath_id;
        ?>
" />
					<input type="hidden" name="lpath_id" value="<?php 
        echo $lpath_id;
        ?>
" />
					<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
					</form>
<?php 
        echo $tabs->endTab();
        echo $tabs->startTab(_JLMS_LPATH_CHAPTER, "jlmstab5");
        echo JLMSCSS::h2(_JLMS_LPATH_TITLE_ADD_CHAP);
        ?>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
		<tr>
			<td align="right">
			<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton_chap('lpath_add_chapter');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton_chap('cancel_lpath_step');");
        echo JLMS_ShowToolbar($toolbar);
        ?>
			</td>
		</tr>
	</table>
					<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="chapForm">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_item_properties">
						<tr>
							<td width="15%"><br /><?php 
        echo _JLMS_ENTER_NAME;
        ?>
</td>
							<td>
								<br /><input type="text" name="step_name" style="width:260px" value="" />
							</td>
						</tr>
						<tr>
							<td width="15%"><br /><?php 
        echo _JLMS_PLACE_IN;
        ?>
</td>
							<td><br /><?php 
        echo $lists['lpath_chaps1'];
        ?>
</td>
						</tr>
						<tr>
							<td><br /><?php 
        echo _JLMS_ORDERING;
        ?>
</td>
							<td><br /><?php 
        echo $lists['lpath_order'];
        ?>
</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="lpath_add_chapter" />
					<input type="hidden" name="id" value="<?php 
        echo $lpath_id;
        ?>
" />
					<input type="hidden" name="lpath_id" value="<?php 
        echo $lpath_id;
        ?>
" />
					<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
					</form>
<?php 
        echo $tabs->endTab();
        if (!empty($my_documents)) {
            echo $tabs->startTab(_JLMS_HEAD_DOCS_STR, "jlmstab1");
            echo JLMSCSS::h2(_JLMS_LPATH_TITLE_ADD_DOCS);
            ?>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
		<tr>
			<td align="right">
			<?php 
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton_doc('lpath_add_doc');");
            $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton_doc('cancel_lpath_step');");
            echo JLMS_ShowToolbar($toolbar);
            ?>
			</td>
		</tr>
	</table>
				<form action="<?php 
            echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
            ?>
" method="post" name="docForm">
					<?php 
            $max_tree_width = 0;
            $max_tree_width1 = 0;
            if (isset($my_documents[0])) {
                $max_tree_width = $my_documents[0]->tree_max_width;
            }
            $max_tree_width1 = $max_tree_width;
            ?>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
						<tr>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="1%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="1%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="<?php 
            echo $max_tree_width + 1;
            ?>
%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="<?php 
            echo $max_tree_width + 1;
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="50%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME_DOCS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="<?php 
            echo 48 - ($max_tree_width + 1);
            ?>
%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><span style="display:block; width:150px"><?php 
            echo _JLMS_LPATH_TBL_HEAD_DESCR_DOCS;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						</tr>
					<?php 
            $k = 1;
            $tree_modes = array();
            for ($i = 0, $n = count($my_documents); $i < $n; $i++) {
                $row = $my_documents[$i];
                $max_tree_width = $row->tree_max_width;
                $link = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_document&amp;course_id=" . $course_id . "&amp;id=" . $row->id;
                $checked = '<input type="checkbox" name="cid[]" value="' . $row->id . '" />';
                ?>
						<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
							<td align="center"><?php 
                echo $i + 1;
                ?>
</td>
							<td align="center" valign="middle"><?php 
                if (!$row->folder_flag || $row->folder_flag == 2 || $row->folder_flag == 3) {
                    echo $checked;
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
							<?php 
                $add_img = '';
                if ($row->tree_mode_num) {
                    $g = 0;
                    $tree_modes[$row->tree_mode_num - 1] = $row->tree_mode;
                    while ($g < $row->tree_mode_num - 1) {
                        $pref = '';
                        if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                            $pref = 'empty_';
                        }
                        $add_img .= "<td width='16' valign='middle'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' /></td>";
                        $g++;
                    }
                    $add_img .= "<td width='16' valign='middle'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row->tree_mode . ".png\" width='16' height='16' /></td>";
                    $max_tree_width = $max_tree_width - $g - 1;
                }
                echo $add_img;
                ?>
							<td align="center" valign="middle" style="vertical-align:middle " width='16'>
							<?php 
                if ($row->folder_flag == 1) {
                    echo "<span style='text-align:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/folder.png\" width='16' height='16' alt='" . _JLMS_LPATH_DOC_ALT_FOLDER . "' /></span>";
                } else {
                    echo "<span style='text-align:center;font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row->file_icon . ".png\" width='16' height='16' alt='" . _JLMS_LPATH_DOC_ALT_FILE . "' /></span>";
                }
                ?>
							</td>
							<td align="left" valign="middle" <?php 
                if ($max_tree_width > 0) {
                    echo "colspan='" . ($max_tree_width + 1) . "'";
                }
                ?>
 width="35%">
							<?php 
                if ($row->folder_flag || !$row->folder_flag && !$row->file_id) {
                    echo '<strong>' . $row->doc_name . '</strong>';
                } else {
                    ?>
								<?php 
                    /*<a href="<?php echo sefRelToAbs($link);?>" title="<?php echo _JLMS_LPATH_LINK_DOC_DOWNLOAD;?>"> */
                    echo $row->doc_name;
                    /* </a> */
                }
                ?>
							</td>
							<td><?php 
                $doc_descr = trim(strip_tags($row->doc_description));
                if (strlen($doc_descr) > 75) {
                    $doc_descr = substr($doc_descr, 0, 75) . "...";
                }
                echo $doc_descr ? $doc_descr : '&nbsp;';
                ?>
							</td>
						</tr>
						<?php 
                $k = 3 - $k;
            }
            ?>
					</table>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_item_properties">
						<tr>
							<td width="15%"><?php 
            echo _JLMS_PLACE_IN;
            ?>
</td>
							<td><?php 
            echo $lists['lpath_chaps1'];
            ?>
</td>
						</tr>
						<tr>
							<td><br /><?php 
            echo _JLMS_ORDERING;
            ?>
</td>
							<td><br /><?php 
            echo $lists['lpath_order'];
            ?>
</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="lpath_add_doc" />
					<input type="hidden" name="id" value="<?php 
            echo $lpath_id;
            ?>
" />
					<input type="hidden" name="lpath_id" value="<?php 
            echo $lpath_id;
            ?>
" />
					<input type="hidden" name="course_id" value="<?php 
            echo $course_id;
            ?>
" />
					</form>
<?php 
            echo $tabs->endTab();
        }
        if (!empty($my_links)) {
            echo $tabs->startTab(_JLMS_HEAD_LINK_STR, "jlmstab2");
            echo JLMSCSS::h2(_JLMS_LPATH_TITLE_ADD_LINKS);
            ?>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
		<tr>
			<td align="right">
			<?php 
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton_link('lpath_add_link');");
            $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton_link('cancel_lpath_step');");
            echo JLMS_ShowToolbar($toolbar);
            ?>
			</td>
		</tr>
	</table>
					<form action="<?php 
            echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
            ?>
" method="post" name="linkForm">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
						<tr>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="1%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="1%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="50%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME_LINKS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="48%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><span style="display:block; width:150px"><?php 
            echo _JLMS_LPATH_TBL_HEAD_DESCR_LINKS;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						</tr>
					<?php 
            $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
            $_JLMS_PLUGINS->loadBotGroup('content');
            for ($i = 0, $n = count($my_links); $i < $n; $i++) {
                $plugin_result_array = $_JLMS_PLUGINS->trigger('onContentProcess', array(&$my_links[$i]->link_href));
                $plugin_result_array = $_JLMS_PLUGINS->trigger('onContentProcess', array(&$my_links[$i]->link_name));
            }
            $k = 1;
            for ($i = 0, $n = count($my_links); $i < $n; $i++) {
                $row = $my_links[$i];
                $link = $row->link_href;
                //'javascript:void(0);';//"index.php?option=".$option."&Itemid=".$Itemid."&task=get_file&id=".$row->file_id;
                $checked = '<input type="checkbox" name="cid[]" value="' . $row->id . '" />';
                ?>
						<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
							<td align="center"><?php 
                echo $i + 1;
                ?>
</td>
							<td><?php 
                echo $checked;
                ?>
</td>
							<td>
								<a target="_blank" href="<?php 
                echo sefRelToAbs($link);
                ?>
" title="<?php 
                echo _JLMS_LPATH_VIEW_LINK;
                ?>
">
									<?php 
                echo $row->link_name;
                ?>
								</a>
							</td>
							<td><?php 
                echo trim($row->link_description) ? $row->link_description : '&nbsp;';
                ?>
</td>
						</tr>
						<?php 
                $k = 3 - $k;
            }
            ?>
					</table>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_item_properties">
						<tr>
							<td width="15%"><?php 
            echo _JLMS_PLACE_IN;
            ?>
</td>
							<td><?php 
            echo $lists['lpath_chaps1'];
            ?>
</td>
						</tr>
						<tr>
							<td><br /><?php 
            echo _JLMS_ORDERING;
            ?>
</td>
							<td><br /><?php 
            echo $lists['lpath_order'];
            ?>
</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="lpath_add_link" />
					<input type="hidden" name="id" value="<?php 
            echo $lpath_id;
            ?>
" />
					<input type="hidden" name="lpath_id" value="<?php 
            echo $lpath_id;
            ?>
" />
					<input type="hidden" name="course_id" value="<?php 
            echo $course_id;
            ?>
" />
					</form>
<?php 
            echo $tabs->endTab();
        }
        if (!empty($my_quizzes)) {
            echo $tabs->startTab(_JLMS_HEAD_QUIZ_STR, "jlmstab3");
            echo JLMSCSS::h2(_JLMS_LPATH_TITLE_ADD_QUIZZES);
            ?>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
		<tr>
			<td align="right">
			<?php 
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton_quiz('lpath_add_quiz');");
            $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton_quiz('cancel_lpath_step');");
            echo JLMS_ShowToolbar($toolbar);
            ?>
			</td>
		</tr>
	</table>
					<form action="<?php 
            echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
            ?>
" method="post" name="quizForm">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
						<tr>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="1%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="1%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="50%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME_QUIZ;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="48%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><span style="display:block; width:150px"><?php 
            echo _JLMS_LPATH_TBL_HEAD_CAT_QUIZ;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						</tr>
					<?php 
            $k = 1;
            for ($i = 0, $n = count($my_quizzes); $i < $n; $i++) {
                $row = $my_quizzes[$i];
                // (WARNING) if link will be changed, don't forgot to change target of <a> element
                $link = 'javascript:void(0);';
                //$row->link_href;//"index.php?option=".$option."&Itemid=".$Itemid."&task=get_file&id=".$row->file_id;
                $checked = '<input type="checkbox" name="cid[]" value="' . $row->c_id . '" />';
                ?>
						<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
							<td align="center"><?php 
                echo $i + 1;
                ?>
</td>
							<td><?php 
                echo $checked;
                ?>
</td>
							<td>
								<a href="<?php 
                echo sefRelToAbs($link);
                ?>
">
									<?php 
                echo $row->c_title;
                ?>
								</a>
							</td>
							<td><?php 
                echo trim($row->c_category) ? $row->c_category : '&nbsp;';
                ?>
</td>
						</tr>
						<?php 
                $k = 3 - $k;
            }
            ?>
					</table>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_item_properties">
						<tr>
							<td width="15%"><?php 
            echo _JLMS_PLACE_IN;
            ?>
</td>
							<td><?php 
            echo $lists['lpath_chaps1'];
            ?>
</td>
						</tr>
						<tr>
							<td><br /><?php 
            echo _JLMS_ORDERING;
            ?>
</td>
							<td><br /><?php 
            echo $lists['lpath_order'];
            ?>
</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="lpath_add_quiz" />
					<input type="hidden" name="id" value="<?php 
            echo $lpath_id;
            ?>
" />
					<input type="hidden" name="lpath_id" value="<?php 
            echo $lpath_id;
            ?>
" />
					<input type="hidden" name="course_id" value="<?php 
            echo $course_id;
            ?>
" />
					</form>
<?php 
            echo $tabs->endTab();
        }
        if (!empty($my_scorms)) {
            echo $tabs->startTab(_JLMS_LPATH_SCORM_OBJECTS, "jlmstab4");
            echo JLMSCSS::h2(_JLMS_LPATH_TITLE_ADD_SCORMS);
            ?>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
		<tr>
			<td align="right">
			<?php 
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton_scorm('lpath_add_scorm');");
            $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton_scorm('cancel_lpath_step');");
            echo JLMS_ShowToolbar($toolbar);
            ?>
			</td>
		</tr>
	</table>
					<form action="<?php 
            echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
            ?>
" method="post" name="scormForm">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
						<tr>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="1%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="1%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="98%" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_SCORM_OBJECT;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						</tr>
					<?php 
            $k = 1;
            for ($i = 0, $n = count($my_scorms); $i < $n; $i++) {
                $row = $my_scorms[$i];
                // (WARNING) if link will be changed, don't forgot to change target of <a> element
                $link = 'javascript:void(0);';
                //$row->link_href;//"index.php?option=".$option."&Itemid=".$Itemid."&task=get_file&id=".$row->file_id;
                $checked = '<input type="checkbox" name="cid[]" value="' . $row->id . '" />';
                ?>
						<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
							<td align="center"><?php 
                echo $i + 1;
                ?>
</td>
							<td><?php 
                if (!isset($row->is_link)) {
                    echo $checked;
                }
                ?>
</td>
							<td>
							
							<?php 
                if (!isset($row->is_link)) {
                    ?>
								<a href="<?php 
                    echo sefRelToAbs($link);
                    ?>
">
							<?php 
                }
                ?>
	
									<?php 
                echo $row->lpath_name;
                ?>
									
							<?php 
                if (!isset($row->is_link)) {
                    ?>
		
								</a>
							<?php 
                }
                ?>
	
							</td>
						</tr>
						<?php 
                $k = 3 - $k;
            }
            ?>
					</table>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_item_properties">
						<tr>
							<td width="15%"><?php 
            echo _JLMS_PLACE_IN;
            ?>
</td>
							<td><?php 
            echo $lists['lpath_chaps1'];
            ?>
</td>
						</tr>
						<tr>
							<td><br /><?php 
            echo _JLMS_ORDERING;
            ?>
</td>
							<td><br /><?php 
            echo $lists['lpath_order'];
            ?>
</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="lpath_add_scorm" />
					<input type="hidden" name="id" value="<?php 
            echo $lpath_id;
            ?>
" />
					<input type="hidden" name="lpath_id" value="<?php 
            echo $lpath_id;
            ?>
" />
					<input type="hidden" name="course_id" value="<?php 
            echo $course_id;
            ?>
" />
					</form>
<?php 
            echo $tabs->endTab();
        }
        echo $tabs->endPane();
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
 function JQ_FinishQuiz($quiz_id, $stu_quiz_id, $user_unique_id, $id)
 {
     global $JLMS_DB, $my, $Itemid, $JLMS_CONFIG;
     $ret_str = '';
     require_once dirname(__FILE__) . '/ajax_quiz.class.php';
     $query = "SELECT * FROM #__lms_quiz_t_quiz WHERE c_id = '" . $quiz_id . "'";
     $JLMS_DB->SetQuery($query);
     $quiz = $JLMS_DB->LoadObjectList();
     if (count($quiz)) {
         $quiz = $quiz[0];
     } else {
         return $ret_str;
     }
     $quiz_params = new JLMSParameters($quiz->params);
     $inside_lp = intval(mosGetParam($_REQUEST, 'inside_lp', 0));
     $QA = new JLMS_quiz_API($quiz_id, $inside_lp);
     if (!$QA->quiz_valid()) {
         return '';
     }
     $toolbar_no_a = $QA->quiz_Get_NoAtToolbar();
     $QA->set('stu_quiz_id', $stu_quiz_id);
     $QA->set('user_unique_id', $user_unique_id);
     $QA->quiz_ProcessStartData();
     if ($QA->start_valid() && $quiz_id) {
         $query = "SELECT SUM(c_score) FROM #__lms_quiz_r_student_question WHERE c_stu_quiz_id = '" . $stu_quiz_id . "'";
         $JLMS_DB->SetQuery($query);
         $user_score = $JLMS_DB->LoadResult();
         if (!$user_score) {
             $user_score = 0;
         }
         $max_score = $QA->quiz_Get_MaxScore();
         $nugno_score = $QA->get_qvar('c_passing_score', 0) * $max_score / 100;
         $user_passed = 0;
         if ($user_score >= $nugno_score) {
             $user_passed = 1;
         }
         $user_time = 0;
         $quiz_time1 = time() - date('Z');
         $query = "SELECT c_date_time FROM #__lms_quiz_r_student_quiz WHERE c_id = '" . $stu_quiz_id . "'";
         $JLMS_DB->SetQuery($query);
         $quiz_time2 = $JLMS_DB->LoadResult();
         $quiz_time2a = strtotime($quiz_time2);
         $user_time = $quiz_time1 - $quiz_time2a;
         $query = "SELECT c_total_score, c_passed, c_total_time FROM #__lms_quiz_r_student_quiz WHERE c_id = '" . $stu_quiz_id . "' and c_quiz_id = '" . $quiz_id . "' and c_student_id = '" . $my->id . "'";
         $JLMS_DB->SetQuery($query);
         $user_quiz_results_obj = $JLMS_DB->LoadObject();
         if (is_object($user_quiz_results_obj)) {
             $user_score = $user_quiz_results_obj->c_total_score;
             $user_passed = $user_quiz_results_obj->c_passed;
             $user_time = $user_quiz_results_obj->c_total_time;
         }
         // update lms results
         $lms_course = $QA->get_qvar('course_id', 0);
         $lms_quiz = $quiz_id;
         $lms_user = $my->id;
         $lms_score = $user_score;
         $lms_time = $user_time;
         $lms_date = date('Y-m-d H:i:s', time() - date('Z'));
         //the same as gmdate
         $lms_passed = $user_passed;
         global $JLMS_CONFIG;
         if ($lms_course && $JLMS_CONFIG->get('course_id') == $lms_course) {
             $course_params = $JLMS_CONFIG->get('course_params');
             $params = new JLMSParameters($course_params);
             $do_insert_new_res = false;
             if ($params->get('track_type', 0) == 1) {
                 $query = "SELECT * FROM #__lms_quiz_results WHERE course_id = '" . $lms_course . "' AND quiz_id = '" . $lms_quiz . "' AND user_id = '" . $lms_user . "'";
                 $JLMS_DB->SetQuery($query);
                 $old_user_results = $JLMS_DB->LoadObject();
                 if (is_object($old_user_results)) {
                     if (!$lms_passed && !$old_user_results->user_passed && $lms_score > $old_user_results->user_score) {
                         $do_insert_new_res = true;
                     } elseif ($lms_passed && !$old_user_results->user_passed) {
                         $do_insert_new_res = true;
                     } elseif ($lms_passed && $old_user_results->user_passed && $lms_score > $old_user_results->user_score) {
                         $do_insert_new_res = true;
                     } elseif ($lms_passed && $old_user_results->user_passed && $lms_score == $old_user_results->user_score && $lms_time < $old_user_results->user_time) {
                         $do_insert_new_res = true;
                     }
                 } else {
                     $do_insert_new_res = true;
                 }
             } else {
                 $do_insert_new_res = true;
             }
             if ($do_insert_new_res) {
                 $query = "DELETE FROM #__lms_quiz_results WHERE course_id = '" . $lms_course . "' AND quiz_id = '" . $lms_quiz . "' AND user_id = '" . $lms_user . "'";
                 $JLMS_DB->SetQuery($query);
                 $JLMS_DB->query();
                 $query = "INSERT INTO #__lms_quiz_results (course_id, quiz_id, user_id, user_score, quiz_max_score, user_time, quiz_date, user_passed)" . "\n VALUES ('" . $lms_course . "', '" . $lms_quiz . "', '" . $lms_user . "', '" . $lms_score . "', " . intval($max_score) . ", '" . $lms_time . "', '" . $lms_date . "', '" . $lms_passed . "')";
                 $JLMS_DB->SetQuery($query);
                 $JLMS_DB->query();
             }
         }
         // end of lms results section
         $cur_tmpl = 'joomlaquiz_lms_template';
         if ($cur_tmpl) {
             require_once dirname(__FILE__) . '/templates/' . $cur_tmpl . '/jq_template.php';
             global $JLMS_LANGUAGE, $JLMS_CONFIG;
             JLMS_require_lang($JLMS_LANGUAGE, 'quiz.lang', $JLMS_CONFIG->get('default_language'));
             require _JOOMLMS_FRONT_HOME . '/includes/quiz/quiz_language.php';
             global $jq_language;
             #$ret_str .= "\t" . '<task>results</task>' . "\n";
             $eee = $jq_language['quiz_header_fin_message'];
             #$ret_str .= "\t" . '<finish_msg><![CDATA[';
             if ($user_passed) {
                 if ($QA->get_qvar('c_pass_message', '')) {
                     $jq_language['quiz_user_passes'] = nl2br($QA->get_qvar('c_pass_message', ''));
                 }
             } else {
                 if ($QA->get_qvar('c_unpass_message', '')) {
                     $jq_language['quiz_user_fails'] = nl2br($QA->get_qvar('c_unpass_message', ''));
                 }
             }
             #$ret_str .= ']]></finish_msg>' . "\n";
             $t_ar = array();
             $t_ar[] = mosHTML::makeOption($user_score . " of " . $max_score, $jq_language['quiz_res_mes_score']);
             $t_ar[] = mosHTML::makeOption($nugno_score ? $nugno_score . " (" . $QA->get_qvar('c_passing_score', 0) . "%)" : '', $jq_language['quiz_res_mes_pas_score']);
             $tot_hour = floor($user_time / 3600);
             if ($tot_hour) {
                 $tot_min = floor(($user_time - $tot_hour * 3600) / 60);
                 $tot_sec = $user_time - $tot_hour * 3600 - $tot_min * 60;
                 $tot_time = str_pad($tot_hour, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT);
             } else {
                 $tot_min = floor($user_time / 60);
                 $tot_sec = $user_time - $tot_min * 60;
                 $tot_time = str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT);
             }
             $t_ar[] = mosHTML::makeOption($tot_time, $jq_language['quiz_res_mes_time']);
             if ($quiz_params->get('sh_final_page_text', 1) == 1) {
                 $results_txt = JoomlaQuiz_template_class::JQ_show_results($jq_language['quiz_header_fin_results'], $t_ar);
             } else {
                 $results_txt = '';
             }
             $footer_ar = array();
             $footer_ar[] = mosHTML::makeOption(0, $jq_language['quiz_fin_btn_review']);
             $footer_ar[] = mosHTML::makeOption(1, $jq_language['quiz_fin_btn_print']);
             $footer_ar[] = mosHTML::makeOption(2, $jq_language['quiz_fin_btn_certificate']);
             $footer_ar[] = mosHTML::makeOption(3, $jq_language['quiz_fin_btn_email']);
             $toolbar_fotter = array();
             if ($QA->get_qvar('c_certificate', 0) && $user_passed) {
                 $link_inside_1 = ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=com_joomla_lms&Itemid=' . $Itemid . '&no_html=1&task=print_quiz_cert&course_id=' . $lms_course . '&stu_quiz_id=' . $stu_quiz_id . '&user_unique_id=' . $user_unique_id);
                 $btn_certificate = 'window.open(\'' . $link_inside_1 . '\',\'blank\');';
                 $footer_ar[2]->text = "<div class='back_button'><a href='javascript:void(0)' onclick=\"window.open ('" . $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=com_joomla_lms&Itemid=" . $Itemid . "&no_html=1&task=print_quiz_cert&course_id=" . $lms_course . "&stu_quiz_id=" . $stu_quiz_id . "&user_unique_id=" . $user_unique_id . "','blank');\">" . $jq_language['quiz_fin_btn_certificate'] . "</a></div>";
                 $toolbar_footer[2] = array('btn_type' => 'certificate_fbar', 'btn_js' => $btn_certificate);
             }
             if ($QA->get_qvar('c_enable_print', 0)) {
                 $link_inside_2 = ampReplace($JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=com_joomla_lms&Itemid=' . $Itemid . '&no_html=1&task=print_quiz_result&course_id=' . $lms_course . '&stu_quiz_id=' . $stu_quiz_id . '&user_unique_id=');
                 $btn_print = 'window.open(\'' . $link_inside_2 . '\'+user_unique_id,\'blank\');';
                 $footer_ar[1]->text = "<div class='back_button'><a href='javascript:void(0)' onclick=\"window.open ('" . $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=com_joomla_lms&Itemid=" . $Itemid . "&no_html=1&task=print_quiz_result&course_id=" . $lms_course . "&stu_quiz_id=" . $stu_quiz_id . "&user_unique_id=' + user_unique_id,'blank');\">" . $jq_language['quiz_fin_btn_print'] . "</a></div>";
                 $toolbar_footer[1] = array('btn_type' => 'print_fbar', 'btn_js' => $btn_print);
             }
             if ($QA->get_qvar('c_email_to', 0)) {
                 $btn_email_to = 'jq_emailResults();';
                 $footer_ar[3]->text = "<div class='back_button'><a href='javascript:void(0)' onclick=\"jq_emailResults();\">" . $jq_language['quiz_fin_btn_email'] . "</a></div>";
                 $toolbar_footer[3] = array('btn_type' => 'email_to_fbar', 'btn_js' => $btn_email_to);
             }
             if ($QA->get_qvar('c_enable_review', 0)) {
                 $btn_review = 'jq_startReview();';
                 $query = "UPDATE #__lms_quiz_r_student_quiz SET allow_review = 1 WHERE c_id = '" . $stu_quiz_id . "' and c_quiz_id = '" . $quiz_id . "' and c_student_id = '" . $my->id . "'";
                 $JLMS_DB->SetQuery($query);
                 $JLMS_DB->query();
                 $footer_ar[0]->text = "<div class='back_button'><a href='javascript:void(0)' onclick=\"jq_startReview();\">" . $jq_language['quiz_fin_btn_review'] . "</a></div>";
                 $toolbar_footer[0] = array('btn_type' => 'review_fbar', 'btn_js' => $btn_review);
             }
             $footer_html_graf = '';
             if ($quiz_params->get('sh_final_page_grafic', 0) == 1) {
                 ////----barss----////
                 $is_pool = 0;
                 if ($quiz_id == -1 || $quiz_id == 0) {
                     $is_pool = 1;
                     $quiz_id = 0;
                 }
                 $rows = $QA->quiz_Get_QuestionList();
                 // 18 August 2007 - changes (DEN) - added check for GD and FreeType support
                 $generate_images = true;
                 $msg = '';
                 if (!function_exists('imageftbbox') || !function_exists('imagecreatetruecolor')) {
                     $generate_images = false;
                     $sec = false;
                     if (!function_exists('imagecreatetruecolor')) {
                         $msg = 'This function requires GD 2.0.1 or later (2.0.28 or later is recommended).';
                         $sec = true;
                     }
                     if (!function_exists('imageftbbox')) {
                         $msg .= ($sec ? '<br />' : '') . 'This function is only available if PHP is compiled with freetype support.';
                     }
                 }
                 // end of GD and FreeType support check
                 if ($JLMS_CONFIG->get('temp_folder', '') && $generate_images) {
                     // temp folder setup is ready.
                     //--------- array of bar-images
                     $img_arr = array();
                     $title_arr = array();
                     $count_graph = array();
                     global $option;
                     for ($i = 0, $n = count($rows); $i < $n; $i++) {
                         $row = $rows[$i];
                         $quest_params = new JLMSParameters($row->params);
                         $z = 1;
                         if (isset($row->c_pool) && $row->c_pool) {
                             $row->c_pool_id = $row->c_pool;
                         } else {
                             $row->c_pool_id = $row->c_id;
                         }
                         $show_case = true;
                         //					if($showtype_id && !$quest_params->get('survey_question'))
                         if (false && !$quest_params->get('survey_question')) {
                             $show_case = false;
                         }
                         if ($show_case) {
                             require_once _JOOMLMS_FRONT_HOME . "/includes/libraries/lms.lib.graph.php";
                             $group_id = 0;
                             $str_user_in_groups = '';
                             $c_question_id = $row->c_pool_id;
                             $obj_GraphStat = JLMS_GraphStatistics($option, $id, $quiz_id, $i, $z, $row, $c_question_id, $group_id, $str_user_in_groups);
                             foreach ($obj_GraphStat as $key => $item) {
                                 if (preg_match_all('#([a-z]+)_(\\w+)#', $key, $out, PREG_PATTERN_ORDER)) {
                                     if ($out[1][0] == 'img') {
                                         $img_arr[$i]->{$out}[2][0] = $item;
                                     } else {
                                         if ($out[1][0] == 'title') {
                                             $title_arr[$i]->{$out}[2][0] = $item;
                                         } else {
                                             if ($out[1][0] == 'count') {
                                                 $count_graph[$i]->{$out}[2][0] = $item;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $footer_html_graf = JoomlaQuiz_template_class::JQ_show_results_footer_content_bars($img_arr, $title_arr, $count_graph, $id);
             }
             $ret_str .= $results_txt;
             // this filed shouldn't be a null - null caused errors in Safari
             if ($quiz_params->get('sh_final_page_fdbck', 1) == 1) {
                 $ret_str .= '<br />';
                 $ret_str .= JoomlaQuiz_template_class::JQ_show_results_msg($eee, $user_passed ? $jq_language['quiz_user_passes'] : $jq_language['quiz_user_fails'], $user_passed);
                 $ret_str .= '<br />';
             } else {
                 $ret_str .= '<br />';
             }
             if (isset($toolbar_footer) && count($toolbar_footer) > 0) {
                 ksort($toolbar_footer);
                 $footer_html = JLMS_ShowToolbar($toolbar_footer, false, 'center');
                 $footer_html = str_replace('"components/com_joomla_lms', '"' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms', $footer_html);
             } else {
                 $footer_html = '';
             }
             $entire_footer_data = $footer_html . ($footer_html_graf ? '<br />' . $footer_html_graf : '');
             $ret_str .= $entire_footer_data ? $entire_footer_data : ' ';
         }
     }
     return $ret_str;
 }
    function statsHW(&$stats, &$row, $option, $course_id, &$pageNav, &$lists, $is_teacher = true)
    {
        global $JLMS_CONFIG;
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $JLMS_ACL =& JLMSFactory::getACL();
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('homework', '', $hparams);
        //$row->hw_name
        JLMS_TMPL::OpenTS();
        ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
				<tr>
					<td colspan="2" width="80%">
						<?php 
        echo JLMSCSS::h2($row->hw_name);
        ?>
					</td>
					<td align="right" style="text-align:right; vertical-align:top " valign="top"><br />
					<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=homework&id={$course_id}"));
        echo JLMS_ShowToolbar($toolbar);
        ?>
					</td>
				</tr>
				<tr>
					<td width="60%" align="left" style="text-align:left "><br />
						<table align="left" width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
<?php 
        /*						<tr>
        							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php echo _JLMS_HW_HOMEWORK_TASK;?></td>
        							<td width="50%" align="left" style="text-align:left "><?php echo $row->hw_name;?></td>
        						</tr>
        */
        ?>
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_HW_HOMEWORK_DATE;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo JLMS_dateToDisplay($row->post_date);
        ?>
</td>
						</tr>
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_HW_HOMEWORK_ENDDATE;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo JLMS_dateToDisplay($row->end_date);
        ?>
</td>
						</tr>
						</table>
					</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>

				</tr>
				<tr>
					<td colspan="3"><br />
						<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
							<tr>
								<td align="left" style="text-align:left; vertical-align:bottom " valign="bottom">
									<div><?php 
        echo $lists['filter'];
        ?>
</div>
								</td>
								<td align="right" style="text-align:right ">
									<div align="right" style="white-space:nowrap ">
									<?php 
        if ($JLMS_ACL->CheckPermissions('homework', 'manage')) {
            ?>
										<?php 
            echo $lists['filter2'] . '<br />';
            if (isset($lists['filter3'])) {
                echo $lists['filter3'] . '<br />';
            }
            echo $lists['filter_stu'] . '<br />';
            ?>
									<?php 
        } else {
            echo '&nbsp;';
        }
        ?>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<!-- start statistics -->
						<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
							<tr>
								<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
								<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_HW_TBL_HEAD_STU;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
								<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_HW_TBL_HEAD_GROUP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
								<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="2"><?php 
        echo _JLMS_HW_TBL_HEAD_GRADE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
								<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="20%">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
							</tr>
						<?php 
        $k = 1;
        for ($i = 0, $n = count($stats); $i < $n; $i++) {
            $srow = $stats[$i];
            $mail_link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=hw_view_result&amp;course_id={$course_id}&amp;user_id=" . $srow->user_id . "&amp;hw_id=" . $row->id;
            $image = $srow->hw_status ? 'btn_accept.png' : 'btn_cancel.png';
            $alt = $srow->hw_status ? _JLMS_HW_STATUS_COMPLETED : _JLMS_HW_STATUS_INCOMPLETE;
            ?>
							<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
								<td align="center"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
								<td align="left" valign="middle" style="vertical-align:middle ">
								<?php 
            if ($JLMS_ACL->CheckPermissions('homework', 'manage')) {
                if ($srow->hw_status) {
                    echo '<a href="' . sefRelToAbs($mail_link) . '" title="' . _JLMS_HW_LINK_SEND_EMAIL . '">';
                }
                echo $srow->username;
                if ($srow->hw_status) {
                    echo '</a>';
                }
            } else {
                echo $srow->username;
            }
            ?>
								</td>
								<td align="left" valign="middle" style="vertical-align:middle ">
									<?php 
            //										echo ($srow->group_id?$srow->ug_name:_JLMS_USER_NO_GROUP_NAME);
            echo $srow->ug_name;
            ?>
								</td>
								<td align="center" valign="middle" style="vertical-align:middle" width="20">
									<?php 
            $grade_num = '';
            if ($srow->hw_status) {
                if ($srow->grade != _STATUS_NOT_SELECT && $srow->grade) {
                    $img = '';
                    if ($srow->graded_activity) {
                        $img = 'btn_accept.png';
                        $grade_num = $srow->grade;
                    } else {
                        switch ($srow->grade) {
                            case _STATUS_NOT_PASSED:
                                $img = 'btn_cancel.png';
                                break;
                            case _STATUS_PASSED:
                                $img = 'btn_accept.png';
                                break;
                        }
                    }
                    echo '<img src="' . JURI::root() . '/components/com_joomla_lms/lms_images/toolbar/' . $img . '" alt="' . $srow->grade . '" />';
                } else {
                    $ttip = '<img src="' . JURI::root() . '/components/com_joomla_lms/lms_images/toolbar/btn_publish_wait.png" alt="waiting" />';
                    echo JLMS_toolTip(_JLMS_HW_AWAITING_REVIEW, '', $ttip, '', false);
                }
            }
            ?>
								</td>
								<td><?php 
            echo $grade_num ? '<b>' . $grade_num . '</b>' : '&nbsp;';
            ?>
</td>
								<td align="left" valign="middle" style="vertical-align:middle ">
									<?php 
            echo JLMS_dateToDisplay($srow->hw_date, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s');
            ?>
								</td>
							</tr>
							<?php 
            $k = 3 - $k;
        }
        ?>
						<tr>
							<td colspan="6" align="center"class="<?php 
        echo JLMSCSS::_('jlmslist-footer_td');
        ?>
"><div align="center" style="white-space:nowrap">
							<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=hw_stats&amp;course_id={$course_id}&amp;id={$row->id}";
        echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
        echo '<br />';
        echo $pageNav->writePagesLinks($link);
        ?>
 
							</div></td>
						</tr>
						</table>
						<!-- end statistics -->
					</td>
				</tr>
			</table>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function showEditScorm(&$row, &$lists, $option, $params, $lp_params)
    {
        global $Itemid, $_MAMBOTS, $JLMS_CONFIG;
        ?>
<script language="javascript" type="text/javascript">
<!--
function setgood() {
	return true;
}
var tmp_sl_var = <?php 
        echo $params->get('scorm_layout', 0);
        ?>
;
function submitbutton(pressbutton, jform_name) {
	var form = eval("document."+jform_name);//adminForm;
	try {
		form.onsubmit();
	} catch(e) {
		//alert(e);
	}
	if (pressbutton == 'cancel_scorm') {
		form.task.value = 'cancel_scorm';
		form.submit();
	} else {
		if (pressbutton == 'save_scorm') {
				form.task.value = 'save_scorm';
				form.submit();
		}
	}
}
function jlms_change_scorm_stages_view() {
	if (tmp_sl_var == 1) {
		$('scorm_stage_width_section').style.display = '';
	} else {
		$('scorm_stage_width_section').style.display = 'none';
	}
}
function jlms_dis_forms(elem, type) {
	var form = document.adminFormsc;

	if (type == 1 || type == '1') {
		if (elem.checked) {
			scorm_upl_type = 1;
			elem.form.scorm_file.disabled = false;
			document.adminFormsc.scorm_ftp_file.disabled = true;
			
			form.scorm_upl_type.value = 1;
			
		} else {
			scorm_upl_type = 2;
			elem.form.scorm_file.disabled = true;
			document.adminFormsc.scorm_ftp_file.disabled = false;
		}
	}
	if (type == 2 || type == '2') {
		if (elem.checked) {
			scorm_upl_type = 2;
			elem.form.scorm_file.disabled = true;
			document.adminFormsc.scorm_ftp_file.disabled = false;
			
			form.scorm_upl_type.value = 2;
		} else {
			scorm_upl_type = 1;
			elem.form.scorm_file.disabled = false;
			document.adminFormsc.scorm_ftp_file.disabled = true;
		}
	}
}
-->		
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array('show_menu' => true, 'simple_menu' => true);
        $toolbar = array();
        $title = '';
        $title = $row->id ? _JLMS_DOCS_EDIT_SCORM_PACKAGE : _JLMS_DOCS_NEW_SCORM_PACKAGE;
        JLMS_TMPL::ShowHeader('outdoc', $title, $hparams, $toolbar);
        JLMS_TMPL::OpenTS('', ' valign="top"');
        if (!$row->id || $row->id && $row->folder_flag == 3) {
            ?>
				<form action="<?php 
            echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
            ?>
" method="post" name="adminFormsc" enctype="multipart/form-data" onsubmit="setgood();">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_properties_table">
					<tr>
						<td align="left" class="contentheading" valign="middle" style="vertical-align:middle ">
							
						</td>
						<td align="right" style="text-align:right ">
						<?php 
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_scorm', 'adminFormsc');");
            $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_scorm', 'adminFormsc');");
            echo JLMS_ShowToolbar($toolbar);
            ?>
						</td>
					</tr>
					</table>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_properties_table">
					<tr>
						<td width="30%"><?php 
            echo _JLMS_ENTER_NAME;
            ?>
<br /></td>
						<td>
							<input size="40" class="inputbox" type="text" name="doc_name" value="<?php 
            echo $row->doc_name;
            ?>
" /><br />
						</td>
					</tr>
					<tr>
						<td colspan="2"><input id="scorm_upl_type_1" type="radio" name="scorm_upl_type" value="1" checked="checked" onchange="jlms_dis_forms(this,1);" /> <label for="scorm_upl_type_1"><strong><?php 
            echo _JLMS_LPATH_CHOOSE_LOCAL_FILE;
            ?>
</strong></label></td>
					</tr>
					<tr>
						<td><?php 
            echo _JLMS_CHOOSE_FILE;
            ?>
</td>
						<td>
							<input size="40" class="inputbox" type="file" name="scorm_file" />
						</td>
					</tr>
					<tr>
						<td colspan="2"><input id="scorm_upl_type_2" type="radio" name="scorm_upl_type" value="2" onchange="jlms_dis_forms(this,2);" /> <label for="scorm_upl_type_2"><strong><?php 
            echo _JLMS_LPATH_CHOOSE_FTP_FILE;
            ?>
</strong></label></td>
					</tr>
					<tr>
						<td><?php 
            echo _JLMS_CHOOSE_FILE;
            ?>
</td>
						<td>
							<input size="40" class="inputbox" type="text" disabled="disabled"  name="scorm_ftp_file" />
						</td>
					</tr>
					<tr>
						<td valign="middle" style="vertical-align:middle"><br /><?php 
            echo _JLMS_PLACE_IN;
            ?>
</td>
						<td><br /><?php 
            echo $lists['course_folders'];
            ?>
</td>
					</tr>
					<tr id="scorm_stage_width_section"<?php 
            if ($params->get('scorm_layout', 0) == 0) {
                echo ' style="display:none"';
            }
            ?>
>
						<td><br /><?php 
            echo _JLMS_LP_SCORM_DISPLAY_WIDTH;
            ?>
</td>
						<td><br />
							<input size="40" class="inputbox" type="text" name="scorm_width" value="<?php 
            echo $row->scorm_width;
            ?>
" />
						</td>
					</tr>
					<tr>
						<td><br /><?php 
            echo _JLMS_LP_SCORM_DISPLAY_HEIGHT;
            ?>
</td>
						<td><br />
							<input size="40" class="inputbox" type="text" name="scorm_height" value="<?php 
            echo $row->scorm_height;
            ?>
" />
						</td>
					</tr>
					<tr>
						<td><br /><?php 
            echo _JLMS_LPATH_SCORM_NAV_BAR_OPTION;
            ?>
</td>
						<td><br />

							<select class="inputbox" size="1" name="params[scorm_nav_bar]" onchange="tmp_nb_var = this.value;jlms_change_scorm_stages_view();">
								<option<?php 
            if ($params->get('scorm_nav_bar', 0) == 0) {
                echo ' selected="selected"';
            }
            ?>
 value="0"><?php 
            echo _JLMS_LP_SCORM_NAV_BAR_HIDE;
            ?>
</option>
								<option<?php 
            if ($params->get('scorm_nav_bar', 0) == 1) {
                echo ' selected="selected"';
            }
            ?>
 value="1"><?php 
            echo _JLMS_LP_SCORM_NAV_BAR_TOP;
            ?>
</option>
								<option<?php 
            if ($params->get('scorm_nav_bar', 0) == 2) {
                echo ' selected="selected"';
            }
            ?>
 value="2"><?php 
            echo _JLMS_LP_SCORM_NAV_BAR_LEFT;
            ?>
</option>
							</select>
						</td>
					</tr>
					<tr>
						<td><br /><?php 
            echo _JLMS_LP_SCORM_LAYOUT_TYPE;
            ?>
</td>
						<td><br />
							<select class="inputbox" size="1" name="params[scorm_layout]"  onchange="tmp_sl_var = this.value;jlms_change_scorm_stages_view();">
								<option<?php 
            if ($params->get('scorm_layout', 0) == 0) {
                echo ' selected="selected"';
            }
            ?>
 value="0"><?php 
            echo _JLMS_LP_SCORM_LAYOUT_INLINE;
            ?>
</option>
								<option<?php 
            if ($params->get('scorm_layout', 0) == 1) {
                echo ' selected="selected"';
            }
            ?>
 value="1"><?php 
            echo _JLMS_LP_SCORM_LAYOUT_SBOX;
            ?>
</option>
							</select>
						</td>
					</tr>
					<tr>
					<td valign="middle"><br /><?php 
            echo _JLMS_OUTDOCS_VISFOR;
            ?>
</td>
					<td><br />
					<?php 
            $chk1 = '';
            $chk2 = '';
            $chk3 = '';
            if ($row->outdoc_share == 0) {
                $chk1 = ' checked="checked"';
            }
            if ($row->outdoc_share == 1) {
                $chk2 = ' checked="checked"';
            }
            if ($row->outdoc_share == 2) {
                $chk3 = ' checked="checked"';
            }
            ?>
						<input type="radio" name="outdoc_share" id="outdoc_share0" value="0"<?php 
            echo $chk1;
            ?>
 /><label for="outdoc_share0"><?php 
            echo _JLMS_OUTDOCS_PRIVATE;
            ?>
</label>
						<input type="radio" name="outdoc_share" id="outdoc_share1" value="1"<?php 
            echo $chk2;
            ?>
 /><label for="outdoc_share1"><?php 
            echo _JLMS_OUTDOCS_TEACHERS;
            ?>
</label>
						<input type="radio" name="outdoc_share" id="outdoc_share2" value="2"<?php 
            echo $chk3;
            ?>
 /><label for="outdoc_share2"><?php 
            echo _JLMS_OUTDOCS_ALL;
            ?>
</label>
					</td>
				</tr>
				<tr>
					<td><br /><?php 
            echo _JLMS_OUTDOCS_SHOWCOURSES;
            ?>
</td>
					<td><br /><?php 
            echo $lists['share_to_courses'];
            ?>
</td>
				</tr>
				<tr>
					<td colspan="2" valign="top" align="left" style="text-align:left "><br /><?php 
            echo _JLMS_DESCRIPTION;
            ?>
</td>
				</tr>	
				<tr>
					<td colspan="2">
					<?php 
            JLMS_editorArea('editor1', $row->doc_description, 'doc_description', '100%;', '250', '40', '20');
            ?>
					</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="save_scorm" />
					<input type="hidden" name="boxchecked" value="0" />
					<input type="hidden" name="id" value="<?php 
            echo $row->id;
            ?>
" />
					</form>
				<?php 
        }
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
Beispiel #9
0
 function JQ_ResultsQuiz_nojs()
 {
     global $JLMS_DB, $my, $Itemid, $option, $Itemid, $JLMS_CONFIG;
     $doc =& JFactory::getDocument();
     $ret_str = '';
     $quiz_id = intval(mosGetParam($_REQUEST, 'quiz', 0));
     $id = intval(mosGetParam($_REQUEST, 'id', 0));
     $query = "SELECT * FROM #__lms_quiz_t_quiz WHERE c_id = '" . $quiz_id . "'";
     $JLMS_DB->SetQuery($query);
     $quiz = $JLMS_DB->LoadObjectList();
     if (count($quiz)) {
         $quiz = $quiz[0];
     } else {
         return $ret_str;
     }
     $quiz_params = new JLMSParameters($quiz->params);
     $inside_lp = intval(mosGetParam($_REQUEST, 'inside_lp', 0));
     $QA = new JLMS_quiz_API($quiz_id, $inside_lp);
     if (!$QA->quiz_valid()) {
         return '';
     }
     //		$toolbar_no_a = $QA->quiz_Get_NoAtToolbar();
     $stu_quiz_id = intval(mosGetParam($_REQUEST, 'stu_quiz_id', 0));
     $user_unique_id = strval(mosGetParam($_REQUEST, 'user_unique_id', ''));
     $QA->set('stu_quiz_id', $stu_quiz_id);
     $QA->set('user_unique_id', $user_unique_id);
     $QA->quiz_ProcessStartData();
     if ($QA->start_valid() && $quiz_id) {
         $query = "SELECT SUM(c_score) FROM #__lms_quiz_r_student_question WHERE c_stu_quiz_id = '" . $stu_quiz_id . "'";
         $JLMS_DB->SetQuery($query);
         $user_score = $JLMS_DB->LoadResult();
         if (!$user_score) {
             $user_score = 0;
         }
         $max_score = $QA->quiz_Get_MaxScore();
         $nugno_score = $QA->get_qvar('c_passing_score', 0) * $max_score / 100;
         $user_passed = 0;
         if ($user_score >= $nugno_score) {
             $user_passed = 1;
         }
         $query = "SELECT c_total_score, c_passed, c_total_time FROM #__lms_quiz_r_student_quiz WHERE c_id = '" . $stu_quiz_id . "' and c_quiz_id = '" . $quiz_id . "' and c_student_id = '" . $my->id . "'";
         $JLMS_DB->setQuery($query);
         $results_data = $JLMS_DB->LoadObjectList();
         $lms_course = $QA->get_qvar('course_id', 0);
         $lms_quiz = $quiz_id;
         $lms_user = $my->id;
         $lms_score = $user_score;
         $lms_time = $user_time = $results_data[0]->c_total_time;
         $lms_date = date('Y-m-d H:i:s', time() - date('Z'));
         $lms_passed = $user_passed = $results_data[0]->c_passed;
         $cur_tmpl = 'joomlaquiz_lms_template';
         if ($cur_tmpl) {
             require_once dirname(__FILE__) . '/templates/' . $cur_tmpl . '/jq_template.php';
             global $JLMS_LANGUAGE, $JLMS_CONFIG;
             JLMS_require_lang($JLMS_LANGUAGE, 'quiz.lang', $JLMS_CONFIG->get('default_language'));
             require _JOOMLMS_FRONT_HOME . '/includes/quiz/quiz_language.php';
             global $jq_language;
             //				$ret_str .= "\t" . '<task>results</task>' . "\n";
             $eee = $jq_language['quiz_header_fin_message'];
             $doc->addStyleSheet($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/templates/joomlaquiz_lms_template/jq_template.css');
             if ($QA->lpath_stu_quiz_id == $stu_quiz_id) {
                 $query = "SELECT lpath_id FROM #__lms_learn_path_steps WHERE id = '" . $QA->lpath_step_id . "'";
                 $JLMS_DB->setQuery($query);
                 $lpath_id = $JLMS_DB->loadResult();
                 $link_pre = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=show_lpath_nojs&id={$lpath_id}&course_id={$id}&step_id=" . $QA->lpath_step_id . "&user_start_id=" . $QA->lpath_start_id . "&user_unique_id=" . $QA->lpath_unique_id . "&action=prev_lpathstep");
                 $link_next = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=show_lpath_nojs&id={$lpath_id}&course_id={$id}&step_id=" . $QA->lpath_step_id . "&user_start_id=" . $QA->lpath_start_id . "&user_unique_id=" . $QA->lpath_unique_id . "&action=next_lpathstep");
                 $link_contents = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=show_lpath_nojs&id={$lpath_id}&course_id={$id}&step_id=" . $QA->lpath_step_id . "&user_start_id=" . $QA->lpath_start_id . "&user_unique_id=" . $QA->lpath_unique_id . "&action=contents_lpath");
                 $ret_str .= "<table width='100%' cellpadding='0' cellspacing='3' border='0' class='jlms_table_no_borders'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width='150'>\n\t\t\t\t\t\t\t&nbsp;\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td width='100%'>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td width='150' align='right'>\n\t\t\t\t\t\t\t<table cellpadding='0' cellspacing='3' border='0' class='jlms_table_no_borders'>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_pre . "' title='" . _JLMS_PREV_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t<img src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_back.png' border='0' alt='" . _JLMS_PREV_ALT_TITLE . "'/>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_pre . "' title='" . _JLMS_PREV_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t" . _JLMS_PREV_ALT_TITLE . "\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_next . "' title='" . _JLMS_NEXT_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t<img src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_start.png' border='0' alt='" . _JLMS_NEXT_ALT_TITLE . "'/>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_next . "' title='" . _JLMS_NEXT_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t" . _JLMS_NEXT_ALT_TITLE . "\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_contents . "' title='" . _JLMS_CONTENTS_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t<img src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_contents.png' border='0' alt='" . _JLMS_CONTENTS_ALT_TITLE . "'/>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href='" . $link_contents . "' title='" . _JLMS_CONTENTS_ALT_TITLE . "'>\n\t\t\t\t\t\t\t\t\t\t" . _JLMS_CONTENTS_ALT_TITLE . "\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>";
             }
             if ($user_passed) {
                 if ($QA->get_qvar('c_pass_message', '')) {
                     $jq_language['quiz_user_passes'] = nl2br($QA->get_qvar('c_pass_message', ''));
                 }
             } else {
                 if ($QA->get_qvar('c_unpass_message', '')) {
                     $jq_language['quiz_user_fails'] = nl2br($QA->get_qvar('c_unpass_message', ''));
                 }
             }
             $t_ar = array();
             $t_ar[] = mosHTML::makeOption($user_score . " of " . $max_score, $jq_language['quiz_res_mes_score']);
             $t_ar[] = mosHTML::makeOption($nugno_score ? $nugno_score . " (" . $QA->get_qvar('c_passing_score', 0) . "%)" : '', $jq_language['quiz_res_mes_pas_score']);
             $tot_hour = floor($user_time / 3600);
             if ($tot_hour) {
                 $tot_min = floor(($user_time - $tot_hour * 3600) / 60);
                 $tot_sec = $user_time - $tot_hour * 3600 - $tot_min * 60;
                 $tot_time = str_pad($tot_hour, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT);
             } else {
                 $tot_min = floor($user_time / 60);
                 $tot_sec = $user_time - $tot_min * 60;
                 $tot_time = str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT);
             }
             $t_ar[] = mosHTML::makeOption($tot_time, $jq_language['quiz_res_mes_time']);
             //21.03.08 Max
             if ($quiz_params->get('sh_final_page_text', 1) == 1) {
                 $results_txt = JoomlaQuiz_template_class::JQ_show_results($jq_language['quiz_header_fin_results'], $t_ar);
                 $ret_str .= "\t" . '<div>' . $results_txt . '</div>' . "\n";
             }
             //21.03.08 Max
             if ($quiz_params->get('sh_final_page_fdbck', 1) == 1) {
                 $ret_str .= JoomlaQuiz_template_class::JQ_show_results_msg($eee, $user_passed ? $jq_language['quiz_user_passes'] : $jq_language['quiz_user_fails'], $user_passed);
                 $ret_str .= '<br />';
             } else {
                 $ret_str .= '<br />';
             }
             $footer_ar = array();
             $footer_ar[] = mosHTML::makeOption(0, $jq_language['quiz_fin_btn_review']);
             $footer_ar[] = mosHTML::makeOption(1, $jq_language['quiz_fin_btn_print']);
             $footer_ar[] = mosHTML::makeOption(2, $jq_language['quiz_fin_btn_certificate']);
             $footer_ar[] = mosHTML::makeOption(3, $jq_language['quiz_fin_btn_email']);
             $toolbar_footer = array();
             if ($QA->get_qvar('c_certificate', 0) && $user_passed) {
                 $link_certificate = sefRelToAbs("index.php?option=com_joomla_lms&Itemid=" . $Itemid . "&no_html=1&task=print_quiz_cert&course_id=" . $lms_course . "&stu_quiz_id=" . $stu_quiz_id . "&user_unique_id=" . $user_unique_id . "");
                 $footer_ar[2]->text = "<div class='back_button'><a target='_blank' href='" . $link_certificate . "'\">" . $jq_language['quiz_fin_btn_certificate'] . "</a></div>";
                 $toolbar_footer[2] = array('btn_type' => 'certificate_fbar', 'btn_js' => $link_certificate);
             }
             if ($QA->get_qvar('c_enable_print', 0)) {
                 $link_print = sefRelToAbs("index.php?option=com_joomla_lms&Itemid=" . $Itemid . "&no_html=1&task=print_quiz_result&course_id=" . $lms_course . "&stu_quiz_id=" . $stu_quiz_id . "&user_unique_id=" . $user_unique_id . "");
                 $footer_ar[1]->text = "<div class='back_button'><a target='_blank' href='" . $link_print . "' \">" . $jq_language['quiz_fin_btn_print'] . "</a></div>";
                 $toolbar_footer[1] = array('btn_type' => 'print_fbar', 'btn_js' => $link_print);
             }
             if ($QA->get_qvar('c_email_to', 0)) {
                 $link_to_mail = ampReplace($JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&task=quiz_action&id={$id}&user_unique_id={$user_unique_id}&atask=email_results&quiz={$quiz_id}&stu_quiz_id={$stu_quiz_id}");
                 $footer_ar[3]->text = "<div class='back_button'><a target='_blank' href='" . $link_to_mail . "' onclick=\"jq_emailResults();\">" . $jq_language['quiz_fin_btn_email'] . "</a></div>";
                 $toolbar_footer[3] = array('btn_type' => 'email_to_fbar', 'btn_js' => $link_to_mail);
             }
             if ($QA->get_qvar('c_enable_review', 0)) {
                 $query = "UPDATE #__lms_quiz_r_student_quiz SET allow_review = 1 WHERE c_id = '" . $stu_quiz_id . "' and c_quiz_id = '" . $quiz_id . "' and c_student_id = '" . $my->id . "'";
                 $JLMS_DB->SetQuery($query);
                 $JLMS_DB->query();
                 $link_review = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&id={$id}&task=quiz_action&quiz={$quiz_id}&stu_quiz_id={$stu_quiz_id}&user_unique_id={$user_unique_id}&atask=review_start");
                 $footer_ar[0]->text = "<div class='back_button'><a href='" . $link_review . "'>" . $jq_language['quiz_fin_btn_review'] . "</a></div>";
                 $toolbar_footer[0] = array('btn_type' => 'review_fbar', 'btn_js' => $link_review);
             }
             if ($quiz_params->get('sh_final_page_grafic', 0) == 1) {
                 ////----barss----////
                 $is_pool = 0;
                 if ($quiz_id == -1 || $quiz_id == 0) {
                     $is_pool = 1;
                     $quiz_id = 0;
                 }
                 $rows = $QA->quiz_Get_QuestionList();
                 // 18 August 2007 - changes (DEN) - added check for GD and FreeType support
                 $generate_images = true;
                 $msg = '';
                 if (!function_exists('imageftbbox') || !function_exists('imagecreatetruecolor')) {
                     $generate_images = false;
                     $sec = false;
                     if (!function_exists('imagecreatetruecolor')) {
                         $msg = 'This function requires GD 2.0.1 or later (2.0.28 or later is recommended).';
                         $sec = true;
                     }
                     if (!function_exists('imageftbbox')) {
                         $msg .= ($sec ? '<br />' : '') . 'This function is only available if PHP is compiled with freetype support.';
                     }
                 }
                 // end of GD and FreeType support check
                 if ($JLMS_CONFIG->get('temp_folder', '') && $generate_images) {
                     // temp folder setup is ready.
                     //--------- array of bar-images
                     $img_arr = array();
                     $title_arr = array();
                     $count_graph = array();
                     for ($i = 0, $n = count($rows); $i < $n; $i++) {
                         $row = $rows[$i];
                         $quest_params = new JLMSParameters($row->params);
                         $z = 1;
                         $show_case = true;
                         //						if($shotype_id && !$quest_params->get('survey_question'))
                         if (false && !$quest_params->get('survey_question')) {
                             $show_case = false;
                         }
                         if ($show_case) {
                             require_once _JOOMLMS_FRONT_HOME . "/includes/libraries/lms.lib.graph.php";
                             $c_question_id = $row->c_id;
                             $group_id = 0;
                             $str_user_in_groups = '';
                             $obj_GraphStat = JLMS_GraphStatistics($option, $id, $quiz_id, $i, $z, $row, $c_question_id, $group_id, $str_user_in_groups, 1);
                             foreach ($obj_GraphStat as $key => $item) {
                                 if (preg_match_all('#([a-z]+)_(\\w+)#', $key, $out, PREG_PATTERN_ORDER)) {
                                     if ($out[1][0] == 'img') {
                                         $img_arr[$i]->{$out}[2][0] = $item;
                                     } else {
                                         if ($out[1][0] == 'title') {
                                             $title_arr[$i]->{$out}[2][0] = $item;
                                         } else {
                                             if ($out[1][0] == 'count') {
                                                 $count_graph[$i]->{$out}[2][0] = $item;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $footer_html = JoomlaQuiz_template_class::JQ_show_results_footer_content_bars($img_arr, $title_arr, $count_graph, $id);
                 $ret_str .= "\t" . $footer_html . "\n";
             }
             //				$footer_html = JoomlaQuiz_template_class::JQ_show_results_footer($footer_ar);
             if (isset($toolbar_footer) && count($toolbar_footer) > 0) {
                 ksort($toolbar_footer);
                 $footer_html = JLMS_ShowToolbar($toolbar_footer, true, 'center');
             } else {
                 $footer_html = '';
             }
             $ret_str .= "\t" . $footer_html . "\n";
         }
     }
     echo $ret_str;
 }
Beispiel #10
0
 function ShowToolbar($toolbar, $align = 'right', $href_link = true, $heading = '', $pad = 0)
 {
     if ($heading) {
         if (!empty($toolbar)) {
             JLMS_TMPL::OpenTS();
             echo '		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">' . "\r\n" . '			<tr>' . "\r\n" . '				<td width="100%" valign="middle" style="vertical-align:middle">' . "\r\n" . '					&nbsp;' . ($heading ? JLMSCSS::h2($heading) : '') . "\r\n" . '				</td>' . "\r\n" . '				<td align="right" style="text-align:right; white-space:nowrap " nowrap="nowrap">' . "\r\n";
             echo JLMS_ShowToolbar($toolbar, $href_link, $align);
             echo '				</td>' . "\r\n";
             echo '			</tr>' . "\r\n" . '		</table>' . "\r\n";
         } else {
             JLMS_TMPL::OpenTS('', '  class="contentheading"');
             echo $heading;
         }
     } else {
         $td_style = '';
         if ($pad) {
             $td_style = ' style="padding-top:' . $pad . 'px; padding-bottom:' . $pad . 'px"' . ($align == 'center' ? ' align="center"' : '');
         }
         JLMS_TMPL::OpenTS('', $td_style);
         echo JLMS_ShowToolbar($toolbar, $href_link, $align);
     }
     JLMS_TMPL::CloseTS();
 }
    function JQ_ShowQuiz($option, $course_id, $quiz, $jq_language, $self_verification, $is_preview = false, $preview_quest = 0, $preview_id = '')
    {
        global $Itemid, $JLMS_CONFIG, $JLMS_DB;
        $doc =& JFactory::getDocument();
        $domready = '
if (document.constructor) {
	document.constructor.prototype.write = function() { };
} else {
	document.write = function() { };
}
';
        $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
        $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/bits_message.js');
        if (JLMS_mootools12()) {
            $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/dragdrop_1.3.js');
        } else {
            $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/dragdrop_1.12.js');
        }
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            $doc->addScript($JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/includes/quiz/progressbar.js');
        }
        ?>
<script language="JavaScript" type="text/javascript">
<!--//--><![CDATA[//><!--
	var stu_quiz_id = 0;

	// *** DRAG'and'DROP CODE *** //
<?php 
        if ($quiz->if_dragdrop_exist) {
            ?>
	var kol_drag_elems = 0;
	var drag_array = new Array(kol_drag_elems);
	var coord_left = new Array(kol_drag_elems);
	var coord_top = new Array(kol_drag_elems);
	var ids_in_cont = new Array(kol_drag_elems);
	var cont_for_ids = new Array(kol_drag_elems);
	var answ_ids = new Array(kol_drag_elems);
	var cont_index = 0;
	var last_drag_id = '';
	var last_drag_id_drag = '';
	
	/*drag&drop mootools realised*/
	function excute_draggable(){
		var DD = new QuizDragDrop('cont', {dropitems: 'jq_drop', dragitems: 'jq_drag'});
	}
	
	function js_in_array(n, ha){
		for(h in ha){
			if(ha[h]==n){
				return true;
			}
		}
		return false;
	}

//});
	/*drag&drop mootools realised*/
	
<?php 
        }
        ?>
	// *** end of DRAG'and'DROP CODE *** //
	var kol_main_elems = 0;
	var main_ids_array = new Array(kol_main_elems); //for likert quest
	// *** MESSAGES *** (addslashes ???)
	var mes_complete_this_part = '<?php 
        echo $jq_language['mes_complete_this_part'];
        ?>
';
	var mes_loading = '<?php 
        echo $jq_language['quiz_load_data'];
        ?>
';
	var mes_failed = '<?php 
        echo $jq_language['quiz_failed'];
        ?>
';
	var mes_please_wait = '<?php 
        echo $jq_language['mes_please_wait'];
        ?>
';
	var mes_time_is_up = '<?php 
        echo $jq_language['quiz_mes_timeout'];
        ?>
';
	var mes_quest_number = '<?php 
        echo $jq_language['quiz_question_number'];
        ?>
';
	var mes_quest_points = '<?php 
        echo $jq_language['quiz_question_points'];
        ?>
';
	// *** some script variables ***
	var user_email_to = '';
	var user_unique_id = '';
	var cur_quest_type = '';
	var saved_prev_quest_data = '';
	var saved_prev_quest_exec_quiz_script = '';
	var save_prev_quest_exec_quiz_script_data = '';
	var saved_prev_res_data = '';
	var saved_prev_quest_id = 0;
	var saved_prev_quest_type = 0;
	var saved_prev_quest_score = 0;
	var saved_prev_quest_num = 0;
	var cur_quest_id = 0;
	var cur_quest_score = 0;
	var cur_quest_num = 0;
	var quiz_count_quests = 0;
	var cur_impscale_ex = 0;
	var response;
	var prev_correct = 0;
	var allow_attempt = 0;
	var timer_sec = <?php 
        echo isset($quiz->resume_timer_value) && $quiz->resume_timer_value ? $quiz->resume_timer_value : 0;
        ?>
;
	var stop_timer = 0;
	var result_is_shown = 0;
	var max_quiz_time = <?php 
        echo $quiz->c_time_limit ? $quiz->c_time_limit * 60 : 3600;
        ?>
;
	var quiz_blocked = 0; // set block after each question (release after 2 seconds).
	var url_prefix = '<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&Itemid={$Itemid}&jlms=1&task=quiz_ajax_action&id={$course_id}";
        ?>
';//'components/com_joomlaquiz/ajax_quiz.php';
	var mCfg_live_site = '';
	
	var stu_quiz_id = 0;
	var user_unique_id = 0;
	
	var quiz_progress = 0; // progressbar value
	
	var review = 0;

	function jq_MakeRequest(url, do_clear) {
		//if (do_clear == 1) jq_UpdateTaskDiv('clear');
		var http_request = false;
		if (window.ActiveXObject) { // IE
			try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		} else if (window.XMLHttpRequest) { // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {
				http_request.overrideMimeType('text/xml');
			}
		}
		if (!http_request) {
			return false;
		}
		if (do_clear == 1) {
			jq_showLoading();
		}
		quiz_blocked == 1;
		http_request.onreadystatechange = function() { jq_AnalizeRequest(http_request); };
		<?php 
        if ($is_preview) {
            ?>
		var url_prefix2 = 'preview_id=<?php 
            echo $preview_id;
            ?>
';
		<?php 
        } else {
            ?>
		var url_prefix2 = 'user_unique_id=' + user_unique_id;
		<?php 
        }
        ?>
		http_request.open('POST', mCfg_live_site + url_prefix, true);
		//http_request.send(null);
		http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http_request.setRequestHeader("Content-length", url_prefix2.length + url.length);
		//http_request.setRequestHeader("Content-Encoding", "utf-8");
		//http_request.setRequestHeader("Connection", "close"); - if close - bug in IE7 - it hungs up
		http_request.send(url_prefix2 + url);
	}
	function jq_AnalizeRequest(http_request) {
		if (http_request.readyState == 4) {
			if ((http_request.status == 200)) {
				//alert(http_request.responseText);
				if(http_request.responseXML.documentElement == null){
					try {
						http_request.responseXML.loadXML(http_request.responseText)
					} catch (e) {
						/*alert('error');*/
					}
				}

				response  = http_request.responseXML.documentElement;
				var task = response.getElementsByTagName('task')[0].firstChild.data;
				ShowMessage('error_messagebox',0,'');

				switch (task) {
					case 'resume':

						user_unique_id = response.getElementsByTagName('user_unique_id')[0].firstChild.data;
						stu_quiz_id = response.getElementsByTagName('stu_quiz_id')[0].firstChild.data;

						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;

						quiz_count_quests = response.getElementsByTagName('quiz_count_quests')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						
						<?php 
        if ($quiz->c_slide) {
            ?>
							getObj('jq_quiz_result_container').innerHTML = response.getElementsByTagName('quiz_panel_data')[0].firstChild.data;
						<?php 
        }
        ?>

						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						quiz_progress = response.getElementsByTagName('progress_quests_done')[0].firstChild.data;

						<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
						progressbar.setProgress(quiz_progress);
						<?php 
        }
        ?>

						jq_QuizContinue();
						jq_Start_TickTackResume();
					break;

					case 'start':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						user_unique_id = response.getElementsByTagName('user_unique_id')[0].firstChild.data;
						stu_quiz_id = response.getElementsByTagName('stu_quiz_id')[0].firstChild.data;
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						quiz_count_quests = response.getElementsByTagName('quiz_count_quests')[0].firstChild.data;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						getObj('jq_quiz_container').innerHTML = '';
						if (cur_quest_type == 7) {
							var div_insidey=document.createElement("div");
							div_insidey.id = 'quest_div_hs';
							getObj('jq_quiz_container').appendChild(div_insidey);
						}
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';

						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						getObj('jq_quiz_container').appendChild(div_inside1);

						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('next');
						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
						jq_Start_TickTack();
						<?php 
        if ($quiz->c_slide) {
            ?>
							getObj('jq_quiz_result_container').innerHTML = response.getElementsByTagName('quiz_panel_data')[0].firstChild.data;
						<?php 
        }
        ?>
					break;
					case 'seek_quest':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						getObj('jq_quiz_container').innerHTML = '';
						if (cur_quest_type == 7) {
							var div_insidey=document.createElement("div");
							div_insidey.id = 'quest_div_hs';
							getObj('jq_quiz_container').appendChild(div_insidey);
						}
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';
						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						getObj('jq_quiz_container').appendChild(div_inside1);
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('next');

						quiz_progress = response.getElementsByTagName('progress_quests_done')[0].firstChild.data;
						<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
							progressbar.setProgress(quiz_progress);
						<?php 
        }
        ?>

						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
					break;
					case 'review_start':
						quiz_blocked = 1;
						review = 1;
						setTimeout("jq_releaseBlock()", 1000);
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						quiz_count_quests = response.getElementsByTagName('quiz_count_quests')[0].firstChild.data;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						
						
						getObj('jq_quiz_container').innerHTML = '';
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';
						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						getObj('jq_quiz_container').appendChild(div_inside1);
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						quiz_review_correct = response.getElementsByTagName('quiz_review_correct')[0].firstChild.data;
						getObj('jq_quiz_result_reviews').innerHTML = quiz_review_correct;
						getObj('jq_quiz_result_reviews').style.display = 'block';
						getObj('jq_quiz_result_reviews').style.visibility = 'visible';
						getObj('jq_quiz_explanation').innerHTML = response.getElementsByTagName('quiz_review_explanation')[0].firstChild.data;;
						getObj('jq_quiz_explanation').style.display = 'block';
						getObj('jq_quiz_explanation').style.visibility = 'visible';
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('review_next');
						
						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
						
						<?php 
        if ($quiz->c_slide) {
            ?>
							//getObj('jq_panel_link_container').style.visibility = 'visible';
						<?php 
        }
        ?>
					break;
					case 'review_next':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						prev_quest_id = response.getElementsByTagName('prev_quest_id')[0].firstChild.data;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						
						getObj('jq_quiz_container').innerHTML = '';
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';
						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						getObj('jq_quiz_container').appendChild(div_inside1);
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						quiz_review_correct = response.getElementsByTagName('quiz_review_correct')[0].firstChild.data;
						getObj('jq_quiz_result_reviews').innerHTML = quiz_review_correct;
						getObj('jq_quiz_result_reviews').style.display = 'block';
						getObj('jq_quiz_result_reviews').style.visibility = 'visible';
						getObj('jq_quiz_explanation').innerHTML = response.getElementsByTagName('quiz_review_explanation')[0].firstChild.data;;
						getObj('jq_quiz_explanation').style.display = 'block';
						getObj('jq_quiz_explanation').style.visibility = 'visible';
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('review_next');
						
						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
					break;
					case 'review_finish':
						quiz_blocked = 1;
						review = 0;
						setTimeout("jq_releaseBlock()", 1000);
						jq_UpdateTaskDiv('finish');
						var quiz_cont = getObj('jq_quiz_container');
						quiz_cont.innerHTML = saved_prev_res_data;//'<form name=\'quest_form\'><\/form>'+saved_prev_res_data;
					break;
					case 'next':
						quiz_blocked = 1;

						quiz_progress = response.getElementsByTagName('progress_quests_done')[0].firstChild.data;
						<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
						progressbar.setProgress(quiz_progress);
						<?php 
        }
        ?>

						setTimeout("jq_releaseBlock()", 1000);
						prev_correct = response.getElementsByTagName('quiz_prev_correct')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						quest_feedback = response.getElementsByTagName('quest_feedback')[0].firstChild.data;
						if (quest_feedback == '1') {
							var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
							var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
							jq_UpdateTaskDiv_htm(quiz_menu);
							if (prev_correct == '1') {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' border=0>";
							<?php 
        }
        ?>
								quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
								jq_UpdateTaskDiv('continue');
							} else {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png' border=0>";
							<?php 
        }
        ?>
								quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
								allow_attempt = response.getElementsByTagName('quiz_allow_attempt')[0].firstChild.data;
								if (allow_attempt == '1') { allow_attempt = 0; jq_UpdateTaskDiv('back_continue');
								} else { allow_attempt = 0; jq_UpdateTaskDiv('continue'); }
							}
						} else {
							var qmb = '';
							var qfrf = response.getElementsByTagName('quest_feedback_repl_func')[0].firstChild.data;
							if (prev_correct == '1') {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' border=0>";
							<?php 
        }
        ?>
							} else {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png' border=0>";
							<?php 
        }
        ?>
							}
							eval(qfrf);
						}
					break;
					<?php 
        if ($is_preview) {
            ?>
					case 'quest_preview':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						quiz_count_quests = response.getElementsByTagName('quiz_count_quests')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
						quiz_cont.innerHTML = '';//<form name=\'quest_form\'></form>';
						cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
						saved_prev_quest_type = cur_quest_type;
						cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
						saved_prev_quest_id = cur_quest_id;
						cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
						saved_prev_quest_score = cur_quest_score;
						cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
						saved_prev_quest_num = cur_quest_num;
						var quiz_cont = getObj('jq_quiz_container');
						quiz_cont.innerHTML = '';
						if (cur_quest_type == 7) {
							var div_insidey=document.createElement("div");
							div_insidey.id = 'quest_div_hs';
							getObj('jq_quiz_container').appendChild(div_insidey);
						}
						var div_inside1=document.createElement("div");
						div_inside1.id = 'quest_div';
						div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data +response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
						quiz_cont.appendChild(div_inside1);
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('next');
						var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
						saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
						if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
							var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
							saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
							eval(v_quiz_script_data);
						}
					break;
					case 'preview_finish':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						prev_correct = response.getElementsByTagName('quiz_prev_correct')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						if (prev_correct == '1') {
							quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
							jq_UpdateTaskDiv('preview_back');
						} else {
							quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
							jq_UpdateTaskDiv('preview_back');
						}
					break;
					<?php 
        }
        ?>
					case 'no_attempts':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('next_no_attempts');
					break;
					case 'email_results':
						quiz_blocked = 1;
						//setTimeout("jq_releaseBlock()", 1000);
						var email_msg = response.getElementsByTagName('email_msg')[0].firstChild.data;
						ShowMessage('error_messagebox', 1, email_msg);
					break;
					case 'time_is_up':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
														
						stu_quiz_id = response.getElementsByTagName('stu_quiz_id')[0].firstChild.data;
						user_unique_id = response.getElementsByTagName('user_unique_id')[0].firstChild.data;
						
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
						var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
						jq_UpdateTaskDiv_htm(quiz_menu);
						jq_UpdateTaskDiv('continue_finish');
					break;
					case 'finish':
						quiz_blocked = 1;

						quiz_progress = response.getElementsByTagName('progress_quests_done')[0].firstChild.data;
						<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
						progressbar.setProgress(quiz_progress);
						<?php 
        }
        ?>

						setTimeout("jq_releaseBlock()", 1000);
						prev_correct = response.getElementsByTagName('quiz_prev_correct')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						quest_feedback = response.getElementsByTagName('quest_feedback')[0].firstChild.data;
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						if (quest_feedback == '1') {
							var qmb = response.getElementsByTagName('quiz_message_box')[0].firstChild.data;
							var quiz_menu = response.getElementsByTagName('quiz_menu')[0].firstChild.data;
							jq_UpdateTaskDiv_htm(quiz_menu);
							if (prev_correct == '1') {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' border=0>";
							<?php 
        }
        ?>
								//stop_timer = 1;
								quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
								jq_UpdateTaskDiv('continue_finish');
							} else {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png' border=0>";
							<?php 
        }
        ?>
								quiz_cont.innerHTML = qmb;//'<form name=\'quest_form\'><\/form>'+qmb;
								allow_attempt = response.getElementsByTagName('quiz_allow_attempt')[0].firstChild.data;
								if (allow_attempt == '1') {
									allow_attempt = 0;
									jq_UpdateTaskDiv('back_continue_finish');
								} else {
									allow_attempt = 0;
									//stop_timer = 1;
									jq_UpdateTaskDiv('continue_finish');
								}
							}
						} else {
							var qmb = '';
							var qfrf = response.getElementsByTagName('quest_feedback_repl_func')[0].firstChild.data;
							if (prev_correct == '1') {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' border=0>";
							<?php 
        }
        ?>
							} else {
							<?php 
        if ($quiz->c_slide) {
            ?>
								getObj('quest_result_'+saved_prev_quest_id).innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png' border=0>";
							<?php 
        }
        ?>
							}
							eval(qfrf);
						}
					break;
					case 'results':
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 100);
						var quiz_cont = getObj('jq_quiz_container');
						var children = quiz_cont.childNodes;
						for (var i = 0; i < children.length; i++) { quiz_cont.removeChild(quiz_cont.childNodes[i]); };
						quiz_cont.innerHTML = '';//'<form name=\'quest_form\'><\/form>';
						stop_timer = 1;
						getObj('jq_time_tick_container').style.visibility = "hidden";
						jq_UpdateTaskDiv('finish');
						var finish_msg = response.getElementsByTagName('finish_msg')[0].firstChild.data;
						var quiz_results = response.getElementsByTagName('quiz_results')[0].firstChild.data;
						var quiz_footer = response.getElementsByTagName('quiz_footer')[0].firstChild.data;
						var quiz_cont = getObj('jq_quiz_container');
						quiz_cont.innerHTML = quiz_results+finish_msg+quiz_footer;//'<form name=\'quest_form\'><\/form>'+quiz_results+finish_msg+quiz_footer;
						saved_prev_res_data = quiz_results+finish_msg+quiz_footer;
					break;
					case 'failed':
						ShowMessage('error_messagebox', 1, mes_failed);
						quiz_blocked = 1;
						setTimeout("jq_releaseBlock()", 1000);
					break;
					default:
					break;
				}
			} else {
				ShowMessage('error_messagebox', 1, '<?php 
        echo $jq_language['quiz_failed_request'];
        ?>
');
			}
		}
	}
	function jq_releaseBlock() { quiz_blocked = 0; }
	function jq_Start_TickTack() {
		timer_sec = 1;
		getObj('jq_time_tick_container').innerHTML = '00:01';
		getObj('jq_time_tick_container').style.visibility = "visible";
		setTimeout("jq_Continue_TickTack()", 1000);
	}
	function jq_Start_TickTackResume() {
		jq_ParseTickTackTimer(timer_sec);
		getObj('jq_time_tick_container').style.visibility = "visible";
		setTimeout("jq_Continue_TickTack()", 1000);
	}
	function jq_Continue_TickTack() {
		if (stop_timer == 1) {
			getObj('jq_time_tick_container').style.visibility = "hidden";
		} else {
			timer_sec ++;
			if ( max_quiz_time && (timer_sec > max_quiz_time) ) {
				getObj('jq_time_tick_container').innerHTML = mes_time_is_up;
			} else {
				jq_ParseTickTackTimer(timer_sec);
				setTimeout("jq_Continue_TickTack()", 1000);
			}
		}
	}
	function jq_ParseTickTackTimer(timer_sec) {
		var timer_hours = parseInt(timer_sec/3600);
		var timer_min = parseInt(timer_sec/60) - (timer_hours*60);
		var plus_sec = timer_sec - (timer_min*60) - (timer_hours*3600);
		if (timer_min < 0) { timer_min = timer_min*(-1); }
		if (plus_sec < 0) { plus_sec = plus_sec*(-1); }
		if (timer_hours < 0) { timer_hours = timer_hours*(-1); }
		var time_str_hours = '';
		if (timer_hours) {
			time_str_hours = timer_hours + '';
			if (time_str_hours.length == 1) time_str_hours = '0'+time_str_hours;
			time_str_hours = time_str_hours + ':';
		}
		var time_str = timer_min + '';
		if (time_str.length == 1) time_str = '0'+time_str;
		time_str2 = plus_sec + '';
		if (time_str2.length == 1) time_str2 = '0'+time_str2;
		getObj('jq_time_tick_container').innerHTML = time_str_hours + time_str + ':' + time_str2;
	}

		function jq_ResumeQuizOn(resume_id, unique_id, last_question) {
	<?php 
        if ($quiz->c_email_to == 2) {
            ?>
		/*var jq_email_cont = getObj('jq_user_email');
		var re_email = /[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}/;
		if (!re_email.test(jq_email_cont.value)) {
			alert("Please enter a correct e-mail address");
			return;
		}
		user_email_to = jq_email_cont.value;*/
	<?php 
        }
        ?>
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();//
			timerID = setTimeout("jq_ResumeQuiz("+resume_id+", '"+unique_id+"', "+last_question+")", 300);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
		}
	}
	function jq_ResumeQuiz(resume_id, unique_id, last_question) { 
		jq_MakeRequest('&atask=resume_quiz&quiz=<?php 
        echo $quiz->c_id;
        ?>
&resume_id='+resume_id+'&unique_id='+unique_id+'&last_question='+last_question,1); 
	}

	
	function jq_StartQuizOn() {
	<?php 
        if ($quiz->c_email_to == 2) {
            ?>
		/*var jq_email_cont = getObj('jq_user_email');
		var re_email = /[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}/;
		if (!re_email.test(jq_email_cont.value)) {
			alert("Please enter a correct e-mail address");
			return;
		}
		user_email_to = jq_email_cont.value;*/
	<?php 
        }
        ?>
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();//
			timerID = setTimeout("jq_StartQuiz()", 300);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
		}
	}
	function jq_StartQuiz() { jq_MakeRequest('&atask=start&quiz=<?php 
        echo $quiz->c_id;
        ?>
',1); }
	
	function jq_StartQuizOn_selfver() {
	<?php 
        if ($quiz->c_email_to == 2) {
            ?>
		/*var jq_email_cont = getObj('jq_user_email');
		var re_email = /[0-9a-z_]+@[0-9a-z_^.]+.[a-z]{2,3}/;
		if (!re_email.test(jq_email_cont.value)) {
			alert("Please enter a correct e-mail address");
			return;
		}
		user_email_to = jq_email_cont.value;*/
	<?php 
        }
        ?>
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();//
			timerID = setTimeout("jq_StartQuiz_selfver()", 300);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
		}
	}
	
	function implode( glue, pieces ) {
	    return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces );
	}
	
	function jq_StartQuiz_selfver(){ 
		var form = document.selfverForm;
		var string_params = '';
		
		if(form.c_pool_type.value == 1){
			string_params = '&mode_self=1&pool_num='+form.pool_qtype_number.value;
		} else if(form.c_pool_type.value == 2){
			if (form['pool_cat_id[]'].length) {
				var arr_cat_id = new Array(form['pool_cat_id[]'].length);
				var arr_cat_number = new Array(form['pool_cat_number[]'].length);
				for (var i = 0; i<form['pool_cat_number[]'].length; i++) {
						if (form['pool_cat_number[]'][i].value > 0) { 
							arr_cat_id[i] = form['pool_cat_id[]'][i].value;
							arr_cat_number[i] = form['pool_cat_number[]'][i].value; 
						} 
				}
				string_params = '&mode_self=2&cats_id='+implode(',', arr_cat_id)+'&pool_num='+implode(',', arr_cat_number);
			} else if (form['pool_cat_id[]'].value > 0) { 
				var arr_cat_id;
				var arr_cat_number;
				arr_cat_id = form['pool_cat_id[]'].value;
				arr_cat_number = form['pool_cat_number[]'].value;
				string_params = '&mode_self=3&cats_id='+arr_cat_id+'&pool_num='+arr_cat_number;
			} 
		}
		jq_MakeRequest('&atask=start&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+string_params,1);
	}
	
	
	function JQ_gotoQuestionOn(qid) {
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();//
			timerID = setTimeout("JQ_gotoQuestion("+qid+")", 300);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
			setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function JQ_gotoQuestion(qid){
		if(review){
			jq_MakeRequest('&atask=review_next&prev=1&quiz=<?php 
        echo $quiz->c_id;
        ?>
&stu_quiz_id='+stu_quiz_id+'&quest_id='+qid, 1 ); 
		} else {
			jq_MakeRequest('&atask=goto_quest&quiz=<?php 
        echo $quiz->c_id;
        ?>
&stu_quiz_id='+stu_quiz_id+'&seek_quest_id='+qid, 1 ); 
		}
	}
	function jq_emailResults() {
		if (!quiz_blocked) {
			ShowMessage('error_messagebox', 1, mes_loading);
			jq_MakeRequest('&atask=email_results&quiz=<?php 
        echo $quiz->c_id;
        ?>
&stu_quiz_id='+stu_quiz_id<?php 
        echo $quiz->c_email_to == 2 ? "+'&email_address='+user_email_to" : '';
        ?>
,0);
		} else {
			//ShowMessage('error_messagebox', 1, mes_please_wait);// setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function jq_startReview() {
		if (!quiz_blocked) {
			jq_MakeRequest('&atask=review_start&quiz=<?php 
        echo $quiz->c_id;
        ?>
&stu_quiz_id='+stu_quiz_id, 1);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait); setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function jq_QuizReviewNext() {
		if (!quiz_blocked) {
			jq_MakeRequest('&atask=review_next&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id, 1);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
			setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function jq_QuizReviewPrev() {
		if (!quiz_blocked) {
			jq_MakeRequest('&atask=review_next&prev=1&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+prev_quest_id, 1);
		} else {
			ShowMessage('error_messagebox', 1, mes_please_wait);
			setTimeout("jq_releaseBlock()", 1000);
		}
	}
	function jq_Check_selectRadio(rad_name, form_name) {
		var tItem = eval('document.'+form_name);
		if (tItem) {
			var selItem = eval('document.'+form_name+'.'+rad_name);
			if (selItem) {
				if (selItem.length) { var i;
					for (i = 0; i<selItem.length; i++) {
						if (selItem[i].checked) {
							if (selItem[i].value > 0) { return selItem[i].value; } } }
				} else if (selItem.checked) { return selItem.value; } }
			return false; }
		return false;
	}
	function jq_Check_selectCheckbox(check_name, form_name) {
		selItem = eval('document.'+form_name+'.'+check_name);
		var rrr = '';
		if (selItem) {
			if (selItem.length) { var i;
				for (i = 0; i<selItem.length; i++) {
					if (selItem[i].checked) {
						if (selItem[i].value > 0) { rrr = rrr + selItem[i].value + ', '; }
					}}
				rrr = rrr.substring(0, rrr.length - 2);
			} else if (selItem.checked) { rrr = rrr + selItem.value; }}
		return rrr;
	}
	function jq_Check_valueItem(item_name, form_name) {
		selItem = eval('document.'+form_name+'.'+item_name);
		var rrr = '';
		if (selItem) {
			if (selItem.length) { var i;
				for (i = 0; i<selItem.length; i++) {
					if (selItem[i].value == '{0}') return '';
					rrr = rrr + selItem[i].value + '```';
				}
				rrr = rrr.substring(0, rrr.length - 3);
			} else { rrr = rrr + selItem.value;	}}
		return rrr;
	}
	function jq_QuizNextOn() { // Two steps CHECK (delete this func in the future)
		switch (cur_quest_type) {
			case '1': //Multi choice
			case '12':
				if (!jq_Check_selectRadio('quest_choice', 'quest_form') && !document.quest_form.ismandatory.value) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '2': //Multi Response
			case '13':
				var res = jq_Check_selectCheckbox('quest_choice', 'quest_form');
				if (res == '') {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '3': //true-false
				if (!jq_Check_selectRadio('quest_choice', 'quest_form')) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '4': // Drag'AND'Drop
			case '11':
				var i_id; var i_value; var complete = true;
				for (i=0; i<kol_drag_elems; i++) {
					if ( (ids_in_cont[i] > 0) && (ids_in_cont[i] <= kol_drag_elems) ) {
						//alert(ids_in_cont[i] + ' - ' + cont_for_ids[ids_in_cont[i] - 1] + ' - ' + answ_ids[ids_in_cont[i]])
						if (cont_for_ids[ids_in_cont[i] - 1] == i+1) { ;
						} else { complete = false; }
					} else { complete = false; }
				}
				if (!complete) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;
				}
			break;
			case '5': //drop-down
				var res = jq_Check_valueItem('quest_match', 'quest_form');
				if (res == '') {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;
				}
			break;
			case '6': //fill in the blank
				var blank_item = document.quest_form.quest_blank;
				var res = TRIM_str(blank_item.value);
				if (res == '' && !document.quest_form.ismandatory.value) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '7': //hotspot question
				var hs_x = parseInt(document.quest_form.hotspot_x.value);
				var hs_y = parseInt(document.quest_form.hotspot_y.value);
				if ((hs_x == 0) && (hs_y == 0)) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '8': //survey question
				var answer = document.quest_form.survey_box.value;
				if (TRIM_str(answer) == '' && !document.quest_form.ismandatory.value) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;
			case '10':
			break;
			/*case '11':
				var i_id; var i_value; var complete = true;
				for (i=0; i<kol_drag_elems; i++) {
					if ( (ids_in_cont[i] > 0) && (ids_in_cont[i] <= kol_drag_elems) ) {
						//alert(ids_in_cont[i] + ' - ' + cont_for_ids[ids_in_cont[i] - 1] + ' - ' + answ_ids[ids_in_cont[i]])
						if (cont_for_ids[ids_in_cont[i] - 1] == i+1) { ;
						} else { complete = false; }
					} else { complete = false; }
				}
				if (!complete) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					return false;}
			break;*/
		}
		if (!quiz_blocked) {
			//ShowMessage('error_messagebox', 1, mes_loading);
			//jq_showLoading();
			quiz_blocked = 1;
			timerID = setTimeout("jq_QuizNext()", 300);
		} else { ShowMessage('error_messagebox', 1, mes_please_wait); setTimeout("jq_releaseBlock()", 1000); }
	}

	function jq_QuizContinue() {

		cur_quest_type = response.getElementsByTagName('quest_type')[0].firstChild.data;
		saved_prev_quest_type = cur_quest_type;
		cur_quest_id = response.getElementsByTagName('quest_id')[0].firstChild.data;
		saved_prev_quest_id = cur_quest_id;
		cur_quest_score = response.getElementsByTagName('quest_score')[0].firstChild.data;
		saved_prev_quest_score = cur_quest_score;
		cur_quest_num = response.getElementsByTagName('quiz_quest_num')[0].firstChild.data;
		saved_prev_quest_num = cur_quest_num;
		skip_next_quest = response.getElementsByTagName('quiz_skip_next_quest')[0].firstChild ? response.getElementsByTagName('quiz_skip_next_quest')[0].firstChild.data : 0;
		var quiz_cont = getObj('jq_quiz_container');
		quiz_cont.innerHTML = '';
		if (cur_quest_type == 7) {
			var div_insidey=document.createElement("div");
			div_insidey.id = 'quest_div_hs';
			getObj('jq_quiz_container').appendChild(div_insidey);
		}
		var div_inside1=document.createElement("div");
		div_inside1.id = 'quest_div';
		div_inside1.innerHTML = response.getElementsByTagName('quest_data')[0].firstChild.data +response.getElementsByTagName('quest_data_user')[0].firstChild.data;
		saved_prev_quest_data = response.getElementsByTagName('quest_data')[0].firstChild.data + response.getElementsByTagName('quest_data_user')[0].firstChild.data;
		quiz_cont.appendChild(div_inside1);
<?php 
        //Max: modign skip question
        ?>
		if(parseInt(skip_next_quest)){
	<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
        $toolbar[] = array('btn_type' => 'skip', 'btn_js' => "javascript:JQ_gotoQuestion(__skip__);void(0);");
        if ($quiz->c_slide) {
            $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
        }
        $m_str = JLMS_ShowToolbar($toolbar, false);
        ?>
			var subject = '<?php 
        echo str_replace('/', '\\/', addslashes($m_str));
        ?>
';
			html_replace = subject.split('__skip__').join(skip_next_quest);
			jq_UpdateTaskDiv_htm(html_replace);
		} else {
	<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
        if ($quiz->c_slide) {
            $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
        }
        $m_str = JLMS_ShowToolbar($toolbar, false);
        ?>
			
			jq_UpdateTaskDiv_htm('<?php 
        echo str_replace('/', '\\/', addslashes($m_str));
        ?>
');
		}

			jq_UpdateTaskDiv('next');
		
		var is_exec_quiz_script = response.getElementsByTagName('exec_quiz_script')[0].firstChild.data;
		saved_prev_quest_exec_quiz_script = is_exec_quiz_script;
		if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
			var v_quiz_script_data = response.getElementsByTagName('quiz_script_data')[0].firstChild.data;
			saved_prev_quest_exec_quiz_script_data = v_quiz_script_data;
			eval(v_quiz_script_data);
		}
	}
	function jq_QuizContinueFinish() {
		jq_MakeRequest('&atask=finish_stop&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&user_unique_id='+user_unique_id, 1);
	}
	function jq_QuizBack() {
		cur_quest_id = saved_prev_quest_id;
		cur_quest_type = saved_prev_quest_type;
		cur_quest_score = saved_prev_quest_score;
		cur_quest_num = saved_prev_quest_num;
		var quiz_cont = getObj('jq_quiz_container');
		quiz_cont.innerHTML = '';
		if (cur_quest_type == 7) {
			var div_insidey=document.createElement("div");
			div_insidey.id = 'quest_div_hs';
			getObj('jq_quiz_container').appendChild(div_insidey);
		}
		var div_inside1=document.createElement("div");
		div_inside1.id = 'quest_div';
		div_inside1.innerHTML = saved_prev_quest_data;
		quiz_cont.appendChild(div_inside1);
<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
        if ($quiz->c_slide) {
            $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
        }
        $m_str = JLMS_ShowToolbar($toolbar, false);
        ?>
		jq_UpdateTaskDiv_htm('<?php 
        echo str_replace('/', '\\/', addslashes($m_str));
        ?>
');
		jq_UpdateTaskDiv('next');
		var is_exec_quiz_script = saved_prev_quest_exec_quiz_script;
		if (is_exec_quiz_script == 1 || is_exec_quiz_script == '1' ) {
			var v_quiz_script_data = saved_prev_quest_exec_quiz_script_data;
			eval(v_quiz_script_data);
		}
	}
	function URLencode(sStr) {
		return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
	}
	function TRIM_str(sStr) {
		return (sStr.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
	}
	function jq_QuizNext() { //send 'TASK = next'
		<?php 
        if ($is_preview) {
            ?>
		var jq_task = 'next_preview';
		<?php 
        } else {
            ?>
		var jq_task = 'next';
		<?php 
        }
        ?>
		switch (cur_quest_type) {
			case '1':
			case '12':
			var answer = jq_Check_selectRadio('quest_choice', 'quest_form');
				if (answer || document.quest_form.ismandatory.value != '0') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '3':
				var answer = jq_Check_selectRadio('quest_choice', 'quest_form');
				if (answer) {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '2':
			case '13':
				var answer = jq_Check_selectCheckbox('quest_choice', 'quest_form');
				if (answer != '') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '4':
			case '11':
				var i_id;
				var i_value;
				var answer = '';
				var complete = true;
				var mas_ans = new Array(kol_drag_elems);
				for (i=0; i<kol_drag_elems; i++) {
					mas_ans[i] = 0;
					if ( (ids_in_cont[i] > 0) && (ids_in_cont[i] <= kol_drag_elems) ) {
						if (cont_for_ids[ids_in_cont[i] - 1] == i+1) {
							mas_ans[i] = ids_in_cont[i];
							answer = answer + answ_ids[ids_in_cont[i]] + '```';
						} else { complete = false; }
					} else { complete = false; }
				}
				if (!complete) {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					setTimeout("jq_releaseBlock()", 1000);
					return false;
				} else {
					answer = answer.substring(0, answer.length - 3);
					answer = URLencode(answer);
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				}
			break;
			case '5':
				var answer = jq_Check_valueItem('quest_match', 'quest_form');
				answer = URLencode(answer);
				if (answer != '') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '6':
				var blank_item = document.quest_form.quest_blank;
				var answer = URLencode(TRIM_str(blank_item.value));
				if (answer != '' || document.quest_form.ismandatory.value != '0') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '7':
				var hs_x = parseInt(document.quest_form.hotspot_x.value);
				var hs_y = parseInt(document.quest_form.hotspot_y.value);
				if ((hs_x != 0) && (hs_y != 0)) {
					var answer = hs_x + ',' + hs_y;
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '8':
				var answer = URLencode(TRIM_str(document.quest_form.survey_box.value));
				if (answer != '' || document.quest_form.ismandatory.value != '0') {
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				} else { ShowMessage('error_messagebox', 1, mes_complete_this_part); setTimeout("jq_releaseBlock()", 1000); return false; }
			break;
			case '9':
				var complete = true;
				var scale_count = parseInt(document.quest_form.scale_count.value);
				var answer = new Array(scale_count);
				for(i=0;i<scale_count;i++)
				{
					var cur_answer = jq_Check_selectRadio('ch_scale_'+i, 'quest_form');
					if(!cur_answer)
						complete = false;
					else
						answer[i] = cur_answer;	
				}
				if (!complete && document.quest_form.ismandatory.value!='1') {
					ShowMessage('error_messagebox', 1, mes_complete_this_part);
					setTimeout("jq_releaseBlock()", 1000);
					return false;
				} else {
					
					jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer='+answer, 1);
				}
			break;	
			case '10':
				jq_MakeRequest('&atask=' + jq_task + '&quiz=<?php 
        echo $quiz->c_id;
        ?>
'+'&stu_quiz_id='+stu_quiz_id+'&quest_id='+cur_quest_id+'&answer=0', 1);
			break;
			default:
				ShowMessage('error_messagebox', 1, '<?php 
        echo $jq_language['quiz_unknown_error'];
        ?>
');
				setTimeout("jq_releaseBlock()", 1000);
			break;
		}
	}

	function jq_showLoading() {
		ShowMessage('error_messagebox', 0, '&nbsp;');

		getObj('jq_quiz_result_reviews').style.visibility = 'hidden';
		getObj('jq_quiz_explanation').style.visibility = 'hidden';
		getObj('jq_quiz_result_reviews').style.display = 'none';
		getObj('jq_quiz_explanation').style.display = 'none';
		getObj('jq_quiz_container').innerHTML = '<br /><br /><center><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/loading.gif" height="32" width="32" border="0" alt="loading" /><\/center>';
	}

	function jq_UpdateTaskDiv_htm(htm_txt) {
		getObj('jq_quiz_task_container').innerHTML = htm_txt;
	}

	function jq_UpdateTaskDiv(task) {
		switch (task) {
			case 'start':
				getObj('jq_quiz_task_container').innerHTML = jq_StartButton('jq_StartQuizOn()', '<?php 
        echo $jq_language['quiz_start'];
        ?>
');
			break;
			case 'resume':
			case 'next':
				//getObj('jq_quiz_task_container').innerHTML = jq_NextButton('jq_QuizNextOn()', '<?php 
        echo $jq_language['quiz_next'];
        ?>
');
				getObj('jq_quest_num_container').innerHTML = mes_quest_number.replace("{X}", cur_quest_num).replace("{Y}", quiz_count_quests);
				getObj('jq_quest_num_container').style.visibility = "visible";
				getObj('jq_points_container').innerHTML = mes_quest_points.replace("{X}", cur_quest_score);
				getObj('jq_points_container').style.visibility = "visible";
				getObj('jq_question_id_container').style.visibility = "hidden";

				<?php 
        if ($JLMS_CONFIG->get('quizzes_show_quest_id', 0) == 1) {
            ?>

					quest_id_gqp = response.getElementsByTagName('quest_id_gqp')[0].firstChild.data;				
					quest_id_pool = response.getElementsByTagName('quest_id_pool')[0].firstChild.data;	

					if(quest_id_gqp > 0) {
						getObj('jq_question_id_container').innerHTML = "<?php 
            echo $JLMS_CONFIG->get('quizzes_quest_id_title', 0);
            ?>
"+quest_id_gqp;
					}
					if(quest_id_pool > 0) {
						getObj('jq_question_id_container').innerHTML = "<?php 
            echo $JLMS_CONFIG->get('quizzes_quest_id_title', 0);
            ?>
"+quest_id_pool;
					}

					if(quest_id_gqp > 0 || quest_id_pool > 0) {
						getObj('jq_question_id_container').style.display = "block";
						getObj('jq_question_id_container').style.visibility = "visible";
					}
					else {
						getObj('jq_question_id_container').style.display = "none";
						getObj('jq_question_id_container').style.visibility = "hidden";
					}

				<?php 
        }
        ?>
				<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
				getObj('progress_bar').style.display = "block";
				<?php 
        }
        ?>
			break;
			case 'review_next':
				//getObj('jq_quiz_task_container').innerHTML = jq_ContinueButton('jq_QuizReviewNext()', '<?php 
        echo $jq_language['quiz_next'];
        ?>
');
				getObj('jq_quest_num_container').innerHTML = mes_quest_number.replace("{X}", cur_quest_num).replace("{Y}", quiz_count_quests);
				getObj('jq_quest_num_container').style.visibility = "visible";
				getObj('jq_points_container').innerHTML = mes_quest_points.replace("{X}", cur_quest_score);
				getObj('jq_points_container').style.visibility = "visible";
			break;
			case 'next_no_attempts':
				//getObj('jq_quiz_task_container').innerHTML = jq_ContinueButton('jq_QuizContinue()', '<?php 
        echo $jq_language['quiz_continue'];
        ?>
');
			break;
			case 'finish':
				<?php 
        if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
            ?>
				getObj('progress_bar').style.display = "none";
				if (getObj('jq_question_id_container')) { getObj('jq_question_id_container').style.visibility = "hidden"; }
				<?php 
        }
        ?>
			case 'clear':
				getObj('jq_quiz_task_container').innerHTML = "";
				getObj('jq_quest_num_container').style.visibility = "hidden";
				getObj('jq_points_container').style.visibility = "hidden";
				getObj('jq_question_id_container').style.visibility = "hidden";
			break;
			case 'continue':
			break;
			case 'continue_finish':
			break;
			case 'back_continue':
				//getObj('jq_quiz_task_container').innerHTML = jq_ContinueButton('jq_QuizContinue()', '<?php 
        echo $jq_language['quiz_continue'];
        ?>
')+jq_BackButton('jq_QuizBack()', '<?php 
        echo $jq_language['quiz_back'];
        ?>
');
			break;
			case 'back_continue_finish':
				//getObj('jq_quiz_task_container').innerHTML = jq_ContinueButton('jq_QuizContinueFinish()', '<?php 
        echo $jq_language['quiz_continue'];
        ?>
')+jq_BackButton('jq_QuizBack()', '<?php 
        echo $jq_language['quiz_back'];
        ?>
');
			break;
			<?php 
        if ($is_preview) {
            ?>
			case 'preview_back':
				//getObj('jq_quiz_task_container').innerHTML = jq_BackButton('JQ_previewQuest()', '<?php 
            echo $jq_language['quiz_back'];
            ?>
');
			break;
			<?php 
        }
        ?>
		}
		<?php 
        if ($quiz->c_slide) {
            ?>
		if (result_is_shown == 1) { jq_ShowPanel(); }
		<?php 
        }
        ?>
		if (task == 'finish') {
			//var obj_plc = getObj('jq_panel_link_container');
			//if (obj_plc) obj_plc.style.visibility = 'hidden';
		}
	}
	function jq_NextButton(task, text) {
		return "<div id=\"jq_next_link_container\" onclick=\""+task+"\"><div class=\"back_button\" id=\"jq_quiz_task_link_container\"><a href=\"javascript: void(0)\">"+text+"<\/a><\/div><br /><\/div>";
	}
	function jq_ContinueButton(task, text) {
		return "<div id=\"jq_continue_link_container\" onclick=\""+task+"\"><div class=\"back_button\" id=\"jq_quiz_task_link_container\"><a href=\"javascript: void(0)\">"+text+"<\/a><\/div><br /><\/div>";
	}
	function jq_StartButton(task, text) {
		return "<div id=\"jq_start_link_container\" onclick=\""+task+"\"><div class=\"back_button\" id=\"jq_quiz_task_link_container\"><a href=\"javascript: void(0)\">"+text+"<\/a><\/div><br /><\/div>";
	}
	function jq_BackButton(task, text) {
		return "<div id=\"jq_back_link_container\" onclick=\""+task+"\"><div class=\"back_button\" id=\"jq_quiz_task_link_container\"><a href=\"javascript: void(0)\">"+text+"<\/a><\/div><br /><\/div>";
	}
	function jq_ShowPanel_go() {
		var jq_quiz_c_cont = getObj('jq_quiz_container');
		if (jq_quiz_c_cont) { jq_quiz_c_cont.style.visibility = 'hidden'; jq_quiz_c_cont.style.display = 'none';}
		var jq_quiz_r_c = getObj('jq_quiz_result_container');
		if (jq_quiz_r_c) { jq_quiz_r_c.style.visibility = 'visible'; jq_quiz_r_c.style.display = 'block';}
	}
	function jq_HidePanel_go() {
		var jq_quiz_r_c = getObj('jq_quiz_result_container');
		if (jq_quiz_r_c) { jq_quiz_r_c.style.visibility = 'hidden'; jq_quiz_r_c.style.display = 'none';}
		var jq_quiz_c_cont = getObj('jq_quiz_container');
		if (jq_quiz_c_cont) { jq_quiz_c_cont.style.visibility = 'visible'; jq_quiz_c_cont.style.display = 'block';}
	}
	function jq_ShowPanel() {
<?php 
        if ($quiz->c_slide) {
            ?>
	
		if (result_is_shown == 1) { jq_HidePanel_go(); result_is_shown = 0;	}
		else { jq_ShowPanel_go();	result_is_shown = 1; }
<?php 
        }
        ?>
	}
<?php 
        if ($is_preview) {
            ?>
	function JQ_previewQuest() {
		jq_MakeRequest('&atask=preview_quest&quiz=<?php 
            echo $quiz->c_id;
            ?>
'+'&preview_id=<?php 
            echo $preview_id;
            ?>
&quest_id=<?php 
            echo $preview_quest;
            ?>
', 1);
	}
<?php 
        }
        ?>

//--><!]]>
</script>
<div>
	<?php 
        $quiz->template_name = 'joomlaquiz_lms_template';
        if ($quiz->template_name) {
            require dirname(__FILE__) . '/templates/' . $quiz->template_name . '/jq_template.php';
            //$url_link = 'index.php?option='.$option.'&task=quiz_action&id='.$course_id.'&atask=start&quiz='.$quiz->c_id.'&Itemid='.$Itemid.'';
            //no-js functionality commented in JoomlaLMS 1.1.0 (due to the lost of bugs and lack of usage)
            $url_link = 'javascript:void(0);';
            $page = strval(mosGetParam($_REQUEST, 'page', ''));
            $task_cont = '';
            if ($page != 'view_preview') {
                $task_cont .= "\n\t\t\t<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"right\" style=\"text-align: right;\" class=\"jlms_table_no_borders\">\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>";
                if ($self_verification != '') {
                    $task_cont .= "<input type='image' src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_start.png' name='atask' value='start'/>";
                    $task_cont .= "<input type='hidden' name='task' value='quiz_action'/>";
                    $task_cont .= "<input type='hidden' name='id' value='" . $course_id . "'/>";
                    $task_cont .= "<input type='hidden' name='quiz' value='" . $quiz->c_id . "'/>";
                    $task_cont .= "<input type='hidden' name='atask' value='start'/>";
                } else {
                    $task_cont .= "<a style=\"cursor: pointer;\" href=\"" . sefRelToAbs($url_link) . "\">\n\t\t\t\t\t\t\t\t<img width=\"32\" height=\"32\" border=\"0\" title=\"" . _JLMS_START_ALT_TITLE . "\" alt=\"" . _JLMS_START_ALT_TITLE . "\" src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/buttons/btn_start.png\" class=\"JLMS_png\"/>\n\t\t\t\t\t\t\t</a>";
                }
                $task_cont .= "</td>\n\t\t\t\t\t\t<td valign=\"middle\" style=\"vertical-align: middle;\">";
                if ($self_verification != '') {
                    $task_cont .= "&nbsp;" . _JLMS_START_ALT_TITLE . "&nbsp;";
                } else {
                    $task_cont .= "<a style=\"cursor: pointer;\" href=\"" . sefRelToAbs($url_link) . "\">&nbsp;" . _JLMS_START_ALT_TITLE . "&nbsp;</a>";
                }
                $task_cont .= "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>";
            }
            $query = "SELECT a.*, 'joomlaquiz_lms_template' as template_name FROM #__lms_quiz_t_quiz as a WHERE a.c_id = " . $quiz->c_id . " and a.course_id = " . $course_id;
            $JLMS_DB->SetQuery($query);
            $quiz_params = $JLMS_DB->LoadObjectList();
            $descr_cont = isset($quiz_params[0]->c_description) ? $quiz_params[0]->c_description : '';
            $descr_cont = JLMS_ShowText_WithFeatures($descr_cont);
            $progress_bar_js = true;
            //by Max
            if ($preview_quest) {
                $progress_bar_js = false;
            }
            echo JoomlaQuiz_template_class::JQ_MainScreen($descr_cont, $task_cont, $self_verification, $progress_bar_js);
            if ($is_preview) {
                ?>
			<script language="JavaScript" type="text/javascript">
			<!--//--><![CDATA[//><!--
				var jq_quiz_c_t = getObj('jq_quiz_container_title');
				if (jq_quiz_c_t) jq_quiz_c_t.innerHTML = "<?php 
                echo addslashes($quiz->c_title);
                ?>
";
				var jq_quiz_c_d = getObj('jq_quiz_container_description');
				if (jq_quiz_c_d) jq_quiz_c_d.innerHTML = "<?php 
                echo "Click <a href='javascript:void(0)' onclick='JQ_previewQuest();'>here<\\/a> to preview the question";
                ?>
";
			//--><!]]>
			</script>
			</div>
			<?php 
            } else {
                $quiz_params = new JLMSParameters($quiz->params);
                if ($quiz_params->get('sh_self_verification', 0) == 1) {
                    $toolbar = array();
                    if ($quiz->attempts_of_this_quiz < $quiz->c_max_numb_attempts || $quiz->c_max_numb_attempts == 0) {
                        $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:jq_StartQuizOn_selfver(); return false;");
                    }
                } else {
                    $toolbar = array();
                    if ($quiz->attempts_of_this_quiz < $quiz->c_max_numb_attempts || $quiz->c_max_numb_attempts == 0) {
                        $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:jq_StartQuizOn(); return false;");
                    }
                }
                //if(isset($quiz->resume_quiz) && $quiz->resume_quiz && $quiz->last_question)
                if (isset($quiz->resume_quiz) && $quiz->resume_quiz && !$quiz->c_total_time) {
                    $toolbar[] = array('btn_type' => 'resume', 'btn_js' => "javascript:jq_ResumeQuizOn(" . $quiz->resume_quiz . ",'" . $quiz->unique_id . "', " . $quiz->last_question . "); return false;");
                }
                $m_str = JLMS_ShowToolbar($toolbar, false);
                //				$m_str = addslashes($m_str);
                //				$m_str = addslashes($m_str);
                $domready2 = '
				jq_UpdateTaskDiv_htm("' . str_replace('/', '\\/', addslashes($m_str)) . '");
				var jq_quiz_c_t = getObj(\'jq_quiz_container_title\');
				if (jq_quiz_c_t) jq_quiz_c_t.innerHTML = "' . addslashes($quiz->c_title) . '";
				var jq_quiz_c_d = getObj(\'jq_quiz_container_description\');
//				if (jq_quiz_c_d) jq_quiz_c_d.innerHTML = "' . str_replace("\n", '', str_replace("\r", '', str_replace("/", "\\/", addslashes($quiz->c_description)))) . '";
				var jq_qiuz_c_selfver = getObj(\'jq_quiz_container_selfver\');
				if (jq_qiuz_c_selfver) jq_qiuz_c_selfver.innerHTML = "' . str_replace("\n", '', str_replace("\r", '', str_replace("/", "\\/", addslashes($self_verification)))) . '";
				';
                $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready2);
                ?>

			</div>
<?php 
            }
            //TODO: replace getObj with mootools $ operand.... !!!!!! NOTE !!!!!!!!!!!! we should update DOM using $ only after ondomready !!!
        }
    }
    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');
        }
    }