// Product specific marked list JavaScript.



// Page global vars for page specific Java information.

var progressWord1 = "Completed: ";

var progressWord2 = " of ";
var progressWord3 = " results";

var typeParam = "";

var markedTotal = 0;



function notifyMarkedListLimitReached()

{

	document.getElementById('markAllActivator').disabled = false;

	alert("Your marked list is full, please delete some entries before adding more.");

}

function notifyMarkedListAddError(reason)

{

//	alert("The server encountered an error, and was unable to add the entry to your marked list.");

	if (reason.indexOf("expired") != -1) {

		window.location = "/resultsExpired.do?" + typeParam;

	} else {

		window.location = "/sessionTimeout.do";

	}

}

function notifyMarkedListRemoveError(reason)

{

//	alert("The server encountered an error, and was unable to remove the entry from your marked list.");

	if (reason.indexOf("expired") != -1) {

		window.location = "/resultsExpired.do?typeValue=" + typeValue;

	} else {

		window.location = "/sessionTimeout.do";

	}

}

function notifyMarkedListRemoveNotFound()

{

// Noone can figure out what to do here.

//	alert("That entry was not found in your marked list.");

}

function notifyMarkedListHttpReqNotSupported()

{

	alert("Couldn't get HttpRequest object, marked list functionality not availible! Please upgrade your browser.");

}

function markedListAddSuccess(checkbox)

{

	updateProgress();

	incTotal();



	var check_id = checkbox.id;

	var list_id = check_id.replace('mlcb','mlli');

	var list_item = document.getElementById(list_id);

	list_item.className="checked";

}

function markedListRemoveSuccess(checkbox)

{

	updateProgress();

	decTotal();



	var check_id = checkbox.id;

	var list_id = check_id.replace('mlcb','mlli');

	var list_item = document.getElementById(list_id);

	list_item.className="unchecked";

}



function updateProgress()

{

	// Update progress.

	var progressDiv = document.getElementById('markAllProgress');

	if (progressDiv)

	{

		selAllMLCounter--;

		if (selAllMLCounter > 0)

		{

			progressDiv.innerHTML = progressWord1 + (selAllMLCount-selAllMLCounter) + progressWord2 + selAllMLCount + progressWord3;

			progressDiv.style.visibility = 'visible';

		}

		else

		{

			progressDiv.style.visibility = 'hidden';

			document.getElementById('markAllActivator').disabled = false;

		}

	}

}



function incTotal()

{

	var totalDiv = document.getElementById('markedTotal');

	if (totalDiv)

	{

		markedTotal++;

		totalDiv.innerHTML = markedTotal;

	}

}

function decTotal()

{

	var totalDiv = document.getElementById('markedTotal');

	if (totalDiv)

	{

		markedTotal--;

		if (markedTotal < 0)

			markedTotal = 0;

		totalDiv.innerHTML = markedTotal;

	}

}

