var ilias = {}; //namespace var icount = 0; //interaction count ilias.UTILS={}; ilias.questions = { answers:Object, success: "not attempted" }; ilias.questions.txt = {}; ilias.questions.txt.wrong_answers = "Incorrect Items"; ilias.questions.txt.wrong_answers_single = "Incorrect Choice."; ilias.questions.txt.tries_remaining = "Tries Remaining"; ilias.questions.txt.please_try_again = "Please try again!"; ilias.questions.txt.all_answers_correct = "Correct!"; ilias.questions.txt.nr_of_tries_exceeded = "Number of tries exceeded."; ilias.questions.txt.correct_answers_shown = "Correct solution see above."; ilias.questions.txt.correct_answers_also = "Also correct are:"; ilias.questions.txt.correct_answer_also = "Also correct is:"; ilias.questions.txt.ov_all_correct = "You have correctly answered all questions."; ilias.questions.txt.ov_some_correct = "You have correctly answered [x] out of [y] questions."; ilias.questions.txt.ov_wrong_answered = "The following questions were not answered or answered wrong"; ilias.questions.init = function() { ilias.questions.shuffle(); }; ilias.questions.shuffleAll = function() { //shuffle questions for (var k in questions) { if (questions[k].shuffle === true) { ilias.questions.swapper(questions[k].answers); } } }; ilias.questions.shuffle = function(a_question) { //shuffle questions if (!a_question.answers) {return;} if (a_question.shuffle === true) { ilias.questions.swapper(a_question.answers); } }; ilias.questions.swapper = function(a) { var i,L; i = L = a.length; while (i--) { var r = Math.floor(Math.random()*L); var x = a[i]; a[i] = a[r]; a[r] = x; } }; ilias.questions.checkAnswers = function(a_id) { if (!answers[a_id]) { answers[a_id] = new Object(); answers[a_id].tries = 0; answers[a_id].wrong = 0; answers[a_id].passed = null; answers[a_id].answer = new Array(); answers[a_id].interactionId=null; } answers[a_id].tries++; var call = "ilias.questions."+questions[a_id].type+"("+a_id+")"; eval(call); // forward answer to self assessment question handler (non-scorm) if (typeof ilCOPageQuestionHandler != "undefined") { ilCOPageQuestionHandler.processAnswer(questions[a_id].type, a_id, answers[a_id]); } }; ilias.questions.handleMCImages = function(a_id) { if(questions[a_id].path === undefined) { return; } jQuery('div#container' + a_id + ' input.order').each(function(key, node){ for(var i=0;i 0) { jQuery(text_node).before('' + ''); } else { jQuery(text_node).before(''); } } } } }); } ilias.questions.assSingleChoice = function(a_id) { var a_node = jQuery('input[name="answers'+a_id+'"]'); var tocheck = "points"; answers[a_id].wrong = 0; answers[a_id].passed = true; answers[a_id].choice = []; for (var i=0;i0) || (a_node.get(i).checked && questions[a_id].answers[i][tocheck]<1)) { answers[a_id].passed = false; answers[a_id].wrong++; answers[a_id].answer[i]=false; } else { answers[a_id].answer[i]=true; } if (a_node.get(i).checked) { answers[a_id].choice.push(a_node.get(i).value); } } ilias.questions.showFeedback(a_id); }; ilias.questions.assMultipleChoice = function(a_id) { var a_node = jQuery('input[name="answers'+a_id+'"]'); var tocheck = "points_checked"; answers[a_id].wrong = 0; answers[a_id].passed = true; answers[a_id].choice = []; for (var i=0;i0) || (a_node.get(i).checked && questions[a_id].answers[i][tocheck]<1)) { answers[a_id].wrong++; answers[a_id].passed = false; answers[a_id].answer[i]=false; } else { answers[a_id].answer[i]=true; } if (a_node.get(i).checked) { answers[a_id].choice.push(a_node.get(i).value); } } ilias.questions.showFeedback(a_id); }; ilias.questions.assTextQuestion = function(a_id) { jQuery('#button'+a_id).attr("disabled", "disabled"); jQuery('#textarea'+a_id).attr("disabled", "disabled"); jQuery('#feedback'+a_id).addClass("ilc_qfeedr_FeedbackRight"); jQuery('#feedback'+a_id).html('Answer submitted!
'); jQuery('#feedback'+a_id).slideToggle(); answers[a_id].passed = true; ilias.questions.scormHandler(a_id,"neutral",jQuery('#textarea'+a_id).val()); }; ilias.questions.assOrderingQuestion = function(a_id) { var result = jQuery('#order'+a_id).sortable('toArray'); answers[a_id].wrong = 0; answers[a_id].passed = true; answers[a_id].choice = []; for (var i=0;i' /*
' + '(+)'*/); jQuery(node).parent().height("auto"); // jQuery(node).parent().width("auto"); }); }; ilias.questions.assOrderingHorizontal = function(a_id) { var result = jQuery('#order'+a_id).sortable('toArray'); answers[a_id].wrong = 0; answers[a_id].passed = true; answers[a_id].choice = []; for (var i=0;i=1) || (answers[a_id].areas[i]==true && questions[a_id].answers[i].points<=0)) { answers[a_id].passed = false; answers[a_id].wrong++; answers[a_id].answer[i]=false; } else { answers[a_id].answer[i]=true; } if (answers[a_id].areas[i] == true) { answers[a_id].choice.push(i); } } ilias.questions.showFeedback(a_id); }; ilias.questions.assMatchingQuestion = function(a_id) { answers[a_id].wrong = 0; answers[a_id].passed = true; answers[a_id].choice = []; for (var i=0;i -1) { jQuery(node).removeClass("ilc_qetitem_ErrorTextSelected"); questions[a_id].selected.splice(id_index, 1); } else { jQuery(node).addClass("ilc_qetitem_ErrorTextSelected"); questions[a_id].selected.push(id); } jQuery(node).blur(); }; ilias.questions.assErrorText =function(a_id) { answers[a_id].wrong = 0; answers[a_id].passed = true; answers[a_id].choice = []; if(questions[a_id].selected === undefined) { answers[a_id].passed = false; } else { var found = 0; for(var i=0;i -1) { // word is not a correct answer if(is_wrong === false) { answers[a_id].wrong++; } // found correct answer else { found++; } } // word has not been selected else if(is_wrong === true) { // should have been selected answers[a_id].wrong++; } } if(found < questions[a_id].correct_answers.length || answers[a_id].wrong > 0) { answers[a_id].passed = false; } } ilias.questions.showFeedback(a_id); } ilias.questions.showFeedback =function(a_id) { jQuery('#feedback'+a_id).hide(); // "image map as single choice" not supported yet if(questions[a_id].type == "assSingleChoice") { var txt_wrong_answers = ilias.questions.txt.wrong_answers_single; } else { var txt_wrong_answers = ilias.questions.txt.wrong_answers + ': ' + answers[a_id].wrong ; } if (answers[a_id].passed===true || (answers[a_id].tries >=questions[a_id].nr_of_tries && questions[a_id].nr_of_tries!=0)) { jQuery('#button'+a_id).attr("disabled", "true"); if (answers[a_id].passed===true) { jQuery('#feedback'+a_id).removeClass("ilc_qfeedw_FeedbackWrong"); jQuery('#feedback'+a_id).addClass("ilc_qfeedr_FeedbackRight"); jQuery('#feedback'+a_id).html('' + ilias.questions.txt.all_answers_correct + '
'+questions[a_id].feedback['allcorrect']); ilias.questions.showCorrectAnswers(a_id); ilias.questions.scormHandler(a_id,"correct",ilias.questions.toJSONString(answers[a_id])); } else { jQuery('#feedback'+a_id).removeClass("ilc_qfeedr_FeedbackRight"); jQuery('#feedback'+a_id).addClass("ilc_qfeedw_FeedbackWrong"); jQuery('#feedback'+a_id).html('' + ilias.questions.txt.nr_of_tries_exceeded + '
' + ilias.questions.txt.correct_answers_shown + '
'+questions[a_id].feedback['onenotcorrect']); ilias.questions.showCorrectAnswers(a_id); ilias.questions.scormHandler(a_id,"incorrect",ilias.questions.toJSONString(answers[a_id])); } } else { if (questions[a_id].nr_of_tries!=0) { jQuery('#feedback'+a_id).removeClass("ilc_qfeedr_FeedbackRight"); jQuery('#feedback'+a_id).addClass("ilc_qfeedw_FeedbackWrong"); var rem = questions[a_id].nr_of_tries - answers[a_id].tries; jQuery('#feedback'+a_id).html(txt_wrong_answers + '
' + ilias.questions.txt.tries_remaining + ': '+ rem + "
" + questions[a_id].feedback['onenotcorrect']); ilias.questions.scormHandler(a_id,"incorrect",ilias.questions.toJSONString(answers[a_id])); } else { jQuery('#feedback'+a_id).removeClass("ilc_qfeedr_FeedbackRight"); jQuery('#feedback'+a_id).addClass("ilc_qfeedw_FeedbackWrong"); jQuery('#feedback'+a_id).html(txt_wrong_answers + '
' + ilias.questions.txt.please_try_again + '
' + questions[a_id].feedback['onenotcorrect']); ilias.questions.scormHandler(a_id,"incorrect",ilias.questions.toJSONString(answers[a_id])); } } jQuery('#feedback'+a_id).slideToggle(); // update question overviews if (typeof ilCOPagePres != "undefined") { ilCOPagePres.updateQuestionOverviews(); } }; ilias.questions.scormHandler = function(a_id,a_state,a_response) { var version; if (ScormApi==null) {return;} var tries = answers[a_id].tries; var i_key; var s_key; switch (ScormApi.version) { case '1.2': i_key = "cmi.interactions."; s_key = "cmi.core.lesson_status"; break; case '1.3': i_key = "cmi.interactions."; s_key = "cmi.success_status"; break; } if (tries==1) { //define interaction answers[a_id].interactionId=icount; setValue(i_key + answers[a_id].interactionId+".id","interaction_"+a_id); setValue(i_key + answers[a_id].interactionId+".type","other"); setValue(i_key + answers[a_id].interactionId+".result",a_state); setValue(i_key + answers[a_id].interactionId+".learner_response",a_response); setValue(i_key + answers[a_id].interactionId+".description",questions[a_id].question); icount++; } else { setValue(i_key + answers[a_id].interactionId+".learner_response",a_response); setValue(i_key + answers[a_id].interactionId+".result",a_state); } ilias.questions.updateSuccessStatus(); if (pager != null) { pager.updateNextLink(); } }; ilias.questions.updateSuccessStatus = function() { var s_key; var status = ilias.questions.determineSuccessStatus(); if (ScormApi==null) {return;} if (status=="passed" || ScormApi.version=="1.3" ) { switch (ScormApi.version) { case '1.2': s_key = "cmi.core.lesson_status"; break; case '1.3': s_key = "cmi.success_status"; break; } setValue(s_key,status); } } ilias.questions.determineSuccessStatus = function() { var status = ""; var at_least_one = false; for (var k in questions) { var index=parseInt(k,10); if (!isNaN(index)) { if (status != "failed") { status = "passed"; } if (!answers[index]) { status = "failed"; } else { if (answers[index].passed!=true) {status="failed";} } } } return status; } ilias.questions.showCorrectAnswers =function(a_id) { switch (questions[a_id].type) { case 'assSingleChoice': for (var i=0;i=1) { jQuery('input[name="answers'+a_id+'"]').eq(i).attr("checked",true); } } break; //end assSingleChoice case 'assMultipleChoice': for (var i=0;i=1) { jQuery('input[name="answers'+a_id+'"]').eq(i).attr("checked",true); } else { jQuery('input[name="answers'+a_id+'"]').eq(i).attr("checked",false); } jQuery('input[name="answers'+a_id+'"]').eq(i).attr("disabled",true); } break; //end assMultipleChoice case 'assImagemapQuestion': //reinit map jQuery(function() { jQuery('.cmap'+a_id).maphilight({fade:true}); }); for (var i=0;i=1) { // is already selected? if(!jQuery('#canvas_' + a_id + '_' + i).attr('id')) { mouseclick(null,document.getElementById(a_id+"_"+questions[a_id].answers[i].order)); } } // remove incorrect else { jQuery('#canvas_' + a_id + '_' + i).remove(); } } break; //end assImagemapQuestion case 'assOrderingQuestion': case 'assOrderingHorizontal': var answers = questions[a_id].answers; var answers_sorted = answers.sort(sortBySolutionorder); var items=jQuery("#order"+a_id).children(); for (var i=0;i=1) { cid=j; } } jQuery('select#'+a_id+"_"+i+" option[id="+cid+"]").attr("selected","selected"); } if (type==0 || type==2) { var cvalue; jQuery('input#'+a_id+"_"+i).attr("disabled",true); //look for correct solution for (var j=0;j=1) { cvalue = questions[a_id].gaps[i].item[j].value; } } jQuery('input#'+a_id+"_"+i).attr("value",cvalue); } } break; //end assClozeTest case 'assTextSubset': var a_node = jQuery('input[name="answers'+a_id+'[]"]'); var choice = []; for (var i=0;i" + questions[a_id].correct_answers[c]["answertext"] + ""; correct_count++; } } if(correct_info.length) { var elements = jQuery("#container"+a_id+" > .ilc_answers"); if(correct_count > 1) { var correct_header = ilias.questions.txt.correct_answers_also; } else { var correct_header = ilias.questions.txt.correct_answer_also; } elements.eq(elements.length -1).after("
" + correct_header + "
    " + correct_info + "
