function initiateMyChoice(){
	var myChoice = readCookie("folioMyChoice");
	myChoice = (typeof(myChoice) == "undefined" || myChoice == null)?"":myChoice;
	return myChoice;
}


function showPopUpMonChoix(e){
    if (window.event && window.event.srcElement) {
        lnk = window.event.srcElement;
    } else if (e && e.target) {
        lnk = e.target;
    }
    if (!lnk) return;
    if (lnk.nodeName.toUpperCase() != 'A') {
        // lnk is not actually the link -- ascend parents until we hit a link
        lnk = getParent(lnk,"A");
    }
    if (!lnk) return;
    
    lnk.title = "L'ouvrage a été ajouté à votre sélection! Cliquez sur Ma Sélection pour afficher la liste des livres choisis";
	//makeNiceTitles();
    lnk.setAttribute("nicetitle",lnk.title);
    checkMessageMonChoix();
    showNiceTitle();
  
}

var checkOrigineMessage = false;
function checkMessageMonChoix(){
	checkOrigineMessage = true;
}

function addMonChoix(idLivre){
	var myChoice = initiateMyChoice();
	var alreadyExist = false;
	var idx;
	if(myChoice != ""){
		for(idx=0;idx<myChoice.split("_").length;idx++){
			if(myChoice.split("_")[idx]==idLivre){
				alreadyExist = true;
				break;
			}
		}
		if(!alreadyExist){
			createCookie("folioMyChoice",myChoice+"_"+idLivre,7);
		}
	}
	else{
		createCookie("folioMyChoice",idLivre,7);
	}

	
//	document.location.href="monChoix.action";
}
function removeMonChoix(idLivre){
	var myChoice = initiateMyChoice();
	var tabChoice = new Array();
	tabChoice = myChoice.split("_");
	var pos;
	if(myChoice != ""){
		for(idx=0;idx<tabChoice.length;idx++){
			if(tabChoice[idx]==idLivre){
				tabChoice.splice(idx,1);
				break;
			}
		}
		myChoice = tabChoice.join("_");
		createCookie("folioMyChoice",myChoice,7);
		window.location.reload();
	}
}