
function procBegin(){document.body.style.cursor='wait';window.status='loading...';if(!arguments[0])popupShow(document.getElementById('popup'),395,21);}
function procEnd(){popupHide(document.getElementById('popup'));window.status='Done';document.body.style.cursor='default';}
function new_xhr(){var xhr;if(document.all&&!window.opera){xhr=new ActiveXObject("Microsoft.XMLHTTP");}else{xhr=new XMLHttpRequest();}
return xhr;}
function get_http_in(url,div){var xhr=new_xhr();if(!document.getElementById('popup'))document.body.innerHTML+='<div id="popup"> </div>';procBegin();xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200)div.innerHTML=xhr.responseText;procEnd();}}
xhr.open("GET",url,true);xhr.send(null);}
function get_http(url){var xhr_content='';try{var xhr=new_xhr();xhr.onreadystatechange=function(){};xhr.open("GET",url,false);xhr.send(null);if(xhr.readyState==4&&xhr.status==200)xhr_content=xhr.responseText;}
catch(error){}
return xhr_content;}
function get_http2select(url,select){if(select.getAttribute("rel"))return;select.setAttribute("rel",1);select.blur();procBegin(1);var xhr=new_xhr();xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200){var content=xhr.responseText;csv2select(content,select);}
procEnd();select.focus();}}
xhr.open("GET",url,true);xhr.send(null);}
function csv2select(content,select){var rec=new Array();var recs=content.split('\n');var last=select.options.length;for(i=0;i<recs.length-1;i++){rec=recs[i].split('\t');select.options[last]=new Option();select.options[last].value=rec[0];select.options[last].text=rec[1];last++;}}
function csv2array(content){var ret=new Array();var rec=new Array();var recs=content.split('\n');var log='';for(i=0;i<recs.length;i++){rec=rec[i].split('\t');for(j=0;j<rec.length;j++){ret[i][j]=rec[j];}}
if(log)alert(log);return ret;}
function content2array(content){var fields=content.split('\t');var ret=new Array();var rec=new Array();var t='';var log='';for(i=0;i<fields.length;i++){t+=' | '+fields[i];rec=fields[i].split('=');ret[rec[0]]=rec[1];}
if(log)alert(log);return ret;}
function get_http_array(url){var content=get_http(url);return content2array(content);}
