var jq = jQuery;
jq.noConflict();
( function() {
	var lb = function(a, b) {
		var c = a.fw;
		if (arguments.length > 2) {
			var d = Array.prototype.slice.call(arguments, 2);
			if (c) {
				d.unshift.apply(d, c)
			}
			c = d
		}
		b = a.hw || b;
		a = a.gw || a;
		var e, f = b || qa;
		if (c) {
			e = function() {
				var g = Array.prototype.slice.call(arguments);
				g.unshift.apply(g, c);
				return a.apply(f, g)
			}
		} else {
			e = function() {
				return a.apply(f, arguments)
			}
		}
		e.fw = c;
		e.hw = b;
		e.gw = a;
		return e
	};
	var ArraySlice = Array.prototype.slice;
	Function.prototype.bind = function(a) {
		if (arguments.length > 1) {
			var b = ArraySlice.call(arguments, 1);
			b.unshift(this, a);
			return lb.apply(null, b)
		} else {
			return lb(this, a)
		}
	};
	Function.prototype.partial = function() {
		var a = ArraySlice.call(arguments);
		a.unshift(this, null);
		return lb.apply(null, a)
	};
	Function.prototype.inherits = function(a) {
		BV(this, a)
	};
	var BV = function(a, b) {
		function c() {
		}
		c.prototype = b.prototype;
		a.F = b.prototype;
		a.prototype = new c;
		a.prototype.constructor = a
	};
	Function.prototype.mixin = function(a, b) {
		var P = this.prototype;
		if (typeof b == 'undefined') {
			b = 1
		}
		if (b) {
			for ( var i in a) {
				P[i] = a[i];
			}
		} else {
			for ( var i in a) {
				(!(i in P)) && (P[i] = a[i]);
			}
		}
	};
})();
function Dict(a) {
	for ( var i in a) {
		this[i] = a[i];
	}
}
Dict.mixin( {
	"keys" : function() {
		var b = [];
		for ( var i in this) {
			b.push(i);
		}
		return b;
	},
	"values" : function() {
		var b = [];
		for ( var i in this) {
			b.push(this[i]);
		}
		return b;
	},
	"items" : function() {
		var b = [];
		for ( var i in this) {
			b.push( [ i, this[i] ]);
		}
		return b;
	}
});
var PageBar = {};
var searchtype = 1;
PageBar.searchFormName = "bar_search_form1";
PageBar.switchSearchType = function(oi) {
	if (!PageBar.searchTypeBtns) {
		var btns = jq(oi).parent().find(">span.search-type");
		PageBar.searchTypeBtns = {
			"video" :btns.eq(0),
			"web" :btns.eq(1)
		}
		btns = null;
	}
	var targetType = oi.getAttribute('rel');
	var theForm = document.forms[this.searchFormName];
	if (!targetType) {
		targetType = 'video'
	}
	if (targetType == "video") {
		PageBar.searchTypeBtns["video"].addClass("search-type-on");
		PageBar.searchTypeBtns["web"].removeClass("search-type-on");
		theForm["action"] = "http://vsearch.cctv.com/";
		theForm["method"] = "post";
		searchtype = 2;
		jq("#btnSearch").val("��Ƶ����");
	} else if (targetType == "web") {
		PageBar.searchTypeBtns["video"].removeClass("search-type-on");
		PageBar.searchTypeBtns["web"].addClass("search-type-on");
		theForm["action"] = "http://web.search.cctv.com/websearch.php";
		theForm["method"] = "get";
		searchtype = 1;
		jq("#btnSearch").val("��ҳ����");
	}
};
PageBar.submitSearchForm = function() {
	try {
		var form1 = document.forms[this.searchFormName];
		if (searchtype == 1) {
			form1.q.value = form1.text.value;
		} else if (searchtype == 2) {
			form1.content.value = form1.text.value;
			form1.title.value = '';
			form1.from_date.value = '';
			form1.to_date.value = '';
		}
		document.forms[this.searchFormName].submit();
		return false;
	} catch (e) {
		return true;
	}
};
var Drag;
( function() {
	var jq_b = jq.browser, ua = navigator.userAgent;
	var Browser = new Object();
	Browser.isMozilla = jq_b.mozilla;
	Browser.isIE = jq_b.msie;
	Browser.isGecko = ua.indexOf("Gecko") != -1;
	Browser.isOpera = jq_b.opera;
	function fixE(a) {
		if (typeof a == "undefined") {
			a = window.event;
		}
		if (typeof a.layerX == "undefined")
			a.layerX = a.offsetX;
		if (typeof a.layerY == "undefined")
			a.layerY = a.offsetY;
		if (typeof a.which == "undefined")
			a.which = a.button;
		if (!a.target && a.srcElement)
			a.target = a.srcElement;
		if (jq.browser.safari && a.target.nodeType == 3)
			a.target = a.target.parentNode;
		return a
	}
	function emptyFn() {
	}
	var ig_d = {
		obj :null,
		init : function(a, b) {
			a.onmousedown = ig_d.start;
			a.obj = b;
			if (isNaN(parseInt(b.style.left, 10)))
				b.style.left = "0px";
			if (isNaN(parseInt(b.style.top, 10)))
				b.style.top = "0px";
			b.onDragStart = emptyFn;
			b.onDragEnd = emptyFn;
			b.onDrag = emptyFn;
		},
		uninit : function(a, b) {
			window.clearInterval(b.qa);
			a.onmousedown = null;
			a.obj = null;
			b.onDragStart = null;
			b.onDragEnd = null;
			b.onDrag = null
		},
		start : function(a) {
			a = fixE(a);
			if (a.target != this) {
				return
			}
			var b = ig_d.obj = this.obj;
			if (a.which != 1) {
				return true
			}
			b.onDragStart(a);
			var c = a.clientY;
			if (!jq.browser.safari) {
				c += document.body.scrollTop
			}
			b.lastMouseX = a.clientX;
			b.lastMouseY = c;
			b.offsetMouseX = parseInt(b.style.left, 10) - a.clientX;
			b.offsetMouseY = parseInt(b.style.top, 10) - c;
			document.onmouseup = ig_d.end;
			document.onmousemove = ig_d.drag;
			return false
		},
		drag : function(a) {
			a = fixE(a);
			if (a.which == 0) {
				return ig_d.end()
			}
			var b = ig_d.obj, c = a.clientY;
			if (!jq.browser.safari) {
				c += document.body.scrollTop
			}
			var d = a.clientX;
			if (b.lastMouseX == d && b.lastMouseY == c) {
				return false
			}
			var e = d + b.offsetMouseX, f = c + b.offsetMouseY;
			b.style.left = e + "px";
			b.style.top = f + "px";
			b.lastMouseX = d;
			b.lastMouseY = c;
			b.onDrag(e, f);
			return false
		},
		end : function(a) {
			a = fixE(a);
			document.onmousemove = null;
			document.onmouseup = null;
			window.clearInterval(ig_d.obj.qa);
			var b = ig_d.obj.onDragEnd();
			ig_d.obj = null;
			return b
		}
	};
	Drag = ig_d;
	function movescrollbar() {
		var elem = Drag.obj;
		var body_clientHeight = getclientHeight();
		var body_scrollHeight = getscrollHeight();
		var body_scrollTop = document.body.scrollTop;
		var body_scrollvalue = body_scrollTop;
		var winvalue = elem.root.offsetTop;
		var body_Height = document.body.offsetHeight;
		var step = 10;
		var winTop = body_clientHeight * 0.05;
		var winDown = body_clientHeight - winTop;
		if (elem.lastMouseY <= winTop) {
			winvalue = Math.max(0, elem.root.offsetTop - step);
			body_scrollvalue = Math.max(0, body_scrollTop - step);
		} else if (elem.lastMouseY >= winDown) {
			winvalue = Math.min(body_scrollHeight - elem.offsetHeight,
					elem.root.offsetTop + step);
			body_scrollvalue = Math.min(body_scrollHeight - body_clientHeight,
					body_scrollTop + step);
		}
		var ig_l = body_scrollvalue - body_scrollTop;
		if (ig_l != 0) {
			if ((body_scrollHeight - winvalue) < elem.root.offsetHeight)
				winvalue = body_scrollHeight - elem.root.offsetHeight;
			elem.root.style.top = winvalue + "px";
			document.body.scrollTop = body_scrollvalue;
		}
	}
})();
function getclientHeight() {
	if (window.innerHeight < document.body.clientHeight) {
		return window.innerHeight
	}
	return document.body.clientHeight
}
function getscrollHeight() {
	if (document.body.scrollHeight > document.documentElement.clientHeight) {
		return document.body.scrollHeight
	} else {
		return document.documentElement.clientHeight
	}
}
function updateDisplay() {
}
if (jq.browser.opera || jq.browser.msie) {
	( function() {
		updateDisplay = function(el) {
			with (document.body) {
				style.zoom = "100%";
				style.zoom = '';
			}
		};
	})();
}
var _P = 'prototype';
var hp = {};
hp.dragTip = '\u79fb\u52a8/\u62c6\u5206\u7ec4\u5408\u4e00\u4e0b!\u5b9a\u5236\u5c5e\u4e8e\u81ea\u5df1\u7684CCTV.com \uff1a\uff09';
hp.layout_cookiename = hp_layout_cookiename;
hp.theme_cookiename = hp_theme_cookiename;
hp.initfinish = 0;
hp.cols = [];
hp.mds = [];
hp.ctx = null;
hp.mds.removeMd = function(md) {
	var hpMdsLen = this.length;
	for ( var i = 0; i < hpMdsLen; i++) {
		if (this[i] == md) {
			this[i] = this[hpMdsLen - 1]
			this.length = hpMdsLen - 1;
			return md;
		}
	}
	return null;
};
function emptyfn() {
}
hp.set_layout_default = function(t) {
	if (t === 'noconfirm'
			|| confirm('\u786e\u8ba4\u6062\u590d\u9ed8\u8ba4\u5e03\u5c40\u5417\uff1f')) {
		hp.cookie(hp.layout_cookiename, '');
		hp.cookie(hp.theme_cookiename, '');
		if (typeof layout_lstid == 'number' && layout_lstid != NaN) {
			hp.cookie(hp_layout_lstid_cookiename, layout_lstid);
		}
		location.reload();
	}
};
hp.cookie = function(cn, cv) {
	var args = Array.prototype.slice.apply(arguments), argsLen = args.length;
	if (argsLen == 0) {
		return '' + document.cookie;
	} else if (argsLen == 1) {
		var Tp = ';', c = cn + '=', d = String(document.cookie);
		for ( var e = -1; (e = d.indexOf(c, e + 1)) >= 0;) {
			var f = e;
			while (--f >= 0) {
				var g = d.charAt(f);
				if (g == Tp) {
					f = -1;
					break
				}
			}
			if (f == -1) {
				var h = d.indexOf(Tp, e);
				if (h < 0) {
					h = d.length
				}
				return d.substring(e + c.length, h)
			}
		}
		return null;
	} else {
		var now = new Date();
		now.setTime(now.getTime() + 2592000000);
		document.cookie = '' + cn + '=' + cv + "; expires=" + now.toGMTString();
		return hp.cookie(cn);
	}
};
hp.ca = "HP_pageDivMaskId";
hp.ba = "HP_moduleDivMaskId";
hp.va = function(a, b, c) {
	hp.oa();
	b = jq('<div>&nbsp;</div>').css('height', document.body.offsetHeight).attr(
			'id', hp.ca).appendTo(document.body)[0];
	if (0 && a && a.Ia) {
		c = b.cloneNode(true);
		b.id = hp.ba;
		b.style.height = a.a.offsetHeight - a.h.offsetHeight + "px";
		b.style.top = a.h.offsetHeight + "px";
		a.a.appendChild(b)
	}
	return [ b, c ];
};
hp.oa = function() {
	var a = [ hp.ba, hp.ca ], c;
	for ( var b = 0; b < a.length; b++) {
		c = document.getElementById(a[b]);
		if (c) {
			c.parentNode.removeChild(c);
		}
	}
	a = c = null;
};
hp.wa = function(a) {
	for ( var b = 0; b < hp.mds.length; b++) {
		var c = hp.mds[b];
		c.a.pagePosLeft = c.md.posInPage(true);
		c.a.boxWidth = c.a.offsetWidth;
		c.a.pagePosRight = c.a.pagePosLeft + c.a.boxWidth;
		c.a.boxHeight = c.a.offsetHeight;
		c.a.pagePosTop = c.md.posInPage(false);
		c.a.pagePosBottom = c.a.pagePosTop + c.a.boxHeight;
	}
	var d = a.a.nextSibling, aRootHeight = a.a.offsetHeight + 10;
	while (d) {
		d.pagePosTop -= aRootHeight;
		d.pagePosBottom -= aRootHeight;
		d = d.nextSibling
	}
};
hp.Sa = function() {
	if (!hp.initfinish) {
		return
	}
	var lay = {};
	_log('save layout S');
	hp.cols.each( function(idx, col) {
		var colid = parseInt(col.id.substring(7), 10), mids = [];
		jq('>div.md', col).each(
				function(idx, md) {
					var dnd = md.DND_Module;
					if (dnd.type == 'normal') {
						var mid = parseInt(dnd.h.id.substring(2), 10);
					} else if (dnd.type == 'tab') {
						mid = [];
						jq.each(dnd.subMds, function(idx, subMd) {
							mid.push(parseInt(subMd.tab.find('h2')[0].id
									.substring(2), 10));
						});
						mid.push(dnd.activeMd.tabIdx);
					}
					mids.push(mid);
				});
		lay[colid] = mids;
	});
	hp.cookie(hp.layout_cookiename, json.stringify(lay));
	_log('save layout E');
};
function Module_P_uninit() {
	if (this.h) {
		if (this.d) {
			this.d.onclick = null;
			this.d.onmouseup = null;
			this.d = null
		}
		Drag.uninit(this.h, this.a);
		this.a.onDragStart = null;
		this.a.onDrag = null;
		this.a.onDragEnd = null;
		this.h = null
	}
	this.btnMin.unbind('click');
	this.btnDel.unbind('click');
	for ( var i in this) {
		if (this.hasOwnProperty(i)) {
			this[i] = null;
		}
	}
}
function Module_P__dragStart(a) {
	hp.wa(this);
	this.origNextSibling = this.a.nextSibling;
	var b = divGhost, c = this.a.offsetHeight;
	c -= 4;
	var d = this.a.offsetWidth, e = this.md.posInPage(true), f = this.md
			.posInPage(false);
	this.md.css('width', d - 2);
	b.style.height = c + "px";
	this.a.parentNode.insertBefore(b, this.a.nextSibling);
	this.a.style.position = "absolute";
	this.a.style.zIndex = 10000;
	this.a.style.left = e + "px";
	this.a.style.top = f + "px";
	hp.va(this);
	this.v = false;
	updateDisplay();
	return false
}
function Module_P__drag(a, b) {
	if (!this.v) {
		this.a.style.filter = "alpha(opacity=60)";
		this.a.style.opacity = 0.6;
		this.v = true;
	}
	var c = null, d = 100000000;
	var theA = this.a;
	this.inModule = null;
	var k = divGhost;
	var mousePosY = theA.lastMouseY + jq.getPageOffset()[1];
	for ( var e = 0; e < hp.mds.length; e++) {
		var f = hp.mds[e], fa = f.a, g = a;
		if (this.lastInModule) {
			divGhostForMerge.css('display', 'none');
			this.lastInModule = null;
		}
		if (f != this && (this.type == 'normal')
				&& (f.type == 'normal' || f.type == 'tab')
				&& theA.lastMouseX >= fa.pagePosLeft
				&& theA.lastMouseX <= fa.pagePosRight
				&& mousePosY >= (fa.pagePosTop + 0)
				&& mousePosY <= (fa.pagePosBottom - 0)) {
			this.inModule = this.lastInModule = f;
			divGhostForMerge.css('display', '').css('left', fa.pagePosLeft - 2)
					.css('top', fa.pagePosTop - 2).css('width', fa.boxWidth)
					.css('height', fa.boxHeight);
			if (k.parentNode != null) {
				updateDisplay();
				k.parentNode.removeChild(k);
			}
			break;
		}
		if (document.body.dir == "rtl" && fa.offsetWidth == 1) {
			g += theA.offsetWidth
		}
		var h = Math.sqrt(Math.pow(g - fa.pagePosLeft, 2)
				+ Math.pow(b - fa.pagePosTop, 2));
		if (f == this)
			continue;
		if (isNaN(h))
			continue;
		if (h < d) {
			d = h;
			c = f
		}
	}
	if (this.inModule === null && c !== null && k.nextSibling != c.a) {
		c.a.parentNode.insertBefore(k, c.a);
		updateDisplay();
	}
}
function Module_P__dragEnd() {
	hp.oa();
	var needSave = 0;
	if (this.Da()) {
		needSave = 1;
	}
	if (this.inModule) {
		divGhostForMerge.css('display', 'none');
		this.lastInModule = null;
		switch (this.inModule.type) {
		case 'normal':
			TabModule.fromModules(this.inModule, this);
			needSave = 1;
			break;
		case 'tab':
			this.inModule._addSubMd(this);
			needSave = 1;
			break;
		}
	}
	if (needSave) {
		hp.Sa()
	}
	return true
}
function Module_P_Da() {
	var a = false;
	this.a.style.position = "";
	this.a.style.width = "";
	this.a.style.zIndex = "";
	this.a.style.filter = "";
	this.a.style.opacity = "";
	window.scrollBy(0, 0);
	var k = divGhost;
	if (k.parentNode != null) {
		if (k.nextSibling != this.origNextSibling) {
			k.parentNode.insertBefore(this.a, k.nextSibling);
			a = true;
		}
		k.parentNode.removeChild(k);
	}
	updateDisplay();
	return a
}
function ModulePix(a) {
	this.md = a;
	this.a = a[0];
}
Module.mixin( {
	type :"pix",
	uninit : function() {
		this.md = this.a = null
	}
});
function Module(a) {
	this.v = false;
	this.md = a;
	this.a = a[0];
	this.a.DND_Module = this;
	this.init();
}
Module
		.mixin( {
			type :"normal",
			init : function() {
				this.cmh = this.md.find('>.mh');
				this.mh = this.cmh.find('>h2');
				this.h = this.mh[0];
				this.h.title = hp.dragTip;
				this.mb = this.md.find('>.mb');
				this.Ia = this.mb.find('iframe');
				if (this.Ia.length < 1) {
					delete this.Ia;
				}
				this._minClick = this._minClick.bind(this);
				this._delClick = this._delClick.bind(this)
				this.btnMin = this.mh.find('>i.min');
				if (this.btnMin.length < 1) {
					this.mh
							.prepend('<i class="del" title="\u5173\u95ed">X</i><i class="min" title="\u6298\u53e0/\u5c55\u5f00">_</i>');
					this.btnMin = this.mh.find('>i.min');
				} else {
					this.btnMin.unbind('click');
				}
				this.btnMin.bind('click', this._minClick);
				this.btnDel = this.mh.find('>i.del').unbind('click').bind(
						'click', this._delClick);
				if (this.h) {
					Drag.init(this.h, this.a);
					this.a.onDragStart = this._dragStart.bind(this);
					this.a.onDrag = this._drag.bind(this);
					this.a.onDragEnd = this._dragEnd.bind(this);
				}
			},
			_urlMouseUp :emptyfn,
			_urlMouseDown :emptyfn,
			_urlClick :emptyfn,
			uninit :Module_P_uninit,
			Da :Module_P_Da,
			_dragStart :Module_P__dragStart,
			_drag :Module_P__drag,
			_dragEnd :Module_P__dragEnd,
			_minClick : function(ev) {
				this.mb.toggleClass('hide');
				if (this.mb.hasClass('hide')) {
					jq(ev.target).addClass('max');
				} else {
					jq(ev.target).removeClass('max');
				}
				updateDisplay();
			},
			_delClick : function() {
				if (confirm('\u786e\u8ba4\u5173\u95ed')) {
					hp.mds.removeMd(this);
					this.md.remove();
					setTimeout(updateDisplay, 0);
				}
			}
		});
