//////////////////////////////////////////////////////////////////////////////////////////
//	Company javascript functions														//
//////////////////////////////////////////////////////////////////////////////////////////

function getSelectedCompanies() {
    var intCounter;
	var strCompanies = "";
	for (intCounter=0; intCounter<document.forms.asd_form.selCompanies.options.length; intCounter++) {
		if (intCounter==0) {
		    strCompanies = document.forms.asd_form.selCompanies.options[intCounter].value;
		}
		else {
			strCompanies += ',' + document.forms.asd_form.selCompanies.options[intCounter].value;
		}
	}
	return strCompanies;
}
function getSelectedCountries() {
    var intCounter;
	var strCountries = "";
	for (intCounter=0; intCounter<document.asd_form.selCountries.options.length; intCounter++) {
		if (intCounter==0) {
		    strCountries = document.asd_form.selCountries.options[intCounter].value;
		}
		else {
			strCountries += ',' + document.asd_form.selCountries.options[intCounter].value;
		}
	}
	return strCountries;
}
function setSelectedOptions(selSrc, selDest, strValues){
	var arrValues;
	var intCounter;
	var intItemCounter;
	var intI;
	var bExists;
	if(strValues!=''){
		arrValues = strValues.split(',');
		for (intItemCounter=0; intItemCounter<arrValues.length; intItemCounter++){
			for (intCounter=selSrc.options.length-1; intCounter>=0; intCounter--){
				if (selSrc.options[intCounter].value == arrValues[intItemCounter]){
					bExists = false;
					for (intI=0; intI<selDest.options.length; intI++){
					    if(selSrc.options[intCounter].value == selDest.options[intI].value){
						  bExists = true;
						}
					}
					if(bExists == false) {
						selDest.options[selDest.options.length] = new Option(selSrc.options[intCounter].text, selSrc.options[intCounter].value);
					}
					selSrc.options[intCounter] = null;
				}
			}
		}
	}
}
