
// This method displays the confirmation pop-up message box after successful adding items to the cart.
// @input display true/false if the message shoudl be shown in the first place
// @input text String - the message to be shown. Usualy read via BundelReader from a property file
function confirmationMessage(display, text){


	//check the cookie variable before displaying confirmation message.
	//This is required inorder to turn off the confirmation message when the user
	//clicks the back button
	var displayMessage = document.cookie;

	if (display){
		if(getCookie("displayMessage") == 'true') {
			window.alert(text);
			document.cookie = "displayMessage=false";
		}
	}
}



// The method sets the value displayMessage to true
// This is essential for the confirmation message on add to cart.
// It is necessary to store the information 'displayMessage' in a cookie due
// to the probelm with back and forward buttons on the browser. 
// The value of the 'displayMessage' will be updated after ONCE shown.
// Using the back/forward browser buttons wont trigger showing the confirmation message 
// more then 1 time
function setDisplayMessage()
{
//  set cookie variable to turn-on message confirmation 
  document.cookie = "displayMessage=true";
}
