﻿// JavaScript Document
/*document.write('<script type="text/javascript" src="http://notes.uoeee.com/tc.js"></script>');*/

$(function () {

     //  function stop() {
       //    return false;
     //  }
     //  document.oncontextmenu = stop
    //-------- 导航 --------


    //-------- 判断分辨率 --------

    positioncont();
    $(window).resize(function () {
        positioncont();
    })
    $(".topsearch").removeClass("hidden-sm");
    $(".Searchicon").click(function () {
        if ($(".topsearch").is(":hidden")) {
            $(".topsearch").fadeIn();
        }
        else {
            $(".topsearch").fadeOut();
        }
    })
 });
	
function positioncont() {

    var overflowwid = $("body").css("overflow", "hidden").width();
    var windowwid = $("body").removeAttr("style").width();
    var scrollwid = overflowwid - windowwid;
		
		
    //常见问题
    $(document).on("click", ".problemlist dt", function () {
	  
           if ($(this).parent().find("dd").is(":hidden")) {
            $(this).addClass("showdd").parent("dl").siblings().find("dt").removeClass("showdd");
            $(this).parent().find("dd").show().parent("dl").siblings().find("dd").hide();
           }
           else {
               $(this).removeClass("showdd");
               $(this).parent().find("dd").hide();
             }
          });

	
    //$('.prodownlist ul').find('li:nth-child(3n)').addClass('li')
    //$('.prodownlist ul').find('li:nth-child(3n+1)').addClass('li2')

    if (windowwid + scrollwid > 767) {
            
        $('.marketadd').find('li:nth-child(4n)').addClass('evenli')
        $('.marketadd').find('li:nth-child(4n-1)').addClass('evenli')	
        $('.marketadd').find('li:nth-child(2n)').removeClass('oddli')
			
        // 右侧栏
        var rightMW = $('.rightmenu .ico-box').find('.ico-cont').outerWidth(true);
        $('.rightmenu').find('.ico-box').hover(function(){
            $(this).find('.ico-cont').stop(false,true).animate({'right':0},500);
        },function(){
            $(this).find('.ico-cont').stop(false,true).animate({'right': -rightMW},500);
        });
        $(".rightmenu .ico03").hover(function () {
            $(this).find("img").stop(true,true).show(300);
        }, function () {
            $(this).find("img").stop(true, true).hide(300);
        })
        // 返回顶部
        $('.backtop').click(function(){
            $('html,body').animate({scrollTop:0}, 800);
        });
					

    }else{
        $('.marketadd').find('li:nth-child(3n)').removeClass('evenli')
        $('.marketadd').find('li:nth-child(3n+1)').removeClass('evenli')	
        $('.marketadd').find('li:nth-child(2n)').addClass('oddli')
    }
		
    if (windowwid + scrollwid < 991) {
            
			
        //移动端下拉
        $(".hamburg").unbind("click").bind("click", function () {
            if ($('.nav').is(':visible')) {
                $('.nav').slideUp();
                $(this).removeClass('hshow')
            } else {
                $('.nav').slideDown();
                $(this).addClass('hshow')
            }
        })
        //phone二级下拉菜单
        $('.nav ul li h3').unbind("click").bind("click", function () {
            if($(this).siblings('.drop-warp').is(':visible')){
                $(this).siblings('.drop-warp').slideUp();	
                $(this).parents('li').removeClass('cur')
            }else{
                $(this).siblings('.drop-warp').slideDown();	
                $(this).parents('li').addClass('cur');
                $(this).parents('li').siblings().find('.drop-warp').slideUp();
                $(this).parents('li').siblings().removeClass('cur')
					
            }
				
        })
        //phone三级级下拉菜单
        $('.drop-warp h4').unbind("click").bind("click", function () {
            if($(this).siblings('.Tlevel').is(':visible')){
                $(this).siblings('.Tlevel').slideUp();	
                $(this).parent('li').removeClass('cur')
            }else{
                $(this).siblings('.Tlevel').slideDown();	
                $(this).parent('li').addClass('cur');
                $(this).parent('li').siblings().find('.Tlevel').slideUp();
                $(this).parent('li').siblings().removeClass('cur')
					
            }
				
        })
			
        //phone底部导航
        $('.footnavlist ul li h3').unbind("click").bind("click", function () {
            if($(this).siblings('.footnavdrop').is(':visible')){
                $(this).siblings('.footnavdrop').slideUp();	
                $(this).parents('li').removeClass('cur')
            }else{
                $(this).siblings('.footnavdrop').slideDown();	
                $(this).parents('li').addClass('cur');
                $(this).parents('li').siblings().find('.footnavdrop').slideUp();
                $(this).parents('li').siblings().removeClass('cur')
					
            }
				
        })
			
			

    }else{
        $(".hamburg").unbind("click");
        $(".drop-warp h4").unbind("click");	
        $(".nav ul li h3").unbind("click");		
    }
		
    if (windowwid + scrollwid > 991) {
        var winpro = $('.Iporright').height()
        $('.Iporleft').height(winpro-15)
			
        //pc导航下拉
        $('.nav ul li').unbind("mouseenter").bind('mouseenter', function () {
            $(this).find('.drop-warp').show();
            if ($(this).find("li").length == 3) {
                $(this).find('.drop-warp').addClass("threeli");
            } else if ($(this).find("li").length == 6) {
                $(this).find('.drop-warp').addClass("sixli");
            } else if( $(this).find("li").length == 4) {
                $(this).find('.drop-warp').addClass("fourli");
            }
        });
        $('.nav ul li').unbind("mouseleave").bind('mouseleave', function () {
            $(this).find('.drop-warp').hide();
        });

        $(".winshowover p").each(function () {
            if ($(this).index() > 5) {
                $(this).hide();
                $(this).siblings(".winshowoverMore").show();
            }
        });
        $(".winshowoverMore").click(function () {
            $(this).parent().addClass("cur");
            $(this).hide().siblings("p").show();
        });

    }else{
        $(".Iporleft").removeAttr("style")
			
        $(".nav ul li").unbind("mouseenter");
        $(".nav ul li").unbind("mouseleave");
			
    }
		
		
    /*奖励及荣誉图片弹窗*/
	
    //-------- 图片资源 --------
		
    $(".Patent ul li").click(function () {
        var winscroll = $(window).scrollTop();
        var winH = $(window).height();
        var thisimg = $(this).find("img").attr("src");
        $(".bigimgfloat img").attr("src", thisimg);
        var nowH = $(".bigimgcont").height();
        $(".yuangongmask").show();
        $(".bigimgcont").fadeIn();
        $(".bigimgcont").css("top", winscroll + winH / 2 - nowH/2);
			
    });
		
    $(".yuangongmask, .closeyuangong").click(function () {
        $(".yuangongmask").fadeOut();
        $(".bigimgcont").fadeOut(function () {
            $(".bigimgfloat ul").html("");
        });
			
    });
		
		
    //核心优势
    if ($(".Advaimglist").length > 0) {
		    

        var userAgent = navigator.userAgent.toLowerCase();
        jQuery.browser = {
            version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
            safari: /webkit/.test(userAgent),
            opera: /opera/.test(userAgent),
            msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
            mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
        };
        $(".Advaimglist").addClass("AdvaimglistIE9");
        if ($.browser.msie && ($.browser.version == "9.0")) {
		        
        } else {
            $(".Advaimglist").removeClass("AdvaimglistIE9");
            var swiper = new Swiper('.Advaimglist .swiper-container', {
                nextButton: '.Advaimglist .Advaright',
                prevButton: '.Advaimglist .Advaleft',
                paginationClickable: true,
                loop: true,
                slidesPerView: 4,
                spaceBetween: 0,
                breakpoints: {
                    1024: {
                        slidesPerView: 3,
                        spaceBetween: 0
                    },
                    768: {
                        slidesPerView: 2,
                        spaceBetween: 10
                    },
                    640: {
                        slidesPerView: 1,
                        spaceBetween: 5
                    }

                }
            });
        };
    }
		
		
    //核心优势图片弹窗
    $(".Advaimglist ul li").click(function () {
        var winscroll = $(window).scrollTop();
        var thisimg = $(this).find("img").attr("src");
        $(".bigimgfloat img").attr("src", thisimg);
        $(".yuangongmask").show();
        $(".bigimgcont").fadeIn();
        $(".bigimgcont").css("top", winscroll + 100);
			
    });
		
    $(".yuangongmask, .closeyuangong").click(function () {
        $(".yuangongmask").fadeOut();
        $(".bigimgcont").fadeOut(function () {
            $(".bigimgfloat ul").html("");
        });
			
    });
    /*首页*/
    if ($(".banner").length > 0) {
        //    var mySwiper = new Swiper('.banner', {
        //        loop: true,
        //        autoplay: 5000,
        //        speed: 1000,
        //        pagination: '.wbannerbtn',
        //        paginationClickable: true,
        //        autoplayDisableOnInteraction: false,
        //        grabCursor: false,
        //        parallax: true
        //    });
        TouchSlide({
            slideCell: "#slideBox",
            titCell: ".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
            mainCell: ".bd ul",
            effect: "leftLoop",
            delayTime: 1000,
            interTime: 5000,
            autoPage: true,//自动分页
            autoPlay: true //自动播放
        });
    };
		
    //万测板块切换
		
    $('.iteamtab a').eq(0).addClass('cur');
    $('.chunkhide').eq(0).show();
    $('.iteamtab a').click(function(){
        var indexw = $(this).index();
        $('.chunkhide').hide().eq(indexw).show();
        $(this).addClass('cur').siblings().removeClass('cur')	
    })				

    $('.Wide').hover(function(){
        $(this).find('.Selelist').stop(true,true).slideDown()	
    },function(){
        $(this).find('.Selelist').stop(true,true).slideUp();
    })
		
    $('.Selelist p').click(function(){
        $('.Widesele').text($(this).text());
        $(this).parents('.Selelist').stop(true,true).slideUp();	
    })


}


