var admin_base = "/";
var admin_path = "/do";
var admin_index = "";
var webpath = admin_path + admin_index;

function collect(id, type) {
	$loginFlag = $('#loginFlag');
	if ($loginFlag.val() == "no") {
			alert("请先登录!");
			return;
		}
	if (id.length < 0 || id == "") {
		alert("\u6536\u85cf\u5931\u8d25\uff01");
		return null;
	}
	if (0 != id.length) {
		var handleSuccess = function (req) {
			var message = {};
			eval("message =" + req.responseText);
			if (message.value) {
				alert(message.message);
				window.location = self.location.href;
			} else {
				if (confirm(message.message)) {
					window.location = webpath + "/collect/add"+type;
				}
			}
		};
		var handleFailure = function () {
		};
		var callback = {success:handleSuccess, failure:handleFailure};
		var req = YAHOO.util.Connect.asyncRequest("post", webpath + "/collect/" + type + "?id=" + id, callback);
	}
}
