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://web.search.cctv.com/prosearch.php"; http: 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.q.value = form1.text.value; }
        document.forms[this.searchFormName].submit(); return false;
    } catch (e) { return true; } 
}; var hp = {}; hp.theme_cookiename = hp_theme_cookiename; function emptyfn() { }
hp.set_layout_default = function(t) { hp.setTheme(hp_theme_default); if (typeof layout_lstid == 'number' && layout_lstid != NaN) { hp.cookie(hp_layout_lstid_cookiename, layout_lstid); } }; 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.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]; return [b, c]; }; hp.oa = function() { var c; c = document.getElementById(hp.ca); if (c) { c.parentNode.removeChild(c); } }; 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 wTab2(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(wTab2.prototype, { bind_click: wTab.prototype.bind_click, bind_hover: wTab.prototype.bind_hover, 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.addClass('hide'); jq(this.cons[idx]).removeClass('hide'); 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 && swf_clock.setColor(t == 'gray' ? 'hei' : 'bai'); hp.cookie(hp.theme_cookiename, t); lnk.href = get_theme_csspath(t); }
        hp.setTheme = setT; 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 = -458, ph = 240, tabw = 87, 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); } 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(); } 
        } 
    })(); jQuery("#column_1 > .md > .mh > .tabs, #column_2 > .md > .mh > .tabs").each(function(_, tab) {
        var tabs = jq('> li', tab), idx = tabs.index(tabs.filter('.cur')); if (idx == -1) { idx = 0; }
        new wTab2({ tabs: tabs, cons: jq('> .mb > .mbsub', tab.parentNode.parentNode), evtype: 'hover', curIdx: idx });
    });
})();