// 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, with 500 items. Please delete some items 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();

	n = getMarkedListTable(checkbox);
	if(n!=null)
	{
		n.className = "inMarkedList";
	}
}

function markedListRemoveSuccess(checkbox)

{

	updateProgress();

	decTotal();

	n = getMarkedListTable(checkbox);
	if(n!=null)
	{
		n.className = "notInMarkedList";
	}

}



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;

	}

}

