﻿function getTotalHeight() {

    if ($.browser.msie) {
        return document.compatMode == "CSS1Compat" ? document.documentElement.clientHeight :
                         document.body.clientHeight;
    } else {
        return self.innerHeight;
    }
}

function getTotalWidth() {

    if ($.browser.msie) {
        return document.compatMode == "CSS1Compat" ? document.documentElement.clientWidth :
                         document.body.clientWidth;
    } else {
        return self.innerWidth;
    }
}

function getContextPath() {
    var path = window.document.location.pathname;
    if (path.substr(0,5) == "/Web/") {
        return "/Web/";
    }
    else {
        return "/";
    }
}

var contextPath = getContextPath();

function openPalyWin(player, vId) {
    player.pause();
    player.stopBuffering();
    window.open(contextPath + "Video/ShowWin.aspx?vId=" + vId, "playWindow", "height=480, width=610, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no");
}

function openPalyWin2(vId) {
    window.open(contextPath + "Video/ShowWin.aspx?vId=" + vId, "playWindow", "height=480, width=610, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no");
}

function checkNumber(str) {
    var Letters = "1234567890";
    var i;
    var c;
    for (i = 0; i < str.length; i++) {
        c = str.charAt(i);
        if (Letters.indexOf(c) == -1) {
            return true;
        }
    }
    return false;
}

var screenWidth = screen.width - 25;
var offsetWidth = (screenWidth - 1000) / 2 - 200;
if (offsetWidth > 0) {
    offsetWidth = 0;
}

$(function () {

    //2011春节
    //if (screenWidth > 1400) {
    //    $("#containerOut").css("width", "1400px");
    //}

    //$("#containerOut").css("background", "url(" + contextPath + "Themes/Default/images/2011CNY.jpg) " + offsetWidth + "px 0 no-repeat");
    //$("#containerOut").css("padding-top", "90px");

    //视频缩略图tip
    $('a.videoA').cluetip({ cluetipClass: 'jtip', arrows: true, dropShadow: false });
    $('a.videoA1').cluetip({ cluetipClass: 'jtip', arrows: true, dropShadow: false });
    $('a.videoA').mouseover(function () {
        $(this).parent().find('div div').css("visibility", "visible")
    });
    $('a.videoA').mouseout(function () {
        $(this).parent().find('div div').css("visibility", "hidden")
    });


    //友情链接
    $("select[name='fl']").change(function () {
        if ($(this).val() != 0) {
            window.open($(this).val());
        }
    });

    //公告先进tab
    $("div[id='ggxj_top'][class='right-panel-tab_top'] div").hover(function () {
        var idx = $("div[id='ggxj_top'][class='right-panel-tab_top'] div").index($(this));

        $("div[id='ggxj_top'][class='right-panel-tab_top'] div:not(" + idx + ")").removeClass("current");
        $("div[id='ggxj_top'][class='right-panel-tab_top'] div:eq(" + idx + ")").addClass("current");

        if (idx == 0) {
            $("#gg").css("display", "block");
            $("#xj").css("display", "none");
            $("#ggxj-more").attr("href", contextPath + 'List.aspx?mId=96');
            $("#ggxj-more").attr("title", '更多公告公示');
        }
        if (idx == 1) {
            $("#gg").css("display", "none");
            $("#xj").css("display", "block");
            $("#ggxj-more").attr("href", contextPath + 'List.aspx?mId=97');
            $("#ggxj-more").attr("title", '更多先进排行');
        }
    });

    //中间新闻tab
    $("div[id='news_top'] ul li").hover(function () {
        var idx = $("div[id='news_top'] ul li").index($(this));
        $("div[id='news_top'] ul li:not(" + idx + ")").removeClass("current");
        $("div[id='news_top'] ul li:eq(" + idx + ")").addClass("current");
        $("div[id='news_content'] div[class='news_content_content']:not(" + idx + ")").css("visibility", "hidden");
        $("div[id='news_content'] div[class='news_content_content']:eq(" + idx + ")").css("visibility", "visible");
    });

});

