<!--//

////////////////////////////////////////////////////////////////////
// Key /industry Drivers
////////////////////////////////////////////////////////////////////
function onChangeKeyIndDrvr(frm,cboSelect,txtID, txtKeyIndDrvr) {
	if(cboSelect == null) return true;
    var intCurrent = cboSelect.selectedIndex;
	var strKeyIndDrvr = cboSelect.options[intCurrent].text;
	
	// Asssign the values to the fields
	txtID.value = intCurrent;
	txtKeyIndDrvr.value = strKeyIndDrvr.trim();
	// Deselect the item
	cboSelect.selectedIndex = -1;
	
	return true;
}

function addKeyIndDrvrOption(cboSelect,txtID, txtKeyIndDrvr, blnClear) {
    var defaultSelected = true;
    var selected = false;
	
	// Exit if missing entries
	if(txtKeyIndDrvr.value == '' ) return  true;
	
	var strValue = txtKeyIndDrvr.value ;
	var length = cboSelect.length;
	
	//alert('cboSelect.length =' + cboSelect.length);
	
	var intOption0;
	var strOption0 = '';
	if(length > 0) strOption0 = cboSelect.options[0].text;
	
	strOption0 = trim3(strOption0);
	strOption0.replace('nbsp;','');
	strOption0.replace(/\s/g,"");
	
	//alert('strOption0 = ' + strOption0);
	
	if(length > 0 && strOption0 != '') 
		intOption0 = cboSelect.options[0].value;
	else
		intOption0 = 1000;
	
	//alert ('strValue = ' + strValue);

	//alert('Option 0 =' + cboSelect.options[0].text);
	//alert('Index = ' + intOption0 );

	// Enable the ability to replace the first entry
	if(intOption0  == 1000) {
		length = 0;	
		txtID.value = '';
	}
	// Create a new option if there are not any or
	// if we entered new information
	// Update an existing option if we had an ID	
	//alert('txtID = ' + txtID.value);
			
	if (txtID.value == '') {
		var optionName = new Option(strValue, length, defaultSelected, selected)	
    		cboSelect.options[length] = optionName;
	}else{
		var intIndex = txtID.value;
		cboSelect.options[intIndex].text = strValue;

	}
	// Since we will reuse this same function in different areas, we don't 
	// always want the source fields cleared; however, we should always clear
	// the ID
	txtID.value = '';
	if(blnClear){
		
		txtKeyIndDrvr.value = ''; 
	}
	cboSelect.selectedIndex = -1;
	
	return true;
}

function removeKeyIndDrvrOption(cboSelect,txtID, txtKeyIndDrvr, blnClear) {


    	
	if (txtID.value != '') {
		
		var intIndex = txtID.value;
		cboSelect.options[intIndex] = null;
		
		txtID.value = '';
		if(blnClear){
			
			txtKeyIndDrvr.value = ''; 
			
		}
	}

}
function storeKeyIndDrivers(cboSelect){
	var strKeyIndDrvr = '';
	//alert('Storing industry drivers...');
	for(var x = 0; x < cboSelect.options.length; x++){
		if(strKeyIndDrvr != '' ) strKeyIndDrvr += '^';
		// Don't store the default entry
		var strValue = cboSelect.options[x].text;
		strValue.replace(/\s/g,"");
		if(cboSelect.options[x].value != 1000) strKeyIndDrvr += strValue;
	}
	$('KeyIndDrvrList').value = strKeyIndDrvr;
}

//-->