function toggleShiurCheck() {
	var allShiurIDs = document.getElementById('allShiurIDList').value;
	var thisShiurIDList = allShiurIDs.split(",");
	
	thisBox = document.getElementById('toggleShiurCheckBox');
	if (thisBox.checked) {
		checkedStatus = true;
	}
	else {
		checkedStatus = false;
	}
	
	for(i = 0; i < thisShiurIDList.length; i++) {
		currID = document.getElementById('add_' + thisShiurIDList[i])
		
		if (currID != null) {
			currID.checked = checkedStatus;
		}
	}
}

function notebookLoginMsg() {
	alert('The [My notebook] feature allows you to print multiple articles or download multiple audio shiurim into iTunes with one click by selecting shiurim from the browse and search results into your notebook to download. To start using this feature, you must be logged in.');
}
	
function addToNotebook(action){
	
	var allShiurIDs = document.getElementById('allShiurIDList').value;
	var thisShiurIDList = allShiurIDs.split(",");
	
	//alert(allShiurIDs);
	
	selectedShiurIDs = "0";
	for(i = 0; i < thisShiurIDList.length; i++) {
		currID = document.getElementById('add_' + thisShiurIDList[i])
		//alert(currID);
		
		if (currID != null && currID.checked) {
			selectedShiurIDs = selectedShiurIDs + "," + currID.value;
		}
	}
	
	//alert(selectedShiurIDs);
	
	var iFrame = document.getElementById('doThis');
	iFrame.src = "/notebook/_addToCart.cfm?action=" + action + "&selectedShiurIDs=" + selectedShiurIDs + "&random=" + Math.random();
	
	/*
	actionMsg = "<br><br>Lecture(s) ADDED<br> to your notebook";
	document.getElementById('fadeBlock').innerHTML = actionMsg;
	
	var myFadeElement = jQuery("#fadeBlock");
	myFadeElement.slideDown(200).delay(1500).slideUp(200);
	*/
}

function notebookAction(obj,id,action) {
	objName = document.getElementById(obj);
	
	/*
	if (objName.checked) {
		action = 'add';	
		actionMsg = "<br><br>Lecture ADDED<br> to your notebook";
	}
	else {
		action = 'delete';
		actionMsg = "<br><br>Lecture DELETED<br> from your notebook";
	}
	*/
	
	minusIcon = document.getElementById('notebookMinus_' + id);
	plusIcon = document.getElementById('notebookPlus_' + id);
	
	if (action == "add") {
		actionMsg = "<br><br>Lecture ADDED<br> to your notebook";
		minusIcon.style.display = "block";
		plusIcon.style.display = "none";
	}
	else {
		actionMsg = "<br><br>Lecture DELETED<br> from your notebook";
		minusIcon.style.display = "none";
		plusIcon.style.display = "block";
	}
	
	var iFrame = document.getElementById('doThis');
	iFrame.src = "/notebook/_cartAction.cfm?action=" + action + "&shiurID=" + id + "&random=" + Math.random();
	
	
	document.getElementById('fadeBlock').innerHTML = actionMsg;
	var myFadeElement = jQuery("#fadeBlock");
	myFadeElement.slideDown(200).delay(800).slideUp(200);
	
	
}

function removeAllNotebook() {
	if (confirm("Remove all lectures?")) {
		window.top.document.getElementById('cartCountDiv').innerHTML = '0';
		window.location.href = "/notebook/removeAll.cfm";
	}
}