/* function Check_ajax_pool() function Delete_pending_requests( str_request_identifier ) function Http_request( str_url, str_params, str_return_action, str_error_action, n_action_late ) function Http_request_advanced( str_url, str_params, str_oncomplete_action, str_onerror_action, n_oncomplete_late, str_method, str_response_type ) function Initialize_HTTP_object() function Close_HTTP_object() function Http_request_data_arriving() function Get_XML_object_from_text( str_XML ) function Get_form_query_string( obj_form ) function Submit_form_by_AJAX( obj_form, str_return_action, str_error_action, n_late, b_loading_animation, b_XML ) function Submit_form_by_AJAX_onComplete( str_form_id ) function Load_frame_HTML_by_AJAX( str_url, str_params, str_target_frame_id, str_action_oncompleted, n_action_late ) function Load_frame_HTML_by_AJAX_onComplete( str_HTML ) function Get_node_value( obj_node, str_tag_name ) function Execute_by_Ajax( str_action, str_params ) function Execute_HREF_by_Ajax( obj_href ) function Execute_HREF_by_Ajax_onComplete() function XML_execute( obj_XML ) function Ajax_auto_ping( b_starting, str_ping_url, str_ping_params, str_oncompleted_action, n_frequency_second, n_timeout_second ) */ var m_obj_http; var m_array_ajax_request = new Array(); var m_obj_ajax_response = new Object(); var m_b_display_ajax_error = false; function Check_ajax_pool() { var obj_array_request; if(m_array_ajax_request.length > 0) { if(!m_obj_http) { obj_array_request = m_array_ajax_request[0].split("#@#"); m_array_ajax_request.shift(); Http_request_advanced(obj_array_request[0], obj_array_request[1], obj_array_request[2], obj_array_request[3], obj_array_request[4], obj_array_request[5], obj_array_request[6]); } //Echo("Check_ajax_pool(" + m_array_ajax_request.length + ")"); setTimeout("Check_ajax_pool();", 100); } } function Delete_pending_requests( str_request_identifier ) { var obj_array = new Array(); for(i=0; i " + str_return_action); return(Http_request_advanced(str_url, str_params, str_return_action, str_error_action, n_action_late, "POST", (str_return_action == "XML_execute") ? "XML" : "HTML")); } function Http_request_advanced( str_url, str_params, str_oncomplete_action, str_onerror_action, n_oncomplete_late, str_method, str_response_type ) { //Echo(str_url);Echo(str_params);Echo(str_oncomplete_action);Echo(str_onerror_action);Echo(n_oncomplete_late);Echo(str_method);Echo(str_response_type); var i; var b_result = false; var obj_array_request; var str_join_request; if(m_obj_http) { obj_array_request = new Array(); obj_array_request.push(str_url); //[0] obj_array_request.push(str_params); //[1] obj_array_request.push(str_oncomplete_action); //[2] obj_array_request.push(str_onerror_action); //[3] obj_array_request.push(n_oncomplete_late); //[4] obj_array_request.push(str_method); //[5] obj_array_request.push(str_response_type); //[6] str_join_request = obj_array_request.join("#@#"); for(i=0; i 160) { n_padding_bottom = n_padding_bottom + n_padding_top - 50; n_padding_top = 50; } if(!n_action_late && n_action_late != 0) { n_action_late = 1000; } obj_frame.innerHTML = "
"; return(Http_request(str_url, "ajax=1&" + str_params, "m_str_target_frame_id=\"" + str_target_frame_id + "\";m_str_load_frame_HTML_oncompleted=\"" + str_action_oncompleted + "\";Load_frame_HTML_by_AJAX_onComplete", "", n_action_late)); } function Load_frame_HTML_by_AJAX_onComplete( str_HTML ) { if(str_HTML.indexOf("= 0) { XML_execute(Get_XML_object_from_text(str_HTML)); } else if(str_HTML.toLowerCase().indexOf("= 0) { document.location = document.location; } else { document.getElementById(m_str_target_frame_id).innerHTML = str_HTML; eval(m_str_load_frame_HTML_oncompleted); } } var m_obj_array_HREF_by_Ajax_element = new Array(); function Execute_by_Ajax( str_action, str_params ) { return(Http_request_advanced(str_action, "ajax=1&" + str_params, "XML_execute", "", 1000, "GET", "XML")); } function Execute_HREF_by_Ajax( obj_href ) { var n_pos_question = obj_href.href.indexOf("?"); var str_action = (n_pos_question > 0) ? obj_href.href.substr(0, n_pos_question) : obj_href.href; var str_params = (n_pos_question > 0) ? obj_href.href.substr(n_pos_question + 1) : ""; obj_href.setAttribute("previousInnerHTML", obj_href.innerHTML); obj_href.innerHTML = ""; m_obj_array_HREF_by_Ajax_element.push(obj_href); return(Http_request_advanced(str_action, "ajax=1&" + str_params, "Execute_HREF_by_Ajax_onComplete();XML_execute", "", 1000, "GET", "XML")); } function Execute_HREF_by_Ajax_onComplete() { var obj_href = m_obj_array_HREF_by_Ajax_element[0]; m_obj_array_HREF_by_Ajax_element.shift(); obj_href.innerHTML = obj_href.getAttribute("previousInnerHTML"); obj_href.setAttribute("previousInnerHTML", ""); } function Get_node_value( obj_node, str_tag_name ) { var str_value = ""; if(obj_node.getElementsByTagName(str_tag_name)[0]) { if(obj_node.getElementsByTagName(str_tag_name)[0].childNodes[0]) { str_value = obj_node.getElementsByTagName(str_tag_name)[0].childNodes[0].nodeValue; } } return(str_value); } function XML_execute( obj_XML ) { var i; var obj_ROOT; var obj_node; var str_element_id; var str_value; var str_action; var str_action_tagname; var str_attribute_name; var str_caption; var obj_elements; var n_index; var obj_root_children; if(typeof(obj_XML) == "string") { obj_XML = Get_XML_object_from_text(obj_XML); } if(typeof(obj_XML) == "object") { if(obj_XML.getElementsByTagName("ROOT")) { obj_ROOT = obj_XML.getElementsByTagName("ROOT")[0]; if(obj_ROOT) { obj_root_children = obj_ROOT.getElementsByTagName("*"); for (i = 0; i < obj_root_children.length; i++) { obj_node = obj_root_children[i]; //alert((new XMLSerializer()).serializeToString(obj_node)); switch(obj_node.tagName.toUpperCase()) { case "COMMAND": switch(obj_node.getElementsByTagName("CMD")[0].childNodes[0].nodeValue.toUpperCase()) { case "JAVASCRIPT": eval(unescape(Get_node_value(obj_node, "SCRIPT"))); break; case "MESSAGEBOX": alert(unescape(Get_node_value(obj_node, "TEXT"))); break; case "REDIRECT": document.location = Get_node_value(obj_node, "URL"); break; case "REDIRECTTOP": top.document.location = Get_node_value(obj_node, "URL"); break; case "INPUTVALUE": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_value = unescape(Get_node_value(obj_node, "VALUE")); if(document.getElementById(str_element_id)) { document.getElementById(str_element_id).value = str_value; } break; case "INNERHTML": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_value = unescape(Get_node_value(obj_node, "INNERHTML")); if(document.getElementById(str_element_id)) { document.getElementById(str_element_id).innerHTML = str_value; } break; case "INNERHTMLCHILD": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_child_tagname = Get_node_value(obj_node, "CHILDTAGNAME"); n_child_index = Val(Get_node_value(obj_node, "CHILDINDEX")); str_value = unescape(Get_node_value(obj_node, "INNERHTML")); if(document.getElementById(str_element_id)) { if(document.getElementById(str_element_id).getElementsByTagName(str_child_tagname)[n_child_index]) { document.getElementById(str_element_id).getElementsByTagName(str_child_tagname)[n_child_index].innerHTML = str_value; } } break; case "ELEMENTDISPLAY": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_value = Get_node_value(obj_node, "DISPLAY"); if(document.getElementById(str_element_id)) { document.getElementById(str_element_id).style.display = str_value; } break; case "ELEMENTDISPLAYCHILD": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_child_tagname = Get_node_value(obj_node, "CHILDTAGNAME"); n_child_index = Val(Get_node_value(obj_node, "CHILDINDEX")); str_value = Get_node_value(obj_node, "DISPLAY"); if(document.getElementById(str_element_id)) { document.getElementById(str_element_id).getElementsByTagName(str_child_tagname)[n_child_index].style.display = str_value; } break; case "ELEMENTSTYLE": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_style_name = Get_node_value(obj_node, "STYLENAME"); str_value = Get_node_value(obj_node, "STYLEVALUE"); if(document.getElementById(str_element_id)) { eval("document.getElementById(str_element_id).style." + str_style_name + " = str_value"); } break; case "ELEMENTOPACITY": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_value = Get_node_value(obj_node, "OPACITY"); Set_object_opacity(document.getElementById(str_element_id), Val(str_value)); break; case "QUESTION": str_question = unescape(Get_node_value(obj_node, "THEQUESTION")); str_action_tagname = confirm(str_question) ? "ACTIONYES" : "ACTIONNO"; str_action = unescape(Get_node_value(obj_node, str_action_tagname)); if(str_action != "") { if(str_action.substr(0, 11) == "javascript:") { eval(str_action.substr(11)); } else { document.location = str_action; } } break; case "SETATTRIBUTE":str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_attribute_name = Get_node_value(obj_node, "ATTRIBUTENAME"); str_value = Get_node_value(obj_node, "ATTRIBUTEVALUE"); document.getElementById(str_element_id).setAttribute(str_attribute_name, str_value); break; case "CLASSNAME": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_value = Get_node_value(obj_node, "CLASSNAME"); document.getElementById(str_element_id).className = str_value; break; case "CLASSNAMECHILD": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_value = Get_node_value(obj_node, "CLASSNAME"); str_child_tagname = Get_node_value(obj_node, "CHILDTAGNAME"); n_child_index = Get_node_value(obj_node, "CHILDINDEX"); if(document.getElementById(str_element_id)) { document.getElementById(str_element_id).getElementsByTagName(str_child_tagname)[n_child_index].className = str_value; } break; case "CLEARSELECT": str_element_id = Get_node_value(obj_node, "ELEMENTID"); obj_elements = document.getElementById(str_element_id).getElementsByTagName("option"); for(n_index=obj_elements.length-1; n_index>=0; n_index--) { document.getElementById(str_element_id).removeChild(obj_elements[n_index]); } break; case "ADDSELECTOPTION": str_element_id = Get_node_value(obj_node, "ELEMENTID"); str_value = Get_node_value(obj_node, "OPTIONVALUE"); str_caption = Get_node_value(obj_node, "OPTIONCAPTION"); obj_option = document.createElement("option"); obj_option.setAttribute("value", str_value); obj_option.innerHTML = str_caption; document.getElementById(str_element_id).appendChild(obj_option); break; case "DISABLE": str_element_id = Get_node_value(obj_node, "ELEMENTID"); document.getElementById(str_element_id).disabled = true; break; case "ENABLE": str_element_id = Get_node_value(obj_node, "ELEMENTID"); document.getElementById(str_element_id).disabled = false; break; default: //alert(obj_node.getElementsByTagName("CMD")[0].childNodes[0].nodeValue.toUpperCase()); } break; } } } } else { if(m_b_display_ajax_error) { Echo("ROOT not found"); } } } else { if(m_b_display_ajax_error) { Echo("Empty XML"); } } } var m_b_ajax_auto_ping_on = false; function Ajax_auto_ping( b_starting, str_ping_url, str_ping_params, str_oncompleted_action, n_frequency_second, n_timeout_second ) { if(b_starting) { m_b_ajax_auto_ping_on = true; if(n_timeout_second > 0) { setTimeout("m_b_ajax_auto_ping_on=false;", n_timeout_second * 1000); } } else { Http_request(str_ping_url, str_ping_params, str_oncompleted_action, ""); } if(m_b_ajax_auto_ping_on) { setTimeout("Ajax_auto_ping(false,'" + str_ping_url + "','" + str_ping_params + "','" + str_oncompleted_action + "'," + n_frequency_second + ",0);", n_frequency_second * 1000); } } function EmptyFunction() {}