function TabModuleSub(a, b, pmd, idx, tabnum) {
	this.tab = a;
	this.active = this.active.bind(this);
	this.deactive = this.deactive.bind(this);
	this._expClick = this._expClick.bind(this);
	this.btn = a.find('a').bind('click', this.active);
	(idx == 0) ? a.addClass("first") : a.removeClass("first");
	(idx == tabnum) ? a.addClass("last") : a.removeClass("last");
	this.btnExp = a.find('i.exp');
	if (this.btnExp.length < 1) {
		this.tab.find('h2').prepend('<i class="exp" title="���">X</i>');
		this.btnExp = a.find('i.exp');
	} else {
		this.btnExp.unbind('click');
	}
	this.btnExp.bind('click', this._expClick);
	this.mb = b;
	if (this.tab.hasClass('cur')) {
		this.mb.removeClass('hide');
	} else {
		this.mb.addClass('hide');
	}
	this.pmd = pmd;
	this.tabIdx = idx;
	if (b.length) {
		this.Ia = b.find('iframe');
		if (this.Ia.length < 1) {
			delete this.Ia;
		}
	}
}
TabModuleSub.mixin( {
	type :"tabsub",
	active : function(ev) {
		this.btn[0].blur();
		if (this.pmd.activeMd == this) {
			return true;
		}
		this.tab.addClass('cur');
		this.mb.removeClass('hide');
		this.pmd.activeMd && this.pmd.activeMd.deactive();
		this.pmd.activeMd = this;
		this.Ia && jq.browser.msie && this.Ia.each( function(idx, mb_iframe) {
			mb_iframe.src = mb_iframe.src;
		});
		updateDisplay();
		hp.Sa();
		return false;
	},
	deactive : function() {
		this.tab.removeClass('cur');
		this.mb.addClass('hide');
		if (this.pmd.activeMd == this) {
			this.pmd.activeMd = null;
		}
	},
	_expClick : function() {
		this.pmd._delSubMd(this);
	},
	uninit : function() {
		this.btn.unbind('click');
		this.btnExp.unbind('click');
		for ( var i in this) {
			if (this.hasOwnProperty(i)) {
				this[i] = null;
			}
		}
	}
});
TabModule.fromModules = function() {
	var mds = Array.prototype.slice.apply(arguments), mdsLen = mds.length;
	if (mdsLen < 2) {
		return;
	}
	var refMd = null;
	var tabMd = jq('<div class="md"/>'), tabMdTab = jq(
			'<div class="mh"><ul class="tabs"><li class="i"><i class="min">_</i><i class="del">X</i></li></ul></div>')
			.appendTo(tabMd).find('> ul.tabs'), tabMdMb = jq(
			'<div class="c-section mb">').appendTo(tabMd);
	try {
		for ( var i = 0; i < mdsLen; i++) {
			var _md = mds[i];
			if (_md.type != 'normal') {
				continue
			}
			var _mdMh = _md.mh, _mdMb = _md.mb, _mdMd = _md.md;
			hp.mds.removeMd(_md);
			if (refMd === null) {
				refMd = _mdMd;
			}
			_md.uninit();
			var licls = [];
			if (i == 0) {
				licls.push('first');
			} else if (i == mdsLen - 1) {
				licls.push('last cur');
			}
			licls = licls.join(' ');
			var liMh = jq('<li class="' + licls + '"/>');
			_mdMh.find('>i.min').remove();
			_mdMh.find('>i.del').attr('class', 'exp').attr('title',
					'\u62c6\u5206');
			liMh.append(_mdMh).appendTo(tabMdTab);
			var mbcls = [ 'mbsub' ];
			if (i != mdsLen - 1) {
				mbcls.push('hide');
			}
			_mdMb.attr('class', mbcls.join(' ')).appendTo(tabMdMb);
			if (refMd != _mdMd) {
				_mdMd.remove();
			}
		}
		tabMd.insertBefore(refMd);
		refMd.remove();
		var tabModule = new TabModule(tabMd);
		hp.mds.push(tabModule);
		return tabModule;
	} catch (ex) {
		_log(ex);
	}
};
function TabModule(a) {
	this.v = false;
	this.md = a;
	this.a = a[0];
	this.a.DND_Module = this;
	this.init();
}
TabModule.inherits(Module);
TabModule
		.mixin( {
			type :"tab",
			init : function() {
				this.cmh = this.md.find('>.mh');
				this.mh = this.cmh.find('>ul.tabs');
				this.h = this.mh[0];
				this.h.title = hp.dragTip;
				this.mb = this.md.find('>.mb');
				this._minClick = this._minClick.bind(this);
				this._delClick = this._delClick.bind(this);
				this.btnMin = this.mh.find('>li.i>i.min');
				if (this.btnMin.length < 1) {
					this.mh
							.prepend('<li class="i"><i class="min" title="\u6298\u53e0/\u5c55\u5f00">_</i><i class="del" title="\u5173\u95ed">X</i></li>');
					this.btnMin = this.mh.find('>li.i>i.min');
				} else {
					this.btnMin.unbind('click');
				}
				this.btnMin.bind('click', this._minClick);
				this.btnDel = this.mh.find('>li.i>i.del').unbind('click').bind(
						'click', this._delClick);
				if (this.h) {
					try {
						Drag.init(this.h, this.a);
						this.a.onDragStart = this._dragStart.bind(this);
						this.a.onDrag = this._drag.bind(this);
						this.a.onDragEnd = this._dragEnd.bind(this);
						this.subMds = [];
						this.subTabs = this.mh.find('>li').not('.i');
						this.subMbs = this.mb.find('>div.mbsub');
						this.activeMd = null;
						var tabnum = this.subTabs.length - 1;
						this.subTabs.each( function(idx, tab) {
							tab = this.subTabs.eq(idx);
							this.subMds[idx] = new TabModuleSub(tab,
									this.subMbs.eq(idx), this, idx, tabnum);
							(this.activeMd === null) && tab.hasClass('cur')
									&& (this.activeMd = this.subMds[idx]);
						}.bind(this));
						this.subTabs = this.subMbs = null;
						(this.activeMd === null) && this.subMds[0].active();
					} catch (ex) {
						_log(ex);
					}
				}
			},
			uninit : function() {
				this.btnMin.unbind('click');
				this.btnDel.unbind('click');
				if (this.h) {
					Drag.uninit(this.h, this.a);
					this.a.onDragStart = this.a.onDrag = this.a.onDragEnd = null;
				}
				for ( var i in this) {
					if (this.hasOwnProperty(i)) {
						this[i] = null;
					}
				}
			},
			_addSubMd : function(md) {
				if (md.type == 'normal') {
					var mdMh = md.mh, mdMb = md.mb, mdMd = md.md;
					hp.mds.removeMd(md);
					md.uninit();
					mdMh.find('>i.del').attr('class', 'exp').attr('title',
							'\u62c6\u5206');
					mdMh.find('>i.min').remove();
					mdMb.attr('class', 'mbsub');
					var mTab = jq('<li/>'), tabIdx = this.subMds.length;
					this.mh.append(mTab.append(mdMh));
					this.mb.append(mdMb);
					mdMd.remove();
					this.subMds[tabIdx] = new TabModuleSub(mTab, mdMb, this,
							tabIdx);
					this.subMds[tabIdx].active();
					return this;
				}
				return null;
			},
			_delSubMd : function(subMd) {
				var smTab = subMd.tab, smMb = subMd.mb, idx = subMd.tabIdx, subMds = this.subMds, subMdsLen = subMds.length, tLen = subMdsLen - 1, hpMds = hp.mds, hpMdsLen = hpMds.length;
				function buildModule(tab, mb, tabMd) {
					_log('buildModule tab, mb, tabMd: ', arguments);
					var mh = tab.find('h2');
					mh
							.find('i.exp')
							.attr('class', 'del')
							.attr('title', '\u5173\u95ed')
							.after(
									jq('<i class="min" title="\u6298\u53e0/\u5c55\u5f00">_</i>'));
					mb = mb.attr('class', 'c-section mb');
					return jq('<div class="md"/>').append(
							jq('<div class="mh"/>').append(mh)).append(mb)
							.insertAfter(tabMd.md);
				}
				for ( var i = idx + 1; i < subMdsLen; i++) {
					var tIdx = i - 1;
					subMds[i].tabIdx = tIdx;
					if (tIdx == 0) {
						subMds[i].tab.addClass('first')
					}
					if (tIdx == tLen - 1) {
						subMds[i].tab.addClass('last')
					}
					if (tIdx == idx) {
						subMds[i].active();
					}
					subMds[tIdx] = subMds[i];
				}
				if (idx == subMdsLen - 1) {
					subMds[tLen - 1].active();
				}
				subMds.length = tLen;
				subMd.uninit();
				var newMd = new Module(buildModule(smTab, smMb, this));
				smTab.remove();
				hpMds.push(newMd);
				subMdsLen = tLen;
				if (subMdsLen < 2) {
					subMd = subMds[0];
					smTab = subMd.tab;
					smMb = subMd.mb;
					subMd.deactive();
					subMd.uninit();
					newMd = new Module(buildModule(smTab, smMb, this));
					hpMds.push(newMd);
					hpMds.removeMd(this);
					this.md.remove();
					this.uninit();
				}
				if (newMd && newMd.a) {
					updateDisplay();
				}
				hp.Sa();
			}
		});
