  var cookieDomain = location.hostname;//"parenting.com";

	var today = new Date();
 	var expiry = new Date(today.getTime() + 20 * 60 * 1000); // plus 20 minutes
	var wshLstExpiry = new Date(today.getTime() + 10 * 365 * 24 * 60 * 60 * 1000); // plus 10 years
	var remove = new Date(today.getTime() - (24 * 60 * 60 * 1000)); // minus 1 day
 function setCookieValue(key, value) {
    	if (value != null && value != "") {
			if (key.substring(0, 3) == "wsh")
    			document.cookie=key + "=" + escape(value) + "; expires=" + wshLstExpiry.toGMTString() + "; path=/; domain=" + cookieDomain + ";";
			else
				document.cookie=key + "=" + escape(value) + "; expires=" + expiry.toGMTString() + "; path=/;";
    	}
    	cookie = document.cookie.split("; ");
  	}
  	function deleteCookieValue(key) {
		if (getCookieValue(key))
			document.cookie = key + "= EXPIRED; expires=" + remove.toGMTString() + "; path=/; domain=" + cookieDomain + ";";
		cookie = document.cookie.split("; ");
	}
	function addWishListItem(postedValue, type) {
 var value=postedValue.replace(/[^a-zA-Z0-9_.,@\+| \/]+/g,"");
		if (value != null && value != "") {
			if(document.cookie.indexOf(escape(value))>-1){
				alert("This item has already been added to your Wish List.");
				return false;
			}
			var tmp_id = getCookieValue("wshlst_id");
			if (tmp_id == null || isNaN(parseInt(tmp_id)))
				var nxt_id = 1;
			else
				var nxt_id = parseInt(tmp_id) + 1;
			var key = "wshlst" + type + "_" + nxt_id;
			setCookieValue(key, value);
			setCookieValue("wshlst_id", nxt_id);
		}
	}
	
	function removeWishListItem(cbo) {
		if(!cbo) return;
		if (cbo.length == undefined) {
			if (cbo.checked == true) deleteCookieValue(cbo.value);
		} else {
			for (var i = 0; i < cbo.length; i++) {
				if (cbo[i].checked == true)
					deleteCookieValue(cbo[i].value);
			}
		}
		window.location.href=window.location.href;
	}
function writeSaved(){
	var wishlist_cookies = 0;
	//Get the number of cookies
	var num_cookies = cookie.length;
	var style_suffix = 1;
	for (var i=0; i < cookie.length; i++) {
  		var nb = cookie[i].split("=");
  		if (nb[0].substring(0, 9) == "wshlsttxt") {
			if (nb[1] != "" && nb[1] != "EXPIRED") {
				document.write("<tr>");
				document.write("<td width='40' valign='top' align='center' class='shop_stripe_orange" + style_suffix + "'><input type='checkbox' name='cbo_wishlist' value='" + nb[0] + "'></td>");
				document.write("<td width='253' class='shop_stripe_orange" + style_suffix + "'><span class='darkgray10b'>" + unescape(nb[1]) + "</span></td>");
				document.write("<td width='38' class='shop_stripe_orange" + style_suffix + "' style='padding-right:10px' nowrap>&nbsp;</td>");
		    	document.write("</tr>");
				if (style_suffix == 2)
					style_suffix = 1;
				else
					style_suffix = 2;
				wishlist_cookies++;
			}
		} else {
			if (nb[0].substring(0, 9) == "wshlstprd") {
				if (nb[1] != "" && nb[1] != "EXPIRED") {					
					var product = unescape(nb[1]).split("||");
					var info_html = "";
					var buy_html = "";
					
					if (product.length > 1)
						var info_html = "<a href='" + product[1] + "' class='channel_blue10b'>Info</a> ";
					if (product.length > 2) {
						if (product[2] != null && product[2] != "")
						 	var buy_html = "<a href='" + product[2] + "' class='channel_blue10b'>Buy It</a>";
					}
					
					document.write("<tr>");
					document.write("<td width='40' valign='top' align='center' class='shop_stripe_orange" + style_suffix + "'><input type='checkbox' name='cbo_wishlist' value='" + nb[0] + "'></td>");
					document.write("<td width='253' class='shop_stripe_orange" + style_suffix + "'><a href='" + product[1] + "' class='channel_blue10b'>" + product[0] + "</a></td>");
					document.write("<td width='38' class='shop_stripe_orange" + style_suffix + "' style='padding-right:10px' nowrap>" + buy_html + "</td>");
			    	document.write("</tr>");
					
					if (style_suffix == 2)
						style_suffix = 1;
					else
						style_suffix = 2;
					wishlist_cookies++;
				}
			}
		}
	}
	if (wishlist_cookies == 0) {
		document.write("<tr>");
		document.write("<td width='331' class='blue10'>&nbsp;&nbsp;You have no items saved at this time</td>");
    	document.write("</tr>");
	}
}