// JavaScript Document
    $(function () {
        var ie6 = /msie 6/i.test(navigator.userAgent),
            dv = $('#trnav810628'),
            st;
        dv.attr('otop', dv.offset().top); //存储原来的距离顶部的距离  
        $(window).scroll(function () {
			var otrnav810628=document.getElementById("trnav810628")
//			var otrnavcompensation178888=document.getElementById("trnavcompensation178888")
//            var otrnavparent178888 = document.getElementById("trnavparent178888");
//            var otrnavbox178888 = document.getElementById("trnavbox178888");
//            otrnavbox178888height = otrnavbox178888.scrollHeight + 20;
            otr178888winclientheight = document.documentElement.clientHeight
            otr178888bodyscrolltop = document.body.scrollTop
//            bodyclientheight = document.body.clientHeight
            otrnav810628offsettop = otrnav810628.offsetTop
            otrnav810628scrollheight = otrnav810628.scrollHeight
            otrnav810628scrolltop = otrnav810628offsettop - otr178888bodyscrolltop //导航栏顶部距离浏览器上边的距离
            otrnav810628scrollbottom = (otr178888bodyscrolltop + otr178888winclientheight) - (otrnav810628offsettop + otrnav810628scrollheight) //导航栏底部距离浏览器下边的距离
            otrnavmore178888 = otrnav810628scrollheight - otr178888winclientheight //导航栏比屏幕高度的数值
            if(otrnav810628scrollheight < otr178888winclientheight) {
				//console.log (otrnav178888.offsetHeight)
//				otrnavcompensation178888.style.height =otrnav178888.offsetHeight + 'px'
                st = Math.max(document.body.scrollTop || document.documentElement.scrollTop);
                if(st > parseInt(dv.attr('otop'))) {
                    if(ie6) { //IE6不支持fixed属性，所以只能靠设置position为absolute和top实现此效果  
                        dv.css({
                            position: 'absolute',
                            top: st,
                            "z-index": '999'
                        });
                    } else if(dv.css('position') != 'fixed') dv.css({
                        'position': 'fixed',
                        top: 0,
                        'z-index': '998'
                    });
//                    tr178888setnavhidden1();
               } else if(dv.css('position') != 'static') {
                    dv.css({
                        'position': 'static',
                        "z-index": '99'
                    });
//                    tr178888setnavhidden2();
                } 
//				else if(st < parseInt(dv.attr('otop'))-1) {
//			var otrnavcompensation178888=document.getElementById("trnavcompensation178888")
// 				otrnavcompensation178888.style.height =0+'px'
//			}
            } else if(otrnav810628scrollheight >= otr178888winclientheight && otrnav810628.style.position != 'absolute') {
                otr178888bodyscrolltop = document.body.scrollTop;
                otrnav810628.style.position = 'absolute'
                otrnav810628.style.top = otr178888bodyscrolltop + 'px'
            } else if(otrnav810628scrolltop > 0) {
                otr178888bodyscrolltop = document.body.scrollTop;
                otrnav810628.style.position = 'absolute'
                otrnav810628.style.top = otr178888bodyscrolltop + 'px'
            } else if(otrnav810628scrollbottom > 0) {
                //                console.log('b:' + otrnavparent178888scrolltop)
                otr178888bodyscrolltop = document.body.scrollTop;
                otrnav810628.style.position = 'absolute'
                otrnav810628.style.top = (otr178888bodyscrolltop - otrnavmore178888) + 'px'
            }

        });
    });
//    window.onload = tr178888setnavparentwidth;
//    window.onresize = tr178888setnavparentwidth;
//    function tr178888setnavparentwidth() {
//        var bodywidth171108 = document.body.offsetWidth;
//		alert ('ddd')
//        document.getElementById("trnav810628").style.width = bodywidth171108 + 'px'
//    }
//    function tr178888setnavhidden1() {
//        var bodywidth171108 = document.body.offsetWidth;
//        if(bodywidth171108 > 767) {
//            document.getElementById("trlogoother").style.display = "none";
//            document.getElementById("trnav178888").style.display = "block";
//        } else {
//            document.getElementById("trlogoother").style.display = "block";
//            document.getElementById("trlogoright178888").style.display = "none";
//        }
//    }
//    function tr178888setnavhidden2() {
//        var bodywidth171108 = document.body.offsetWidth;
//        if(bodywidth171108 > 767) {
//            document.getElementById("trlogoother").style.display = "block";
//            document.getElementById("trnav178888").style.display = "block";
//        } else {
//            document.getElementById("trlogoother").style.display = "block";
//            document.getElementById("trlogoright178888").style.display = "block";
//        }
//    }
