function updateTripList(cat, bowTripBool){
	var params = "category=" + cat + "&";
	
	if(bowTripBool == true){
		params += "location=bow";
	}else{
		params += "location=other";
	}
	var request = null;

	
	if(window.XMLHttpRequest){
		request = new XMLHttpRequest();
	}else if(window.ActiveXObject){
		request = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		alert("Warning!  This browser does not support XMLHttpRequests, try Internet Explorer or Firefox");
		return
	}
	
	request.open("POST", "servlets/tripList.php", false);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.send(params);
	var result = request.responseXML;
	var trip_array = result.getElementsByTagName('trip');

	
	var trip_list_control = document.getElementById('trip');
		for(var i = 0; i < trip_list_control.size;i++){
		trip_list_control.remove(0);
	}
	
	if(trip_array.length <= 0){
		disableControls();
		document.getElementById('editCat').disabled = false;
		return;
	}
	enableControls();
	//remove all elements from the list;

	
	
	for(var i =0; i < trip_array.length; i++){
		var item = document.createElement('option');
		item.value = trip_array[i].getAttribute('id');
		var txt = document.createTextNode(trip_array[i].firstChild.nodeValue);
		item.appendChild(txt);
		trip_list_control.appendChild(item);
		
	}

}

function enableControls(){
	document.getElementById('trip').disabled = false;
	document.getElementById('createTrip').disabled = false;
	document.getElementById('editCat').disabled = false;


}

function disableControls(){

	document.getElementById('createTrip').disabled = false;
	document.getElementById('editTrip').disabled = false;
}

function launchPopup(target,location,id){
//	var win = window.open(target + "?location=" + location + "&trip=" + id, "popup", 'toolbar,width=730,height=600,status=true,scrollbars=yes,toolbar=no');
	document.location.href = target + "?location=" + location + "&trip=" + id;
}

function enableTripListControls(){
	document.getElementById('editTrip').disabled = false;	
}
function disableTripListControls(){
	
}

function updateThumbnail(file){
var obj = document.getElementById("trip_thumb").src=file;

}
