function $i(a) {
	return $("#" + a).get(0)
}
var boxys = new Object();
String.prototype.sInclude = function(s) {
	var a = new RegExp("(^|,)" + s + "(,|$)", "ig");
	return a.test(this, s)
};
String.prototype.sRemove = function(s) {
	if (this.sInclude(s)) {
		var a = RegExp.leftContext;
		var b = RegExp.rightContext;
		if (a.length > 0 && b.length > 0) {
			return a + "," + b
		} else if (a.length > 0) {
			return a
		} else if (b.length > 0) {
			return b
		} else {
			return ""
		}
	} else {
		return this
	}
};
String.prototype.isRelate = function() {
	var r = /^\w+\:\/\//g;
	return !r.test(this)
};
String.prototype.gbLen = function() {
	var a = this.length;
	for (var i = 0; i < this.length; i++) {
		if (this.charCodeAt(i) > 255) {
			a++
		}
	}
	return a
};
String.prototype.gbIndexOf = function(a) {
	var b = this.indexOf(a);
	return this.substr(0, b).gbLen() + 1
};
String.prototype.gbLeft = function(a, s) {
	var b = '';
	var c = s || '';
	var d = 0;
	var e = false;
	var f = 0;
	if (a < 1) {
		return b
	}
	if (this.length * 2 <= a || c.length > this.length) {
		return this.toString()
	}
	for (var i = 0; i < this.length; i++) {
		var l = (this.charCodeAt(i) > 255) ? 2 : 1;
		if (d + l > a) {
			e = true;
			break
		} else {
			d += l;
			f++
		}
	}
	if (e && c.length > 0) {
		d += s.gbLen();
		while (d > a) {
			f--;
			d -= (this.charCodeAt(f) > 255) ? 2 : 1
		}
		b = this.substr(0, f) + s
	} else {
		b = this.substr(0, f)
	}
	return b
};
String.prototype.trimEnd = function() {
	var a, n;
	n = this.length;
	while (n >= 0) {
		var c = this.charCodeAt(n - 1);
		if (c != 32 && c != 12288) {
			break
		} else {
			n--
		}
	}
	if (n == 0) {
		return ""
	} else {
		return this.substr(0, n)
	}
};
String.prototype.trim = function() {
	var s = 0,
		e = this.length - 1;
	while (s < this.length) {
		var c = this.charCodeAt(s);
		if (c != 32 && c != 12288) {
			break
		} else {
			s++
		}
	}
	while (e > s) {
		var c = this.charCodeAt(e);
		if (c != 32 && c != 12288) {
			break
		} else {
			e--
		}
	}
	if (s > e) {
		return ""
	} else {
		return this.substring(s, e + 1)
	}
};
String.prototype.isSpace = function() {
	var a = /^(\s| )*$/g;
	return a.test(this)
};
Array.prototype.include = function(v) {
	for (var i = 0; i < this.length; i++) {
		if (this[i] == v) {
			return true
		}
	}
	return false
};
Number.prototype.twoDigit = function(n) {
	return this < 10 ? "0" + this : this.toString()
};
Date.prototype.toFriendString = function() {
	var n = new Date();
	var a = new Date(n.getFullYear(), n.getMonth(), n.getDate());
	var b = (new Date(a)).setDate(a.getDate() - 1);
	var c = (new Date(a)).setDate(a.getDate() - 2);
	var d = this.getHours().twoDigit() + ":" + this.getMinutes().twoDigit();
	var e = (this.getMonth() + 1).twoDigit() + "-" + this.getDate().twoDigit() + " " + d;
	var s;
	n = Math.floor((n - this) / 1000);
	if (n < 3600) {
		s = Math.ceil(n / 60) + "分钟前"
	} else if (n < 36000) {
		s = Math.floor(n / 3600) + "小时" + Math.floor(n % 3600 / 60) + "分前"
	} else if (this > a) {
		s = "今天 " + d
	} else if (this > b) {
		s = "昨天 " + d
	} else if (this > c) {
		s = "前天 " + d
	} else {
		s = e
	}
	return s
};
var iwms = new Object();
iwms.urlPrefix = "";
iwms.payEnable = 0;
iwms.setTimeDiff = function(a) {
	iwms.timeDiff = new Date() - new Date(a)
};
iwms.getClientDate = function(a) {
	return new Date(Date.parse(new Date(a)) + iwms.timeDiff)
};
iwms.msgPos = function(a, b) {
	var c = {
		x: 0,
		y: 0
	};
	var d = [b.style.display.toString(), b.style.visibility.toString()];
	with(document.documentElement) {
		var e = clientWidth;
		var f = scrollLeft;
		var g = scrollTop
	}
	b.style.display = "block";
	b.style.visibility = "hidden";
	if (a) {
		var p = iwms.elePos(a);
		c.x = p.x;
		c.y = p.y + p.h;
		if (c.x + b.offsetWidth > e + f) {
			c.x = e + f - b.offsetWidth;
			if (c.x < 0) {
				c.x = 0
			}
		}
		var h = $(".twidth:eq(0)");
		if (h.length == 1) {
			var i = h.offset();
			if (c.x + b.offsetWidth > h.width() + i.left) {
				c.x = h.width() + i.left - b.offsetWidth
			}
		}
	} else {
		c.x = Math.floor((e - b.offsetWidth) / 2);
		c.y = g
	}
	b.style.display = d[0];
	b.style.visibility = d[1];
	return c
};
iwms.elePos = function(a) {
	var p = {
		'x': 0,
		'y': 0,
		'w': 0,
		'h': 0
	};
	p.h = a.offsetHeight;
	p.w = a.offsetWidth;
	do {
		p.x += a.offsetLeft || 0;
		p.y += a.offsetTop || 0;
		a = a.offsetParent
	} while (a);
	return p
};
iwms.popDivs = new Array();
iwms.popMsg = function(a, b, c, d) {
	var e;
	iwms.clearPopTimer(a);
	for (var i = 0; i < iwms.popDivs.length; i++) {
		if (iwms.popDivs[i].id == "pop_" + a) {
			e = iwms.popDivs[i]
		}
	}
	if (e == null) {
		e = document.createElement("DIV");
		e.id = "pop_" + a;
		iwms.popDivs.push(e);
		e.onmouseout = function() {
			iwms.hideMsg(a, 800)
		};
		e.onmouseover = function() {
			iwms.clearPopTimer(a)
		};
		document.body.appendChild(e)
	} else {
		e.removeChild(e.childNodes[0])
	}
	e.className = d ? d : (b ? "aj_msg" : "aj_msg aj_msgTop");
	if (typeof(c) == "string") {
		e.innerHTML = c
	} else {
		e.appendChild(c)
	}
	var f = iwms.msgPos(b, e);
	with(e.style) {
		top = f.y + "px";
		left = f.x + "px";
		display = "block";
		zIndex = 100
	}
	if (b) {
		iwms.dropShadow(a, e);
		b.onmouseout = function() {
			iwms.hideMsg(a, 800)
		}
	}
};
iwms.popTimers = new Array();
iwms.hideMsg = function(a, b) {
	iwms.clearPopTimer(a);
	if (b && b > 0) {
		iwms.popTimers.push([a, window.setTimeout("iwms.hideMsg('" + a + "')", b)])
	} else {
		var c;
		for (var i = 0; i < iwms.popDivs.length; i++) {
			if (iwms.popDivs[i].id == "pop_" + a) {
				c = iwms.popDivs[i];
				break
			}
		}
		if (c) {
			c.style.display = "none";
			iwms.clearShadow(a)
		}
	}
};
iwms.clearPopTimer = function(a) {
	var n = -1;
	for (var i = 0; i < iwms.popTimers.length; i++) {
		if (iwms.popTimers[i][0] == a) {
			n = i;
			break
		}
	}
	if (n >= 0) {
		var b = iwms.popTimers.splice(n, 1)[0][1];
		if (b) {
			window.clearTimeout(b)
		}
	}
};
iwms.shadows = new Array();
iwms.dropShadow = function(a, b) {
	if (self != top && $.browser.msie && self.frameElement.tagName == "IFRAME") {
		return
	}
	var c = 1;
	var d = null;
	for (var i = 0; i < iwms.shadows.length; i++) {
		if (iwms.shadows[i][0] == a) {
			d = iwms.shadows[i][1];
			break
		}
	}
	if (d == null) {
		d = [a, new Array()];
		for (var i = 0; i < c; i++) {
			var o = document.createElement("DIV");
			o.className = "shadow";
			with(o.style) {
				position = "absolute";
				zIndex = b.style.zIndex - 1;
				var e = Math.floor(100 * (c - i) / c);
				if (typeof(opacity) == "string") {
					opacity = (e / 100).toString()
				} else {
					filter = "alpha(opacity=" + e + ")"
				}
			}
			d[1].push(o);
			document.body.appendChild(o)
		}
		iwms.shadows.push(d);
		d = d[1]
	}
	var p = iwms.elePos(b);
	for (var i = 0; i < d.length; i++) {
		with(d[i].style) {
			top = p.y + (i + 1) * 1 + "px";
			left = p.x + (i + 1) * 1 + "px";
			width = p.w + "px";
			height = p.h + "px"
		}
	}
};
iwms.clearShadow = function(a) {
	var o, n = -1,
		arr;
	for (var i = 0; i < iwms.shadows.length; i++) {
		if (iwms.shadows[i][0] == a) {
			n = i;
			break
		}
	}
	if (n == -1) {
		return
	}
	arr = iwms.shadows.splice(n, 1);
	arr = arr[0][1];
	while (o = arr.pop()) {
		document.body.removeChild(o)
	}
};
iwms.cookie = function(a, b, d) {
	if (b == undefined) {
		var e = a + "=";
		var c = document.cookie;
		if (c.length > 0) {
			offset = c.indexOf(e);
			if (offset != -1) {
				offset += e.length;
				end = c.indexOf(";", offset);
				if (end == -1) {
					end = c.length
				}
				return decodeURI(c.substring(offset, end))
			}
		}
		return ""
	}
	if (d != undefined && d != null) {
		var f = new Date();
		f.setTime(f.getTime() + (d * 1000 * 3600 * 24))
	}
	document.cookie = a + "=" + encodeURI(b) + "; path=/;" + ((d == undefined || d == null) ? "" : (" expires=" + f.toGMTString()))
};
iwms.imgResize = function() {
	if (iwms.imgCont) {
		iwms.imgCont.style.overflowX = "hidden";
		iwms.imgCont.style.wordBreak = "break-all";
		var c = iwms.imgCont.getElementsByTagName("img")
	} else {
		return
	}
	for (var i = 0; i < c.length; i++) {
		var o = c[i];
		if (o.complete) {
			iwms.imgLoaded(o)
		} else {
			o.onload = function() {
				iwms.imgLoaded(this)
			}
		}
		if (iwms.imgPage && typeof(pager) == "object" && c.length == 1 && o.width > 200) {
			o.style.cursor = "pointer";
			if (o.resized == "1") {
				o.setAttribute("title", "ctrl+鼠标左键原大小");
				o.onclick = function(a) {
					var b = a || window.event;
					b.ctrlKey ? iwms.imgFullsize(this) : pager.Next()
				}
			} else {
				o.onclick = function() {
					pager.Next()
				}
			}
		}
	}
};
iwms.imgLoaded = function(o) {
	var a = parseInt(iwms.imgCont.clientWidth) - 50;
	if (o.width > a) {
		if (o.style.width) {
			o.style.width = ""
		}
		o.width = a;
		o.removeAttribute("height");
		o.style.cursor = "pointer";
		o.style.display = "block";
		o.vspace = 5;
		o.resized = 1;
		if (typeof(o.onclick) != "function") {
			o.onclick = function() {
				iwms.imgFullsize(this)
			}
		}
	}
};
iwms.imgFullsize = function(c) {
	if (c.parentElement) {
		if (c.parentElement.tagName == "A") {
			return
		}
	}
	var b = new Boxy("<p><img src='" + c.src + "'/></p>", {
		title: "查看图片",
		fixed: false,
		modal: true,
		unloadOnHide: true,
		afterShow: function() {
			var a = this.getPosition();
			if (a[1] < 0) this.moveTo(a[0], 0)
		},
		behaviours: function(r) {
			$(r).click(function() {
				b.hide()
			})
		}
	})
};
iwms.obj2json = function(o) {
	var s = "{";
	for (var p in o) {
		if (s.length > 1) s += ",";
		var v = o[p];
		s += p + ":";
		if (typeof(v) == 'string') {
			s += "'" + v.replace(/'/g, "\\'") + "'"
		} else {
			s += v
		}
	}
	return s + "}"
};
iwms.logSave = function(u) {
	var d = new Date();
	var m = new Date(2000, 0, 1);
	u.lastSet = Math.floor((d - m) / 60000);
	var s = iwms.obj2json(u);
	if (u.keep) {
		iwms.cookie("iwmsUser", s, 30)
	} else {
		iwms.cookie("iwmsUser", s)
	}
};
iwms.logOut = function() {
	iwms.cookie("iwmsUser", "", -30);
	iwms.logReload()
};
iwms.logReload = function() {
	var a = top.location.href;
	if (a.charAt(a.length - 1) == '#') {
		a = a.substr(0, a.length - 1)
	}
	if (a.substr(a.lastIndexOf("/") + 1).indexOf("member") == 0) {
		a = a.substr(0, a.lastIndexOf("/"))
	}
	top.location = a
};
iwms.logedUser = function() {
	var s = iwms.cookie("iwmsUser").trim();
	if (s.length == 0 || s.charAt(0) != '{' || s.charAt(s.length - 1) != '}') {
		s = {
			ver: 1,
			id: 0,
			name: '',
			pass: '',
			admin: 0,
			admPs: 0,
			signin: 0,
			msg: 0,
			keep: 0,
			lastSet: 0
		}
	} else {
		eval("s=" + s)
	}
	return s
};
iwms.user = iwms.logedUser();
iwms.logDisp = function() {
	$u = $("#topUser");
	if ($u.length == 0 || iwms.user.id < 1) {
		return
	}
	var a = 5;
	var d = new Date();
	var m = new Date(2000, 0, 1);
	var b = Math.floor((d - m) / 60000);
	if (b - iwms.user.lastSet > a) {
		iwms.logReset();
		return
	}
	var c = ["你好,", iwms.user.name, "<a href='#' onmouseover='iwms.popMine(this)'>我的</a>", (iwms.user.msg ? "<a href='#' onclick='msg.disp()' class='remind'>新消息</a>" : "<a href='#' onclick='msg.disp()'>消息</a>"), (iwms.user.signin > 0 ? "<a href='" + iwms.urlPrefix + "memberSignIns.aspx' class='remind'>待签收</a>" : ""), "<a href='#' onmouseover='iwms.popPub(this)'>发布</a>", (iwms.payEnable ? "<a href='" + iwms.urlPrefix + "memberCharge.aspx'>充值</a>" : ""), (iwms.user.admin ? "<a href='" + iwms.urlPrefix + "admin_login.aspx' target='_blank'>管理</a>" : ""), "<a href='", iwms.urlPrefix, "memberList.aspx'>会员</a>", "<a href='", iwms.urlPrefix, "search.aspx'>搜索</a>", "<a href='#' onclick='iwms.logOut()'>退出</a>"].join("");
	$u.html(c)
};
iwms.logReset = function() {
	iwms.ajSrc = null;
	$.post(iwms.urlPrefix + 'ajax.aspx', {
		cmd: 'userJson'
	}, function(r) {
		iwms.logSave(r);
		iwms.user = r;
		iwms.logDisp()
	}, 'json')
};
$(function() {
	iwms.logDisp()
});
iwms.logPop = function() {
	var b = boxys.login;
	if (b) {
		b.toggle()
	} else {
		b = new Boxy("<iframe src='" + iwms.urlPrefix + "login.aspx' height='100%' width='100%' frameborder='0'></iframe>", {
			title: "会员登录"
		});
		b.resize(380, 180);
		boxys.login = b
	}
};
iwms.popMine = function(a) {
	var b = $("<div class='popMine'></div>").appendTo(document.body).append("<a href='" + iwms.urlPrefix + "memberProfile.aspx?id=" + iwms.user.id + "' target='_blank'>会员信息</a>").append("<a href='" + iwms.urlPrefix + "search.aspx?where=memberid&keyword=" + iwms.user.id + "' target='_blank'>发布内容</a>").append("<a href='" + iwms.urlPrefix + "memberModify.aspx?id=" + iwms.user.id + "' taget='_blank'>控制中心</a>");
	iwms.popMsg("my", a, b.get(0))
};
iwms.popPub = function(a) {
	var b = $("<div class='popMine'></div>").appendTo(document.body).append("<a href='" + iwms.urlPrefix + "memberNewsAdd.aspx'>发布新闻</a>").append("<a href='" + iwms.urlPrefix + "memberSoftAdd.aspx'>发布软件</a>");
	iwms.popMsg("pub", a, b.get(0))
};
iwms.addFriend = function(b, c) {
	if (iwms.user.id <= 0) {
		iwms.popMsg("addFriend", b, "登陆会员才可以添加好友");
		iwms.hideMsg("addFriend", 2000);
		return
	}
	var o = {};
	o.cmd = "friendAdd";
	o.friendId = c;
	$.post(iwms.urlPrefix + "ajax.aspx", o, function(r) {
		var a;
		if (r.success) {
			a = "添加好友成功"
		} else {
			a = "添加好友失败,已添加或达到好友数上限"
		}
		iwms.popMsg("addFriend", b, a);
		iwms.hideMsg("addFriend", 3000)
	}, 'json')
};
iwms.removeFriend = function(b, c) {
	if (iwms.user.id <= 0) {
		return
	}
	var o = {};
	o.cmd = "friendRemove";
	o.friendId = c;
	$.post(iwms.urlPrefix + "ajax.aspx", o, function(r) {
		var a;
		if (r.success) {
			$(b).parent().remove()
		} else {
			a = "删除好友失败";
			iwms.popMsg("removeFriend", b, a);
			iwms.hideMsg("removeFriend", 3000)
		}
	}, 'json')
};
var msg = new Object();
msg.friendLoaded = false;
msg.gotUnread = false;
msg.dispContact = function(a) {
	$src = $(a);
	if ($src.next().css("display") != "none") {
		return
	}
	$("#msFriend,#msRecent").hide();
	if ($src.next().attr("id") == "msFriend" && !msg.friendLoaded) {
		msg.getFriends()
	} else {
		$src.next().show()
	}
};
msg.appendMsg = function(o) {
	var a = $("<div/>");
	a.addClass("msMsg");
	$("<div/>").addClass(o.sender == iwms.user.name ? "msMe" : "msSender").text(o.sender + " " + iwms.getClientDate(o.time).toFriendString()).appendTo(a);
	$("<div/>").addClass(o.unread ? "msBody msUnread" : "msBody").html(o.body.replace(/\n/g, '<br/>')).appendTo(a);
	$("#msList").append(a).scrollTop(10000)
};
msg.init = function(u) {
	$("#msCon").find("div.msHead").click(function() {
		msg.dispContact(this)
	});
	$(document).on("click", "#msRecent a,#msFriend a", function(a) {
		$this = $(this);
		$("#msRecent a,#msFriend a").removeClass("msCur");
		$this.addClass("msCur").removeClass("msUnread");
		iwms.ajSrc = null;
		$.post(iwms.urlPrefix + "ajax.aspx", {
			cmd: "msgGet",
			receiverId: $this.data("id")
		}, function(r) {
			$list = $("#msList").empty();
			for (var i = 0; i < r.length; i++) {
				var o = r[i];
				msg.appendMsg(o)
			}
			$("#msForm form input[name='id']").val($this.data("id"));
			if (msg.gotUnread && $("#msRecent a.msUnread").length == 0) {
				msg.gotUnread = false;
				iwms.logReset()
			}
		}, 'json');
		msg.enable();
		a.preventDefault()
	});
	msg.getRecent(u);
	$("#msForm form").submit(function() {
		var o = new Object();
		var a = $("#msForm form textarea");
		o.receiverId = $("#msForm form input[name='id']").val();
		o.body = a.val();
		if (!/^\d+$/.test(o.receiverId)) {
			alert("请选择联系人");
			return false
		}
		if (o.body.trim().length < 2) {
			alert("请填写消息内容");
			return false
		}
		o.cmd = "msgPost";
		o.body = iwms.ajEncode(o.body);
		$.post(iwms.urlPrefix + "ajax.aspx", o, function(r) {
			if (r.success) {
				msg.appendMsg({
					sender: iwms.user.name,
					time: new Date(Date.parse(new Date()) - iwms.timeDiff),
					body: r.body
				});
				a.val("")
			}
		}, 'json');
		return false
	});
	msg.handle = function(a) {
		if (a.ctrlKey && a.keyCode == 13) {
			$("#msForm form").submit();
			return false
		} else {
			return true
		}
	};
	msg.disable()
};
msg.disable = function() {
	$("#msForm button").attr("disabled", "disabled");
	$("#msForm textarea").val("").attr("disabled", "disabled")
};
msg.enable = function() {
	$("#msForm button, #msForm textarea").removeAttr("disabled")
};
msg.getRecent = function(u) {
	iwms.ajSrc = null;
	$.post(iwms.urlPrefix + "ajax.aspx", {
		cmd: "msgRecent"
	}, function(r) {
		iwms.setTimeDiff(r.serverTime);
		$recent = $("#msRecent");
		for (var i = 0; i < r.contact.length; i++) {
			var o = r.contact[i];
			var a = $("<a/>").text(o.name).attr("href", "#").data("id", o.id).appendTo($recent);
			if (o.unread) {
				a.addClass("msUnread");
				msg.gotUnread = true
			}
		}
		if (u) {
			msg.addRecent(u)
		}
	}, 'json')
};
msg.addRecent = function(u) {
	var a = null;
	$("#msRecent a").each(function() {
		if ($(this).data("id") == u.id) {
			a = $(this)
		}
	});
	if (a == null) {
		a = $("<a/>").text(u.name).attr("href", "#").data("id", u.id).prependTo($recent)
	}
	a.click()
};
msg.getFriends = function() {
	iwms.ajSrc = null;
	$.post(iwms.urlPrefix + "ajax.aspx", {
		cmd: "msgFriends"
	}, function(r) {
		$friend = $("#msFriend");
		for (var i = 0; i < r.contact.length; i++) {
			var o = r.contact[i];
			$("<a/>").text(o.name).attr("href", "#").data("id", o.id).appendTo($friend)
		}
		msg.friendLoaded = true;
		$friend.show()
	}, 'json')
};
msg.disp = function(u) {
	var b = boxys.msg;
	if (b) {
		b.toggle();
		if (u) {
			msg.addRecent(u)
		}
	} else {
		iwms.ajSrc = null;
		$.get(iwms.urlPrefix + "msg.xml", function(r) {
			var a = $(r).find("html:eq(0)").text();
			boxys.msg = new Boxy(a, {
				title: "查看消息"
			});
			msg.init(u)
		}, 'xml')
	}
};
iwms.diggIt = function(b, c) {
	var d = iwms.cookie("iwmsDigged");
	d = d.length == 0 ? [] : d.split(',');
	if (d.include(c)) {
		b.innerHTML = "已投票!";
		b.onclick = function() {
			return false
		};
		b.style.color = "#999";
		return
	}
	iwms.ajSrc = b;
	$.post(iwms.urlPrefix + 'ajax.aspx', {
		cmd: 'digg',
		aid: c
	}, function(a) {
		if (a.success) {
			var o = b.parentNode.parentNode.getElementsByTagName("LI")[0];
			o.innerHTML = parseInt(o.innerHTML) + 1;
			b.innerHTML = "已投票!";
			b.onclick = function() {
				location.href = iwms.urlPrefix + 'hot.aspx'
			};
			b.style.color = "#999";
			if (d.length > 9) {
				d = d.slice(d.length - 9)
			}
			d.push(c);
			iwms.cookie("iwmsDigged", d.toString(), 30)
		} else {
			iwms.popMsg('digg', b, 'digg操作失败');
			iwms.hideMsg('digg', 2000)
		}
	}, "json")
};
iwms.addLink = function() {
	var b = boxys.addLink;
	if (b) {
		b.toggle()
	} else {
		b = new Boxy("<iframe src='" + iwms.urlPrefix + "admin_popLinkAdd.aspx' height='100%' width='100%' frameborder='0'></iframe>", {
			title: "申请友情链接"
		});
		b.resize(500, 340);
		boxys.addLink = b
	}
};
var menu = new Object();
menu.container = null;
menu.ele = null;
menu.items = null;
menu.done = false;
menu.bind = function() {
	$("#navbar a[title]").each(function() {
		$this = $(this);
		$this.mouseover(function() {
			menu.show(this, $(this).data("id"), 1, 0)
		}).data("id", $this.attr("title")).removeAttr("title")
	})
};
$(function() {
	menu.bind()
});
menu.show = function(e, a, p, b) {
	if (menu.items == null) {
		iwms.ajSrc = null;
		menu.items = dataMenu;
			menu.show(e, a, p, b);
		return
	}
	if (menu.items[a] == null) {
		return
	}
	if (!document.all && !document.getElementById && !document.layers) {
		return false
	}
	menu.ele = e;
	var c = menu.items[a];
	var d = 10;
	var f = Math.floor((c.length - 1) / d) + 1;
	if (c.length == 0) {
		return
	}
	if (menu.container == null) {
		var o = document.createElement("DIV");
		menu.container = o
	}
	if (f == 1) {
		menu.addItem(c)
	} else {
		c = c.slice((p - 1) * d, p * d);
		menu.addItem(c);
		menu.container.appendChild(menu.pageDiv(a, p, f))
	}
	iwms.popMsg("menu", e, menu.container, "menuskin");
	return false
};
menu.pageDiv = function(a, p, b) {
	var c = $("<div/>").addClass("menuitems").css({
		'text-align': 'right',
		'padding-right': '10px',
		'white-space': 'nowrap'
	});
	var d = $("<font/>").attr('face', 'arial').html('&#9668;');
	if (p == 1) {
		d.attr('color', '#cccccc')
	} else {
		d.css('cursor', 'pointer').data('idx', a).data('page', p - 1).click(menu.pageClick)
	}
	c.append(d);
	var e = $("<font/>").attr('face', 'arial').html('&#9658;');
	if (p == b) {
		e.attr('color', '#cccccc')
	} else {
		e.css('cursor', 'pointer').data('idx', a).data('page', p + 1).click(menu.pageClick)
	}
	c.append(e);
	return c.get(0)
};
menu.pageClick = function() {
	menu.show(menu.ele, $(this).data('idx'), $(this).data('page'), true);
	iwms.hideMsg('menu', 1500)
};
menu.addItem = function(b) {
	for (var i = menu.container.childNodes.length; i--; i >= 0) {
		menu.container.removeChild(menu.container.childNodes[i])
	}
	for (var i = 0; i < b.length; i++) {
		var a = b[i];
		var c = document.createElement("DIV");
		c.className = "menuitems";
		c.onmouseover = new Function("menu.highlight(this,'on');");
		c.onmouseout = new Function("menu.highlight(this,'off');");
		var d = document.createElement("A");
		if (iwms.urlPrefix.length > 0 && a[1].isRelate()) {
			d.href = iwms.urlPrefix + a[1]
		} else {
			d.href = a[1]
		}
		if (a[2]) {
			d.target = "_blank"
		}
		d.innerHTML = a[0];
		c.appendChild(d);
		menu.container.appendChild(c)
	}
};
menu.highlight = function(a, b) {
	a.id = (b == "on") ? "mouseoverstyle" : ""
};

function Flash(a, w, h) {
	document.write(['<div style="padding:5px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="', w, '" height="', h, '"><param name="movie" value="', iwms.urlPrefix, a, '"> <param name="quality" value="high"><param name="wmode" value="opaque"><embed src="', a, '" loop="false" menu="false" quality="high" width="', w, '" height="', h, '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object></div>'].join(''))
}
function pollCheck(o, a) {
	var b = 0;
	var f = o.form;
	for (var i = 0; i < f.elements.length; i++) {
		var c = f.elements[i];
		if (c.name == o.name && c.checked) {
			b++
		}
	}
	if (b > a) {
		alert("最多选择" + a + "项!");
		o.checked = false
	}
}
function ViewPoll(a) {
	window.open(iwms.urlPrefix + "pollView.aspx?act=result&id=" + a, "iwmsPoll", "width=500,height=400,left=0,top=0,scrollbars=1,status=1,resizable=1")
}
function StartRollV() {
	var a = 3000;
	var b = $("#oRollV");
	if (b.length == 0) {
		return
	}
	if (b.children().length == 0) {
		b.hide();
		return
	}
	$lastChild = b.children().last();
	if (($lastChild.offset().top - b.offset().top + $lastChild.height()) < b.height()) {
		b.css("height", "auto");
		return
	}
	myInter = setInterval(MarqueeV, a);
	b.mouseover(function() {
		clearInterval(myInter)
	});
	b.mouseout(function() {
		myInter = setInterval("MarqueeV()", a)
	})
}
function MarqueeV() {
	var a = $("#oRollV");
	var b = $("a:eq(0)", a);
	b.slideUp('slow', function() {
		a.append(this);
		$(this).show()
	})
}
function linkSize() {
	var a, o2;
	a = $("#siteNav");
	$roll = $("#oRollV");
	if (a.length > 0 && $roll.length > 0 && a.parents("table:last").find("#oRollV").length == 1) {
		if ($roll.parent().last().height() < a.offsetParent().height()) {
			$roll.height($roll.height() + a.parent().outerHeight() - $roll.parent().outerHeight());
			if (/msie|MSIE 7/.test(navigator.userAgent)) {
				$roll.parents("table:last").css("table-layout", "fixed")
			}
		}
	}
}
var bRoll = new Object();
bRoll.delay = 3000;
bRoll.timer = 0;
bRoll.height = 0;
bRoll.count = 0;
bRoll.roll = function() {
	var b = $i("bulletinBody");
	if (bRoll.count == bRoll.height) {
		if (b.scrollHeight - bRoll.height <= b.scrollTop) {
			b.scrollTop = b.scrollHeight / 2 - bRoll.height
		}
		bRoll.count = 0;
		bRoll.timer = setTimeout('bRoll.roll()', bRoll.delay)
	} else {
		b.scrollTop++;
		bRoll.count++;
		bRoll.timer = setTimeout('bRoll.roll()', 10)
	}
};
bRoll.clear = function() {
	if (bRoll.count == 0) {
		clearTimeout(bRoll.timer);
		bRoll.timer = 0
	}
};
bRoll.init = function(b) {
	document.write('<div id="bulletin" class="bulletin"></div>');
	var o, oD, oU, oL;
	o = $i("bulletin");
	bRoll.height = o.scrollHeight;
	oD = document.createElement("DIV");
	oU = document.createElement("UL");
	o.onmouseover = bRoll.clear;
	o.onmouseout = function() {
		if (!bRoll.timer) {
			bRoll.timer = setTimeout('bRoll.roll()', bRoll.delay)
		}
	};
	for (var i = 0; i < b.length; i++) {
		var a = b[i];
		if (iwms.urlPrefix.length > 0 && a[1].isRelate()) {
			a[1] = iwms.urlPrefix + a[1]
		}
		oL = document.createElement("LI");
		oL.innerHTML = '<a href="' + a[1] + '" target="_blank">' + a[0] + '</a><em>(' + a[2] + ')</em></a></li>';
		oU.appendChild(oL)
	};
	oD.appendChild(oU);
	oD.id = "bulletinBody";
	oD.innerHTML += '<br style="clear:both"/>' + oD.innerHTML;
	o.appendChild(oD);
	bRoll.timer = setTimeout('bRoll.roll()', bRoll.delay)
};
var imgSlide = new Object();
imgSlide.idx = 0;
imgSlide.timer;
imgSlide.imgs;
imgSlide.show = function(a) {
	imgSlide.idx = a;
	imgSlide.setNum(a);
	imgSlide.setImg(a);
	imgSlide.setTitle(a)
};
imgSlide.setNum = function(v) {
	for (var i = 0; i < imgSlide.imgs.length; i++) {
		$("#slNum a").eq(i).attr("class", v == i ? "slOn" : "slOff")
	}
};
imgSlide.setImg = function(v) {
	var o = $i("slImg");
	$(o).find("a:eq(0)").attr("href", imgSlide.imgs[v][1]).end().find("img:eq(0)").attr("src", imgSlide.imgs[v][2])
};
imgSlide.setTitle = function(v) {
	$("#slLink a:eq(0)").attr({
		href: imgSlide.imgs[v][1]
	}).get(0).innerHTML = imgSlide.imgs[v][0]
};
imgSlide.clear = function() {
	clearInterval(imgSlide.timer)
};
imgSlide.start = function() {
	imgSlide.timer = setInterval("imgSlide.next()", 3000)
};
imgSlide.next = function() {
	imgSlide.idx++;
	if (imgSlide.idx > imgSlide.imgs.length - 1) {
		imgSlide.idx = 0
	}
	imgSlide.show(imgSlide.idx)
};
imgSlide.init = function(w, h, b, c) {
	var l, a, v1;
	var d = document;
	d.write('<div id="slImg" style="width:' + w + 'px;height:' + h + 'px"></div><div id="slTitle" style="width:' + w + 'px"><div id="slNum"></div><div id="slLink"></div></div>');
	if (b.length == 0) {
		v1 = ["请先添加头条图片新闻", "###", "style/iwms/no_picture.gif"]
	} else {
		v1 = b[0]
	}
	for (var i = 0; i < b.length; i++) {
		b[i][0] = b[i][0].gbLeft(c, "...");
		if (iwms.urlPrefix.length > 0) {
			if (b[i][1].isRelate()) {
				b[i][1] = iwms.urlPrefix + b[i][1]
			}
			if (b[i][2].isRelate()) {
				b[i][2] = iwms.urlPrefix + b[i][2]
			}
		}
	}
	imgSlide.imgs = b;
	$imgs = $("<ul/>");
	for (var i = 0; i < imgSlide.imgs.length; i++) {
		var e = $("<a/>").attr('href', '###').html(i + 1).addClass(i == 0 ? 'slOn' : 'slOff').mouseover(imgSlide.clear).mouseout(imgSlide.start).click(new Function("imgSlide.show(" + i + ")"));
		$imgs.append($("<li/>").append(e)).appendTo("#slNum")
	}
	var f = $("<a/>").attr({
		'href': v1[1],
		'target': '_blank'
	});
	var g = $("<img/>").attr({
		'src': v1[2],
		'width': w,
		'height': h
	});
	if (b.length > 1) {
		g.mouseover(imgSlide.clear).mouseout(imgSlide.start)
	}
	f.append(g).appendTo("#slImg");
	var j = $("<a/>").text(v1[0]).attr({
		'href': v1[1],
		'target': '_blank'
	});
	var k = $("#slLink").append(j);
	if (b.length > 1) {
		k.mouseover(imgSlide.clear).mouseout(imgSlide.start)
	}
	if (b.length > 1) {
		imgSlide.start()
	}
};
iwms.ajSrc = null;
$(function() {
	$("body").ajaxStart(function() {
		iwms.popMsg("ajax", iwms.ajSrc, "开始发送数据")
	}).ajaxSuccess(function(a, b) {
		iwms.popMsg("ajax", iwms.ajSrc, "成功接收数据")
	}).ajaxComplete(function(a, b) {
		iwms.hideMsg("ajax", 1000)
	}).ajaxError(function(a, b, c) {
		iwms.popMsg("ajax", iwms.ajSrc, "发送数据错误")
	})
});
iwms.ajForm = function(c) {
	var o = new Object();
	$("[name]:input", c).each(function() {
		if (this.name.length == 0 || this.tagName == "BUTTON" || this.type == "reset" || this.type == "submit" || this.name == "__VIEWSTATE" || this.name == "__EVENTVALIDATION") {
			return
		}
		var a = "";
		if (this.type == "SELECT" && this.multiple) {
			for (var i = 0; i < this.options.length; i++) {
				var b = this.options[i];
				if (b.selected) {
					if (a.length > 0) {
						a += ","
					}
					a += iwms.ajEncode(b.value)
				}
			}
		} else {
			a = this.value
		}
		eval("o." + iwms.ajTrueName(this.name) + "='" + iwms.ajEncode(a) + "';")
	});
	$("[name]:radio", c).each(function() {
		if (this.name.length > 0 && this.checked) {
			eval("o." + iwms.ajTrueName(this.name) + "='" + iwms.ajEncode(this.value) + "';")
		}
	});
	$("[name]:checkbox", c).each(function() {
		if (this.name.length > 0) {
			eval("o." + iwms.ajTrueName(this.name) + "='" + (this.checked ? "1" : "0") + "';")
		}
	});
	return o
};
iwms.ajEncode = function(v) {
	v = escape(v);
	v = v.replace(/\+/g, "%2B");
	return v
};
iwms.ajTrueName = function(a) {
	if (a.indexOf("$") >= 0) {
		var b = a.substr(a.lastIndexOf("$") + 1);
		return b
	} else {
		return a
	}
};
iwms.loadAdv = function(e) {
	$.ajax({
		url: e,
		async: false,
		success: function(a) {
			var b = a.indexOf('<body>') + 6;
			var c = a.indexOf('</body>');
			var d = a.substring(b, c);
			document.write(d)
		}
	})
};
jQuery.fn.boxy = function(d) {
	d = d || {};
	return this.each(function() {
		var c = this.nodeName.toLowerCase(),
			self = this;
		if (c == 'a') {
			jQuery(this).click(function() {
				var a = Boxy.linkedTo(this),
					href = this.getAttribute('href'),
					localOptions = jQuery.extend({
						actuator: this,
						title: this.title
					}, d);
				if (href.match(/(&|\?)boxy\.modal/)) localOptions.modal = true;
				if (a) {
					a.show()
				} else if (href.indexOf('#') >= 0) {
					var b = jQuery(href.substr(href.indexOf('#'))),
						newContent = b.clone(true);
					b.remove();
					localOptions.unloadOnHide = false;
					new Boxy(newContent, localOptions)
				} else if (href.match(/\.(jpe?g|png|gif|bmp)($|\?)/i)) {
					localOptions.unloadOnHide = true;
					Boxy.loadImage(this.href, localOptions)
				} else {
					if (!localOptions.cache) localOptions.unloadOnHide = true;
					Boxy.load(this.href, localOptions)
				}
				return false
			})
		} else if (c == 'form') {
			jQuery(this).bind('submit.boxy', function() {
				Boxy.confirm(d.message || 'Please confirm:', function() {
					jQuery(self).unbind('submit.boxy').submit()
				});
				return false
			})
		}
	})
};

function Boxy(a, b) {
	this.boxy = jQuery(Boxy.WRAPPER);
	jQuery.data(this.boxy[0], 'boxy', this);
	this.visible = false;
	this.options = jQuery.extend({}, Boxy.DEFAULTS, b || {});
	if (this.options.modal) {
		this.options = jQuery.extend(this.options, {
			center: true,
			draggable: false
		})
	}
	if (this.options.actuator) {
		jQuery.data(this.options.actuator, 'active.boxy', this)
	}
	this.setContent(a || "<div></div>");
	this._setupTitleBar();
	this.boxy.css('display', 'none').appendTo(document.body);
	this.toTop();
	if (this.options.fixed) {
		if (Boxy.IE6) {
			this.options.fixed = false
		} else {
			this.boxy.addClass('fixed')
		}
	}
	if (this.options.center && Boxy._u(this.options.x, this.options.y)) {
		this.center()
	} else {
		this.moveTo(Boxy._u(this.options.x) ? Boxy.DEFAULT_X : this.options.x, Boxy._u(this.options.y) ? Boxy.DEFAULT_Y : this.options.y)
	}
	if (this.options.show) this.show()
};
Boxy.EF = function() {};
jQuery.extend(Boxy, {
	WRAPPER: "<table cellspacing='0' cellpadding='0' border='0' class='boxy-wrapper'>" + "<tr><td class='boxy-top-left'></td><td class='boxy-top'></td><td class='boxy-top-right'></td></tr>" + "<tr><td class='boxy-left'></td><td class='boxy-inner'></td><td class='boxy-right'></td></tr>" + "<tr><td class='boxy-bottom-left'></td><td class='boxy-bottom'></td><td class='boxy-bottom-right'></td></tr>" + "</table>",
	DEFAULTS: {
		title: null,
		closeable: true,
		draggable: true,
		clone: false,
		actuator: null,
		center: true,
		show: true,
		modal: false,
		fixed: true,
		closeText: '[close]',
		unloadOnHide: false,
		clickToFront: false,
		behaviours: Boxy.EF,
		afterDrop: Boxy.EF,
		afterShow: Boxy.EF,
		afterHide: Boxy.EF,
		beforeUnload: Boxy.EF,
		hideFade: false,
		hideShrink: 'vertical'
	},
	IE6: (/msie|MSIE 6/.test(navigator.userAgent)),
	DEFAULT_X: 50,
	DEFAULT_Y: 50,
	MODAL_OPACITY: 0.7,
	zIndex: 1337,
	dragConfigured: false,
	resizeConfigured: false,
	dragging: null,
	load: function(b, c) {
		c = c || {};
		var d = {
			url: b,
			type: 'GET',
			dataType: 'html',
			cache: false,
			success: function(a) {
				a = jQuery(a);
				if (c.filter) a = jQuery(c.filter, a);
				new Boxy(a, c)
			}
		};
		jQuery.each(['type', 'cache'], function() {
			if (this in c) {
				d[this] = c[this];
				delete c[this]
			}
		});
		jQuery.ajax(d)
	},
	loadImage: function(a, b) {
		var c = new Image();
		c.onload = function() {
			new Boxy($('<div class="boxy-image-wrapper"/>').append(this), b)
		};
		c.src = a
	},
	get: function(a) {
		var p = jQuery(a).parents('.boxy-wrapper');
		return p.length ? jQuery.data(p[0], 'boxy') : null
	},
	linkedTo: function(a) {
		return jQuery.data(a, 'active.boxy')
	},
	alert: function(a, b, c) {
		return Boxy.ask(a, ['OK'], b, c)
	},
	confirm: function(b, c, d) {
		return Boxy.ask(b, ['OK', 'Cancel'], function(a) {
			if (a == 'OK') c()
		}, d)
	},
	ask: function(c, d, e, f) {
		f = jQuery.extend({
			modal: true,
			closeable: false
		}, f || {}, {
			show: true,
			unloadOnHide: true
		});
		var g = jQuery('<div></div>').append(jQuery('<div class="question"></div>').html(c));
		var h = jQuery('<form class="answers"></form>');
		h.html(jQuery.map(Boxy._values(d), function(v) {
			return "<input type='button' value='" + v + "' />"
		}).join(' '));
		jQuery('input[type=button]', h).click(function() {
			var b = this;
			Boxy.get(this).hide(function() {
				if (e) {
					jQuery.each(d, function(i, a) {
						if (a == b.value) {
							e(d instanceof Array ? a : i);
							return false
						}
					})
				}
			})
		});
		g.append(h);
		new Boxy(g, f)
	},
	isModalVisible: function() {
		return jQuery('.boxy-modal-blackout').length > 0
	},
	_u: function() {
		for (var i = 0; i < arguments.length; i++) if (typeof arguments[i] != 'undefined') return false;
		return true
	},
	_values: function(t) {
		if (t instanceof Array) return t;
		var o = [];
		for (var k in t) o.push(t[k]);
		return o
	},
	_handleResize: function(a) {
		jQuery('.boxy-modal-blackout').css('display', 'none').css(Boxy._cssForOverlay()).css('display', 'block')
	},
	_handleDrag: function(a) {
		var d;
		if (d = Boxy.dragging) {
			d[0].boxy.css({
				left: a.pageX - d[1],
				top: a.pageY - d[2]
			})
		}
	},
	_nextZ: function() {
		return Boxy.zIndex++
	},
	_viewport: function() {
		var d = document.documentElement,
			b = document.body,
			w = window;
		return jQuery.extend(/msie|MSIE/.test(navigator.userAgent) ? {
			left: b.scrollLeft || d.scrollLeft,
			top: b.scrollTop || d.scrollTop
		} : {
			left: w.pageXOffset,
			top: w.pageYOffset
		}, !Boxy._u(w.innerWidth) ? {
			width: w.innerWidth,
			height: w.innerHeight
		} : (!Boxy._u(d) && !Boxy._u(d.clientWidth) && d.clientWidth != 0 ? {
			width: d.clientWidth,
			height: d.clientHeight
		} : {
			width: b.clientWidth,
			height: b.clientHeight
		}))
	},
	_setupModalResizing: function() {
		if (!Boxy.resizeConfigured) {
			var w = jQuery(window).resize(Boxy._handleResize);
			if (Boxy.IE6) w.scroll(Boxy._handleResize);
			Boxy.resizeConfigured = true
		}
	},
	_cssForOverlay: function() {
		if (Boxy.IE6) {
			return Boxy._viewport()
		} else {
			return {
				width: '100%',
				height: jQuery(document).height()
			}
		}
	}
});
Boxy.prototype = {
	estimateSize: function() {
		this.boxy.css({
			visibility: 'hidden',
			display: 'block'
		});
		var a = this.getSize();
		this.boxy.css('display', 'none').css('visibility', 'visible');
		return a
	},
	getSize: function() {
		return [this.boxy.width(), this.boxy.height()]
	},
	getContentSize: function() {
		var c = this.getContent();
		return [c.width(), c.height()]
	},
	getPosition: function() {
		var b = this.boxy[0];
		return [b.offsetLeft, b.offsetTop]
	},
	getCenter: function() {
		var p = this.getPosition();
		var s = this.getSize();
		return [Math.floor(p[0] + s[0] / 2), Math.floor(p[1] + s[1] / 2)]
	},
	getInner: function() {
		return jQuery('.boxy-inner', this.boxy)
	},
	getContent: function() {
		return jQuery('.boxy-content', this.boxy)
	},
	setContent: function(a) {
		if (jQuery.type(a) === 'string') {
			a = jQuery(jQuery.parseHTML(a)).css({
				display: 'block'
			}).addClass('boxy-content')
		}
		if (this.options.clone) a = a.clone(true);
		this.getContent().remove();
		this.getInner().append(a);
		this._setupDefaultBehaviours(a);
		this.options.behaviours.call(this, a);
		return this
	},
	moveTo: function(x, y) {
		this.moveToX(x).moveToY(y);
		return this
	},
	moveToX: function(x) {
		if (typeof x == 'number') this.boxy.css({
			left: x
		});
		else this.centerX();
		return this
	},
	moveToY: function(y) {
		if (typeof y == 'number') this.boxy.css({
			top: y
		});
		else this.centerY();
		return this
	},
	centerAt: function(x, y) {
		var s = this[this.visible ? 'getSize' : 'estimateSize']();
		if (typeof x == 'number') this.moveToX(x - s[0] / 2);
		if (typeof y == 'number') this.moveToY(y - s[1] / 2);
		return this
	},
	centerAtX: function(x) {
		return this.centerAt(x, null)
	},
	centerAtY: function(y) {
		return this.centerAt(null, y)
	},
	center: function(a) {
		var v = Boxy._viewport();
		var o = this.options.fixed ? [0, 0] : [v.left, v.top];
		if (!a || a == 'x') this.centerAt(o[0] + v.width / 2, null);
		if (!a || a == 'y') this.centerAt(null, o[1] + v.height / 2);
		return this
	},
	centerX: function() {
		return this.center('x')
	},
	centerY: function() {
		return this.center('y')
	},
	resize: function(a, b, c) {
		if (!this.visible) return;
		var d = this._getBoundsForResize(a, b);
		this.boxy.css({
			left: d[0],
			top: d[1]
		});
		this.getContent().css({
			width: d[2],
			height: d[3]
		});
		if (c) c(this);
		return this
	},
	tween: function(a, b, c) {
		if (!this.visible) return;
		var d = this._getBoundsForResize(a, b);
		var e = this;
		this.boxy.stop().animate({
			left: d[0],
			top: d[1]
		});
		this.getContent().stop().animate({
			width: d[2],
			height: d[3]
		}, function() {
			if (c) c(e)
		});
		return this
	},
	isVisible: function() {
		return this.visible
	},
	show: function() {
		if (this.visible) return;
		if (this.options.modal) {
			var c = this;
			Boxy._setupModalResizing();
			this.modalBlackout = jQuery('<div class="boxy-modal-blackout"></div>').css(jQuery.extend(Boxy._cssForOverlay(), {
				zIndex: Boxy._nextZ(),
				opacity: Boxy.MODAL_OPACITY
			})).appendTo(document.body);
			this.toTop();
			if (this.options.closeable) {
				jQuery(document.body).bind('keypress.boxy', function(a) {
					var b = a.which || a.keyCode;
					if (b == 27) {
						c.hide();
						jQuery(document.body).unbind('keypress.boxy')
					}
				})
			}
		}
		this.getInner().stop().css({
			width: '',
			height: ''
		});
		this.boxy.stop().css({
			opacity: 1
		}).show();
		this.visible = true;
		this.boxy.find('.close:first').focus();
		this._fire('afterShow');
		return this
	},
	hide: function(a) {
		if (!this.visible) return;
		var b = this;
		if (this.options.modal) {
			jQuery(document.body).unbind('keypress.boxy');
			this.modalBlackout.animate({
				opacity: 0
			}, function() {
				jQuery(this).remove()
			})
		}
		var c = {
			boxy: {},
			inner: {}
		},
			tween = 0,
			hideComplete = function() {
				b.boxy.css({
					display: 'none'
				});
				b.visible = false;
				b._fire('afterHide');
				if (a) a(b);
				if (b.options.unloadOnHide) b.unload()
			};
		if (this.options.hideShrink) {
			var d = this.getInner(),
				hs = this.options.hideShrink,
				pos = this.getPosition();
			tween |= 1;
			if (hs === true || hs == 'vertical') {
				c.inner.height = 0;
				c.boxy.top = pos[1] + d.height() / 2
			}
			if (hs === true || hs == 'horizontal') {
				c.inner.width = 0;
				c.boxy.left = pos[0] + d.width() / 2
			}
		}
		if (this.options.hideFade) {
			tween |= 2;
			c.boxy.opacity = 0
		}
		if (tween) {
			if (tween & 1) d.stop().animate(c.inner, 300);
			this.boxy.stop().animate(c.boxy, 300, hideComplete)
		} else {
			hideComplete()
		}
		return this
	},
	toggle: function() {
		this[this.visible ? 'hide' : 'show']();
		return this
	},
	hideAndUnload: function(a) {
		this.options.unloadOnHide = true;
		this.hide(a);
		return this
	},
	unload: function() {
		this._fire('beforeUnload');
		this.boxy.remove();
		if (this.options.actuator) {
			jQuery.data(this.options.actuator, 'active.boxy', false)
		}
	},
	toTop: function() {
		this.boxy.css({
			zIndex: Boxy._nextZ()
		});
		return this
	},
	getTitle: function() {
		return jQuery('> .title-bar h2', this.getInner()).html()
	},
	setTitle: function(t) {
		jQuery('> .title-bar h2', this.getInner()).html(t);
		return this
	},
	_getBoundsForResize: function(a, b) {
		var c = this.getContentSize();
		var d = [a - c[0], b - c[1]];
		var p = this.getPosition();
		return [Math.max(p[0] - d[0] / 2, 0), Math.max(p[1] - d[1] / 2, 0), a, b]
	},
	_setupTitleBar: function() {
		if (this.options.title) {
			var b = this;
			var c = jQuery("<div class='title-bar'></div>").html("<h2>" + this.options.title + "</h2>");
			if (this.options.closeable) {
				c.append(jQuery("<a href='#' class='close'></a>").html(this.options.closeText))
			}
			if (this.options.draggable) {
				c[0].onselectstart = function() {
					return false
				};
				c[0].unselectable = 'on';
				c[0].style.MozUserSelect = 'none';
				if (!Boxy.dragConfigured) {
					jQuery(document).mousemove(Boxy._handleDrag);
					Boxy.dragConfigured = true
				}
				c.mousedown(function(a) {
					b.toTop();
					Boxy.dragging = [b, a.pageX - b.boxy[0].offsetLeft, a.pageY - b.boxy[0].offsetTop];
					jQuery(this).addClass('dragging')
				}).mouseup(function() {
					jQuery(this).removeClass('dragging');
					Boxy.dragging = null;
					b._fire('afterDrop')
				})
			}
			this.getInner().prepend(c);
			this._setupDefaultBehaviours(c)
		}
	},
	_setupDefaultBehaviours: function(b) {
		var c = this;
		if (this.options.clickToFront) {
			b.click(function() {
				c.toTop()
			})
		}
		jQuery('.close', b).click(function() {
			c.hide();
			return false
		}).mousedown(function(a) {
			a.stopPropagation()
		})
	},
	_fire: function(a) {
		this.options[a].call(this)
	}
};