function addBookToWishlistAndShoppingcart ( editionId , destination ) {
  addBookToWishlistShowMode ( editionId, "all" , destination);
}

function addBookToWishlist ( editionId ) {
  addBookToWishlistShowMode ( editionId, "wish" , "wish" );
}

function addBookToShoppingcart ( editionId){
  addBookToWishlistShowMode ( editionId, "shop" , "shop");
}
function addBookToWishlistShowMode ( editionId, show , destination){
	  // check existence
  //var cookiePos = document.cookie.indexOf( "wishlist" + editionId + "=" );
  //if (cookiePos < 0 ) {
    // set new cookie for 90 days
    var expdate = new Date ();
    expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 90));
    document.cookie = "wishlist" + editionId + "=1" + "; expires=" + expdate.toGMTString();
    //document.cookie = "wishlistchecked" + editionId + "=no" + "; expires=" + expdate.toGMTString();
    document.cookie = "wishlistshow"+ editionId + "="+ show + "; expires=" + expdate.toGMTString();
    // check success
    if (document.cookie.indexOf( "wishlist" + editionId + "=" ) == -1){
      alert( "Bitte erlauben sie das Setzen von Cookies, um die Merkliste und den Warenkorb "
           + "nutzen zu können. Die im Cookie gespeicherten Daten werden "
           + "von uns in keinerlei Hinsicht zur Datenerhebung verwendet." );
    } else {
      	if (destination == "shop"){
     		window.location.href = "shoppingcart.jsp";
      	}else{
      		window.location.href = "wishlist.jsp";
      	}
    }
  /*} else {
   	if (destination == "shop"){
     		window.location.href = "shoppingcart.jsp";
      	}else{
      		window.location.href = "wishlist.jsp";
 	}
  }*/
}

function addBookToWishlistAndShoppingcartFromPopup( editionId, destination ) {
  addBookToWishlistShowModeFromPopup( editionId, "all" , destination);
}

function addBookToWishlistFromPopup( editionId ) {
	addBookToWishlistFromPopupShowMode( editionId , "wish" , "wish");
}
function addBookToShoppingcartFromPopup( editionId ) {
	addBookToWishlistFromPopupShowMode( editionId , "shop" , "shop");
}

function addBookToWishlistFromPopupShowMode( editionId , show , destination) {
  // check existence
  //var cookiePos = document.cookie.indexOf( "wishlist" + editionId + "=" );
  //if (cookiePos < 0 ) {
    // set new cookie for 90 days
    var expdate = new Date ();
    expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 90));
    document.cookie = "wishlist" + editionId + "=1" + "; expires=" + expdate.toGMTString();
    //document.cookie = "wishlistchecked" + editionId + "=no" + "; expires=" + expdate.toGMTString();
    document.cookie = "wishlistshow"+ editionId + "=" + show + "; expires=" + expdate.toGMTString();
    // check success
    if (document.cookie.indexOf( "wishlist" + editionId + "=" ) == -1){
      alert( "Bitte erlauben sie das Setzen von Cookies, um die Merkliste und den Warenkorb "
           + "nutzen zu können. Die im Cookie gespeicherten Daten werden "
           + "von uns in keinerlei Hinsicht zur Datenerhebung verwendet." );
    } else {
    	if (destination == "shop"){
     		window.open = "shoppingcart.jsp";
      	}else{
      		window.open = "wishlist.jsp";
      	}      
    }
 /* } else {
  		if (destination == "shop"){
     		window.open = "shoppingcart.jsp";
      	}else{
      		window.open = "wishlist.jsp";
      	} 
  }*/
}


function addBookToWishlistAndShoppingcart2 ( editionId) {
  addBookToWishlistShowMode2 ( editionId, "all" );
}

function addBookToWishlist2( editionId ) {
  addBookToWishlist2ShowMode( editionId, "wish");
}

function addBookToShoppingcart2( editionId ) {
  addBookToWishlist2ShowMode( editionId, "shop");
}

function addBookToWishlist2ShowMode( editionId , show ) {
  // check existence
  //var cookiePos = document.cookie.indexOf( "wishlist" + editionId + "=" );
  //if (cookiePos < 0 ) {
    // set new cookie for 90 days
    var expdate = new Date ();
    expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 90));
    document.cookie = "wishlist" + editionId + "=1" + "; expires=" + expdate.toGMTString();
    //document.cookie = "wishlistchecked" + editionId + "=no" + "; expires=" + expdate.toGMTString();
    document.cookie = "wishlistshow"+ editionId + "=" + show + "; expires=" + expdate.toGMTString();
    // check success
    if (document.cookie.indexOf( "wishlist" + editionId + "=" ) == -1){
      alert( "Bitte erlauben sie das Setzen von Cookies, um die Merkliste und den Warenkorb "
           + "nutzen zu können. Die im Cookie gespeicherten Daten werden "
           + "von uns in keinerlei Hinsicht zur Datenerhebung verwendet." );
    }
  
  //}
}


