﻿function GND(tid,id,ddisp,sid,uid,change){if(id!=null && id!=''){if(ddisp==1){NAjax.GNDS(tid,id,ddisp,sid,uid,change,NDDB);}else{NAjax.GNDS(tid,id,ddisp,sid,uid,change,NDB);}}}function NDB(response){var ds = response.value;var changing;var uid='';if(ds != null && typeof(ds) == "object" && ds.Tables != null){if(ds.Tables[0].Rows.length>0){changing=document.getElementById(ds.Tables[0].Rows[0].change);changing.options.length=1;uid=ds.Tables[0].Rows[0].uid;}
for(var i=0; i<ds.Tables[0].Rows.length; i++){changing.options[changing.length]=new Option(ds.Tables[0].Rows[i].catalogName,ds.Tables[0].Rows[i].catalogId);changing.options[changing.length-1].style.backgroundColor=ds.Tables[0].Rows[i].color;if(ds.Tables[0].Rows[i].catalogId==ds.Tables[0].Rows[i].sid)changing.options[changing.length-1].selected=true;}
DCE(uid);}else{ alert("There have some error,please refresh the page!");}}function NDDB(response){var ds = response.value;var changing;var uid;if(ds != null && typeof(ds) == "object" && ds.Tables != null){if(ds.Tables[0].Rows.length>0){changing=document.getElementById(ds.Tables[0].Rows[0].change);
changing.options.length=1;uid=ds.Tables[0].Rows[0].uid;}for(var i=0; i<ds.Tables[0].Rows.length; i++){if(ds.Tables[0].Rows[i].fatherId==ds.Tables[0].Rows[i].oldId){changing.options[changing.length]=new Option(ds.Tables[0].Rows[i].catalogName,ds.Tables[0].Rows[i].catalogId);changing.options[changing.length-1].style.backgroundColor=ds.Tables[0].Rows[i].color;
if(ds.Tables[0].Rows[i].catalogId==ds.Tables[0].Rows[i].sid)changing.options[changing.length-1].selected=true;for(var j=0;j<ds.Tables[0].Rows.length; j++){if(ds.Tables[0].Rows[j].fatherId==ds.Tables[0].Rows[i].catalogId){changing.options[changing.length]=new Option(" ├"+ds.Tables[0].Rows[j].catalogName,ds.Tables[0].Rows[j].catalogId);
changing.options[changing.length-1].style.backgroundColor=ds.Tables[0].Rows[j].color;if(ds.Tables[0].Rows[j].catalogId==ds.Tables[0].Rows[j].sid)changing.options[changing.length-1].selected=true;}}}}DCE(uid);}else{}}function DCC(selectvalue,change,tid,ddisp,sid,uid){DCES(uid,change);var changing=document.getElementById(change);if(changing!=null && typeof(changing) == "object"){
changing.options.length=1;GND(tid,selectvalue,ddisp,sid,uid,change);}}function DSF(uid,firstid){eval('SetFID'+uid+'(\''+firstid+'\')');}function DCE(uid){try{DCChanged(uid);}catch(erro){}}function DCES(uid,change){try{DCChanging(uid,change);}catch(erro){}}
function DCInit(firstid,change,tid,ddisp,sid){var changing=document.getElementById(change);if(changing.options.length==1){var uid=change.substr(0,change.length-1);var ic=1;while(document.getElementById(uid+ic.toString())!=null){document.getElementById(uid+ic.toString()).options.length=1;ic++;}GND(tid,firstid,ddisp,sid,uid,change);}}