var region=new Object();region.isAdmin=false;region.loadRegions=function(a,b){Ajax.call(region.getFileName(),"target="+b+"&parent="+a,region.response,"GET","JSON")};region.loadFields=function(b,a){var c=(typeof a=="undefined")?"selFields":a;region.loadRegions(b,c)};region.changed=function(c,a){var b=c.options[c.selectedIndex].value;region.loadRegions(b,a)};region.response=function(a,c){var e=document.getElementById(a.target);e.length=1;e.selectedIndex=0;e.style.display=(a.regions.length==0&&!region.isAdmin)?"none":"";if(document.all){e.fireEvent("onchange")}else{var b=document.createEvent("HTMLEvents");b.initEvent("change",true,true);e.dispatchEvent(b)}if(a.regions){var f=a.regions;var d=f.split(",");enterValue(d,e)}};function enterValue(a,b){clearPreValue(b);var c=a[0];for(i=0;i<a.length;i++){isselected=addOption(b,a[i],a[i]);if(isselected){b.options[i].selected=true;c=a[i]}}return c}function addOption(c,a,d){var b=document.createElement("option");b.text=a;b.value=d;c.options.add(b);return true}function clearPreValue(a){while(a.hasChildNodes()){a.removeChild(a.childNodes[0])}}region.getFileName=function(){if(region.isAdmin){return"./sql.php?act=getfields"}else{return""}};
