home *** CD-ROM | disk | FTP | other *** search
/ US Department of Defense…ndamentals 1.0 2004 April / US Department of Defense: Firewall & Router Fundamentals 1.0 2004 April.iso / sco / includes / api_functions.js next >
Encoding:
Text File  |  2004-03-11  |  25.6 KB  |  780 lines

  1. function find_api(win)
  2. {
  3.     while ((win.API == null) && (win.parent != null) && (win.parent != win))
  4.     {
  5.         FIND_API_TRIES++;
  6.         if (FIND_API_TRIES > 7)
  7.         {
  8.             return null;
  9.         }
  10.  
  11.         win = win.parent;
  12.     }
  13.     return win.API;
  14. }
  15.  
  16. function get_api()
  17. {
  18.     var theAPI = find_api(window);
  19.  
  20.     if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined"))
  21.     {
  22.         theAPI = find_api(window.opener);
  23.     }
  24.     return theAPI
  25. }
  26.  
  27. function run_sco()
  28. {
  29.     if (!FILE_LMS)
  30.         SCORM_API = get_api();
  31.     else
  32.         SCORM_API = null;
  33.  
  34.     if (SCORM_API != null)  {
  35.         if (SCORM_API.LMSInitialize('') == "true")
  36.             SCORM_INITIALIZED = true;
  37.  
  38.         if (SCORM_API.LMSGetLastError() != 0)
  39.             SCORM_INITIALIZED = false;
  40.     }
  41.  
  42.   //if checking about running 508, default run 508 to nothing
  43.     if (CHECK_508)
  44.     RUN_508 = null;
  45.  
  46.   var sco_page = 0;
  47.   
  48.   var OLD_LANG_EXT = LANG_EXT;
  49.   
  50.     if (SCORM_INITIALIZED)  {
  51.     
  52.         //get location
  53.         sco_location = SCORM_API.LMSGetValue("cmi.core.lesson_location");
  54.         if (sco_location != '') {
  55.             sco_location = sco_location.toLowerCase();
  56.       if (!isNaN(sco_location))
  57.         sco_page = parseInt(sco_location);
  58.       }
  59.  
  60.     //get language value
  61.     var tmp_iso_lang = get_suspend_data("iso_lang");
  62.     
  63.     if (tmp_iso_lang == "en")
  64.       ISO_LANG = "en";
  65.     if (tmp_iso_lang == "es")
  66.       ISO_LANG = "es";
  67.     
  68.     //***
  69.     LANG_EXT = "";
  70.     if (ISO_LANG != "en")
  71.       LANG_EXT = "_" + ISO_LANG;
  72.  
  73.     //get run 508 value, if supposed to check for 508
  74.     if (CHECK_508) {
  75.       var tmp_run_508 = get_suspend_data("run_508");
  76.       if (tmp_run_508 == "1")
  77.         RUN_508 = true;
  78.       if (tmp_run_508 == "0")
  79.         RUN_508 = false;
  80.     }
  81.  
  82.         //set status if needed
  83.         SCO_STATUS = parse_sco_status(SCORM_API.LMSGetValue("cmi.core.lesson_status"));
  84.         if (SCO_STATUS == 'na') {
  85.             SCORM_API.LMSSetValue("cmi.core.lesson_status","incomplete");
  86.       SCORM_API.LMSCommit('');
  87.       SCO_STATUS = 'i';
  88.         }
  89.     
  90.     }
  91.     else  {
  92.         //see if there is a file-based LMS available
  93.         if (FILE_LMS)  {
  94.       //set sco status to incomplete if na
  95.       SCO_STATUS = flms_get_sco_status(CUR_SCO,"1");
  96.             if (SCO_STATUS == 'n')
  97.         SCO_STATUS = "i";
  98.             flms_set_sco_status(CUR_SCO,"1",SCO_STATUS);
  99.       document.cookie = "SCO_STATUS=" + SCO_STATUS + "; path=" + COOKIE_PATH + ";";
  100.       //get lesson location
  101.       sco_location = flms_get_sco_loc(CUR_SCO,"1");
  102.       if (!isNaN(sco_location))
  103.         sco_page = parseInt(sco_location);
  104.         }
  105.         else  {
  106.       if (SHOW_LMS_WARNING)
  107.         alert("Unable to connect to a LMS.");
  108.     }
  109.     }
  110.  
  111.   var pw_obj_style = get_obj_style("PleaseWait" + OLD_LANG_EXT);
  112.   pw_obj_style.visibility = 'hidden';
  113.   var run_obj_style = get_obj_style("Running" + LANG_EXT);
  114.   run_obj_style.visibility = 'visible';
  115.  
  116.     if (get_url_value("location")=="yes")
  117.         var show_location = "yes";
  118.     else
  119.         var show_location = "no";
  120.  
  121.     if ((sco_page < 0) || (sco_page > MAX_PAGE_NUM))
  122.       sco_page = 0;
  123.  
  124.   //if run_508 is null, ask which version to run
  125.   if (RUN_508 == null)  {
  126.     var bln_ans = confirm("There are two versions of this course.  Please select the appropriate one.\n    OK       = Standard course with audio.  Most should select this option.\n    Cancel = Section 508 version with accessibility options enabled."," ");
  127.         RUN_508 = !bln_ans;
  128.     set_suspend_data("run_508",convert_boolean_to_num(RUN_508).toString());
  129.   }
  130.  
  131.   if (ASK_BOOKMARK) {
  132.       if (sco_page > 0) {
  133.           myAns = confirm("Do you wish to continue where you left off?"," ");
  134.           if (myAns == false)
  135.               sco_page = 0;
  136.       }
  137.   }
  138.  
  139.   //Set page number to current page
  140.   PAGE_NUM = sco_page;
  141.   
  142.   //if 508, disable audio and set default page_type to html
  143.   if (RUN_508) {
  144.     ENABLE_AUDIO = false;
  145.     PAGE_TYPE = "html";
  146.     AUDIO_TYPE = "";
  147.     CONTENT_SCROLL = "yes";
  148.     CONTENT_RESIZE = "yes";
  149.     CONTENT_WIDTH = (parseInt(CONTENT_WIDTH) + 20) + "";
  150.   }
  151.   
  152.   var sco_url = "";
  153.   var sco_page_str = convert_num_to_str(sco_page);
  154.   var tmp_page_type = get_page_type(sco_page_str,PAGE_TYPE,LIST_FLASH_PAGES,LIST_HTML_PAGES);
  155.   if (tmp_page_type == "html")  {
  156.     sco_url = "page" + sco_page_str + ".htm";
  157.     if (RUN_508)  {
  158.       if ((SEPARATE_508) || ((!SEPARATE_508) && (LIST_508_PAGES.indexOf(sco_page_str) > -1))) {
  159.         sco_url = "page" + sco_page_str + "_508.htm";
  160.       }
  161.     }
  162.   }
  163.   if (tmp_page_type == "flash") {
  164.     sco_url = FLASH_PAGE_ROOT;
  165.   }
  166.   if (RUN_TYPE == "netg")  {
  167.     sco_url = "../karta_launcher.htm?action=0";
  168.   }
  169.   if (RUN_TYPE == "flms")  {
  170.     var tmp_user_id = get_user_name();
  171.     if (tmp_user_id == "")
  172.       tmp_user_id = PROG_ID;
  173.     set_flms_cookie_data(PROG_ID,tmp_user_id);
  174.     sco_url = "sco/mode.htm?user_id=" + tmp_user_id;   
  175.   }
  176.   
  177.   if (sco_url != "")  {
  178.     if (WIN_TYPE == "new_window") {
  179.         CONTENT_WIN = open(sco_url,"ContentWin", CONTENT_POS + "scrollbars=" + CONTENT_SCROLL + ",resizable=" + CONTENT_RESIZE + ",width=" + CONTENT_WIDTH +  ",height=" + CONTENT_HEIGHT + ",toolbar=no,directories=no,menubar=no,status=yes,location=" + show_location + ",");
  180.         TIMER_INTERVAL_ID = setInterval("check_content_win();",1000);
  181.     }
  182.     else  {
  183.       if (WIN_TYPE == "frame")  {
  184.         if (window.parent.training != null) {
  185.           CONTENT_WIN = window.parent.training;
  186.           CONTENT_WIN.location.href=sco_url;
  187.           resize_window(CONTENT_WIN,window.parent);
  188.         }
  189.       }
  190.       else  {
  191.         API_WIN.WIN_TYPE = WIN_TYPE;
  192.         API_WIN.MAX_PAGE_NUM = MAX_PAGE_NUM;
  193.         API_WIN.PAGE_NUM = PAGE_NUM;
  194.         location.href = sco_url;
  195.       }
  196.     }
  197.   }
  198.   else  {
  199.     alert("An error has occurred. No content page has been specified.");
  200.   }
  201. }
  202.  
  203. function check_content_win()
  204. {
  205.     if (CONTENT_WIN.closed) { 
  206.         sco_finish();
  207.     }
  208.     else  {
  209.     if ((SCORM_INITIALIZED) && (RUN_TYPE == "netg"))  {
  210.       TIME_OUT_TIMER += 1;
  211.       if (TIME_OUT_TIMER == 60) {
  212.         TIME_OUT_TIMER = 0;
  213.         tmp_ls = SCORM_API.LMSGetValue("cmi.core.lesson_status");
  214.         if (SCORM_API.LMSGetLastError() != 0) {        
  215.           if (TIMER_INTERVAL_ID != "")
  216.                 clearInterval(TIMER_INTERVAL_ID);
  217.           alert("An error communicating to the LMS has occured.\nPlease exit the training and contact your training administrator.");
  218.           sco_finish();
  219.         }
  220.       }
  221.     }
  222.   }
  223. }
  224.  
  225. function set_sco_status(sco_location,sco_status)
  226. {
  227.   sco_status = parse_sco_status(sco_status);
  228.     sco_page = parseInt(sco_location);
  229.   if (RUN_TYPE == "flms") {
  230.     //get current status
  231.     tmp_cur_sco = get_cookie_value("CUR_SCO");
  232.     tmp_sco_status = get_cookie_value(tmp_cur_sco);
  233.     
  234.     //take care of lesson location or score
  235.     if ((sco_status == "p") || (sco_status == "f")) {
  236.         //nothing - can't handle scores, yet.
  237.     }
  238.     else if (sco_page > 0)  {
  239.       flms_set_sco_loc(tmp_cur_sco,"1",sco_page.toString());
  240.         }
  241.   
  242.     //Take care of Lesson Status
  243.     if (((tmp_sco_status != "c") && (tmp_sco_status != "p")) && ((tmp_sco_status != "f") || ((tmp_sco_status == "f") && (sco_status == "p")))) {
  244.       flms_set_sco_status(tmp_cur_sco,"1",sco_status);
  245.       SCO_STATUS = sco_status;
  246.     }
  247.   }
  248.   else  {
  249.     //take care of lesson location or score
  250.     if ((sco_status == "p") || (sco_status == "f")) {
  251.       if (SCORM_INITIALIZED)  {
  252.         var tmp_doit = true;
  253.         if ((SCO_STATUS == "f") && (sco_status == "f")) {
  254.           //check previous score
  255.           old_score = SCORM_API.LMSGetValue("cmi.core.score.raw");
  256.           if (old_score != "")  {
  257.             if (parseInt(old_score) >= parseInt(sco_page))
  258.               tmp_doit = true;
  259.           }
  260.         }
  261.         if (tmp_doit) {
  262.           SCORM_API.LMSSetValue("cmi.core.score.raw",sco_page.toString());
  263.                 SCORM_API.LMSCommit('');
  264.         }
  265.       }
  266.       if (FILE_LMS) {
  267.         //nothing - can't handle scores, yet.
  268.       }
  269.     }
  270.     else if (sco_page > 0)  {
  271.       if (SCORM_INITIALIZED)  {
  272.               SCORM_API.LMSSetValue("cmi.core.lesson_location",sco_page.toString());
  273.               SCORM_API.LMSCommit('');
  274.       }
  275.       if (FILE_LMS) {
  276.         flms_set_sco_loc(CUR_SCO,"1",sco_page.toString());
  277.       }
  278.         }
  279.   
  280.     //Take care of Lesson Status
  281.     if (((SCO_STATUS != "c") && (SCO_STATUS != "p")) && ((SCO_STATUS != "f") || ((SCO_STATUS == "f") && (sco_status == "p")))) {
  282.       if (SCORM_INITIALIZED)  {
  283.         SCORM_API.LMSSetValue("cmi.core.lesson_status",convert_sco_status(sco_status));
  284.         SCORM_API.LMSCommit('');
  285.       }
  286.       if (FILE_LMS) {
  287.         flms_set_sco_status(CUR_SCO,"1",sco_status);
  288.       }
  289.       SCO_STATUS = sco_status;
  290.     }
  291.   }
  292.  
  293. }
  294.  
  295. function set_session_time(session_time)
  296. {
  297.   if ((session_time != "") && (session_time != null)) {
  298.     if (SCORM_INITIALIZED)  {
  299.       SCORM_API.LMSSetValue("cmi.core.session_time",session_time.toString());
  300.       SCORM_API.LMSCommit('');
  301.     }
  302.   }
  303. }
  304.  
  305. function set_lang(tmp_iso_lang)
  306. {
  307.   //save language change
  308.   set_suspend_data("iso_lang",tmp_iso_lang);
  309.  
  310.   //change display text
  311.   var pw_obj_style = get_obj_style("PleaseWait" + LANG_EXT);
  312.   var run_obj_style = get_obj_style("Running" + LANG_EXT);
  313.   var done_obj_style = get_obj_style("Done" + LANG_EXT);
  314.   var copy_obj_style = get_obj_style("Copyright" + LANG_EXT);
  315.  
  316.   var tmp_lang_ext = "";
  317.   if (tmp_iso_lang != "en")
  318.     tmp_lang_ext = "_" + tmp_iso_lang;
  319.  
  320.   if (pw_obj_style.visibility == 'visible') {
  321.     //hide current obj, show other language
  322.     pw_obj_style.visibility = 'hidden';
  323.     pw_obj_style = get_obj_style("PleaseWait" + tmp_lang_ext);
  324.     pw_obj_style.visibility = 'visible';
  325.   }
  326.  
  327.   if (run_obj_style.visibility == 'visible') {
  328.     //hide current obj, show other language
  329.     run_obj_style.visibility = 'hidden';
  330.     run_obj_style = get_obj_style("Running" + tmp_lang_ext);
  331.     run_obj_style.visibility = 'visible';
  332.   }
  333.  
  334.   if (done_obj_style.visibility == 'visible') {
  335.     //hide current obj, show other language
  336.     done_obj_style.visibility = 'hidden';
  337.     done_obj_style = get_obj_style("Done" + tmp_lang_ext);
  338.     done_obj_style.visibility = 'visible';
  339.   }
  340.  
  341.   copy_obj_style.visibility = 'hidden';
  342.   copy_obj_style = get_obj_style("Copyright" + tmp_lang_ext);
  343.   copy_obj_style.visibility = 'visible';
  344.  
  345.   //save value in this window
  346.   ISO_LANG = tmp_iso_lang;
  347.   LANG_EXT = "";
  348.   if (ISO_LANG != "en")
  349.     LANG_EXT = "_" + ISO_LANG;
  350.  
  351. }
  352.  
  353. function sco_finish()
  354. {
  355.     //stop timer
  356.     if (TIMER_INTERVAL_ID != "")
  357.         clearInterval(TIMER_INTERVAL_ID);
  358.     
  359.   //close all children windows
  360.   close_child_windows("exit_sco");
  361.   
  362.   var run_obj_style = get_obj_style("Running" + LANG_EXT);
  363.   run_obj_style.visibility = 'hidden';
  364.   var done_obj_style = get_obj_style("Done" + LANG_EXT);
  365.   done_obj_style.visibility = 'visible';
  366.   
  367.   if ((FILE_LMS) || (RUN_TYPE == "flms")) {
  368.     flms_sco_finish('../menu.htm');
  369.     if (SCORM_INITIALIZED)  {
  370.           SCORM_API.LMSFinish('');
  371.       }
  372.   }
  373.   else  {
  374.     if (SCORM_INITIALIZED)  {
  375.           SCORM_API.LMSFinish('');
  376.       }
  377.     if ((!SCORM_INITIALIZED) && (NO_LMS_URL != ""))
  378.       location.href = NO_LMS_URL;
  379.   }
  380. }
  381.  
  382. function getAICCHost()
  383. {
  384.     var aiccHost = "http://ilearning.oracle.com";
  385.     var queryString = unescape(location.search);
  386.  
  387.     if (queryString != null && queryString.length > 0)
  388.     {
  389.        // Chop the '?' off
  390.        if (queryString.charAt(0) == '?') {
  391.           queryString = queryString.slice(1);
  392.        }
  393.  
  394.        // Split the remaining query string into an array, delimited
  395.        // by '&'
  396.        var queryParameters = queryString.split("&");
  397.  
  398.        // Now loop over the elements of the array, looking for one
  399.        // that starts with "AICC_URL="
  400.        for (var i = 0; i < queryParameters.length; i++) {
  401.           if (queryParameters[i].toUpperCase().substring(0, 9) == "AICC_URL=") {
  402.  
  403.              // Found it, grab the part after "AICC_URL="
  404.              var aiccUrl = queryParameters[i].slice(9);
  405.  
  406.              // Now find the index of the third slash, and grab everything
  407.              // up to that point.  We assume it will start with "http://" or
  408.              // "https://".  This could be improved...
  409.              var slashIndex = 0;
  410.              slashIndex = aiccUrl.indexOf("/", slashIndex);
  411.              slashIndex = aiccUrl.indexOf("/", slashIndex + 1);
  412.              slashIndex = aiccUrl.indexOf("/", slashIndex + 1);
  413.              if (slashIndex == -1) {
  414.                 aiccHost = aiccUrl;
  415.              } else {
  416.                 aiccHost = aiccUrl.substring(0, slashIndex);
  417.              }
  418.           }
  419.        }
  420.     }
  421.  
  422.     return aiccHost;
  423. }
  424.  
  425. function get_user_name()
  426. {
  427.   myReturn = "";
  428.   if (SCORM_INITIALIZED)  {
  429.     myReturn = SCORM_API.LMSGetValue("cmi.core.student_id");
  430.     if (SCORM_API.LMSGetLastError() != "0")
  431.       myReturn = "";
  432.   }
  433.   if (FILE_LMS) {
  434.     myReturn = TEMP_USER;
  435.   }
  436.   if ((myReturn == "") && (RUN_TYPE == "flms"))
  437.     myReturn = PROG_ID;
  438.   return myReturn;
  439. }
  440.  
  441. function get_suspend_data(key)
  442. {
  443.   var value = "";
  444.   if (SCORM_INITIALIZED)  {
  445.     var tmp_value = get_list_value(key,SCORM_API.LMSGetValue("cmi.suspend_data"),PAIR_DELIMITER,VALUE_DELIMITER,"")
  446.     if (tmp_value != "")  {
  447.       if (USE_HEX_ENCODING)
  448.         value = convert_from_hex(tmp_value);
  449.       else
  450.         value = tmp_value;
  451.     }
  452.   }
  453.   return value;
  454. }
  455.  
  456. function set_suspend_data(key,value)
  457. {
  458.   if (SCORM_INITIALIZED)  {
  459.     var suspend_data = SCORM_API.LMSGetValue("cmi.suspend_data");
  460.     var tmp_value = "";
  461.     if (USE_HEX_ENCODING)
  462.       tmp_value = convert_to_hex(value);
  463.     else
  464.       tmp_value = value;
  465.     suspend_data = set_list_value(key,tmp_value,suspend_data,PAIR_DELIMITER,VALUE_DELIMITER);
  466.     SCORM_API.LMSSetValue("cmi.suspend_data",suspend_data);
  467.     SCORM_API.LMSCommit('');
  468.   }
  469. }
  470.  
  471. function set_flms_cookie_data(tmp_prog_id,tmp_user_id)
  472. {
  473.   if (SCORM_INITIALIZED)  {
  474.     var tmp_data = get_suspend_data("flms_user");
  475.     flms_set_cookie_data(tmp_prog_id,tmp_user_id,"user",tmp_data);
  476.     tmp_data = get_suspend_data("flms_loc");
  477.     flms_set_cookie_data(tmp_prog_id,tmp_user_id,"loc",tmp_data);
  478.     tmp_data = get_suspend_data("flms_status");
  479.     flms_set_cookie_data(tmp_prog_id,tmp_user_id,"status",tmp_data);
  480.   }
  481. }
  482.  
  483. function get_flms_cookie_data(tmp_prog_id,tmp_user_id)
  484. {
  485.   var tmp_data = flms_get_cookie_data(tmp_prog_id,tmp_user_id,"user");
  486.   set_suspend_data("flms_user",tmp_data);
  487.   tmp_data = flms_get_cookie_data(tmp_prog_id,tmp_user_id,"loc");
  488.   set_suspend_data("flms_loc",tmp_data);
  489.   tmp_data = flms_get_cookie_data(tmp_prog_id,tmp_user_id,"status");
  490.   set_suspend_data("flms_status",tmp_data);
  491. }
  492.  
  493. function get_raw_score()
  494. {
  495.   var score = null;
  496.   if (SCORM_INITIALIZED)  {
  497.     var tmp_score = SCORM_API.LMSGetValue("cmi.core.score.raw");
  498.     if (tmp_score != "")
  499.       score = tmp_score;
  500.   }
  501.   return score;
  502. }
  503.  
  504. function parse_sco_status(sco_status)
  505. {
  506.   sco_status = sco_status.toLowerCase();
  507.   if ((sco_status == "n") || (sco_status == "c") || (sco_status == "i") || (sco_status == "na") || (sco_status == "p") || (sco_status == "f"))
  508.     return sco_status;
  509.   else  {
  510.     if (sco_status == "not attempted")
  511.       return "na";
  512.     if (sco_status == "incomplete")
  513.       return "i";
  514.     if (sco_status == "completed")
  515.       return "c";
  516.     if (sco_status == "passed")
  517.       return "p";
  518.     if (sco_status == "failed")
  519.       return "f";
  520.   }
  521.   return "";
  522. }
  523.  
  524. function convert_sco_status(sco_status)
  525. {
  526.   sco_status = sco_status.toLowerCase();
  527.   if ((sco_status == "c") || (sco_status == "i") || (sco_status == "na") || (sco_status == "p") || (sco_status == "f")) {
  528.       if (sco_status == "na")
  529.         return "not attempted";
  530.       if (sco_status == "i")
  531.         return "incomplete";
  532.       if (sco_status == "c")
  533.         return "completed";
  534.       if (sco_status == "p")
  535.         return "passed";
  536.       if (sco_status == "f")
  537.         return "failed";
  538.   }
  539.   return "";
  540. }
  541.  
  542. function write_start_screen()
  543. {
  544.   var START_Y = START_TEXT_Y;
  545.   var START_X = START_TEXT_X;
  546.   
  547.   var wait_txt = "<DIV ID='PleaseWait' style=\"visibility:hidden;position:absolute;top:" + START_Y + ";left:" + START_Y + ";font-family:arial;font-size:12pt;color:#000000;font-weight:bold;\">Please wait for the training to load...</DIV>";
  548.   var wait_txt_es = "<DIV ID='PleaseWait_es' style=\"visibility:hidden;position:absolute;top:" + START_Y + ";left:" + START_Y + ";font-family:arial;font-size:12pt;color:#000000;font-weight:bold;\">Por favor espere el programa mientras cargar...</DIV>";
  549.  
  550.   var running_txt = "<DIV id='Running' style=\"visibility:hidden;position:absolute;top:" + START_Y + ";left:" + START_Y + ";font-family:arial;font-size:12pt;color:#000000;font-weight:bold;\">Training is currently running...</DIV>";
  551.   var running_txt_es = "<DIV id='Running_es' style=\"visibility:hidden;position:absolute;top:" + START_Y + ";left:" + START_Y + ";font-family:arial;font-size:12pt;color:#000000;font-weight:bold;\">El entrenamiento se encuentra en processo...</DIV>";
  552.  
  553.   var done_txt = "<DIV id='Done' style=\"visibility:hidden;position:absolute;top:" + START_Y + ";left:" + START_Y + ";font-family:arial;font-size:12pt;color:#000000;font-weight:bold;\">Your learning session has ended.";
  554.   var done_txt_es = "<DIV id='Done_es' style=\"visibility:hidden;position:absolute;top:" + START_Y + ";left:" + START_Y + ";font-family:arial;font-size:12pt;color:#000000;font-weight:bold;\">Su sesi≤n de aprendizaje ha finalizado.";
  555.   if (ILEARNING)  {
  556.     done_txt += "<P>To return to iLearning training menu,<BR>click on the 'Home' button on the iLearning menu bar.<P>To continue to the next training item,<BR>click the next arrow in the iLearning menu bar or<BR>select it in the course outline.</DIV>";
  557.     done_txt_es += "<P>Para volver al men· de entrenamiento en iLearning, <BR>presione 'Home' en la barra de men· de iLearning.<P>Para continuar con la pr≤xima lecci≤n de entrenamiento, <BR>presione la flecha de la derecha en la barra de men· de<BR>iLearning o selecionela en el curso.</DIV>";
  558.   }
  559.   else  {
  560.     done_txt += "</DIV>";
  561.     done_txt_es += "</DIV>";
  562.   }
  563.  
  564.   var copyright_txt = "<DIV id='Copyright' style=\"visibility:hidden;position:absolute;top:433;left:135;font-family:arial;font-size:8pt;color:#000000;\">";
  565.   var copyright_txt_es = "<DIV id='Copyright_es' style=\"visibility:hidden;position:absolute;top:433;left:135;font-family:arial;font-size:8pt;color:#000000;\">";
  566.  
  567.   if (INC_START_COPYRIGHT)  {
  568.     copyright_txt += "Copyright ⌐ 2001-2003 Karta Technologies, Inc. All Rights Reserved</DIV>";
  569.     copyright_txt_es += "Derechos de Autor . Copyright ⌐ 2001-2003 Karta Technologies, Inc. Todos los Derechos Reservados.</DIV>";
  570.   }
  571.   else  {
  572.     copyright_txt += "</DIV>";
  573.     copyright_txt_es += "</DIV>";
  574.   }
  575.  
  576.     var tmp_html = "<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><DIV id='filler' style=\"visibility:visible;position:absolute;" + START_Y + ";left:" + START_Y + ";\"> </DIV>" + wait_txt + wait_txt_es + running_txt + running_txt_es + done_txt + done_txt_es + copyright_txt + copyright_txt_es;
  577.  
  578.     document.write(tmp_html);
  579.  
  580.   //show right language
  581.   var obj_style = get_obj_style("PleaseWait" + LANG_EXT);
  582.   obj_style.visibility = 'visible';
  583.   obj_style = get_obj_style("Copyright" + LANG_EXT);
  584.   obj_style.visibility = 'visible';
  585.  
  586. }
  587.  
  588. function get_content_url(page_str,page_type)
  589. {
  590.   var tmp_return = "";  
  591.   if (page_type == "flash")
  592.     tmp_return = FLASH_PAGE_ROOT;
  593.   if (page_type == "html")  {
  594.     if (RUN_508)  {
  595.       if ((SEPARATE_508) || ((!SEPARATE_508) && (LIST_508_PAGES.indexOf(page_str) > -1))) {
  596.         tmp_return = "page" + page_str + LANG_EXT + "_508.htm";
  597.       }
  598.     }
  599.     else
  600.       tmp_return = "page" + page_str + LANG_EXT + ".htm";
  601.   }
  602.   return tmp_return;
  603. }
  604.  
  605. function get_flash_html(file_url,movie_width,movie_height,bkgrd_color,flash_version)
  606. {
  607.   var tmp_flash_params = get_flash_params();
  608.   //alert(tmp_flash_params);
  609.   //adding for DISA II project
  610.   file_url = "../interface/sco.swf";
  611.   return "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + flash_version + "' WIDTH='" + movie_width + "' HEIGHT='" + movie_height + "' id='flashplayer' ALIGN=''><PARAM NAME=movie VALUE='" + file_url + "?" + tmp_flash_params + "'><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=" + bkgrd_color + "><PARAM NAME='menu' VALUE='false'><PARAM NAME=FlashVars VALUE='" + tmp_flash_params + "'><EMBED src='" + file_url + "?" + tmp_flash_params + "' quality=high bgcolor=" + bkgrd_color + "  WIDTH='" + movie_width + "' HEIGHT='" + movie_height + "' NAME='flash_player' FlashVars='" + tmp_flash_params + "' menu='false' ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";
  612. }
  613.  
  614. function get_wma_html(file_url)
  615. {
  616.   return "<OBJECT ID='MediaPlayer1' NAME='MediaPlayer1' WIDTH=1 HEIGHT=1 style='position:absolute;top:0;left:0;' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' standby='Loading Microsoft Windows Media Player components...' TYPE='application/x-oleobject'><PARAM NAME='FileName' VALUE='" + file_url + "'><PARAM NAME='AnimationatStart' VALUE='false'><PARAM NAME='TransparentatStart' VALUE='true'><PARAM NAME='AutoStart' VALUE='true'><PARAM NAME='AutoSize' Value='true'><PARAM NAME='ShowControls' VALUE=0><EMBED TYPE='application/x-mplayer2' SRC='" + file_url + "' NAME='MediaPlayer1' ID='MediaPlayer1' WIDTH=5 HEIGHT=5 SHOWCONTROLS='false'></EMBED></OBJECT>";
  617. }
  618.  
  619. function get_flash_params()
  620. {
  621.   var return_data = "";
  622.   if ((FILE_LMS) || (RUN_TYPE == "flms"))  {
  623.     tmp_user_id = get_user_name();
  624.     tmp_cur_sco = flms_get_cur_sco();
  625.     if ((tmp_user_id != "") && (tmp_cur_sco != ""))
  626.       return_data = flms_get_flash_params(PROG_ID,tmp_user_id,tmp_cur_sco);
  627.     else
  628.       alert("PROBLEM!");
  629.   }
  630.   else  {
  631.     //REGULAR SCORM MODE
  632.     //retrieve values from suspend_data
  633.   }
  634.   return return_data
  635. }
  636.  
  637. function get_page_type(page_str,default_page_type,flash_list,html_list)
  638. {
  639.   var tmp_return = default_page_type;
  640.   if (default_page_type == "")  {
  641.    //now get & set this page's page type
  642.     if (flash_list.indexOf(page_str) > -1)
  643.       tmp_return = "flash";
  644.     if (html_list.indexOf(page_str) > -1)
  645.       tmp_return = "html";
  646.   }
  647.   return tmp_return;
  648. }
  649.  
  650. function get_media_url(page_str,media_type)
  651. {
  652.   var tmp_return = "";
  653.   if (media_type == "flash")
  654.     tmp_return  = "media/page" + page_str + LANG_EXT + ".swf";
  655.   if (media_type == "wma")
  656.     tmp_return  = "media/page" + page_str + LANG_EXT + ".wma";
  657.   return tmp_return;
  658. }
  659.  
  660. function get_audio_url(page_str)
  661. {
  662.   return "audio/aud_page" + page_str + LANG_EXT + ".htm";
  663. }
  664.  
  665. function open_audio_win(audio_file)
  666. {
  667.     if (SHOW_AUDIO) {
  668.     if ((AUDIO_WIN == null) || (AUDIO_WIN.closed))
  669.           AUDIO_WIN = window.open(audio_file,"AUDIOWIN","toolbar=no,menubar=no,location=no,height=" + AUDIO_WIN_HEIGHT + ",width=" + AUDIO_WIN_WIDTH + ",resizable=" + AUDIO_WIN_RESIZE + ",scrollbars=" + AUDIO_WIN_SCROLL + ",top=" + AUDIO_WIN_TOP + ",left=" + AUDIO_WIN_LEFT);
  670.     else
  671.       AUDIO_WIN.document.location.href = audio_file;
  672.         AUDIO_WIN.focus();
  673.     }
  674. }
  675.  
  676. function close_child_windows(exit_type)
  677. {
  678.   if (exit_type == "exit_sco")  {
  679.       if (AUDIO_WIN != null)  {
  680.           AUDIO_WIN.close();
  681.       AUDIO_WIN = null;
  682.     }
  683.     if (CONTENT_WIN != null)  {
  684.           CONTENT_WIN.close();
  685.       CONTENT_WIN = null;
  686.     }
  687.   }
  688.     if (GLOSS_WIN != null)  {
  689.       GLOSS_WIN.close();
  690.     GLOSS_WIN = null;
  691.   }
  692.   if (RV_WIN != null) {
  693.     RV_WIN.close();
  694.     RV_WIN = null;
  695.   }
  696.   if (PREFS_WIN != null)  {
  697.     PREFS_WIN.close();
  698.     PREFS_WIN = null;
  699.   }
  700.   if (REFS_WIN != null)  {
  701.     REFS_WIN.close();
  702.     REFS_WIN = null;
  703.   }
  704.   if (HELP_WIN != null)  {
  705.     HELP_WIN.close();
  706.     HELP_WIN = null;
  707.   }
  708.   if (POPUP_WIN != null)  {
  709.     POPUP_WIN.close();
  710.     POPUP_WIN = null;
  711.   }
  712.   RUN_REVIEW = false;
  713. }
  714.  
  715. function get_language(lang_default)
  716. {
  717.   if (IE)
  718.     tmp_lang = navigator.browserLanguage;
  719.   else
  720.     tmp_lang = navigator.language;
  721.   if (tmp_lang) {
  722.     tmp_lang = tmp_lang.substring(0,2);
  723.     switch (tmp_lang) {
  724.       case "es" :
  725.         return tmp_lang;
  726.       default :
  727.         return lang_default;
  728.     } 
  729.   }
  730.   else
  731.     return lang_default;
  732. }
  733.  
  734. function open_glossary(term) 
  735. {
  736.   if ((term == null) || (term == ''))
  737.     gloss_target = "../glossary/default" + LANG_EXT + ".htm";
  738.   else
  739.     gloss_target = "../glossary/terms" + LANG_EXT + "/" + term + ".htm";
  740.     GLOSS_WIN=open(gloss_target,"GLOSSWIN","scrollbars=yes,resizable=no,width=450,height=250,toolbar=no,directories=no,menubar=no,status=no,");
  741.   GLOSS_WIN.focus();
  742. }
  743.  
  744. function open_prefs()
  745. {
  746.   PREFS_WIN = open("../includes/prefs_form.htm","PREFSWIN","scrollbars=no,resizeable=no,width=250,height=150,toolbar=no,directories=no,menubar=no,status=no,");
  747.   PREFS_WIN.focus();
  748. }
  749.  
  750. function open_refs()
  751. {
  752.   REFS_WIN=open("../references/default" + LANG_EXT + ".htm","REFSWIN","location=no,scrollbars=yes,resizable=yes,width=" + REFS_WIDTH + ",height=" + REFS_HEIGHT + ",toolbar=no,directories=no,menubar=no,status=yes,");
  753.   REFS_WIN.focus();
  754. }
  755.  
  756. function open_help()
  757. {
  758.   HELP_WIN=open("../help/default.htm","HELPWIN","location=no,scrollbars=yes,resizable=yes,width=" + HELP_WIDTH + ",height=" + HELP_HEIGHT + ",toolbar=no,directories=no,menubar=no,status=yes,");
  759.   HELP_WIN.focus();
  760. }
  761.  
  762. function resize_window(win_obj,resize_win_obj)
  763. {
  764.     var tmp_x = 0;
  765.     var tmp_y = 0;
  766.     if (IE) {
  767.       tmp_x = win_obj.document.body.clientWidth;
  768.       tmp_y = win_obj.document.body.clientHeight;
  769.     }
  770.     else  {
  771.       tmp_x = win_obj.innerWidth;
  772.       tmp_y = win_obj.innerHeight;
  773.     }
  774.     if ((tmp_x > 0) && (tmp_y > 0)) {
  775.       var tmp_x_offset = parseInt(CONTENT_WIDTH) - tmp_x;
  776.       var tmp_y_offset = parseInt(CONTENT_HEIGHT) - tmp_y;
  777.       resize_win_obj.resizeBy(tmp_x_offset,tmp_y_offset);
  778.     }
  779. }
  780.