"); } break; //end assTextSubset case 'assErrorText': for(var i=0;i' + questions[a_id].answers[i]["answertext"] + '' + correct); } } } break; //end assErrorText } }; function sortBySolutionorder(thisObject,thatObject) { if (thisObject.order > thatObject.order) { return 1; } else if (thisObject.order < thatObject.order) { return -1; } return 0; } ilias.questions.fix_imageurls = function(node) { var container =jQuery(node).find('img'); for (var i=0;i').append( this.eq(0).clone() ).html(); }; jQuery.fn.textLimiter = function(){ return this.each(function(){ if(typeof(nr) == "undefined") { nr = 0; } var counter_id = 'counter' +nr; var max = this.getAttribute('maxlength'); var html_counter = '
Remaining characters: ' +max+ ''; jQuery(this).after(html_counter); var jquery_pattern = '#' +counter_id +' > span'; this.relatedElement = jQuery(jquery_pattern)[0]; nr++; jQuery(this).bind("keyup", function(){ var maxLength = this.getAttribute('maxlength'); var currentLength = this.value.length; if(currentLength >= maxLength) { this.relatedElement.className = 'toomuch'; this.value = this.value.substring(0, maxLength); } else { this.relatedElement.className = ''; } var left_over = maxLength - currentLength; this.relatedElement.firstChild.nodeValue = left_over; }); }); }; (function(jQuery) { // register jQuery extension jQuery.extend({ create: function(element, attributes, children) { // create new element var elem = jQuery(document.createElement(element)); // add passed attributes if (typeof(attributes) == 'object') { for (key in attributes) { elem.attr(key, attributes[key]); } } // add passed child elements if (typeof(children) == 'object') { for (i = 0; i < children.length; i++) { elem.append(children[i]); } } else if (typeof(children) != 'undefined' && children != null) { elem.text(children.toString()); } return elem; } }); })(jQuery); //add question specific css class jQuery(document).ready(function() { /* for (var q in questions) { var qType = questions[q].type; var cssClass = qType.substring(3,qType.length); jQuery('#container'+questions[q].id).parents('.ilc_question_Standard').addClass("ilc_question_"+cssClass); } */ }); (function(jQuery) { var has_VML, create_canvas_for, add_shape_to, clear_canvas, shape_from_area, canvas_style, fader, hex_to_decimal, css3color, is_image_loaded; var counter = 0; has_VML = document.namespaces; has_canvas = document.createElement('canvas'); has_canvas = has_canvas && has_canvas.getContext; if(!(has_canvas || has_VML)) { jQuery.fn.maphilight = function() { return this; }; return; } // For non IE browsers!!! if(has_canvas) { fader = function(element, opacity, interval) { if(opacity <= 1) { element.style.opacity = opacity; window.setTimeout(fader, 10, element, opacity + 0.1, 10); } }; hex_to_decimal = function(hex) { return Math.max(0, Math.min(parseInt(hex, 16), 255)); }; css3color = function(color, opacity) { return 'rgba('+hex_to_decimal(color.substr(0,2))+','+hex_to_decimal(color.substr(2,2))+','+hex_to_decimal(color.substr(4,2))+','+opacity+')'; }; create_canvas_for = function(img, id) { var width = jQuery(img).prop("width"); var height = jQuery(img).prop("height"); if(typeof(img.width) == "number") { width = img.width; height = img.height; } var c = jQuery('').get(0); c.width = width; c.height = height; c.getContext("2d").clearRect(0, 0, c.width, c.height); return c; }; add_shape_to = function(canvas, shape, coords, options, name) { var i, context = canvas.getContext('2d'); context.beginPath(); if(shape == 'rect') { context.rect(coords[0], coords[1], coords[2] - coords[0], coords[3] - coords[1]); } else if(shape == 'poly') { context.moveTo(coords[0], coords[1]); for(i=2; i < coords.length; i+=2) { context.lineTo(coords[i], coords[i+1]); } } else if(shape == 'circ') { context.arc(coords[0], coords[1], coords[2], 0, Math.PI * 2, false); } context.closePath(); if(options.fill) { context.fillStyle = css3color(options.fillColor, options.fillOpacity); context.fill(); } if(options.stroke) { context.strokeStyle = css3color(options.strokeColor, options.strokeOpacity); context.lineWidth = options.strokeWidth; context.stroke(); } if(options.fade && !jQuery.browser.msie) { fader(canvas, 0); } }; clear_canvas = function(canvas, area) { canvas.getContext('2d').clearRect(0, 0, canvas.width,canvas.height); }; } // IE!!! else { var ie8=false; // ie executes this code if (document.documentMode) // IE8 { if (document.documentMode==8) { ie8 = true; } } if(ie8==true) { document.writeln(''); document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', "#default#VML"); } else { document.createStyleSheet().addRule("v\\:*", "behavior: url(#default#VML); antialias: true;"); document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); } create_canvas_for = function(img, id) { var width = jQuery(img).prop("width"); var height = jQuery(img).prop("height"); if(typeof(img.width) == "number") { width = img.width; height = img.height; } return jQuery('').get(0); }; add_shape_to = function(canvas, shape, coords, options, name, id) { var fill, stroke, opacity, e; fill = ''; stroke = (options.stroke ? 'strokeweight="'+options.strokeWidth+'" stroked="t" strokecolor="#'+options.strokeColor+'"' : 'stroked="f"'); opacity = ''; if(shape == 'rect') { e = jQuery(''); } else if(shape == 'poly') { e = jQuery(''); } else if(shape == 'circ') { e = jQuery(''); } e.get(0).innerHTML = fill+opacity; jQuery(canvas).append(e); }; clear_canvas = function(canvas) { jQuery(canvas).find('[name=highlighted]').remove(); }; } shape_from_area = function(area) { var i, coords = area.getAttribute('coords').split(','); for (i=0; i < coords.length; i++) { coords[i] = parseFloat(coords[i]); } return [area.getAttribute('shape').toLowerCase().substr(0,4), coords]; }; is_image_loaded = function(img) { if(!img.complete) { return false; } // IE if(typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) { return false; } // Others return true; }; canvas_style = { position: 'absolute', left: 0, top: 0, padding: 0, border: 0 }; jQuery.fn.maphilight = function(opts) { opts = jQuery.extend({}, jQuery.fn.maphilight.defaults, opts); return this.each(function() { var img, wrap, options, map, canvas, canvas_always, mouseover, highlighted_shape, question_id; img = jQuery(this); if(!is_image_loaded(this)) { // If the image isn't fully loaded, this won't work right. Try again later. return window.setTimeout(function() { img.maphilight(opts); }, 200); } options = jQuery.metadata ? jQuery.extend({}, opts, img.metadata()) : opts; map = jQuery('map[name="'+img.attr('usemap').substr(1)+'"]'); if(!(img.is('img') && img.attr('usemap') && map.size() > 0)) { return; } if(img.hasClass('maphilighted')) { // We're redrawing an old map, probably to pick up changes to the options. // Just clear out all the old stuff. var wrapper = img.parent(); img.insertBefore(wrapper); wrapper.remove(); // alert('yes'); } wrap = jQuery('
').css({display:'block',background:'url("'+this.src+'")',position:'relative',padding:0,width:this.width,height:this.height}); img.before(wrap).css('opacity', 0).css(canvas_style).remove(); if(jQuery.browser.msie && !has_canvas) { img.css('filter', 'Alpha(opacity=0)'); } wrap.append(img); question_id = img.attr('usemap'); question_id = question_id.substr(4); canvas = create_canvas_for(this, question_id); jQuery(canvas).css(canvas_style); mouseover = function(e) { var shape, area_options; area_options = jQuery.metadata ? jQuery.extend({}, options, jQuery(this).metadata()) : options; if (area_options.linked) { var thislinked = area_options.linked; jQuery(map).find('area[coords]').each(function() { var shape, area_options, object; area_options = jQuery.metadata ? jQuery.extend({}, options, jQuery(this).metadata()) : options; if (thislinked == area_options.linked) { shape = shape_from_area(this); add_shape_to(canvas, shape[0], shape[1], area_options, "highlighted", null); } }); } else { shape = shape_from_area(this); add_shape_to(canvas, shape[0], shape[1], area_options, "highlighted", null); } //if(!area_options.alwaysOn) //{ // shape = shape_from_area(this); // add_shape_to(canvas, shape[0], shape[1], area_options, "highlighted", null); //} }; draw = function(object, target_canvas) { var shape, area_options, object; area_options = jQuery.metadata ? jQuery.extend({}, options, jQuery(this).metadata()) : options; // NON IE if(has_canvas) { var arr_map = jQuery(object).attr("id").split("_"); var str_cmap = '.cmap' + arr_map[0]; canvas_always = create_canvas_for($(str_cmap).get(), jQuery(object).attr("id")); jQuery(canvas_always).css(canvas_style); $(str_cmap).before(canvas_always); } shape = shape_from_area(object); // IE! if (jQuery.browser.msie && !has_canvas) { add_shape_to(target_canvas, shape[0], shape[1], area_options, "", jQuery(object).attr("id")); } else { add_shape_to(canvas_always, shape[0], shape[1], area_options, ""); } }; mouseclick = function(e,id) { var shape, area_options, object; area_options = jQuery.metadata ? jQuery.extend({}, options, jQuery(this).metadata()) : options; if (id) { object = id; } else { object = this; } if (!jQuery('#canvas_' + jQuery(object).attr('id')).attr('id')) { if (area_options.linked) { var thislinked = area_options.linked; jQuery(map).find('area[coords]').each(function() { var shape, area_options, object; area_options = jQuery.metadata ? jQuery.extend({}, options, jQuery(this).metadata()) : options; if (thislinked == area_options.linked) { // alert(jQuery(this).attr('id') + ' ' + area_options.linked); draw(this, canvas); } }); } else { draw(object, canvas); } } else { if (area_options.linked) { var thislinked = area_options.linked; jQuery(map).find('area[coords]').each(function() { var shape, area_options, object; area_options = jQuery.metadata ? jQuery.extend({}, options, jQuery(this).metadata()) : options; if (thislinked == area_options.linked) { jQuery('#canvas_' + jQuery(this).attr('id')).remove(); } }); clear_canvas(canvas); } else { jQuery('#canvas_' + jQuery(object).attr('id')).remove(); clear_canvas(canvas); } } }; if(options.alwaysOn) { jQuery(map).find('area[coords]').each(mouseover); } else { if(jQuery.metadata) { // If the metadata plugin is present, there may be areas with alwaysOn set. // We'll add these to a *second* canvas, which will get around flickering during fading. jQuery(map).find('area[coords]').each(function() { var shape, area_options; area_options = jQuery.metadata ? jQuery.extend({}, options, jQuery(this).metadata()) : options; if(area_options.alwaysOn) { draw(this, canvas); } }); } jQuery(map).find('area[coords]').unbind(); jQuery(map).find('area[coords]').mouseover(mouseover).mouseout(function(e) { clear_canvas(canvas); }); jQuery(map).find('area[coords]').click(mouseclick); } img.before(canvas); // if we put this after, the mouseover events wouldn't fire. img.addClass('maphilighted'); // if question was not answered correctly yet, "reload" active areas if(ilias.questions.answers[question_id] && ilias.questions.answers[question_id].passed != true) { for (i=0; i < ilias.questions.answers[question_id].areas.length; i++){ if(ilias.questions.answers[question_id].areas[i] == true) { var canvas_id = question_id + '_' + i; if (!jQuery('#canvas_' + canvas_id).attr('id')) { var selected_area = jQuery(map).find('area[id="'+ canvas_id + '"]'); draw(jQuery(selected_area).get(0), canvas); } } }; } }); }; jQuery.fn.maphilight.defaults = { fill: true, fillColor: 'ff6633', fillOpacity: 0.4, stroke: true, strokeColor: 'ff6633', strokeOpacity: 1, strokeWidth: 2, fade: true, alwaysOn: false }; })(jQuery); function getFname(yStr){ var sFileName = ""; for (nloop=yStr.length-1;nloop>1;nloop--){ if (yStr.charAt(nloop)=="/"){ sFileName=yStr.substring(nloop+1,yStr.length); break; } if (yStr.charAt(nloop)=="\\"){ // backslash must be escaped sFileName=yStr.substring(nloop+1,yStr.length); break; } } return sFileName; } answers = ilias.questions.answers;