﻿var submenu = [[["咨询预约流程", "/news-733.aspx"], ["网络在线咨询", "/consultation/"]], [["1栋心理咨询室", "/category-52.aspx"], ["3栋心理咨询室", "/category-53.aspx"], ["7栋心理咨询室", "/category-54.aspx"], ["11栋心理咨询室", "/category-56.aspx"], ["14栋心理咨询室", "/category-57.aspx"], ["18栋心理咨询室", "/category-58.aspx"], ["22栋心理咨询室", "/category-59.aspx"], ["26栋心理咨询室", "/category-511.aspx"], ["27栋心理咨询室", "/category-512.aspx"]]];
var bcontent = ["<div class='newstitle'>中心简介</div>", "<div class='newstitle'>教师风采</div>", "<div class='newstitle'>成果展示</div>", "<div class='newstitle'>媒体报道</div>"];
var bc = ["<div id='zxjjtext' onclick='getajax(\"zxjj\");'>南昌大学心理健康教育中心（以下简称中心）前身之一是1988年成立的江西大学心理咨询中心，2004年11月更名为“心理健康教育中心”。中心是一个集心理健康教育工作、教学、心理咨询与科研为一体的处级单位，负责对全校五个校区心理健康教育的规划、组织、协调和实施。<br><font color='red'>单击查看完整内容</font></div>",
          "<ul><li onclick='getajax(\"cjh\")'><img class='left' src='js/cjh.gif' alt='陈建华老师' />陈建华老师,教授、硕士生导师，南昌大学心理健康教育中心主任</li><li onclick='getajax(\"gmc\")'><img class='left' src='js/gmc.gif' alt='高美才老师' />高美才老师,硕士,讲师,南昌大学心理健康教育中心副主任</li><li onclick='getajax(\"zx\")'><img class='left' src='js/zx.gif' alt='郑霞老师' />郑霞老师,硕士,南昌大学心理健康教育中心老师,国家二级心理咨询师</li><li onclick='getajax(\"hyt\")'><img class='left' src='js/hyt.gif' alt='黄雅婷老师' />黄雅婷老师，本科，中共党员，南昌大学心理健康教育中心专职教师</li><li onclick='getajax(\"ly\")'><img class='left' src='js/ly.gif' alt='李阳老师' />李阳老师，硕士，南昌大学心理健康教育中心教师</li></ul><div class='clear'></div>",
          "<img style='margin-left:-20px;' src='upload/tp1.jpg' width='200' /><img src='upload/tp2.jpg' width='200'  /><img src='upload/jq1.jpg' width='200'  /><img src='upload/jq2.jpg' width='200'  />", 
          "4"];
var p;
var c;
var blc;
var lasth="";
var lindex = 0;
var de=document.documentElement;
var base = location.href.substring(0,location.href.lastIndexOf("/")+1);
function _g(o) {return document.getElementById(o); }
$(document).ready(function() {
    $(".submenu").hide();
    $(".newslist").hide();
    $(".newslist:first").fadeIn("slow");
    $("#bcontent").hide().html(bcontent[1] + "<div class='bcbox'>" + bc[1] + "</div>").fadeIn("slow");
    $("#newshead li:first").addClass("nhselect");
    $(".menu li").click(function() {
        var h = $(this).attr("title");
        if (h) {
            $(".menu li").removeClass("menuhover");
            $(".menu").animate({ marginTop: '-38px' }, 200, null, function() { $(".submenu").hide("fast").fadeIn("fast").html(gensubmenu(h)); });
            $(this).addClass("menuhover");
        }
        if (h == "1" && lasth == h) {
            location.href = "/category-51.aspx";
        }
        lasth = h;
    });
    $(".menu li").mouseover(function() {
        $(".menu li").removeClass("menuon");
        $(this).addClass("menuon");
    });
    $(".menu li").mouseout(function() { $(this).removeClass("menuon"); });
    $(".menu li img").parent().css("padding", "0");
    $("#newshead li").click(function() {
        $("#newshead li").removeClass("nhselect");
        $(this).addClass("nhselect");
        $(".newslist").hide();
        $(".newslist:eq(" + $("#newshead li").index(this) + ")").fadeIn("slow");
    });
    $("#blist li:eq(1)").css("backgroundColor", "#bae0fe");
    $("#blist li").click(function() {
        blc = $("#blist li").index(this);
        $("#bcontent").hide().html(bcontent[$("#blist li").index(this)] + "<div class='bcbox'>" + bc[$("#blist li").index(this)] + "</div>").fadeIn("slow").attr("index", $("#blist li").index(this));
        $("#blist li").css("backgroundColor", "#f7feff");
        $(this).css("backgroundColor", "#bae0fe");
    });
    $("#cright a").mouseover(function() {
        $("#cright a").css("background", "transparent");
        $(this).css("backgroundColor", "#bde0ff");
        $("#aback").hide();
    });
    $("#fnnav").mouseover(function() {
        $("#fnnav").css({ "position": "absolute" }).animate({ width: "420px", height: "363px" }, 500);
        $("#xljkflash").hide();
    });
    $("#fnnav").mouseout(function() {
        $("#fnnav").css({ "position": "relative" }).animate({ width: "238px", height: "180px" }, 500);
        $("#xljkflash").show();
    });
    window.onscroll = function() { $("#float").animate({ marginTop: de.scrollTop }, 100); }
    $("#ht").css("color", "red");
});

