(function(b) {
	if (typeof b.Qk_Vip !== "undefined") {
		return
	}
	if (typeof b.$ === "undefined") {
		return
	}
	var L = [".qk_vip_level0{vertical-align:middle;display:inline-block;height:20px;width:44px;background:url(http://www.7k7kjs.cn/css/vip/img/members0.gif) no-repeat!important;cursor:pointer;}", ".qk_vip_level1{vertical-align:middle;display:inline-block;height:20px;width:44px;background:url(http://www.7k7kjs.cn/css/vip/img/members1.gif) no-repeat!important;}", ".qk_vip_level2{vertical-align:middle;display:inline-block;height:20px;width:44px;background:url(http://www.7k7kjs.cn/css/vip/img/members2.gif) no-repeat!important;}", ".qk_vip_level3{vertical-align:middle;display:inline-block;height:20px;width:44px;background:url(http://www.7k7kjs.cn/css/vip/img/members3.gif) no-repeat!important;}", ".qk_vip_level4{vertical-align:middle;display:inline-block;height:20px;width:44px;background:url(http://www.7k7kjs.cn/css/vip/img/members4.gif) no-repeat!important;}", ".qk_vip_level5{vertical-align:middle;display:inline-block;height:20px;width:44px;background:url(http://www.7k7kjs.cn/css/vip/img/members5.gif) no-repeat!important;}", ".qk_vip_level6{vertical-align:middle;display:inline-block;height:20px;width:44px;background:url(http://www.7k7kjs.cn/css/vip/img/members66.gif) no-repeat!important;}", ".qk_vip_name_level1{color:#84cfff;}", ".qk_vip_name_level2{color:#67efa0;}", ".qk_vip_name_level3{color:#f67abe;}", ".qk_vip_name_level4{color:#f6b517;}", ".qk_vip_name_level5{color:#ec7063;}", ".qk_vip_name_level6{color:#ec7063;}", ".qk_vip_name_level1 i{font:normal;}", ".qk_vip_name_level2 i{font:normal;}", ".qk_vip_name_level3 i{font:normal;}", ".qk_vip_name_level4 i{font:normal;}", ".qk_vip_name_level5 i{font:normal;}", ".qk_vip_name_level6 i{font:normal;}", ".qk_vip_payframe {}", ".qk_vip_payframe .pay_top{width:100%;height:34px;border-bottom:1px solid #e0dfdf;background:#efefef;}", ".qk_vip_payframe .pay_top h1{float:left;margin-left:15px;display:inline;font:normal 16px/34px Tahoma;color:#666666;}", ".qk_vip_payframe .pay_top h1 span{color:#e62a28;}", ".qk_vip_payframe .pay_top .pay_close{width:23px;height:23px;float:right;cursor: pointer;margin:4px;display:inline;background:url(http://www.7k7kjs.cn/css/vip/img/close.png) no-repeat;}", ".qk_vip_payframe .pay_top .pay_close:hover{background:url(http://www.7k7kjs.cn/css/vip/img/closeh.png) no-repeat;}", ".qk_vip_payframe strong{display:block;height:13px;width:13px;position:absolute;}", ".qk_vip_payframe strong.lt{left:-7px;top:-7px;background:url(http://www.7k7kjs.cn/css/vip/img/payboxtl.png) no-repeat;}", ".qk_vip_payframe strong.lb{left:-7px;bottom:-7px;background:url(http://www.7k7kjs.cn/css/vip/img/payboxbl.png) no-repeat;}", ".qk_vip_payframe strong.rt{right:-7px;top:-7px;background:url(http://www.7k7kjs.cn/css/vip/img/payboxtr.png) no-repeat;}", ".qk_vip_payframe strong.rb{right:-7px;bottom:-7px;background:url(http://www.7k7kjs.cn/css/vip/img/payboxbr.png) no-repeat;}"].join("");
	if ($("#qk_vip_style").length === 0) {
		$("head").append('<style id="qk_vip_style" type="text/css">' + L + "</style>")
	}
	function C() {
		return document.getElementsByTagName("script")
	}
	function f() {
		var V = C();
		if (!V) {
			return
		}
		var Y;
		var X;
		var Z;
		for (Y = 0; Y < V.length; Y++) {
			X = V[Y].getAttribute("data-main");
			if (X && X.toLowerCase() == "vip") {
				var ac = V[Y].getAttribute("data-target");
				if (ac) {
					var W, aa, U, ab;
					ac = ac.split(" ");
					for (W = 0; W < ac.length; W++) {
						if (ac[W]) {
							aa = ac[W].split(":");
							if (aa.length > 1) {
								U = $.trim(aa[0]);
								ab = $.trim(aa[1]);
								if (U && ab) {
									if (!Z) {
										Z = {}
									}
									Z[U] = ab
								}
							}
						}
					}
					break
				}
			}
		}
		return Z
	}
	function K(d, X, V) {
		var Y = d.attr("class");
		if (Y) {
			var W = Y.split(" ");
			var U;
			for (U = 0; U < W.length; U++) {
				if (W[U] == X) {
					continue
				}
				if (V && W[U].indexOf(V) > -1) {
					continue
				}
				X += " " + W[U]
			}
		}
		d.attr("class", X)
	}
	var T = "",
		S = "",
		y = "10",
		o = 90,
		s = 10001,
		q = 1,
		A = "huiyuan_",
		c = "",
		l = "",
		w = "",
		x = "",
		Q = false,
		G = {},
		F = -1,
		M, v = 0,
		B = "qk_vip_payframe_",
		R = new Date();
	var n = ["#84cfff;", "#67efa0;", "#f67abe;", "#f6b517;", "#ec7063;"];
	B += R.getTime();
	var i = parseInt(h("userid"));
	if (isNaN(i)) {
		i = -1
	}
	function N() {
		var U = 0;
		if (i > 0 && G[i]) {
			U = G[i]
		}
		if (U < 1 || U > 5) {
			return
		}
		var d = $("#login_vip_mark_" + i + "_id");
		if (d.length != 1) {
			return
		}
		$tips = d.find("b");
		if ($tips.length != 1) {
			return
		}
		$tips.fadeIn("slow");
		setTimeout(function() {
			$tips.fadeOut("slow")
		}, 3000)
	}
	function O(d) {
		if (i < 1) {
			return
		}
		var U = g();
		if (typeof U !== "undefined" && typeof U[i] !== "undefined") {
			G[i] = U[i];
			typeof d === "function" && d();
			return
		}
		I([i], function(V) {
			var W = 0;
			v = 0;
			if (V && typeof V[i] !== "undefined") {
				W = parseInt(V[i]["rank"]);
				if (isNaN(W) || W < 0) {
					W = 0
				}
				if (typeof V[i]["score"] !== "undefined") {
					F = V[i]["score"]
				}
				if (typeof V[i]["hasGrowth"] !== "undefined") {
					v = parseInt(V[i]["hasGrowth"]);
					if (isNaN(v)) {
						v = 0
					}
				}
			}
			G[i] = W;
			typeof d === "function" && d()
		})
	}
	O();

	function g() {
		var d = h("qkv");
		if (d) {
			var U = d.split(":");
			if (U.length > 1) {
				var V = {};
				V[U[0]] = U[1];
				if (U.length > 2) {
					F = U[2]
				}
				return V
			}
		}
	}
	function D() {
		$("#" + B).hide()
	}
	function m(d) {
		if (d) {
			if (typeof G[i] !== "undefined") {
				G[i] = undefined
			}
			if (M) {
				O(function() {
					P(M, true)
				})
			}
		}
		$("#" + B).hide();
		typeof r === "function" && r(d)
	}
	function J(Y) {
		var ac = T,
			X = S,
			ab = c,
			aa = y,
			d = o,
			W = s,
			Z = q,
			U = A;
		if (typeof Y === "object") {
			typeof Y.vipName !== "undefined" && (ac = Y.vipName);
			typeof Y.vipUrl !== "undefined" && (X = Y.vipUrl);
			typeof Y.vipImg !== "undefined" && (ab = Y.vipImg);
			typeof Y.price !== "undefined" && (aa = Y.price);
			typeof Y.discount !== "undefined" && (d = Y.discount);
			typeof Y.sid !== "undefined" && (W = Y.sid);
			typeof Y.bid !== "undefined" && (Z = Y.bid);
			typeof Y.idPrefix !== "undefined" && (U = Y.idPrefix)
		}
		$("#" + B + " .frame").get(0).contentWindow.resetPayFrame(ac, X, ab, aa, d, W, Z, U);
		$frameDiv = $("#" + B);
		$frameDiv.css({
			top: $(document).scrollTop() + 50,
			width: $(document).width() - 10,
			height: $(document).height() - 10
		});
		var V = ($(document).width() - 720) / 2;
		if (V < 1) {
			V = 3
		}
		$("#" + B + " ._pay_body").css("left", V);
		$frameDiv.show()
	}
	function E(d) {
		if (Q) {
			d();
			return
		}
		var V = h("kk");
		Q = true;
		$("body").append("<div id='" + B + "' class='qk_vip_payframe' style='display:none;position:absolute;top:50px;left:0px;height:645px;z-index:1000;text-align:center'><div class='_pay_body' style='width:720px;border:7px solid #BBBBBB;position:absolute;height:645px;left:50px;'><div class='pay_top'><h1>服务开通（<span>" + V + "</span>）</h1><i class='pay_close'></i></div><iframe class='frame' src='" + l + "' width='720px' height='610px' scrolling='no' frameborder='0' style='background:#fff;' marginheight='0' marginwidth='0'></iframe><strong class='lt'></strong><strong class='lb'></strong><strong class='rt'></strong><strong class='rb'></strong></div></div>");
		$("#" + B + " .pay_close").click(function() {
			D()
		});
		var U = $("#" + B + " .frame").get(0);
		if (U.attacEvent) {
			U.attacEvent("onload", function() {
				d()
			})
		} else {
			U.onload = function() {
				d()
			}
		}
	}
	var r;

	function k(V) {
		var U = {},
			d = "";
		if (arguments.length > 1) {
			if (typeof arguments[1] === "function") {
				d = arguments[1]
			} else {
				if (typeof arguments[1] === "object") {
					U = arguments[1]
				}
			}
		}
		if (arguments.length > 2) {
			if (typeof arguments[2] === "function") {
				d = arguments[2]
			} else {
				if (typeof arguments[2] === "object") {
					U = arguments[2]
				}
			}
		}
		$(V).click(function() {
			if (i < 1) {
				return
			}
			E(function() {
				J(U)
			});
			typeof d === "function" && (r = d)
		})
	}
	function p(d, U) {
		d.each(function() {
			var X = $(this);
			var W = X.attr("vip-marked");
			if (!U && W) {
				return
			}
			var Z = parseInt(X.attr("data-uid"));
			if (isNaN(Z) || Z < 1) {
				return
			}
			if (typeof G[Z] === "undefined") {
				return
			}
			X.attr("vip-marked", 1);
			var ac = G[Z];
			var ab = "";
			if (ac == 0) {
				ab = "你还不是VIP"
			} else {
				if (ac < 6) {
					ab = "VIP" + ac + "，距离下一级还有" + F + "成长值"
				} else {
					ab = "VIP6，已经达到顶级了！"
				}
			}
			K(X, "", "qk_vip_level");
			var V = "<a target='_blank' class='qk_vip_level" + ac + "' href='" + S + "' style='height:20px;width:44px;'";
			if (F > -1 && Z == i && ab.length > 0) {
				V += " title='" + ab + "'"
			}
			V += "></a>";
			var Y = "login_vip_mark_" + i + "_id";
			var aa = $("#" + Y);
			if (Z == i && ac < 6 && ac > 0 && aa.length < 1) {
				X.attr({
					style: "position: relative;zoom: 1;",
					id: Y
				});
				V += '<b style="display:none;position:absolute;bottom:-34px;right:-34px;z-index:9999;height:29px;width:80px;background:url(http://www.7k7kjs.cn/css/vip/img/noticbg.png) no-repeat!important;text-align:center;"><span style="font:normal 12px/32px Simsun;color:#fff;vertical-align: middle;">成长值</span><span style="font:bold 18px/32px Arial;color:#fcff00;vertical-align: middle;">+10</span></b>'
			}
			X.html(V);
			if (v > 0 && Z == i && ac < 6 && ac > 0 && aa.length < 1) {
				N()
			}
		})
	}
	function t(d, U) {
		d.each(function() {
			var ab = $(this);
			var X = ab.attr("vip-marked");
			if (!U && X) {
				return
			}
			var ad = parseInt(ab.attr("data-uid"));
			if (isNaN(ad) || ad < 1) {
				return
			}
			if (typeof G[ad] === "undefined") {
				return
			}
			K(ab, "", "qk_vip_name_level");
			var aa = G[ad];
			ab.attr("vip-marked", 1);
			if (aa < 6) {
				K(ab, "qk_vip_name_level" + aa, "qk_vip_name_level");
				var V = ab.attr("style");
				if (!V) {
					V = ""
				} else {
					V = V.replace(/color:[^;]*;/, "");
					V = V.replace(/background:[^;]*;/, "")
				}
				var Z = V;
				if (aa > 0) {
					Z = "color:" + n[aa - 1] + V;
					var Y = "color:#fff;background:" + n[aa - 1] + V;
					ab.hover(function() {
						ab.attr("style", Y)
					}, function() {
						ab.attr("style", Z)
					})
				}
				ab.attr("style", Z);
				return
			} else {
				var ac = ab.html().replace(/<[^<|>]*>/g, "");
				var W = 1;
				setInterval(function() {
					var ag, ae = W;
					var af = "";
					for (ag = 0; ag < ac.length; ag++) {
						if (ae > 6) {
							ae = 1
						}
						af += "<i class='qk_vip_name_level" + ae + "' style='color:" + n[ae - 1] + "; font-style:normal;'>" + ac.charAt(ag) + "</i>";
						ae++
					}
					ab.html(af);
					W++;
					if (W > 6) {
						W = 1
					}
				}, 500)
			}
		})
	}
	function j(U, V, d) {
		if (typeof U.name !== "undefined") {
			t(U.name, V)
		}
		if (typeof U.mark !== "undefined") {
			p(U.mark, V)
		}
		typeof d === "function" && d(G)
	}
	function P(W) {
		var X = false,
			U = "";
		if (arguments.length > 1) {
			if (typeof arguments[1] === "boolean") {
				X = arguments[1]
			} else {
				if (typeof arguments[1] === "function") {
					U = arguments[1]
				}
			}
		}
		if (arguments.length > 2) {
			if (typeof arguments[2] === "boolean") {
				X = arguments[2]
			} else {
				if (typeof arguments[2] === "function") {
					U = arguments[2]
				}
			}
		}
		var d = [],
			V = {};
		if (typeof W.name !== "undefined") {
			d.push(W.name);
			V.name = $(W.name)
		}
		if (typeof W.mark !== "undefined") {
			d.push(W.mark);
			V.mark = $(W.mark)
		}
		if (d.length < 1) {
			return
		}
		var Z = {};
		var Y = [];
		$(d.join(",")).each(function() {
			var aa = $(this);
			var ab = parseInt(aa.attr("data-uid"));
			if (isNaN(ab) || ab < 1) {
				return
			}
			if (Z[ab]) {
				return
			}
			if (typeof G[ab] !== "undefined") {
				return
			}
			var ac = parseInt(aa.attr("data-vip"));
			if (!isNaN(ac) && (ac > -1 && ac <= 6)) {
				G[ab] = parseInt(ac);
				return
			}
			Z[ab] = 1;
			Y.push(ab)
		});
		if (Y.length > 0) {
			I(Y, function(ad) {
				var aa, ab, ac = parseInt(h("userid"));
				if (i < 1 && ac) {
					i = ac
				}
				for (aa = 0; aa < Y.length; aa++) {
					if (!ad || typeof ad[Y[aa]] === "undefined") {
						ab = 0
					} else {
						ab = parseInt(ad[Y[aa]]["rank"]);
						if (isNaN(ab)) {
							ab = 0
						}
					}
					G[Y[aa]] = ab;
					if (Y[aa] == i && typeof ad[i]["score"] !== "undefined") {
						F = ad[i]["score"]
					}
				}
				v = 0;
				if (typeof ad[i] !== "undefined") {
					if (typeof ad[i]["hasGrowth"] !== "undefined") {
						v = parseInt(ad[i]["hasGrowth"]);
						if (isNaN(v)) {
							v = 0
						}
					}
				}
				j(V, X, U)
			})
		} else {
			j(V, X, U)
		}
	}
	function h(d) {
		var W = document.cookie.split("; ");
		for (var V = 0; V < W.length; V++) {
			var U = W[V].split("=");
			if (U.length > 1 && U[0] == d) {
				return decodeURIComponent(U[1])
			}
		}
		return
	}
	function I(V, d, U) {
		if (typeof U === "undefined" || U !== true) {
			U = 0
		} else {
			U = 1
		}
		var W = {
			uidList: V,
			withVipCount: U
		};
		$.ajax({
			url: w,
			type: "GET",
			dataType: "jsonp",
			data: W,
			success: function(X) {
				if (X && X.status && X.status == 1) {
					typeof d === "function" && d(X.data)
				} else {
					typeof d === "function" && d({})
				}
			},
			error: function() {
				typeof d === "function" && d({})
			}
		})
	}
	var u = {};

	function z(V, d) {
		if (typeof d !== "function") {
			return
		}
		if (typeof u[V] !== "undefined") {
			d(u[V]);
			return
		}
		var U = {
			account: V
		};
		$.ajax({
			url: x,
			type: "GET",
			dataType: "jsonp",
			data: U,
			success: function(W) {
				if (W && W.status && W.status == 1) {
					u[V] = W.data;
					d(W.data)
				} else {
					d(-1)
				}
			},
			error: function() {
				d(-1)
			}
		})
	}
	function a(d) {
		var U = -1;
		if (typeof G[i] !== "undefined") {
			U = G[i]
		}
		if (typeof d === "function") {
			if (U == -1) {
				I([i], function(V) {
					var W = 0;
					if (V && typeof V[i] !== "undefined") {
						W = parseInt(V[i]["rank"]);
						if (isNaN(W) || W < 0) {
							W = 0
						}
						if (typeof V[i]["score"] !== "undefined") {
							F = V[i]["score"]
						}
					}
					G[i] = W;
					d(W)
				})
			} else {
				d(U)
			}
		}
		return U
	}
	function e(d) {
		return a(d) > 0
	}
	function H() {
		M = f();
		if (!M) {
			return
		}
		O(function() {
			P(M, true)
		})
	}
	b.Qk_Vip = {
		setVip: P,
		getCookie: h,
		closePayFrame: D,
		noticePayResult: m,
		isVip: e,
		getUserVip: I,
		getRank: a,
		loadDataTarget: H,
		bindPay: k,
		loginIsVip: z
	}
})(window);
if (typeof $ !== "undefined") {
	$(document).ready(function() {
		typeof Qk_Vip !== "undefined" && typeof Qk_Vip.loadDataTarget === "function" && Qk_Vip.loadDataTarget()
	})
};