$(function() {
    $('.wshadow').each(function() {
        $(this).prepend('<div class="wshadow1"></div><div class="wshadow0"></div>');
        var text = $(this).text();
        var pos = $(this).position;
        var width = $(this).width()
        $(this).find('div.wshadow0, div.wshadow1').css({left: pos.left, top: pos.top, width: width}).text(text);
    });
    if ($.browser.webkit) {
        $(this).find('div.menu-path div.wshadow0').css({marginLeft: -1});
        $(this).find('div.menu-path div.wshadow1').css({marginLeft: 0});
    }
    $('div.side-content li a').mouseenter(function(e) {
		
		$(this).next('div.menu3').css({marginTop: setManagerTop($(this).next('div.menu3').height(), e.pageY	)});
		$(this).next('div.menu3').show();
    }).mouseleave(function() {
        $(this).data('mouseover', false);
        var $a = $(this);
        window.setTimeout(function() {
            if (!$a.next('div.menu3').data('mouseover'))
                $a.next('div.menu3').hide();
        }, 100);
    });
    $('div.menu3').mouseenter(function() {
        $(this).data('mouseover', true);
    }).mouseleave(function() {
        $(this).data('mouseover', false).hide();
    });
    $('a.menu2').mouseenter(function() {
        $(this).prev('div.menu22').show();
    }).mouseleave(function() {
        $(this).data('mouseover', false);
        var $a = $(this);
        window.setTimeout(function() {
            if (!$a.prev('div.menu22').data('mouseover'))
                $a.prev('div.menu22').hide();
        }, 100);
    });
    $('div.menu22').mouseenter(function() {
        $(this).data('mouseover', true);
    }).mouseleave(function() {
        $(this).data('mouseover', false).hide();
    });
    $('#search').submit(function() {
        var name = $('#field_name').get(0);
        if (name.value == name.defaultValue) name.value = '';
        var code = $('#field_code').get(0);
        if (code.value == code.defaultValue) code.value = '';
    });
    $('#type_text').click(function() {
        $('#type_layer').toggle();
    });
	$('#type_text22').click(function() {
        $('#type_layer22').toggle();
    });
    $('a.scroll-arrow-left').click(function() {
        $('#scroll').get(0).scrollLeft -= 205;
        return false;
    });
    $('a.scroll-arrow-right').click(function() {
        $('#scroll').get(0).scrollLeft += 205;
        return false;
    });
});
function type_sel(id) {
    doc_id('type_val').value = id;
    doc_id('type_text').value = doc_id('type'+id).innerHTML;
    doc_id('type_layer').style.display = 'none';
    return false;
}
function type_sel2(id) {
    doc_id('type_val22').value = id;
    doc_id('type_text22').value = doc_id('type'+id).innerHTML;
    doc_id('type_layer22').style.display = 'none';
    return false;
}
var ycoord2=0;
function setManagerTop(hit,myY) {
   	
	var docheight2= document.all ? Math.min(truebody2().scrollHeight, truebody2().clientHeight) : Math.min(window.innerHeight);	
	
	
	var myNum = Number('-'+(hit/3));
	
	return myNum;
	
	
}


function truebody2() {
  return (!window.opera && document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
}
