$(document).ready(function()
{
  // 首页-选项卡
  $('.tab .tit a:not(.more)').each(function(i)
  {
    $(this).click(function()
    {
      var tab = $(this).parents('.tab');
      var href = $(this).attr('href');
      $(tab).find('.tit .on').removeClass('on');
      $(this).addClass('on');
      $(tab).children('.con').hide();
      $('.tab .con').eq(i).show();
      if(href != '' && href != undefined) $(tab).find('.tit .more').attr('href',href);
      return false;
    })
  });

  $(".AddFavorite").click(function()
  {
    var title = document.title;
    var url = window.location.href;
    if(window.sidebar){window.sidebar.addPanel(title,url,"");}
    else if(document.all){window.external.AddFavorite(url,title);}
    return false;
  });

/*
  //固定位置
  var cva = ".fixed_box";
  //var offsetTop=$(cva).offset().top;
  $(window).scroll(function(){
    if($(document).scrollTop() > $(cva).offset().top){
      $(cva).css({position:"fixed",top:"35px"});
      if($.browser.msie && $.browser.version=='6.0'){
        $(cva).css({position:"absolute",top:$(document).scrollTop()});
      }
    }else{
      $(cva).css({position:"absolute",top:"auto"});
    }
  });
*/
  $('select[name="chprovince"]').change(function(){$('select[name="enprovince"]').get(0).selectedIndex = $(this).get(0).selectedIndex;});

  $('embed[src$=".flv"]').each(function(i)
  {
    var flv = $(this).attr('src');
    var wid = $(this).attr('width');
    var hei = $(this).attr('height');
    var sty = $(this).attr('style');
    var autostart = $(this).attr('autostart');
    var box = 'flvplayer' + i + '';
    $(this).after('<div id="' + box + '"></div>');
    var so = new SWFObject("/skin/ancms/files/flvplayer.swf?autostart=true","single",wid,hei,"7");
    so.addParam("allowfullscreen","true");
    so.addParam("wmode","opaque");//transparent//opaque
    so.addVariable("image","");
    so.addVariable("file",flv);
    so.addVariable("width",wid);
    so.addVariable("height",hei);
    so.write(box);
    $(this).remove();
  });
});

window.onload = function()
{
  var html = '<div id="google_translate_element" title="Google翻译"></div><script type="text/javascript">function googleTranslateElementInit(){ new google.translate.TranslateElement({pageLanguage:"zh-CN", includedLanguages:"zh-CN,zh-TW,en", layout: google.translate.TranslateElement.InlineLayout.SIMPLE},"google_translate_element");}</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>';
  $('body').append(html);
  show_baidu_share();//百度分享
}

//百度分享
function show_baidu_share()
{
  $('#bdshell_js').attr('src','http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=' + Math.ceil(new Date()/3600000));
  $('#bdlike_shell').attr('src','http://bdimg.share.baidu.com/static/js/like_shell.js?t=' + Math.ceil(new Date()/3600000));
}
//百度统计
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?83a90f9e0e08863a7322af162af74de0";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();

//Banner图片切换
function change_img()
{
  for (i = 0; i <= counts; i++)
  {
    $("#picdiv" + i).hide();
  }
  $("#picdiv" + nn).show();
  for (i = 0; i <= counts; i++)
  {
    $("#xxjdjj" + i).removeClass('bxx');
    $("#xxjdjj" + i).addClass('axx');
  }
  $("#xxjdjj" + nn).removeClass('axx');
  $("#xxjdjj" + nn).addClass('bxx');
  nn++;
  if (nn >= counts) {nn = 0;}
  tt = setTimeout('change_img()', 5000);
}
function changeimg(n)
{
  nn = n;
  window.clearInterval(tt);
  change_img();
}
window.onerror = function(){return true;}