﻿var ajax = { post: function(url, func) { this.send(url, func); }, send: function(url, param, func) { var xmlhttp; var method = 'POST'; var MSXML = ['MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP']; if (!func) { method = 'GET'; func = param; param = null } if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { for (var n = 0; n < MSXML.length; n++) { try { xmlhttp = new ActiveXObject(MSXML[n]); break } catch (e) { } } } if (xmlhttp.readyState == null) { xmlhttp.readyState = 0; xmlhttp.addEventListener('load', function() { xmlhttp.readyState = 4; if (typeof xmlhttp.onreadystatechange == 'function') xmlhttp.onreadystatechange(); }, false); } with (xmlhttp) { try { url += (url.indexOf('?') > 0 ? '&' : '?') + 'ajaxrandom=' + Math.random(); xmlhttp.open(method, url, true); xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) func(xmlhttp.responseText); }; xmlhttp.send(param) } catch (e) { } } } };
var menutemp = null, pageflag = '', autotoplansplit = true, toplantimer = null, schkey = '请输入关键字...';
var logout = function() { if (confirm('确定要注销当前用户吗?')) ajax.send(siteroot + 'admin/handle/login.ashx?action=logout', function(res) { eval(res); }); };
var showlogin = function(val) { $('#boxlogin').css('display', val); };
var openlink = function(val) { if (val != '') { var open = document.createElement('a'); open.href = decodeURIComponent(val); open.target = '_blank'; document.body.appendChild(open); if (open.click) open.click(); else if (element.fireEvent) open.fireEvent('onclick'); else if (document.createEvent) { var evt = document.createEvent('MouseEvents'); evt.initEvent('click', true, true); open.dispatchEvent(evt); } open.parentNode.removeChild(open); } };
var setpoint = function(xuh, lx) { ajax.send(siteroot + 'ashx/common.ashx', 'action=point&lx=' + lx + '&xuh=' + xuh, function(res) { if (res != '') { if (lx == 'twxx') { $('#twxxdjl').html(res); } if (lx == 'fcxx') { $('#fcxxdjl').html(res); } } }); };
var settoplan = function(i) { $("#toplanflbl > label[class!='split']").removeClass('hover'); $('#toplanflbl').parent().find('ul.cl').hide(); $("#toplanflbl > label[class!='split']").eq(i).addClass('hover'); $('#toplanflbl').parent().find('ul.cl').eq(i).show(); if ($("#toplanflbl > label[class!='split']").length == 1) autotoplansplit = false; };
var autotoplan = function() { if (autotoplansplit) toplantimer = setInterval(function() { var len = $("#toplanflbl > label[class!='split']").length; var idx = $("#toplanflbl > label[class='hover']").attr('index'); settoplan((parseInt(idx) + 1) == len ? 0 : (parseInt(idx) + 1)); }, 5000); };
var menuchild = function(xuh) { $('#mclcxb').html('<img alt="loading" src="' + siteroot + 'resources/images/loading.gif" style="float:left;margin-top:7px;" />'); ajax.send(siteroot + 'ashx/common.ashx', 'action=menuchild&xuh=' + xuh, function(res) { if (res != '') $('#mclcxb').html(res); }); };
var showPic = function(src) { if (src == '') { alert('没有照片!'); return; } imageview(siteroot + src); };
var showAD = { timer: 3000, curve: function(t, b, c, d, s) { if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; return c / 2 * ((t -= 2) * t * t + 2) + b; }, fx: function(from, to, playTime, onEnd) { var Me = this, who = this.adWrap, position = 0, changeVal = to - from, curve = this.curve; playTime = playTime / 10; who.style.overflow = 'hidden'; function _run() { if (position++ < playTime) { who.style.height = Math.max(0, Math.abs(Math.ceil(curve(position, from, changeVal, playTime)))) + 'px'; setTimeout(_run, 10); } else { onEnd && onEnd.call(Me, to); } }; _run(); }, init: function(info) { var Me = this, loadImg = new Image; loadImg.src = info.endImgURL; window.onload = function() { Me.endImgURL = info.endImgURL; Me.img = document.getElementById(info.imgID); Me.adWrap = document.getElementById(info.adWrapID); var max = Me.img.height; setTimeout(function() { Me.fx(max, 0, 500, function(x) { /*this.img.src = this.endImgURL;*/this.img.parentNode.parentNode.removeChild(this.img.parentNode); this.curve = function(t, b, c, d) { if ((t /= d) < (1 / 2.75)) { return c * (7.5625 * t * t) + b } else if (t < (2 / 2.75)) { return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b } else if (t < (2.5 / 2.75)) { return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b } else { return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b } }; /*this.fx(0, this.img.height, 600)*/this.fx(0, 0, 1000); }); }, info.timeout || Me.timer); }; } };
/*showAD.init({ adWrapID: 'ad_box_2011_11', imgID: 'adImg', endImgURL: 'images/a.jpg' });*/
var setLRAD = function() { $('img.imgview').parent().css('padding-top', ($(window).height() > $('img.imgview').height() + 20) ? ($(window).height() - $('img.imgview').height()) / 2 - 20 : 0); $('img.imgclose').click(function() { $(this).parent().parent().remove(); }); };
var loadFCXX = function() { ajax.send(siteroot + 'ashx/common.ashx', 'action=fcxx', function(res) { if (res != '') { $('#fcxxcnt').html(res); setTimeout(function() { loadFCXX(); }, 8000); } }); };
$(function() {
    ajax.send(siteroot + 'admin/handle/login.ashx', 'action=status', function(res) { eval(res); });
    ajax.send(siteroot + 'ashx/common.ashx', 'action=total', function(res) { if (res != '') { $('#totalcount').html(res); } });
    $('#loginform').submit(function() { var form = $(this)[0]; if (form.UserName.value == '') { alert('帐号不能为空！'); return false; } if (form.Password.value == '') { alert('密码不能为空！'); return false; } ajax.send(siteroot + 'admin/handle/login.ashx', 'action=login&UserName=' + encodeURIComponent(form.UserName.value) + '&Password=' + encodeURIComponent(form.Password.value), function(res) { eval(res); }); return false; });
    $('#subsearch').mouseover(function() { $('#search').show(); }).mouseout(function() { setTimeout(function() { if ($('#scht').attr('show') == '' || $('#scht').attr('show') == 'true') $('#search').show(); else $('#search').hide(); }, 1000); });
    $('#scht').mouseover(function() { $(this).attr('show', 'true'); setTimeout(function() { if ($('#scht').attr('show') == '' || $('#scht').attr('show') == 'true') $('#search').show(); else $('#search').hide(); }, 1000); $(this).mouseout(function() { $(this).attr('show', 'false'); setTimeout(function() { if ($('#scht').attr('show') == '' || $('#scht').attr('show') == 'true') $('#search').show(); else $('#search').hide(); }, 1000); }); });
    $('#txtsearch').val(schkey).keydown(function(e) { var key = e.which; if (key == 13) { var val = $('#txtsearch').val(); if (val == '' || val == '请输入关键字...') alert('请输入关键字...'); else location.href = siteroot + 'search.aspx?key=' + encodeURIComponent(val); } }).click(function() { if ($(this).val() == '请输入关键字...') $(this).val(''); }).focus(function() { if ($(this).val() == '请输入关键字...') $(this).val(''); }).blur(function() { if ($(this).val() == '') $(this).val('请输入关键字...'); });
    $('#btnsearch').click(function() { var val = $('#txtsearch').val(); if (val == '' || val == '请输入关键字...') alert('请输入关键字...'); else location.href = siteroot + 'search.aspx?key=' + encodeURIComponent(val); });
    $("#toplanflbl > label[class!='split']").each(function(i) { if (i == 0) { settoplan(i); autotoplan(); } $(this).mouseover(function() { if (toplantimer != null) clearInterval(toplantimer); settoplan($(this).attr('index')); }).mouseout(function() { autotoplan(); }).attr('index', i); });
    $('#toplanflbl').parent().find('ul.cl').mouseover(function() { if (toplantimer != null) clearInterval(toplantimer); }).mouseout(function() { autotoplan(); });
    $('.srlan').each(function(i) { if (i == 0) $(this).first().addClass('nobortop'); });
    $('.sitemaptop').each(function(i) { if (i == 0) $(this).first().addClass('nomartop'); });
    $('#menuchildlist').mouseover(function() { $('#menuchildlist').attr('status', 'show').css('visibility', 'visible'); }).mouseout(function() { $('#menuchildlist').attr('status', 'hide'); setTimeout(function() { if ($('#menuchildlist').attr('status') == 'hide') { if (menutemp != null) menutemp.removeClass('temp'); menutemp = null; $('#menuchildlist').css('visibility', 'hidden'); } }, 1000); }).width($('.menu span').length * 82 - 7);
    $('#mclcxb').width($('.menu span').length * 82 - 22);
    $('.fbc').eq(2).css('margin-top', '22px');
    $('.fbc').eq(3).css('margin-top', '22px');
    $('.menu a').first().addClass('hover');
    $('.menu a').mouseover(function() { if ($(this).html() == '首页' || $(this).html() == '首 页') return; $('.menu a').removeClass('temp'); menuchild($(this).attr('flag')); menutemp = $(this); menutemp.addClass('temp'); $('#menuchildlist').attr('status', 'show').css('visibility', 'visible'); }).mouseout(function() { $('#menuchildlist').attr('status', 'hide'); setTimeout(function() { if ($('#menuchildlist').attr('status') == 'hide') { if (menutemp != null) menutemp.removeClass('temp'); menutemp = null; $('#menuchildlist').css('visibility', 'hidden'); } }, 1000); }).each(function(i) { if ($(this).attr('flag') == pageflag) { $('.menu a').removeClass('hover'); $(this).addClass('hover'); } });
    $('img.sval_dt').each(function(i) { if ($(this).width() > 500) $(this).width(500); });

    setLRAD();
    loadFCXX();
    
    (function() {
        if ($('.rlsbxtli').length > 1) {
            var sa = 20, sb = 1, sc = 45, sd = 1, se = 3000, sf = $('.rlsbxtli').length * sc, scrtimer = null, pause = false;
            $('#rlsbxtb').html($('#rlsbxta').html());
            function autoscrh() {
                scrtimer = setInterval(function() {
                    if (($('#rlsbxt')[0].scrollTop + sb) >= (sc * sd)) {
                        $('#rlsbxt')[0].scrollTop = (sc * sd) - sb;
                        sd++;
                        clearInterval(scrtimer);
                        setTimeout(function() { autoscrh(); }, se);
                    } else if (($('#rlsbxt')[0].scrollTop + sb) >= sf) {
                        $('#rlsbxt')[0].scrollTop = 0;
                        sd = 1;
                    }
                    if (!pause) $('#rlsbxt')[0].scrollTop += sb;
                }, sa);
            }
            setTimeout(function() { autoscrh(); }, se);
            $('#rlsbxt').mouseover(function() { pause = true; }).mouseout(function() { pause = false; });
        }
    })();
    (function() {
        $('#ciscrha').parent().width($('.cili').length * 154 * 2);
        if ($('.cili').length > 5) {
            $('#ciscrhb').html($('#ciscrha').html());
            var sa = 20, sb = 5, sc = 154, sd = 1, se = 3000, sf = $('#ciscrha').width(), scrtimer = null, pause = false;
            function autoscrh() {
                scrtimer = setInterval(function() {
                    if (($('#scrhbox')[0].scrollLeft + sb) >= (sc * sd)) {
                        $('#scrhbox')[0].scrollLeft = (sc * sd) - sb;
                        sd++;
                        clearInterval(scrtimer);
                        setTimeout(function() { autoscrh(); }, se);
                    } else if (($('#scrhbox')[0].scrollLeft + sb) >= sf) {
                        $('#scrhbox')[0].scrollLeft = 0;
                        sd = 1;
                    }
                    if (!pause) $('#scrhbox')[0].scrollLeft += sb;
                }, sa);
            }
            setTimeout(function() { autoscrh(); }, se);
            $('#scrhbox').mouseover(function() { pause = true; }).mouseout(function() { pause = false; });
        }
    })();
    (function() {
        if ($('.slrb').length > 2) {
            var sa = 20, sb = 5, sc = 208, sd = 1, se = 3000, sf = $('.slrb').length * sc, scrtimer = null, pause = false;
            $('#slbxtb').html($('#slbxta').html());
            $('#slbxt').height(3 * sc - 25);
            function autoscrh() {
                scrtimer = setInterval(function() {
                    if (($('#slbxt')[0].scrollTop + sb) >= (sc * sd)) {
                        $('#slbxt')[0].scrollTop = (sc * sd) - sb;
                        sd++;
                        clearInterval(scrtimer);
                        setTimeout(function() { autoscrh(); }, se);
                    } else if (($('#slbxt')[0].scrollTop + sb) >= sf) {
                        $('#slbxt')[0].scrollTop = 0;
                        sd = 1;
                    }
                    if (!pause) $('#slbxt')[0].scrollTop += sb;
                }, sa);
            }
            setTimeout(function() { autoscrh(); }, se);
            $('#slbxt').mouseover(function() { pause = true; }).mouseout(function() { pause = false; });
        }
        $('.slrb').first().css('margin-top', '0');
    })();
});
$(function() {
    if (!document.getElementById('logo')) return;
    var flashlogo = new SWFObject('resources/images/logo.swf', 'movie', '415', '449', '7', '');
    flashlogo.addParam('allowFullScreen', 'true');
    flashlogo.addParam('allowScriptAccess', 'always');
    flashlogo.addParam('quality', 'high');
    flashlogo.addParam('wmode', 'Transparent');
    flashlogo.write('logo');
});
$(function() {
    if (!document.getElementById('space')) return;
    var flashspace = new SWFObject('resources/images/kouhao.swf', 'smovie', '587', '137', '7', '');
    flashspace.addParam('allowFullScreen', 'true');
    flashspace.addParam('allowScriptAccess', 'always');
    flashspace.addParam('quality', 'high');
    flashspace.addParam('wmode', 'Transparent');
    flashspace.write('space');
});
$(function() {
    if (!document.getElementById('imgView')) return;
    var pw = 260;
    var ph = 175;
    var sizes = 12;
    var Times = 5000;
    var umcolor = 0xFFFFFF;
    var btnbg = 0xFF7E00;
    var txtcolor = 0xFFFFFF;
    var txtoutcolor = 0x2B2B2B;
    var flash = new SWFObject('resources/images/focus.swf', 'mymovie', pw, ph, '7', '');
    flash.addParam('allowFullScreen', 'true');
    flash.addParam('allowScriptAccess', 'always');
    flash.addParam('quality', 'high');
    flash.addParam('wmode', 'Transparent');
    flash.addVariable('pw', pw);
    flash.addVariable('ph', ph);
    flash.addVariable('sizes', sizes);
    flash.addVariable('umcolor', umcolor);
    flash.addVariable('btnbg', btnbg);
    flash.addVariable('txtcolor', txtcolor);
    flash.addVariable('txtoutcolor', txtoutcolor);
    flash.addVariable('urls', urls);
    flash.addVariable('Times', Times);
    flash.addVariable('titles', titles);
    flash.addVariable('imgs', imgs);
    flash.write('imgView');
});
$(window).resize(function() { setLRAD(); });
$(window).load(function() { var h = $('#content').height(); if ($('body').hasClass('idx')) { if (h < 1277) $('#content').height(1277); } else { if (h < 1066) $('#content').height(1066); } });
