function openPDF(threadId, programId){
  window.open("/file/viewTool.html?program_id="+programId+"&thread_id="+threadId, "pdfWinID", "width=800, height=700,  scrollbars=no,  resizable=yes");
}

function openPDF(threadId){
  window.open("/file/viewTool.html?thread_id="+threadId, "pdfWinID", "width=800, height=700,  scrollbars=no,  resizable=yes");
}

function openCoachPDF(threadId, conditionId){
	window.open("/file/viewTool.html?condition_id="+conditionId+"&thread_id="+threadId, "pdfWinID", "width=800, height=700,  scrollbars=no,  resizable=yes");
}

function createPDF(collectionId){
  window.open("/file/getSummary.html?collection_id="+collectionId, "pdfWinID", "width=800, height=700, menubar=yes, status=yes, scrollbars=no, toolbar=yes,location=no, resizable=yes");
}

function openLibraryItem(libItemId){
	window.open("/file/viewLibraryItem.html?item_id="+libItemId, "pdfWinID", "width=800, height=700, scrollbars=no, resizable=yes");
}

function popUpFAQs(URL) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=520,height=600');");
}

function popUpInfo(URL) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=520,height=480');");
}


/*
 * Returns a list of all the checked checkboxes in the form.
 * Assumes only one form exists on the page.  The form name/id is not important.
 * Takes a regular expression as an argument.  This must match the ids of the
 * checkbox elements you want to select.
 */
function getSelectedCheckboxes(exp){
	var theForm = document.forms[0];
	var re = new RegExp(exp);
	var results = new Array();
	for(i = 0; i < theForm.elements.length; i++){
		var element = theForm.elements[i];
		if (re.test(element.id)) {
			if (element.checked) {
				results[i] = element;
			}
		}
	}
	return results;
}
