/*
 * Handles a submission of the search form
 */
// ÂòÇÏ±â
function insertWishListSubmitHandler(product_id, member_id) {
  // ¿©·¯°³ ´ã±â checkbox:product_ids
	if (product_id == 0) {
		var product_ids_obj = document.getElementsByName("product_ids");
		var product_ids = "";
		for (i=0; i<product_ids_obj.length; i++) {
			if (product_ids_obj[i].checked == true) {
				product_ids = product_ids + product_ids_obj[i].value + ",";
			}
		}
		if (product_ids == "") {
			alert("ÂòÇÒ »óÇ°À» ¼±ÅÃÇÏ¼¼¿ä.");
		} else {
			wishListManager.insertWishList({product_ids:product_ids, member_id:member_id}, displayInsertWishListResult);
		}
	// ÇÑ°³¸¸ ´ã±â
	} else {
  	wishListManager.insertWishList({product_id:product_id, member_id:member_id}, displayInsertWishListResult);
	}
  return false;
}
// Âò¿¡¼­ »©±â
function deleteWishListSubmitHandler(wishlist_id) {
  wishListManager.deleteWishList(wishlist_id, displayDeleteWishListResult);
  return false;
}

/*
 * Displays a list of catalogue items
 */
// ÂòÇÏ±â callback
function displayInsertWishListResult(wishlist_id) {
	if (wishlist_id > 0) {
		if (!isPopupBlock()) {
	  	l_commonPopup("/shopping/myshopping/wish_list_popup.html?act=popup", "wish_list_popup", 740, 400, "yes", "no", "yes");
	  } else {
	  	if(confirm("¼±ÅÃÇÏ½Å »óÇ°ÀÌ Âò¸ñ·Ï¿¡ Ãß°¡ µÇ¾úÀ¸³ª,\n\rÆË¾÷ÀÌ Â÷´ÜµÇ¾î  Âò¸ñ·ÏÀ» º¼ ¼ö ¾ø½À´Ï´Ù.\n\rÂò¸ñ·Ï ÆäÀÌÁö·Î ¹Ù·Î °¡½Ã°Ú½À´Ï±î?")) {
	  		document.location = "/shopping/myshopping/wish_list.html";
	  	}
	  }
	} else {
		if(confirm("ÀÌ¹Ì ÂòÇÏ½Å »óÇ°ÀÔ´Ï´Ù. Âò¸ñ·ÏÀ¸·Î °¡½Ã °Ú½À´Ï±î?")) {
			document.location = "/shopping/myshopping/wish_list.html";
		}
	}
	return false;
}
// Âò¿¡¼­ »©±â callback
function displayDeleteWishListResult(wishlist_id) {
	var delline = $('delline_'+wishlist_id);
	var divTR = $('div_wish_'+wishlist_id);
	if (delline != null) new Effect.SwitchOffAndRemoveElement(delline);
	if (divTR != null) new Effect.Shrink(divTR);
	return false;
}



