function SelectList ( ) {
	this.noData = Array( Array( '', 'No Data' ) );
	this.loading = Array( Array( '', 'Loading...' ) );
	this.dependent = Array( Array( '', 'Waiting on selections...' ) );

	this.checkId = function ( pulldownId ) {
		if ( !document.getElementById( pulldownId ) ) {
			return false;
		}
		return document.getElementById( pulldownId );
	}	

	this.setClear = function ( pulldownId ) {
		var selectList = this.checkId( pulldownId );
		if ( !selectList ) return;
		selectList.options.length = 0;
		selectList.style.visibility = 'visible';
	}

	this.setEmpty = function ( pulldownId ) {
		var selectList = this.checkId( pulldownId );
		if ( !selectList ) return;
		this.setClear( pulldownId );
		this.setOptions( pulldownId, this.noData );
	}

	this.setLoading = function ( pulldownId ) {
		var selectList = this.checkId( pulldownId );
		if ( !selectList ) return;
		this.setOptions( pulldownId, this.loading );
	}
	
	this.setDependent = function ( pulldownId ) {
		var selectList = this.checkId( pulldownId );
		if ( !selectList ) return;
		this.setOptions( pulldownId, this.dependent );
	}
	
	this.setOptions = function ( pulldownId, dataList, exceptionSelectList, boolDontResetist ) {
		var selectList = this.checkId( pulldownId );
		if ( !selectList ) return;
		if ( !boolDontResetist ) boolDontResetist = false;
		if ( !boolDontResetist ) this.setClear( pulldownId );
		
		var selectExceptionList = false;
		if ( exceptionSelectList != "" ) {
			selectExceptionList = this.checkId( exceptionSelectList );
		}
		if ( selectExceptionList ) {
			for ( i = 0; i<dataList.length; i++ ) {
				if ( !is_select_list_item(selectExceptionList, dataList[i][0]) ) {
					this.addItem( pulldownId, dataList[i][0], dataList[i][1] );
				}
			}
		} else {
			for ( i = 0; i<dataList.length; i++ ) {
				this.addItem( pulldownId, dataList[i][0], dataList[i][1] );
			}
		}
		selectList.options.selectedIndex = -1;
		selectList.blur();
	}
	
	this.addItem = function ( pulldownId, optionValue, optionName ) {
		var selectList = this.checkId( pulldownId );
		if ( !selectList ) return;
		selectList.options[selectList.options.length] = new Option( optionName, optionValue );
	}

	this.getNumItems = function ( pulldownId ) {
		var selectList = this.checkId( pulldownId );
		if ( !selectList ) return;
		return selectList.options.length;
	}
	
	this.getSelectedValue = function ( pulldownId, bShowText ) {
		var selectList = this.checkId( pulldownId );
		if ( !selectList ) { alert('ret1'); return; }
		if ( selectList.options.length > 0 ) {
			if ( selectList.options.selectedIndex != -1 ) {
				switch ( selectList.type ) {
					case "select-one":
						return (bShowText) ? 
							selectList.options[ selectList.options.selectedIndex ].text:
							selectList.options[ selectList.options.selectedIndex ].value;
					case "select-multiple":
						var theVals = new Array();
						//alert('len: '+theObj.length);
						for (var i=0; i<theObj.length; i++) {
							if (theObj[i].selected) {
								theVals.push( (bShowText?theObj[i].text:theObj[i].value) );
							}
						}
						return theVals;
				}
			}
		}
	}
	this.rawdataToArray = function ( rawdata ) {
		var debug, array1, array2, finalArray, i;
		i = 0;
		finalArray = new Array();
		array1 = rawdata.split( "\n" );
		debug = '';
		for ( i = 0; i < array1.length-1; i++ ) {
			array2 = array1[i].split("\|\|");
			debug += 'finalArray['+i+'] = new Array( '+array2[0]+', '+array2[1]+' )<br>';
			finalArray[finalArray.length] = new Array( array2[0], array2[1] );
		}
		//alert(debug);
		return finalArray;
	}
}