ajaxHttp.onRequestComplete = function() {
	document.getElementById(ajaxHttp.setDivId).innerHTML =  ajaxHttp.getResponseText();
}
  
function setContent(id, source, method, string) {
	ajaxHttp.setDivId = id;
	if(method == "GET") {
		var value = source + string;
		ajaxHttp.getRequest(value);
	} else if(method == "POST") {
		if(string == null) {string = ""}
		ajaxHttp.postRequest(source, string);
	}
}

function show_confirm(task, type) {
	var confirm_text = "";
	var associates = "";
	if(type == "volume") {associates = "issues";}
	if(type == "issue") {associates = "papers";}
	if(task == "delete") {
		confirm_text = confirm("Are you sure you want to " + task + " this " + type + " and its associated " + associates + "?");
	}
	return confirm_text;
}




// Compare two options within a list by VALUE
function compareOptionValues(a, b) {
	// Radix 10: for numeric values
	// Radix 36: for alphanumeric values
	var sA = parseInt(a.value, 36);
	var sB = parseInt(b.value, 36);
	return sA - sB;
}

// Compare two options within a list by TEXT
function compareOptionText(a, b) { 
	// Radix 10: for numeric values
	// Radix 36: for alphanumeric values
	var sA = parseInt(a.text, 36);
	var sB = parseInt(b.text, 36);
	return sA - sB;
}

// Compare two options within a list by TITLE
function compareOptionTitle(a, b) { 
	// Radix 10: for numeric values
	// Radix 36: for alphanumeric values
	var sA = parseInt(a.title, 36);
	var sB = parseInt(b.title, 36);
	return sA - sB;
}

// Dual list move function
function moveDualList(srcList, destList, moveAll, doSort) {

	// Do nothing if nothing is selected
	if ((srcList.selectedIndex == -1) && (moveAll == false)) {
		return;
	}

	newDestList = new Array(destList.options.length);
	
	var len = 0;
	
	for(len = 0; len < destList.options.length; len++) {
		if (destList.options[len] != null) {
			newDestList[len] = new Option(destList.options[len].text, destList.options[len].value/*, destList.options[len].defaultSelected, destList.options[len].selected*/);
			newDestList[len].setAttribute('title', destList.options[len].title);
		}
	}

	for( var i = 0; i < srcList.options.length; i++ ) { 
		if (srcList.options[i] != null && (srcList.options[i].selected == true || moveAll)) {
			// Statements to perform if option is selected
			// Incorporate into new list
			newDestList[len] = new Option(srcList.options[i].text, srcList.options[i].value/*, srcList.options[i].defaultSelected, srcList.options[i].selected*/);
			newDestList[len].setAttribute('title', srcList.options[i].title);
			
			len++;
		}
	}
	
	if(doSort == true) {
		// Sort out the new destination list
		//newDestList.sort(compareOptionValues);   // BY VALUES
		//newDestList.sort(compareOptionText);   // BY TEXT
		newDestList.sort(compareOptionTitle);   // BY TITLE
	}
	
	// Populate the destination with the items from the new array
	for (var j = 0; j < newDestList.length; j++) {
		if (newDestList[j] != null) {
			destList.options[j] = newDestList[j];
		}
	}
	
	// Erase source list selected elements
	for( var i = srcList.options.length - 1; i >= 0; i-- ) { 
		if (srcList.options[i] != null && (srcList.options[i].selected == true || moveAll)) {
			// Erase Source
			//srcList.options[i].value = "";
			//srcList.options[i].text  = "";
			srcList.options[i] = null;
		}
	}

} // End of moveDualList()
//  End -->