	function PopulateList(ItemName,FormItem,ListName) {
		/* remove all spaces from name */
		ItemName = ItemName.replace(' ','');
		/* take passed in values and create objects to be used */
		var arrName = eval('arr' + ItemName);
		var arrLength = eval('arr' + ItemName + '.length');
		/* call clear function to clear previous list */
		ClearList(FormItem,ListName);
		/* populate list with new contents from new array */
		for (var i = 0; i < arrLength; i++) {
			FormItem.options[i+1] = arrName[i];
		}
	}

//	function ClearList(FormItem,ListName) {
//		/* make sure the default is selected */
//		FormItem.selectedIndex = null;
//		FormItem.selectedIndex = -1;
//		FormItem.selectedIndex = 0;
//		/* clear the entire list contents to allow for different sized lists */
//		while (FormItem.options.length > 0) FormItem.options[FormItem.options.length-1] = null;
//		/* repopulate the default list item */
//		FormItem.options[0] = new Option('Select ' + ListName,'');
//	}

	function ClearList(FormItem, ListName) {
		// clear the entire list contents to allow for different sized lists
		var i = 0;
		var o = FormItem.options;
		for (i = o.length; i >= 0; --i)
			o[i] = null;

//		while (FormItem.options.length > 0) FormItem.options[FormItem.options.length-1] = null;

		// repopulate the default list item
		FormItem.options[0] = new Option('Select ' + ListName,'');

		// make sure the default is selected
		FormItem.selectedIndex = null;
		FormItem.selectedIndex = -1;
		FormItem.selectedIndex = 0;
	}

	function VerifyOfferId() {
		var msg = '';
		document.frmDetailedSearch.PriceId.value = document.frmDetailedSearch.tmpPriceId.value;
		document.frmDetailedSearch.tmpPriceId.value = '';
		var PriceId = document.frmDetailedSearch.PriceId.value;
		if (PriceId != '') {
			var id_val = parseInt(document.frmDetailedSearch.PriceId.value,10);
	
			if (id_val < 0 || id_val > 2147483647) {
				msg += 'Offer ID: must be a valid number (out of range)\n\n';
			}
			if ((PriceId == '') || (isNaN(PriceId) == true)) {
					msg += 'Offer ID: can not be left blank and must be a numeric value\n\n';
			}
				
			if ((PriceId.indexOf('.') != -1) || (PriceId.indexOf(',') != -1)) {
				msg += 'Offer ID: can not include "." or ","\n\n';
			}
			if (msg == '') {
				document.frmDetailedSearch.action = 'OfferDetail.asp?ReferringType=8';
				document.frmDetailedSearch.OfferIdSearch.value = 'true';
				document.frmDetailedSearch.submit();
			}
			else {
				msg = 'The form could not be submitted due to the following errors:\n\n' + msg;
				alert(msg);
				document.frmDetailedSearch.tmpPriceId.focus();
				return false;
			}
		} // if (PriceId != '')
		else {
			return true;
		}
	} // function
	function RepopulateDetailedSearch(SearchType, CurrDestination, CurrtxtDestination, CurrWhen, CurrLength, CurrBudget, CurrTravelType, CurrInterests, CurrCompany, CurrDepartState, CurrDepartCity, CurrDepartCode) {
		var objForm = document.frmDetailedSearch;
		var i;
		if (CurrtxtDestination != '' && objForm.txtDestination) {
			objForm.txtDestination.value = CurrtxtDestination;
		}
		if (CurrWhen != '' && objForm.selWhen) {
			for (i = 0; i < objForm.selWhen.length; i++) {
				if (objForm.selWhen(i).value == CurrWhen) {
					objForm.selWhen(i).selected = true;
				}
			}
		}
		if (CurrLength !='' && objForm.selLength) {
			for (i = 0; i < objForm.selLength.length; i++) {
				if (objForm.selLength(i).value == CurrLength) {
					objForm.selLength(i).selected = true;
				}
			}
		}
		if (CurrBudget != '' && objForm.selBudget) {
			for (i = 0; i < objForm.selBudget.length; i++) {
				if (objForm.selBudget(i).value == CurrBudget) {
					objForm.selBudget(i).selected = true;
				}
			}
		}
		if (CurrTravelType != '' && objForm.selTravelType) {
			for (i = 0; i < objForm.selTravelType.length; i++) {
				if (objForm.selTravelType(i).value == CurrTravelType) {
					objForm.selTravelType(i).selected = true;
				}
			}
		}
		if (CurrInterests != '' && objForm.selInterests) {
			for (i = 0; i < objForm.selInterests.length; i++) {
				if (objForm.selInterests(i).value == CurrInterests) {
					objForm.selInterests(i).selected = true;
				}
			}
		}
		if (CurrCompany != '' && objForm.txtSupplier) {
			objForm.txtSupplier.value = CurrCompany;
		}
		if (CurrDepartState != '' && objForm.selDepartState) {
			for (i = 0; i < objForm.selDepartState.length; i++) {
				if (objForm.selDepartState(i).value == CurrDepartState) {
					objForm.selDepartState(i).selected = true;
				}
			}
		}
		if (CurrDepartCity != '' && objForm.txtDepartCity) {
			objForm.txtDepartCity.value = CurrDepartCity;
		}
		if (CurrDepartCode != '' && objForm.txtDepartCode) {
			objForm.txtDepartCode.value = CurrDepartCode;
		}
	}