$(function () {

    //wuqiuping start
    function mobile() {
         if ($(document).width() > 640) {

            $(".wwindexbanner ul li").each(function (index, element) {
                var _pcimg = $(this).attr("pc-img");
                $(this).find("img").attr("src", _pcimg)
            });

            //内页
			
			$(".wqp-banner ul li").each(function (index, element) {
				var _inpcimg = $(this).attr("pc-img");
                $(this).find("img").attr("src", _inpcimg)
            });
        }
        else {
			$(".wqp-banner ul li").each(function (index, element) {
                 var _inmocimg = $(this).attr("mobile-img");
				$(this).find("img").attr("src", _inmocimg)
				
            })

            $(".wwindexbanner ul li").each(function (index, element) {
                var _mobileimg = $(this).attr("mod-img");
                $(this).find("img").attr("src", _mobileimg)
            })
        }
    }
    mobile();
    $(window).resize(function () {
        mobile()
    });

   
		
		
});
//20170405
$(function () {
    $(".cutP").each(function () {
        var _this = $(this);
        $(this).find(".cutbtns").find("a").eq(0).addClass("cur");
        $(this).find(".cutlump").eq(0).show();
        $(this).find(".cutbtns").find("a").click(function () {
            $(this).addClass("cur").siblings().removeClass("cur");
            _this.find(".cutlump").hide();
            _this.find(".cutlump").eq($(this).index()).show();
        })

    })
})



