/**
 * @author 老阴
 */
$(function(){
    var url;
    
    (function(){
        var url;
        InitUrl = function(i){
            if (i) {
                url = i;
            }
            return {
                Get: get,
                Set: set
            };
        }
        function get(){
            return url;
        };
        function set(i){
            if (i) {
                url = i;
            }
        };
            })();
    
    var json;
    (function(){
        var j;
        InitJson = function(i){
            if (i) {
                j = eval('(' + i + ')');
                
            }
            return {
                Get: get,
                Set: set
            };
        }
        function get(){
            return j;
        };
        function set(i){
            if (i) {
                j = eval('(' + i + ')');
            }
        };
            })();
    
    var pageInfo;
    
    (function(){
        var pageInfo;
        InitPageInfo = function(i){
            if (i) {
                pageInfo = eval('(' + i + ')');
                
            }
            return {
                Get: get,
                Set: set
            };
        }
        function get(){
            return pageInfo;
        };
        function set(i){
            if (i) {
                pageInfo = eval('(' + i + ')');
            }
        };
            })();
    
    var totalCount;
    (function(){
        var totalCount;
        InitTotalCount = function(i){
            if (i) {
                totalCount = i;
                
            }
            return {
                Get: get,
                Set: set
            };
        }
        function get(){
            return totalCount;
        };
        function set(i){
            if (i) {
                totalCount = i;
            }
        };
            })();
    
    
    var tag;
    (function(){
        var t;
        InitTag = function(i){
            if (i != undefined) {
                t = i;
                
            }
            return {
                Get: get,
                Set: set
            };
        }
        function get(){
            return t;
        };
        function set(i){
            if (i) {
                t = i;
            }
        };
            })();
    
    /******** 初始化全局变量******/
    
    (function(){
        url = InitUrl($("#hfUrl").val());
        
        try {
            json = InitJson($("#hfJson").val());
        } 
        catch (e) {
            alert(e);
        }
        try {
            pageInfo = InitPageInfo($("#hfPageinfo").val());
        } 
        catch (e) {
            alert(e);
        }
        
        totalCount = InitTotalCount($("#hfTotalCount").val());
    })();
    
    
    /********************填充***************************/
    
    (function(){
        $("div#instrument-view-con ul li a:first").addClass("unit-selected");
        expandUnitType($("div#instrument-view-con ul li a:first"));
        $("div#instrument-view-con ul li a").click(function(){
            $("div#instrument-view-con ul li a").removeClass("unit-selected");
            $(this).addClass("unit-selected");
            expandUnitType(this);
        });
    })();
    
    
    function expandUnitType(obj){
        if (!obj) {
            return;
        }
        var that = obj;
        if (that) {
            $.ajax({
                type: 'GET',
                url: url.Get() + '/Ajax/Instrument/GetInstrumentTypeForUnit.ashx',
                data: 'id=' + $(that).attr("id"),
                dataType: 'json',
                success: function(data, textStatus){
                    if (data && data.success) {
                        var r = Constructor(data.first, data.second, data.third);
                        $("div#content-con").empty().append(r === '' ? '<div style="padding: 10px; color: #ff0000;">暂无相关数据</div>' : r);
                        $("div#content-con a").click(function(){
                            if (json.Get().Cates && json.Get().Units) {
                                json.Get().Units = [];
                                json.Get().Units.push($("div#instrument-view-con ul li a.unit-selected").attr("id"));
                                json.Get().Cate = $(this).attr("id");
                                json.Get().Cates = [];
                                json.Get().Cates.push($(this).attr("id"));
                                window.open('InstrumentList.aspx?json=' + escape($.toJSON(json.Get())));
                            }
                        });
                        
                        animateBranch();
                    }
                }
            });
        }
    }
    
    
    
    /***********************第三级的Type和 第二级的Type************************/
    
    function ConstrucotThird(third, second){
        var leavecon = ' <ul class="tagCol clearfix" >_result_</ul>';
        var leave = '<li class="floatl" style="margin-right: 3px;"><a id="_lid_">_lname_(_lcount_)</a></li>';
        
        var contentresult = '';
        if (third && second) {
            for (var j = 0; second[j]; j++) {
                var result = '';
                for (var i = 0; i < third.length; i++) {
                    if (third[i] && third[i].parent == second[j].id) {
                        var nl = leave.replace(/_lid_/g, third[i].id);
                        nl = nl.replace(/_lname_/, third[i].name);
                        nl = nl.replace(/_lcount_/, third[i].count);
                        result += nl;
                    }
                    
                }
                if (result && result !== "") {
                
                    result = leavecon.replace(/_result_/g, result);
                    contentresult += result;
                    
                }
            }
            
        }
        
        
        return contentresult;
        
    }
    
    /************************第一级的 项  和第二级的 type List*****************************/
    
    function ConstrucotSecond(second, root){
        var branchcon = '<div class="clearfix" style="border-bottom: 1px solid rgb(204, 204, 204); padding-bottom: 5px;margin-bottom: 10px;">' +
        '<ul class="floatr greyinput">_branches_</ul></div>'
        var branch = '<li style="float:left;margin-right: 8px; min-width:100px;"><a id="_bid_"  >_bname_(_bcount_)</a><em style="cursor:pointer; margin:0 5px 0 2px; margin-left:5px; color:#435f87" >查看</em></li>';
        
        var result = '';
        if (second && root) {
            for (var i = 0; i < second.length; i++) {
                if (second[i].parent == root.id) {
                    var nb = branch.replace(/_bid_/g, second[i].id);
                    nb = nb.replace(/_bname_/g, second[i].name);
                    nb = nb.replace(/_bcount_/g, second[i].count);
                    result += nb;
                }
            }
        }
        
        return branchcon.replace(/_branches_/g, result);
        
    }
    
    /************************构造一级  某一个单位的一级 ***************************/
    
    function Constructor(first, second, third){
        var root = '<div class="content margin15"><h2><a id="_rid_">_rname_(_count_)</a>· · · </h2>_branches_ _leaves_</div>';
        var result = '';
        /********************************************************/
        if (first && second && third) {
            if (first.length > 0) {
                for (var i = 0; i < first.length; i++) {
                    var nr = root.replace(/_rid_/g, first[i].id);
                    nr = nr.replace(/_rname_/g, first[i].name);
                    nr = nr.replace(/_branches_/g, ConstrucotSecond(second, first[i]));
                    nr = nr.replace(/_count_/g, first[i].count);
                    var temp = [];
                    for (var j = 0; j < second.length; j++) {
                        temp.push(second[j].parent === first[i].id ? second[j] : undefined);
                    }
                    nr = nr.replace(/_leaves_/g, ConstrucotThird(third, temp));
                    result += nr;
                }
            }
        }
        
        return result;
    }
    
    
    
    
    
    /*************** Intruemnt******************/
    
    (function(){
        $("input[name='search_text']").click(function(){
            this.value = this.value == "搜索单位" ? "" : this.value;
        });
        
    })();
    
    /*******************Tab  单位***********************/
    
    (function(){
        $("div#unit-con ul:not(:first)").eq(1).hide();
        $("#div#unit-con ul#unit-con-nav li").eq(2).click(function(){
            $(this).blur();
        });
        
        $("div#unit-con ul#unit-con-nav li a").click(function(){
            $(this).parent().addClass("current").siblings().removeClass("current");
            var index = $("div#unit-con ul#unit-con-nav li a").index(this);
            
            $("div#unit-con ul:not(:first)").eq(index).animate({
                opacity: 1,
                height: 'show'
            }, 500, function(){
            }).siblings(":not(#unit-con-nav)").animate({
                opacity: 0,
                height: 'hide'
            }, 500, function(){
            });
            
        })
        
        /********************填充 仪器***********************/
    
    })();
    
    
    /**************动画效果*****************/
    
    
    $("#unit-con-nav>li").each(function(index){
        $(this).click(function(){
            if ($(this).attr('className').indexOf('current') != -1) {
                return false;
            }
            else {
                $(this).addClass('current').siblings('li').removeClass('current');
                $("#instrument-view-con>ul").animate({
                    opacity: 'hide',
                    height: 'hide'
                }, {
                    duration: 300,
                    complete: function(){
                        $("#instrument-view-con>ul:nth-child(" + (index + 1) + ")").animate({
                            height: 'show',
                            opacity: 'show'
                        }, {
                            duration: 300,
                            complete: function(){
                            }
                        });
                    }
                });
            }
        });
    });
    
    
    /**********在构建 内容后需调用该函数*************/
    function animateBranch(){
        /************初始化*************/
        /*******初始化Branch*******/
        $("div#content-con div ul li:first").addClass("branch-selected");
        $("div#content-con>div>ul:not(:first)").hide();
        $("div#content-con div ul li em").click(function(){
            $(this).parent("li").addClass("branch-selected").siblings("li").removeClass("branch-selected");
            var index = $("div#content-con div ul li").index($(this).parent("li"));
            $("div#content-con>div>ul").eq(index).animate({
                opacity: 'show',
                height: 'show'
            }, function(){
                $(this).siblings("ul").animate({
                    opacity: 'hide',
                    height: 'hide'
                });
            })
        });
        
        /*
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         $("div#content-con div span a").click(function(){
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         var index = $("div#content-con div span a").index($(this));
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         $("div#content-con div ul").eq(index).animate({
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         opacity: 1,
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         height: 'show'
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         }).siblings().animate({
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         opacity: 0.0,
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         height: 'hiden'
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         });
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         });
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         
        
        
         */
        
        
    }
    
    
    $("#ajax-loading").ajaxStart(function(){
        $(this).show();
    }).ajaxComplete(function(){
        $(this).hide();
         window.location = "#unit-con";
    });
    
    
    /*************************/
    
    
    (function(){
        $("#tbUnitName").focus(function(){
            $(this).val("");
        });
    })();
    
});
