function __NBaseClearOptions(vstrListBoxID,vblnSelected){
	var objListBox=document.getElementById(vstrListBoxID);
		if (objListBox==null)objListBox=document.getElementsByName(vstrListBoxID)[0];
	if(objListBox==null) return false;
   	var intCount=objListBox.options.length;
   	for (var i=intCount-1;i>=0;i--){
   		if(vblnSelected){
   			if(objListBox.options[i].selected){
      			objListBox.options[i].selected=false;
      			objListBox.remove(i);}
      	}
      	else{
      		objListBox.options[i].selected=false;
      		objListBox.remove(i);
      	}
   }

		if(document.getElementById&&!document.all){
   		//__NBase_BaseListBox_SetTrackerValue(vstrListBoxID);
   	}
  	else{
  		__NBase_BaseListBox_SetTrackerValue(vstrListBoxID);
  	}
  	
   return false;
}

function __NBaseAddOptionsByStr(vstrListBoxID,vstrOptContent){
	if(vstrOptContent=="") return false;
	var arrItem;
	var sOptText;
	var sOptValue;
	var objListBox=document.getElementById(vstrListBoxID);
	if (objListBox==null)objListBox=document.getElementsByName(vstrListBoxID)[0];
	
	//alert(vstrOptContent);//by sky
		
	var arrOption=vstrOptContent.split("^");
	for(var i=0;i<arrOption.length;i++){
     	var objOption = document.createElement('OPTION');
     	arrItem=arrOption[i].split("|");
		objOption.value=arrItem[0];
		objOption.text=arrItem[1];
		if (document.getElementById&&!document.all){
			if (!__NBaseCheckOptionExists(vstrListBoxID,objOption.value,1))objListBox[objListBox.options.length] = objOption;
		}
		else{
    	if (!__NBaseCheckOptionExists(vstrListBoxID,objOption.value,1))objListBox.options.add(objOption);
  	}
	}
	 __NBase_BaseListBox_SetTrackerValue(vstrListBoxID);
}
function __NBaseAddOptionsByArray(vstrListBoxID,varrOption){
	var sOptValue,sOptText;
	var objListBox=document.getElementById(vstrListBoxID);
	var i=0;
	while(i<varrOption.length){
     	var objOption = document.createElement("OPTION");
		objOption.value=varrOption[i];
		objOption.text=varrOption[i+1];
     	if (!__NBaseCheckOptionExists(vstrListBoxID,objOption.value,1)) objListBox.options.add(objOption);
     	i=i+2;
	}
	 __NBase_BaseListBox_SetTrackerValue(vstrListBoxID);
}
function __NBaseCheckOptionExists(vstrListBoxID,vstrCompareOpt,vintCompareType){
	var strCompared;
	if (typeof(vintCompareType)!="number") vintCompareType=1;
	var objListBox=document.getElementById(vstrListBoxID);
	if (objListBox==null)objListBox=document.getElementsByName(vstrListBoxID)[0];
	for (var i=0;i<objListBox.length;i++){
		if (vintCompareType==1) strCompared=objListBox.options[i].value;
		if (vintCompareType==2) strCompared=objListBox.options[i].text;
		if (vstrCompareOpt ==strCompared) return true;
	}
	return false;
}


