$(window).on('load', function() {

//入场动效
//左侧进入渐显
var wow01 = new WOW({
  boxClass: 'wow01',
  animateClass: 'fadeInLeft',
  offset: 100,
  mobile: true,
  live: true
});
wow01.init();
//右侧进入渐显
var wow02 = new WOW({
  boxClass: 'wow02',
  animateClass: 'fadeInRight',
  offset: 100,
  mobile: true,
  live: true
});
wow02.init();
//由下向上进入渐显
var wow03 = new WOW({
  boxClass: 'wow03',
  animateClass: 'fadeInUp',
  offset: 100,
  mobile: true,
  live: true
});
wow03.init();
//由上向下进入渐显
var wow04 = new WOW({
  boxClass: 'wow04',
  animateClass: 'fadeInDown',
  offset: 100,
  mobile: true,
  live: true
});
wow04.init();
  
  var wow = new WOW({
		boxClass:'wow'
	});
	wow.init();
	var wow_l = new WOW({
		boxClass:'wow_l',
	});
	wow_l.init();
	var wow_r = new WOW({
		boxClass:'wow_r',
	});
	wow_r.init();
	var wow_d = new WOW({
		boxClass:'wow_d',
	});
	wow_d.init();
});
$(function(){
    if(!placeholderSupport()){
        $('[placeholder]').focus(function() {
            var input = $(this);
            if (input.val() == input.attr('placeholder')) {
                input.val('');
                input.removeClass('placeholder');
            }
        }).blur(function() {
            var input = $(this);
            if (input.val() == '' || input.val() == input.attr('placeholder')) {
                input.addClass('placeholder');
                input.val(input.attr('placeholder'));
            }
        }).blur();
    };
    if(!IsPC()){$('body').addClass('touch_body')}
    //ie浏览器
    if(isIE()){$('html').addClass('isIe');}
    // 获取当前url
    var url_location = window.location.pathname;
    var arr = [];
    arr = url_location.split('/');
})

function placeholderSupport() {
    return 'placeholder' in document.createElement('input');
}
function scrollT($Dom){
    if($Dom.offset()){
      if($(window).scrollTop()+$(window).height()>=$Dom.offset().top+200){
          return true;
      }
    }
}
function mainBgResize1($img, width, height, W_b, H_b) {
    var sw = width,
        sh = width / W_b * H_b
    if (sh < height) {
        sh = height;
        sw = height / H_b * W_b
    }
    $img.css({height:sh,width:sw, marginTop: -(sh - height) / 2, marginLeft: -(sw - width) / 2, 'visibility': 'visible' });

}
//判断是否Firefox浏览器
function isFirefox(){
    if (navigator.userAgent.indexOf("Firefox") > -1) 
    return true;
    else
    return false;
}
//判断是否IE浏览器
function isIE() {
    if (!!window.ActiveXObject || "ActiveXObject" in window)
    return true;
    else
    return false;
}
function IsPC() { 
   var userAgentInfo = navigator.userAgent; 
   var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"); 
   var flag = true; 
   for (var v = 0; v < Agents.length; v++) { 
       if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } 
   } 
   return flag; 
}  
//绑定事件监听
function addEvent(eve,callback){
  if (window.attachEvent){
      window.attachEvent("on"+eve,callback); 
  }else if(window.addEventListener) { 
      window.addEventListener(eve,callback,false);   
  }
}
//判断pad横屏竖屏，刷新页面
addEvent('load', function(){
   // orientationChange();
    window.onorientationchange = orientationChange;
});
function orientationChange() {
  switch(window.orientation) {
　　case 0: 
        //alert("肖像模式 0,screen-width: " + screen.width + "; screen-height:" + screen.height);
         window.location.reload();
        break;
　　case -90: 
        //alert("左旋 -90,screen-width: " + screen.width + "; screen-height:" + screen.height);
      window.location.reload();
        break;
　　case 90:   
       // alert("右旋 90,screen-width: " + screen.width + "; screen-height:" + screen.height);
      window.location.reload();
        break;
　　case 180:   
    　　//alert("风景模式 180,screen-width: " + screen.width + "; screen-height:" + screen.height);
    window.location.reload();
    　　break;
  }
};
//获取IE浏览器版本
function getBrowserVersion(){
  var hc = $('html').attr('class');
  if(hc){
    var ieVersion = hc && hc.split(' ')[1];
    if(ieVersion){
      $('.browserupgrade>strong').text(ieVersion.toUpperCase());
    }
  }
}
getBrowserVersion();
//鼠标延迟执行事件方法
$.fn.hoverDelay = function(options){
    var defaults = {
        hoverDuring: 200,
        outDuring: 200,
        hoverEvent: function(){
            $.noop();
        },
        outEvent: function(){
            $.noop();    
        }
    };
    var sets = $.extend(defaults,options || {});
    var hoverTimer, outTimer, that = this;
    return $(this).each(function(){
        $(this).on('mouseenter',function(){
            clearTimeout(outTimer);
            hoverTimer = setTimeout(function(){sets.hoverEvent.apply(that)}, sets.hoverDuring);
        });
        $(this).on('mouseleave',function(){
            clearTimeout(hoverTimer);
            outTimer = setTimeout(function(){sets.outEvent.apply(that)}, sets.outDuring);
        });
    });
};

$.fn.numberRock=function(options){
    var defaults={
        speed:24,
        count:100
    };
    var opts=$.extend({}, defaults, options);

    var div_by = 100,
    count = opts["count"],
    speed = Math.floor(count / div_by),
    sum = 0,
    $display = this,
    run_count = 1,
    int_speed = opts["speed"];
    var int = setInterval(function () {
        if (run_count <= div_by&&speed!=0) {
            $display.text(sum=speed * run_count);
            run_count++;
        } else if (sum < count) {
            $display.text(++sum);
        } else {
            clearInterval(int);
        }
    }, int_speed);
}
//无图图像
var noimg = '../images/error.jpg';
function imgerror(t) {
    t.onerror = null;
    t.src = noimg
}

function posNav(){
	var nowL,now_w;
    
   if($(window).width() >= 960){
     if($('.nav').find('.active').length > 0){
       nowL = $('.nav').find('.active').offset().left;
       now_w = $('.nav').find('.active').width();
       $('.nav').find('.moveline').css({
          left:nowL,
          width:now_w
        });
     }
   }
    
}