$(document).ready(function() {

    $(".actcontent .box").click(function() {
        var currentId = ($(".actcontent .box.isselected").attr("id")).substr(3);
        var selectedId = ($(this).attr("id")).substr(3);
        if (currentId !== selectedId) {
            $(".actcontent .image img").fadeOut(1000);
            $(".actcontent .image #img" + selectedId).fadeIn(1000);
            $(".actcontent .image .caption").slideUp(500);
            window.setTimeout(function() { $(".actcontent .image #cap" + selectedId).slideDown(500); }, 500);
        }
        $(".actcontent .box").removeClass("isselected");
        $(this).addClass("isselected");
    });

    var toPrepend = "<div class='arrow'>&#187</div>";
    $(".main .maincontent .tsmain .tsbody .tsline").prepend(toPrepend);
    $(".main .maincontent .trmain .tsbody .tsline .text").before(toPrepend);

    $(".main .maincontent .tsmain .tsbody .tsline:even").addClass("even");

    $(".main .maincontent .colleft .tnm-area .tnm-box .tnm-body ul li a").click(function(e) {
        var href = $(this).attr("href");
        window.open(href, 'title', 'width=1000,height=550,resizable=yes,scrollbars=yes');
        e.preventDefault();
    });
    
    $(".main .maincontent .colmid .news-area .news-wrapper .news-body .news-box .body a").click(function(e) {
        var href = $(this).attr("href");
        window.open(href, 'title', 'width=1000,height=550,resizable=yes,scrollbars=yes');
        e.preventDefault();
    });
    
    $(".main .maincontent .tsmain .tsbody .tsline .text a").click(function(e) {
        var href = $(this).attr("href");
        window.open(href, 'title', 'width=1000,height=550,resizable=yes,scrollbars=yes');
        e.preventDefault();
    });
    
    $(".main .maincontent .trmain .tsbody .tsline .text a").click(function(e) {
        var href = $(this).attr("href");
        window.open(href, 'title', 'width=1000,height=550,resizable=yes,scrollbars=yes');
        e.preventDefault();
    });

    $(".main .maincontent .gmmain .gmbody .gmbox:nth-child(3n)").addClass("last");
    
    $(".main .maincontent .gdmain .gdbody .gdbox:nth-child(6n)").addClass("last");
    $('a.lightbox').lightBox();

    var numsilde = $(".video-area .slides .slide").length;
    $(".video-area .slides .slide").hide();
    var initslide = 0;
    $(".video-area .slides #s" + initslide).show();

    $(".video-area .goright").click(function(){
        initslide = (initslide + 1) % numsilde;
        $(".video-area .slides .slide").hide();
        $(".video-area .slides #s" + initslide).show();
    });
    
    $(".video-area .goleft").click(function(){
        initslide = initslide - 1;
        if(initslide < 0 )initslide = numsilde - 1;
        $(".video-area .slides .slide").hide();
        $(".video-area .slides #s" + initslide).show();
    });

});