$(function () {

    //搜索
    $("#tbTopSubmit").click(function () {
        var keyword = $("#tbTopKeyword").val();
        if (keyword == "" || keyword == "请输入关键字") {
            layer.msg("请填写关键词！", 1, 9);
            return false;
        }
        window.location.href = "/search.html?keyword=" + escape(keyword) + "";
        return false;
    })


    processLink();

    ////回车搜索
    //$("#text_search").submit(function () {
    //    var keyword = $("#tbTopKeyword").val();
    //    if (keyword == "" || keyword == "请输入关键字") {
    //        layer.msg("请填写关键词！", 1, 9);
    //        return false;
    //    }
    //    window.location.href = "/search.html?keyword=" + escape(keyword) + "";
    //    return false;
    //})
})

function processLink(){
  var browser = {
  versions: function () {
  var u = navigator.userAgent, app = navigator.appVersion;
  return {//移动终端浏览器版本信息
  trident: u.indexOf('Trident') > -1, //IE内核
  presto: u.indexOf('Presto') > -1, //opera内核
  webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
  gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
  mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
  ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
  android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
  iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
  iPad: u.indexOf('iPad') > -1, //是否iPad
  webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
  };
  }(),
  language: (navigator.browserLanguage || navigator.language).toLowerCase()
  }
  if (!(browser.versions.mobile || browser.versions.ios || browser.versions.android || browser.versions.iPhone || browser.versions.iPad)) {
	$("a[href*=-]").each(function(){
		$(this).attr("target", "_blank");
	});
  }
}


