/*
	$Id: wishList.js 2096 2007-07-17 02:04:54Z brad $
*/


function addToWishList(pageURL)
{
	showLightboxOverlay();
	var url = getBaseURL() + pageURL + "/add-to-wish-list/?ajax=true";
	var ajax = new AJAX(showAddToWishList);
	ajax.setResponseFormat("JSON");
	ajax.request(url);
	return false;
}


function showAddToWishList(args)
{
	var response = JSON.parse(args['response']);
	if(response)
	{
		var div = document.getElementById("popupWrapper");
		if(!div)
		{
			div = document.createElement("DIV");
			div.id="popupWrapper";
			document.body.appendChild(div);
		}

		var message = Base64Utils.prototype.decode(response['message']);
		div.innerHTML = message;
	}
}


function closeAddToWishList()
{
	hideLightboxOverlay();
	var div = document.getElementById("popupWrapper");
	if(div)
	{
		document.body.removeChild(div);
	}
}


function viewWishList(loggedIn, url)
{
	if(loggedIn)
	{
		window.location = getBaseURL() + "my-account/wish-list/";
	}
	else
	{
		window.location = getBaseURL() + url;
	}
}


function deleteFromWishList(url)
{
	window.location = url;
}
