
function wpm_get_obj(object_name){var res=document.getElementById(object_name);return res;}
function wpm_catch_error(str){if(str!="")
throw new Error(str);}
function wpm_get_error(e){return e.message}
var wpm_ajax_prg_flag=new Array();var wpm_ajax_sct=new Array();function wpm_in_array(hook,stack){for(tmp in stack){if(tmp==hook)
return true;}
return false;}
function wpm_check_all(field,flag){var tmp;var i=0;do{tmp=wpm_get_obj(field+"_"+i.toString());tmp.checked=flag;i++;tmp=wpm_get_obj(field+"_"+i.toString());}while(tmp);}
function wpm_ajax_sct_reg(wpm_nm){if(!wpm_in_array(wpm_nm,wpm_ajax_sct))
wpm_ajax_sct[wpm_ajax_sct.length]=wpm_nm;}
function wpm_ajax_hnd_err(wpm_sct,e){wpm_ajax_disp_msg(wpm_sct,"error",wpm_get_error(e));wpm_ajax_disp_prg(wpm_sct,false);}
function wpm_ajax_disp_msg(wpm_sct,wpm_type,wpm_msg){wpm_ajax_hide_all_msg();var wpm_wrn=wpm_get_obj("sct_ajax_"+wpm_sct+"_msg");if(wpm_wrn==null)
return;wpm_wrn.className="ajax_message "+wpm_type;wpm_wrn.style.display="";wpm_wrn.innerHTML=wpm_msg;}
function wpm_ajax_hide_msg(wpm_sct){var wpm_msg=wpm_get_obj("sct_ajax_"+wpm_sct+"_msg");if(wpm_msg==null)
return;wpm_msg.style.display="none";wpm_msg.innerHTML=wpm_msg;}
function wpm_ajax_hide_all_msg(){for(wpm_sct in wpm_ajax_sct){wpm_ajax_hide_msg(wpm_ajax_sct[wpm_sct]);}}
function wpm_ajax_disp_prg(wpm_sct,wpm_prg){if(typeof wpm_prg=="undefined")
wpm_prg=true;if(typeof wpm_ajax_prg_flag[wpm_sct]=="undefined")
wpm_ajax_prg_flag[wpm_sct]=false;var wpm_frm=wpm_get_obj("sct_ajax_"+wpm_sct);var wpm_trn=wpm_get_obj("sct_ajax_"+wpm_sct+"_prg");if(wpm_prg){if(wpm_ajax_prg_flag[wpm_sct])
return;wpm_ajax_hide_msg(wpm_sct);if(wpm_to_int(wpm_frm.offsetHeight)<=20)
wpm_trn.style.height="20px";else
wpm_trn.style.height=wpm_frm.offsetHeight+"px";wpm_trn.style.width=wpm_frm.offsetWidth+"px";wpm_frm.style.display="none";wpm_trn.style.display="";wpm_ajax_prg_flag[wpm_sct]=true;}else{if(!wpm_ajax_prg_flag[wpm_sct])
return;wpm_frm.style.display="";wpm_trn.style.display="none";wpm_ajax_prg_flag[wpm_sct]=false;}}
function wpm_create_http_req(){var wpm_request;if(window.ActiveXObject){try{wpm_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){wpm_request=false;}}else{try{wpm_request=new XMLHttpRequest();}catch(e){wpm_request=false;}}
if(!wpm_request)
wpm_catch_error("Your browser does not support AJAX!");else
return wpm_request;}
function wpm_ajax_query(prm_cmd,prm_wpm_dat_post,prm_wpm_misc){var wpm_xml=wpm_create_http_req();if(typeof prm_dat_get=="undefined")
var prm_dat_get={};if(typeof prm_wpm_dat_post=="undefined")
var prm_wpm_dat_post={};if(typeof prm_wpm_misc=="undefined")
var prm_wpm_misc={};function wpm_send_query(){if(prm_cmd==""){alert("No act to be send!");return false;}
if(wpm_xml.readyState==4||wpm_xml.readyState==0){req_url=wpm_url(prm_cmd);dat_str="";for(tmp in prm_wpm_dat_post){if(dat_str!="")
dat_str+="&";dat_str+=tmp+"="+prm_wpm_dat_post[tmp];}
if(dat_str==""){wpm_xml.open("GET",req_url,true);wpm_xml.onreadystatechange=wpm_response;wpm_xml.setRequestHeader("Accept-Charset","UTF-8");wpm_xml.send(null);}else{wpm_xml.open("POST",req_url,true);wpm_xml.onreadystatechange=wpm_response;wpm_xml.setRequestHeader("Content-Type","application/x-www-form-urlencoded");wpm_xml.setRequestHeader("Accept-Charset","UTF-8");wpm_xml.send(dat_str);}
return true;}
return false;}
function wpm_response(){try{if(wpm_xml.readyState==4){if(wpm_xml.status==200){try{wpm_res=wpm_xml.responseXML.documentElement;wpm_handle_response(wpm_res);if(typeof prm_wpm_misc.exec_cpl!="undefined")
eval(prm_wpm_misc.exec_cpl);if(typeof prm_wpm_misc.exec_done!="undefined")
eval(prm_wpm_misc.exec_done);}catch(err){}}else{wpm_catch_error(wpm_xml.responseText);}}}catch(e){if(typeof prm_wpm_misc.exec_fail!="undefined")
eval(prm_wpm_misc.exec_fail);if(typeof prm_wpm_misc.exec_done!="undefined")
eval(prm_wpm_misc.exec_done);wpm_catch_error(e);}}
function wpm_handle_response(wpm_reply){try{if(typeof prm_wpm_misc.exec!="undefined")
eval(prm_wpm_misc.exec+"(wpm_reply, prm_wpm_misc);");}catch(e){wpm_catch_error(e);}}
return wpm_send_query();}
function wpm_str_replace(str,sr,val){return str.replace(sr,val,"g");}
function wpm_parse_html(html){var wpm_res=html;wpm_res=wpm_str_replace(wpm_res,"&gt;",">");wpm_res=wpm_str_replace(wpm_res,"&lt;","<");wpm_res=wpm_str_replace(wpm_res,"&quot;","\"");wpm_res=wpm_str_replace(wpm_res,"&brvbar;","|");wpm_res=wpm_str_replace(wpm_res,"&amp;","&");return wpm_res;}
function wpm_to_int(str){wpm_res=parseInt(wpm_to_num(str));if(isNaN(wpm_res))
wpm_res=0;return wpm_res;}
function wpm_to_num(str){wpm_res=parseFloat(str);if(isNaN(wpm_res))
wpm_res=0;return wpm_res;}
function wpm_is_ie(){if(navigator.appName=="Microsoft Internet Explorer")
return true;else
return false;}
function wpm_is_opera(){if(navigator.appName=="Opera")
return true;else
return false;}
function wpm_url(wpm_nm){return wpm_base_url+"ajax/"+wpm_nm;}
function wpm_xml_nd_val(wpm_nd){try{return wpm_parse_html(wpm_nd.firstChild.data);}catch(e){return"";}}
function wpm_xml_nds_by_tag(wpm_xml,wpm_tag){wpm_res=new Array();wpm_nds=wpm_xml.getElementsByTagName(wpm_tag);wpm_len=wpm_nds.length;for(wpm_ai=0;wpm_ai<wpm_len;wpm_ai++)
wpm_res[wpm_ai]=wpm_nds[wpm_ai];return wpm_res;}
function wpm_xml_nd_chd(wpm_nd){wpm_res=new Array();wpm_nds=wpm_nd.childNodes;wpm_len=wpm_nds.length;for(wpm_bi=0;wpm_bi<wpm_len;wpm_bi++)
wpm_res[wpm_bi]=wpm_nds[wpm_bi];return wpm_res;}
function wpm_xml_msg(wpm_xml,wpm_tag){if(typeof wpm_tag=="undefined")
var wpm_tag="error";lst_msg=new Array();nds_msg=wpm_xml_nds_by_tag(wpm_xml,wpm_tag);if(nds_msg.length==0)
return"";for(nd_msg in nds_msg)
lst_msg[lst_msg.length]=wpm_xml_nd_val(nds_msg[nd_msg]);return lst_msg.join("<br/>");}
