"use strict"; function load_content(img_obj, win_id) { //alert(document.baseURI); var q_string = null; var url = null; var host_name = null; url = document.baseURI.toLowerCase(); url = document.baseURI.trim(); host_name = document.location.hostname; host_name = host_name.toLowerCase(); if (host_name.length > 0) { if (host_name === "www.chromosphere.com" || host_name === "chromosphere.com" || host_name === "localhost") { //proceed } else { return; //exit function } } else { return; //exit function } //q_string = get_querystring(img_obj.src); //alert(img_obj.src); q_string = get_querystring_value_by_name(img_obj.src, "i"); //alert(q_string); if (check_content_id(q_string) === true) { load_window_contents(win_id, q_string); } else { //alert("invalid content id"); } } function check_content_id(cid) { var c = null; c = Math.abs(Math.floor(parseInt(cid.toString()))); if (typeof c === "number" && c >= 0 && c.toString().length === 16) { return true; } else { return false; } } function initialize_xmlhttp_array() { global_xmlhttp_array = []; //var array_len = global_xmlhttp_array.length; var i = null; for (i=0;i<1000;i++) { global_xmlhttp_array[i] = null; } } function initialize_global_interval_timer_array() { global_interval_timer_array = []; var i = null; for (i = 0; i < 1000; i++) { global_interval_timer_array[i] = null; } } function load_window_contents(window_id, qstring) { var htmlhttp_obj_id = null; var timer_id = null; var window_obj = null; var table_obj = null; var timer_expression = null; //set default: Web window's minimize, maximize, and cascade state icons, are all set to default (cascade). //this function needs to access elements by id from the document. The //web window is not attached to the document upon creation. Since it //is now attached to the document, we can implement this function. //function is currently within window_2.js set_window_state_icons(window_id); //alert(qstring); window_obj = document.getElementById(window_id); table_obj = document.getElementById((window_id + "_tbl_0000")); /* displays loading status in window's status box */ set_window_status("Loading contents"); timer_id = get_available_timer_array_slot(); //timer_expression = "show_loading_progress(\"" + window_id + "\", " + timer_id + ");"; //global_interval_timer_array[timer_id] = setInterval(timer_expression, 150); //send instructions to POST or GET data htmlhttp_obj_id = add_xmlhttp_obj(); send_xmlhttp_request(htmlhttp_obj_id, window_id, qstring); if (window_obj !== null) { if (table_obj !== null) { window_obj.style.height = (table_obj.scrollHeight + "px"); window_obj.style.width = (table_obj.scrollWidth + "px"); } } } function add_xmlhttp_obj() { var xmlhttp = null; var i = null; var array_len = null; var array_slot = null; var xmlhttp_id = null; var xmlhttp_added = null; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } else { xmlhttp = new XMLHttpRequest(); } array_len = global_xmlhttp_array.length; xmlhttp_added = false; for (i=0;i 0) { host_port = ":" + host_port; } xmlhttp_url_path = "https://" + document.location.hostname + host_port + "/chromosphere/xmlhttp/"; xmlhttp.protocol = "https:"; xmlhttp.hostname = top.location.hostname.toLowerCase(); host_name = xmlhttp.hostname.toLowerCase(); xmlhttp.protocol = "https:"; i_protocol = xmlhttp.protocol.toLowerCase(); top_location_hostname = top.location.hostname.toLowerCase(); if (typeof host_name == "string" && host_name.length > 0) { if (host_name == "www.chromosphere.com" || host_name == "chromosphere.com" || host_name == "localhost") { if (i_protocol == "https:") { //console.log("The remote server host name and Internet protocol for an XMLHTTP request is qualified as valid. Proceeding with request."); } } } else { console.log("Unable to validate the current remote server host name. The host name must either be specified as \"chromosphere.com\", or \"localhost\". Contact steve@chromosphere.com to request the addition of another valid host."); return false; } if (host_name == "www.chromosphere.com" || host_name == "chromosphere.com" || host_name == "localhost") { if (xmlhttp.protocol.toLowerCase() == "https:") { if (top_location_hostname == host_name) { if (typeof q_string === "string" && typeof Math.abs(parseInt(q_string)) === "number") { check_qstring = check_content_id(q_string); if (check_qstring === true) { //is querystring value format correct? xmlhttp.open("GET", encodeURI(xmlhttp_url_path + "Default?i=" + q_string), true); } } } } } } function show_loading_progress(win_id, timer_id) { var obj_container = null; var txt_node_loading = null; var loading_txt = null; var blank_img = null; var blank_img_exists = null; var td_window_status = null; var window_obj = null; window_obj = document.getElementById((win_id)); if (window_obj == null || window_obj == undefined) { clear_interval_timer(timer_id); } td_window_status = document.getElementById((win_id + "_window_status")); blank_img = document.getElementById(("contents_blankimage_" + win_id)); obj_container = document.getElementById(("contents_" + win_id)); blank_img_exists = document.getElementById(("contents_blankimage_" + win_id)); if (blank_img_exists == null) { blank_img_exists = false; } else { blank_img_exists = true; } if (blank_img_exists == true) { update_status_text(td_window_status.id); } else if (blank_img_exists == false || blank_img == null || blank_img == undefined) { clear_interval_timer(timer_id); //td_window_status.innerText = "status: open"; //set_window_status("Window Has Loaded"); td_window_status.style.color = "#ffffff"; } else { return; } } function update_status_text(status_box_id) { var status_box = null; var status_box_text = null; var periods = null; var status_box_txt_node = null; var i = null; status_box = document.getElementById(status_box_id); status_box_text = status_box.innerText; if (status_box_text == "Loading contents" || status_box_text == null || status_box_text == "" || status_box_text == undefined) { periods = "."; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == "Loading contents.") { periods = ".."; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == "Loading contents..") { periods = "..."; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == "Loading contents...") { periods = "...."; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == "Loading contents....") { periods = "....."; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == "Loading contents.....") { periods = "......"; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == "Loading contents......") { periods = ""; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == "Loading contents") { periods = "."; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == "") { periods = ""; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } if (status_box_text == null) { periods = ""; status_box_text = ("Loading contents" + periods); status_box.innerText = status_box_text; return true; } } function clear_interval_timer(timer_ID) { clearInterval(global_interval_timer_array[timer_ID]); global_interval_timer_array[timer_ID] = null; } function get_available_timer_array_slot() { var i = null; var array_len = null; var array_slot = null; var slot_index = null; var slot_open = null; slot_open = false; i = 0; array_len = global_interval_timer_array.length; for (i = 0; i < array_len; i++) { array_slot = global_interval_timer_array[i]; if (array_slot == null) { slot_index = i; global_interval_timer_array[slot_index] = i; //alert(i); slot_open = true; break; } } if (slot_open == true) { return slot_index; } else { return -1; } }