function enableDrag() {
	window.divGhost = jq('<div class="md_replace"/>')[0];
	window.divGhostForMerge = jq(
			'<div class="md_activeborder" style="display:none;"/>').appendTo(
			document.body);
	var columnids = [ "column_1", "column_2" ];
	for ( var i = 0; i < columnids.length; i++) {
		columnids[i] = "#" + columnids[i];
	}
	hp.cols = jq(columnids.join(","));
	function getmdinpage(mhid, autofix) {
		var _mh = jq("#m_" + mhid);
		var r = {};
		if (_mh.length) {
			var _md = _mh.parent();
			if (_md.is("div.mh")) {
				r.type = "normal";
				r.md = _md.parent();
				r.mh = _mh;
				r.mb = r.md.find(">.mb");
			} else if (_md.is("li")) {
				var idx = null;
				r.type = "tabsub";
				r.mh = _mh;
				r.tab = _md;
				_mh = r.tab.parent();
				_md = _mh.parent().parent();
				var elm_h2 = r.mh[0];
				jq.each(_mh[0].getElementsByTagName("h2"), function(_i, h2) {
					if (elm_h2 == h2) {
						idx = _i;
						return false;
					}
				});
				r.md = _md;
				r.mb = jq(_md.find('> .mb > .mbsub')[idx]);
				r.autoFix = function() {
					var _mbs = _md.find("> .mb > .mbsub");
					if (_mbs.length == 1) {
						_md.after(jq('<div class="md"/>').append(
								jq('<div class="mh"/>').append(_mh.find('h2')))
								.append(_mbs.attr("class", "c-section mb")));
						try {
							_md.remove();
							_mbs = _md = null;
						} catch (ex) {
							_log(ex)
						}
					}
				};
			}
			return r;
		} else {
			return null;
		}
	}
	var hp_layout = hp.cookie(hp.layout_cookiename);
	if (hp_layout) {
		hp_layout = json.parse(hp_layout);
		if (hp_layout) {
			hp.cols.css("display", "none");
			for ( var i in hp_layout) {
				var colid = "#column_" + i, col = jq(colid);
				if (!col.length) {
					continue
				}
				var mhids = hp_layout[i];
				for ( var j = 0; j < mhids.length; j++) {
					var mhid = mhids[j];
					if (mhid instanceof Array) {
						var curIdx = mhid.pop();
						var lastTab = lastMb = null;
						var themd = null, _mds = [], m;
						for ( var k = 0; k < mhid.length; k++) {
							m = jq('#m_' + mhid[k]);
							if (m && m.length) {
								_mds.push(mhid[k]);
							}
						}
						if (_mds.length == 0) {
							continue;
						} else if (_mds.length == 1) {
							var m = getmdinpage(_mds[0]);
							if (m && m.type) {
								if (m.type == "normal") {
									col.append(m.md);
								} else if (m.type == "tabsub") {
									col
											.append(jq('<div class="md"/>')
													.append(
															jq(
																	'<div class="mh"/>')
																	.append(
																			m.mh))
													.append(
															m.mb
																	.attr(
																			"class",
																			"c-section mb")));
									m.tab.remove();
									m.autoFix();
									delete m.tab;
								}
							}
							m = null;
						} else if (_mds.length > 1) {
							if (curIdx > _mds.length - 1) {
								curIdx = _mds.length - 1;
							}
							var firstLoop = true;
							for (k = _mds.length - 1; k >= 0; k--) {
								var m = getmdinpage(_mds[k]);
								if (firstLoop) {
									firstLoop = false;
									if (m.type == "normal") {
										m.tab = jq('<li/>').append(m.mh);
										m.md
												.find('>.mh')
												.append(
														jq('<ul class="tabs"/>')
																.append(m.tab))
												.end()
												.append(
														jq(
																'<div class="c-section mb"/>')
																.append(
																		m.mb
																				.attr(
																						"class",
																						"mbsub")));
									} else if (m.type == "tabsub") {
										m.tab.prependTo(m.tab.parent());
										m.mb.prependTo(m.mb.parent());
									}
									themd = m.md;
									lastTab = m.tab;
									lastMb = m.mb;
								} else {
									if (m.type == "normal") {
										m.tab = jq('<li/>').append(m.mh);
										lastTab.before(m.tab);
										lastMb.before(m.mb.attr("class",
												"mbsub"));
										m.md.remove();
										delete m.md;
									} else if (m.type == "tabsub") {
										lastTab.before(m.tab);
										lastMb.before(m.mb);
										if (m.md != themd) {
											m.autoFix();
											delete m.md;
										}
									}
									lastTab = m.tab;
									lastMb = m.mb;
								}
								(k === curIdx) ? m.tab.addClass("cur") : m.tab
										.removeClass("cur");
							}
							col.append(themd);
						}
					} else {
						var m = getmdinpage(mhid);
						if (m && m.type) {
							if (m.type == "normal") {
								col.append(m.md);
							} else if (m.type == "tabsub") {
								col.append(jq('<div class="md"/>').append(
										jq('<div class="mh"/>').append(m.mh))
										.append(
												m.mb.attr("class",
														"c-section mb")));
								m.tab.remove();
								m.autoFix();
								delete m.tab;
							}
						}
						m = null;
					}
				}
			}
			hp.cols.css("display", "");
		}
	}
	hp.cols.each( function(idx, col) {
		for ( var i = 0; i < col.childNodes.length; i++) {
			var c = col.childNodes[i];
			if (c.nodeType != 1) {
				col.removeChild(c);
			}
		}
		var md = jq('<div class="md_dm"><br/></div>').appendTo(col);
		hp.mds.push(new ModulePix(md));
	});
	jq('>div.md', hp.cols).each( function(idx, md) {
		md = jq(md);
		var mh = md.find('> .mh');
		if (mh.find('> h2').length) {
			hp.mds.push(new Module(md));
		} else if (mh.find('> ul.tabs').length) {
			if (mh.find('> ul.tabs > li').length) {
				hp.mds.push(new TabModule(md));
			} else {
				md.remove();
				md = null;
			}
		} else {
			md.remove();
			md = null;
		}
	});
	hp.initfinish = 1;
	if (jq.browser.msie) {
		with (document.body.style) {
			display = "none";
			display = "";
		}
		if (0 && jq.browser.version < "7") {
			jq("iframe", hp.cols).each( function(idx, iframe) {
				iframe.src = iframe.src;
			});
		}
	}
	hp.Sa();
}
var json = ( function() {
	var a = {
		"\u0008" :"\\b",
		"\t" :"\\t",
		"\n" :"\\n",
		"\u000c" :"\\f",
		"\r" :"\\r",
		'"' :'\\"',
		"\\" :"\\\\"
	}, b = {
		"boolean" : function(c) {
			return String(c)
		},
		number : function(c) {
			return isFinite(c) ? String(c) : "null"
		},
		string : function(c) {
			if (/["\\\x00-\x1f]/.test(c)) {
				c = c.replace(/([\x00-\x1f\\"])/g, function(d, e) {
					var f = a[e];
					if (f) {
						return f
					}
					f = e.charCodeAt();
					return "\\u00" + Math.floor(f / 16).toString(16)
							+ (f % 16).toString(16)
				})
			}
			return '"' + c + '"'
		},
		object : function(c) {
			if (c) {
				var d = [], e, f, g, h, i;
				if (c instanceof Array) {
					d[0] = "[";
					h = c.length;
					for (g = 0; g < h; g += 1) {
						i = c[g];
						f = b[typeof i];
						if (f) {
							i = f(i);
							if (typeof i == "string") {
								if (e) {
									d[d.length] = ","
								}
								d[d.length] = i;
								e = true
							}
						}
					}
					d[d.length] = "]"
				} else if (typeof c.hasOwnProperty === "function") {
					d[0] = "{";
					for (g in c) {
						if (c.hasOwnProperty(g)) {
							i = c[g];
							f = b[typeof i];
							if (f) {
								i = f(i);
								if (typeof i == "string") {
									if (e) {
										d[d.length] = ","
									}
									d.push(b.string(g), ":", i);
									e = true
								}
							}
						}
					}
					d[d.length] = "}"
				} else {
					return
				}
				return d.join("")
			}
			return "null"
		}
	};
	return {
		copyright :"(c)2005 JSON.org",
		license :"http://www.JSON.org/license.html",
		stringify : function(c) {
			var d = b[typeof c];
			if (d) {
				c = d(c);
				if (typeof c == "string") {
					return c
				}
			}
			return null
		},
		parse : function(c) {
			try {
				return !/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(c.replace(
						/"(\\.|[^"\\])*"/g, ""))
						&& eval("(" + c + ")")
			} catch (d) {
				return false
			}
		}
	}
})();
var _id;
( function() {
	var idcount = 0
	_id = function(obj, forceId) {
		switch (typeof obj.__id__) {
		case "undefined":
			if (obj instanceof String || typeof obj == 'string') {
				return '$' + obj;
			} else if (obj instanceof Number || typeof obj == 'number') {
				return '#' + obj;
			} else if (forceId) {
				obj.__id__ = '@' + (idcount++);
				return obj.__id__;
			}
		case "function":
			return obj.__id__();
		default:
			return obj.__id__;
		}
	}
})();
function wTab(cfg) {
	var this_ = this;
	this.btns = cfg.btns;
	this.tabs = cfg.tabs;
	this.cons = cfg.cons;
	this.curIdx = cfg.curIdx || 0;
	this.idxA = [ 0, this.tabs.length - 1 ];
	var evtype = 'bind_' + (cfg.evtype || 'click');
	if (this[evtype]) {
		this[evtype]();
	}
	if (this.btns) {
		jq(this.btns[0]).click( function() {
			this_.navTo(this_.curIdx - 1);
			return false;
		});
		jq(this.btns[1]).click( function() {
			this_.navTo(this_.curIdx + 1);
			return false;
		});
	}
	this.navTo(this.curIdx, 1);
}
jQuery.extend(wTab.prototype, {
	bind_click : function() {
		var this_ = this;
		this.tabs.each( function(idx, tab) {
			jq(tab).click( function(ev) {
				if (this_.navTo(idx)) {
					ev.stopPropagation();
					return false;
				}
			});
		});
	},
	bind_hover : function() {
		var this_ = this;
		this.tabs.each( function(idx, tab) {
			jq(tab).hover( function() {
				this_.navTo(idx);
			}, function() {
			});
		});
	},
	navTo : function(idx, f) {
		if ((idx < this.idxA[0] || idx > this.idxA[1])
				|| (this.curIdx == idx && !f))
			return false;
		this.curIdx = idx;
		this.tabs.removeClass('cur');
		jq(this.tabs[idx]).addClass('cur');
		this.cons.css('display', 'none');
		jq(this.cons[idx]).css('display', '');
		return true;
	}
});
( function() {
	( function() {
		var r = jq('#themes-selector');
		if (!r.length)
			return;
		var btns = r.find('> a'), lnk = document
				.getElementById('link_for_theme');
		if (!(btns.length && lnk))
			return;
		if (window.theme_cookie_to_save)
			hp.cookie(hp.theme_cookiename, window.theme_cookie_to_save);
		var swf_clock = window['swf_clock'] || document['swf_clock'];
		function setT(t) {
			swf_clock && swf_clock.setColor(t == 'gray' ? 'hei' : 'bai');
			hp.cookie(hp.theme_cookiename, t);
			lnk.href = get_theme_csspath(t);
		}
		btns.click( function() {
			this.blur();
			setT(this.className);
			return false;
		});
	})();
	function mixScroll(rid, b) {
		var inprogress = false, live_div = jq(rid);
		if (!live_div.length)
			return;
		var items = live_div.find("li"), btnPrev = live_div.find(">a.btn-prev"), btnNext = live_div
				.find(">a.btn-next"), p_item = live_div.find("ul"), p_itemP0 = p_item[0].parentNode, p_itemP = jq(p_itemP0), itemNum = items.length, lastItem = items[itemNum - 1], leftMax = lastItem.offsetLeft
				+ lastItem.offsetWidth, leftMin = 0, areaWidth = p_itemP0.offsetWidth;
		items.clone(true).appendTo(p_item);
		if (!items.length || leftMax <= areaWidth) {
			return;
		}
		btnPrev.click( function(ev) {
			leftCur = p_itemP0.scrollLeft;
			if (leftCur <= leftMin) {
				return false;
			}
			var leftTarget = Math.max(leftMin, leftCur - areaWidth);
			p_itemP.stop();
			p_itemP.animate( {
				"scrollLeft" :leftTarget
			}, {
				"duration" :400,
				"easing" :"swing"
			});
			return false;
		});
		btnNext.click( function(ev) {
			leftCur = p_itemP0.scrollLeft;
			if (leftCur >= leftMax) {
				return false;
			}
			var leftTarget = Math.min(leftMax, leftCur + areaWidth);
			p_itemP.stop();
			p_itemP.animate( {
				"scrollLeft" :leftTarget
			}, {
				"duration" :400,
				"easing" :"swing"
			});
			return false;
		});
		function autoScroll(r) {
			if (inprogress) {
				return;
			}
			if (r === true) {
				p_itemP0.scrollLeft = leftMin;
			}
			inprogress = true;
			p_itemP.stop();
			p_itemP.animate( {
				"scrollLeft" :leftMax
			}, {
				"duration" :(leftMax - p_itemP0.scrollLeft) * 18,
				"easing" :"linear",
				'complete' : function() {
					inprogress = false;
					setTimeout( function() {
						autoScroll(true);
					}, 0);
				}
			});
		}
		live_div.hover( function(e) {
			p_itemP.stop();
			inprogress = false;
		}, autoScroll);
		autoScroll(true);
	}
	mixScroll("#brand-show");
	( function() {
		var r = jq('#img_slide');
		if (!r.length)
			return;
		var ctl = jq('>div.ctl_bar', r), btnbar = jq('>div.btns', ctl), btns = jq(
				'a.prev, a.next', btnbar), playbtn = jq('a.play_pause', btnbar), tip = jq(
				'span.index_status', btnbar), tabs = jq(
				'>ul.imgs>li:not(:last-child)', ctl), tabcur = jq(
				'>ul.imgs>li:last-child', ctl), con = jq('>div.cons>div', r), total = tabs.length, idxA = [
				0, total - 1 ], curIdx = 0, pw = -727, ph = 248, tabw = 98, t_s = 1000;
		var default_play = true, delay_time = 8000, autoplay_process = jq('>i',
				tabcur), last_time = 0, autoplay_timer = null;
		playbtn.click( function(ev) {
			playbtn.toggleClass('on_pause');
			autoPlay(!playbtn.hasClass('on_pause'));
			return false;
		});
		if (default_play) {
			playbtn.removeClass('on_pause');
			//autoPlay(true);
			autoPlay(false);
		} else {
			playbtn.addClass('on_pause');
		}
		tabs.each( function(idx, tab) {
			jq(tab).click( function(ev) {
				navTo(idx);
				return false;
			});
		});
		var inNav = false;
		function navTo(idx) {
			if (inNav || curIdx == idx)
				return false;
			inNav = true;
			if (idx < idxA[0]) {
				idx = idxA[1];
				con.stop().animate( {
					'top' :ph
				}, {
					'duration' :t_s * .6,
					'complete' : function() {
						con.css('left', idx * pw);
						con.animate( {
							'top' :0
						}, {
							'duration' :t_s * .4,
							'complete' : function() {
								last_time = (new Date).getTime();
								inNav = false;
							}
						});
					}
				});
			} else if (idx > idxA[1]) {
				idx = idxA[0];
				con.stop().animate( {
					'top' :ph
				}, {
					'duration' :t_s * .6,
					'complete' : function() {
						con.css('left', idx * pw);
						con.animate( {
							'top' :0
						}, {
							'duration' :t_s * .4,
							'complete' : function() {
								last_time = (new Date).getTime();
								inNav = false;
							}
						});
					}
				});
			} else {
				con.stop().animate( {
					'left' :idx * pw
				}, {
					'duration' :t_s,
					'complete' : function() {
						last_time = (new Date).getTime();
						inNav = false;
					}
				});
			}
			tabcur.animate( {
				'left' :idx * tabw
			}, {
				'duration' :t_s * .6
			});
			curIdx = idx;
			tip.html((idx + 1) + '/' + total);
			return true;
		}
		function autoPlay(f) {
			if (autoplay_timer !== null) {
				clearInterval(autoplay_timer);
				autoplay_timer = null;
			}
			if (f) {
				autoplay_process.show();
				last_time = (new Date).getTime();
				autoplay_timer = setInterval(
						function() {
							if (!inNav) {
								var passed = (new Date).getTime() - last_time;
								if (passed >= delay_time) {
									navTo(curIdx + 1);
								} else {
									autoplay_process
											.css(
													'width',
													(((passed / delay_time) * 100 | 0) % 100) + '%');
								}
							}
						}, 80);
			} else {
				autoplay_process.hide();
			}
		}
	})();
	enableDrag();
})();