﻿/// <reference path="jquery-1.3.2-vsdoc.js" />

$(document).ready(function() {
    $(".crumb > ul > li > a").hover(ShowMemu, HideMemuNoUse);

    $(".crumb > ul > li > ul").hover("", HideMenu);

    $(".right_buttom_context").height($("#pagecontextwarp").height() - 51);

    //二次读取博客文章
    LoadBlogs();

    //隐藏每个模块的口号
    $("#leadstory-container > div").hide();
});

function ShowMemu() {
    $(this).next("ul").show("fast");
    $(this).css("backgroundColor", "#F1F1F1");
}

function HideMemuNoUse(e) {
    var ulObj = $(this).next("ul");
    if (e.screenX > ulObj.offset().left
        && e.screenX < ulObj.offset().left + ulObj.width()
        && e.pageY > ulObj.offset().top - 5
        && e.pageY < ulObj.offset().top + ulObj.height()) {
    }
    else {
        $(this).next("ul").hide("fast");
        $(this).css("backgroundColor", "#FFF");
    }
}

function HideMenu() {
    $(this).hide("fast");
    $(".crumb > ul > li > a").css("backgroundColor", "#FFF");
}

function LanguageSelect(lang) {
    if (lang == "chinese") {
        window.location = "/Home/SetCulture/zh-CN?prv=" + escape(window.location.href);
    }
    else if (lang == "english") {
        window.location = "/Home/SetCulture/en-US?prv=" + escape(window.location.href);
    }
    else if (lang == "japanese") {
        window.location = "/Home/SetCulture/en-US?prv=" + escape(window.location.href);
    }    
}

function LoadBlogs() {
    $("#ceoblogitem").text("Loadding...");

    //CEO 博客
    var URL = "/Home/GetCEOBlog/CEO";
    $.get(URL, function(data) {
        $("#ceoblogitem").html(data);
    });

    $("#employeblogitem").text("Loadding...");

    //员工博客
    var URL = "/Home/GetEmployBlog/OTHER";
    $.get(URL, function(data) {
        $("#employeblogitem").html(data);
        $("#employeblogitem").height($("#employeblogitem").parent().height() - $("#ceoblogtitle").height() - $("#ceoblogitem").height() - $("#employblogtitle").height() - 21);
    });
}
