/**/
//搜索框
function switchSearch()
{
	var sbox = $("#eSearchBox");
	if (sbox.is(":hidden"))
	{
		//sbox.show();
		sbox.slideDown();
    }
	else
	{
		//sbox.hide();
        sbox.slideUp();
    }
};﻿


 $(document).ready(function () {
       

        //$("#treebody").height($("#treebody").height() + "px");
        $("#treeparent").height($(".treeaside").height() + "px");

        $("#sidebody").height($("#sidebody").height() + "px");
        $("#sideparent").height(($(".ui-aside").height() - 59 - ($(".toolmenu") ? $(".toolmenu").height() : 0)) + "px");
        $("#pagebodyb").width($("#pagebodyb").width() + "px");
        $("#pagebodya").width($("#epage").width() + "px");
        var cur = $("#pagebodyb a.cur");
        if (cur.index() > 4) {
            $("#pagebodya").scrollLeft($("#pagebodyb a").eq(cur.index() - 4).get(0).offsetLeft);
        }

        $("#eSearchBox").css("top", "-10000px");
        $("#eSearchBox").css("display", "block");
        $(".eform .text").each(function (index, val) {
            var td = getParent(this, "td");
			
            var ele = $(this);
			if(ele.attr("etype")=="fileselect")	{return true;}
			if(ele.attr("etype")=="date")	{  ele.css("width", "100px");return true;}
            if (this.getAttribute("eautowidth") == null)
            {
                ele.css("width", ($(td).width() - 10) + "px");
            }
        });
        $(".eform select").each(function (index, val) {
            var td = getParent(this, "td");
            var ele = $(this);
            //alert($(td).width());
            ele.css("width", ($(td).width()) + "px");
        });
        $(".eform textarea").each(function (index, val) {
            var td = getParent(this, "td");
            var ele = $(this);

            ele.css("min-width", ($(td).width() - 16) + "px");
            ele.css("width", ($(td).width() - 4) + "px");
        });

        $(".eform iframe").each(function (index, val) {
            var td = getParent(this, "td");
            var ele = $(this);
            ele.attr("width", ($(td).width()) + "px");
        });
        $("#eSearchBox").css("top", "0px");
        $("#eSearchBox").css("display", "none");
     
	 
	//选项卡
	
	 function setCurrentSlide(ele, index) {
            $(".swiper_title .swiper-slide").removeClass("selected");
            ele.addClass("selected");
        };
       
        var swiper_title = new Swiper('.swiper_title', {
            slidesPerView: 4,
            paginationClickable: true,
            spaceBetween: 0,
            freeMode: true,
            loop: false,
            onTab: function (swiper) { var n = swiper_title.clickedIndex; }
        });
        if (swiper_title.slides) {
            swiper_title.slides.each(function (index, val) {
                var ele = $(this);
                ele.on("click", function () {
                    setCurrentSlide(ele, index);
                    swiper_body.slideTo(index, 500, false);
                });
            });
        }
        var swiper_body = new Swiper('.swiper_body', {
            direction: 'horizontal',
            loop: false,
            autoHeight: false,
            onSlideChangeEnd: function (swiper) {
                var n = swiper.activeIndex;
                setCurrentSlide($(".swiper_title .swiper-slide").eq(n), n);
                swiper_title.slideTo(n, 500, false);
            }
        });
	 
	 //顶部菜单和目录树
	  var asideLift = $(".ui-aside").asideUi({
            hasmask: true,
            size: "5rem",
            position: "left",
            sidertime: 300
        });

        $(".eHeader .menu").unbind("click").on("click", function () {			
            asideLift.toggle();
        });

        var asidetree = $(".treeaside").asideUi({
            hasmask: true,
            size: "5rem",
            position: "left",
            sidertime: 300
        });

        $(".treemenu").unbind("click").on("click", function () {
            asidetree.toggle();
        });
	 
	 
    });