//初始化
YAHOO.util.Connect.asyncRequest("POST", "/showSubscription.dyn", {
	"success": function (o) {
		var obj = o.responseText.parseJSON();
		if (obj.ok) {
			if (obj.data.keepOn == 1) {
				if (obj.data.paymentMode > 1) {
					var elb = document.getElementById("bankBind");
					elb.style.display = "";
				}else {
					var elf = document.getElementById("fengleiBind");
					elf.style.display = "";
				}
			}else{
				alert("操作有误请重新操作!");
				window.location.href = "http://pay.8850.com";	
			}
		}
	}
}, null);

function quitSubscription (paymentMode) {
	var url = "/subscriptionQuitKeepOn.dyn";
	if (paymentMode == "bank") {
		url = "/yeepayCancel.dyn";
	}
	YAHOO.util.Connect.asyncRequest("POST", url, {
		"success": function (o) {
			var obj = o.responseText.parseJSON();
			if (obj.ok) {
				//隐藏
				var elf = document.getElementById("fengleiBind");
				var elb = document.getElementById("bankBind");
				if(url == "/subscriptionQuitKeepOn.dyn"){
					elf.style.display = "none"
					//银行已经被隐藏的时候挑转
					if(elb.style.display == "none"){
						window.location.href = "http://pay.8850.com";
					}
				}else{
					elb.style.display = "none";
					//风雷积分已经被隐藏的时候挑转
					if(elf.style.display == "none"){
						window.location.href = "http://pay.8850.com";
					}
				}
				alert("退订成功，下月起生效!");
			} else {
				alert(obj.exception[0].message);
			}
		}
	}, null);
}