function ajaxget(url, dis) {
    var ajaxtimeout = setTimeout("timeout()", 10000);
    $("#lightbox").css("height", $("#content").height() + 2).html("<img id='loadingimg' src='images/loading.gif' />").show().click(function() { $("#lightbox").hide(); $("#ajaxdis").fadeOut("fast"); $("embed").show(); });
    $.get(url, function(src) {
        clearTimeout(ajaxtimeout);
        $("#lightbox").html("");
        $("#ajaxdis").hide().html("<div id='adclose'><div id='adt'>单击任意外围黑色部分或右侧的关闭退出</div><div id='adc'>X 关闭</div></div><div id='adcontent'>" + src + "</div>").fadeIn("slow");
        $("embed").hide();
        $("#adcontent").css("padding", "8px");
        $("#ajaxdis").css("height", /*"auto" */parseInt($("#adcontent").height()) + 50 + "px").css("top", de.scrollTop + "px");
        $("#adc").click(function() { $("#lightbox").hide(); $("#ajaxdis").fadeOut("fast").hide(); $("embed").show(); });
    });
}

function timeout() {
    alert("网络连接超时,请重试!");
    $("#lightbox").hide();
}

function d_imgnav() {
/*
    var imgnavnum = "";
    var appenddata="";
    var fnshow;
    $("#navimg").attr("src", imgnav[0][1]);
    $("#fntext").html("<a href='" + imgnav[0][2] + "' target='_blank'>" + imgnav[0][0] + "</a>");
    $("#flashnav").unbind("click");
    $("#flashnav").click(function() { window.open(imgnav[0][2]); });
    for (i = 0; i < imgnav.length; i++) {
        imgnavnum += "<div class='imgnavnum'>" + (imgnav.length - i) + "</div>";
        appenddata+=("<img src='" + imgnav[i][1] + "'/>");
    }
    $("#content").append("<div id='appenddata' style='display:none'>"+appenddata+"</div>");
    $("#fnnav").html(imgnavnum);
    fnshow = setInterval("changefnimage()", 10000);
    $(".imgnavnum:last").css({ background: "#ff0000" });
    $(".imgnavnum").mouseover(function() {
        var index = parseInt($(this).html()) - 1;
        if (lindex != index) {
            lindex = index;
            $(".imgnavnum").css({ background: "#50b0fb" });
            $(this).css({ background: "#ff0000" });
            $("#navimg").fadeOut(500);
            setTimeout('$("#navimg").attr("src", imgnav[' + index + '][1]).fadeIn(500);', 300);
            $("#fntext").html("<a href='" + imgnav[index][2] + "' target='_blank'>" + imgnav[index][0] + "</a>");
            $("#flashnav").unbind("click");
            $("#flashnav").click(function() { window.open(imgnav[index][2]); });
        }
        fnshow = clearInterval(fnshow);
    });
    $("#navimg,#fntext").mouseover(function() { fnshow = clearInterval(fnshow);});
    $("#navimg,.imgnavnum,#fntext").mouseout(function() { fnshow = setInterval("changefnimage()", 10000); });
*/
}

function gensubmenu(i) {
    if (i==null) {
        return $(".submenu").html();
    }
    var submenuhtml = "";
    for (j = 0; j < submenu[i].length; j++) {
        submenuhtml += "<a href='" + submenu[i][j][1] + "'>" + submenu[i][j][0] + "</a>";
    }
    return submenuhtml;
}

function changefnimage() {
    index = lindex + 1;
    if (index > imgnav.length-1) {
        index = 0;
    }
    lindex = index;
    $(".imgnavnum").css({ background: "#50b0fb" });
    $(".imgnavnum:eq("+(imgnav.length-index-1)+")").css({ background: "#ff0000" });
    $("#navimg").fadeOut(500);
    setTimeout('$("#navimg").attr("src", imgnav[' + index + '][1]).fadeIn(500);', 300);
    $("#fntext").html("<a href='" + imgnav[index][2] + "' target='_blank'>" + imgnav[index][0] + "</a>");
    $("#flashnav").unbind("click");
    $("#flashnav").click(function() { window.open(imgnav[index][2]); });
}

function getajax(str) {
    ajaxget(base + "js/"+str+".txt", "bcontent");
}