$(function(){
banner();
tools();
share();
tablist();
if($(".imglist").length){
$(".imglist").each(function(){
var _this=$(this);
imglist(_this);
});
}
if(window.screen.width < 1681){
$(".header_main").addClass("headeiw8");
}
});
// banner鐒︾偣鍥
function banner() {
if (!$("#banner").length || $("#banner li").length <= 1) { return false; }
$("#banner ul li:gt(0)").css({"display":"none"});
var b = $("#banner"),
me = $("#banner ul"),
tip = $("#banner .tip"),
t, interval = 10000,
speed = 1000,
speed2 = 700,
n = 0,
N = me.children("li").length;
wid = b.children("li").width();
step = 200,time = 3000;
if ($("#banner .tip").length) {
var htmlTip = "";
for (var i = 0; i < N; i++) {
if (i == 0) {
htmlTip += ""+(i+1)+"";
} else {
htmlTip += ""+(i+1)+"";
}
}
tip.html(htmlTip);
}
var func = function() {
if (n >= N - 1) {
n = 0;
}else if(n < -1){
n = N-1;
}
else {
n++;
}
me.children("li").eq(n).css({
"z-index": 2
}).stop().fadeIn(speed).siblings("li").css({
"z-index": 1
}).stop().fadeOut(speed2);
if ($("#banner .tip").length) {
tip.children("span").eq(n).addClass("cur").siblings("span").removeClass("cur");
}
}
$("#banner").hover(function(){
$("#btn_prev,#btn_next").fadeIn()
},function(){
$("#btn_prev,#btn_next").fadeOut()
})
$dragBln = false;
$("#btn_prev").click(function(){
clearInterval(t);
n -= 2;
func();
t = setInterval(func, time)
});
$("#btn_next").click(function(){
clearInterval(t);
func();
t = setInterval(func, time)
});
tip.children("span").click(function() {
clearInterval(t);
n = $(this).index() - 1;
func();
t = setInterval(func, interval);
})
$("#banner ul.list li").mouseenter(function() {
clearInterval(t);
}).mouseleave(function() {
t = setInterval(func, time);
});
t = setInterval(func, interval);
}
function tablist(){
$(".menu .sbox p").click( function (e) {
if($(".menu .sbox .lc").is(":hidden")){
$(".menu .sbox .lc").show();
}else{
$(".menu .sbox .lc").hide();
}
e.stopPropagation();
});
$("body").click(function () {
$(".menu .sbox .lc").hide();
});
$(".menu .sbox .lc a").click(function () {
var html = $(this).html();
$(".menu .sbox").find("p").html(html);
$(".menu .sbox .lc").hide();
});
}
// 闆嗘垚JS鏁堟灉
function tools(){
// 璁句负棣栭〉
$(".setHome").click(function(){
var hm = window.location.host;
SetHome(this, location.href);
});
// 鍔犲叆鏀惰棌
$(".addFavo").click(function(){
var fm = $("title").html();
AddFavorite(fm, location.href, '');
});
$("#gotop").click(function() {
$("body, html").stop().animate({
"scrollTop": 0
});
});
$(".search-box .butn").on('click', function () {
if ($(this).hasClass('hov')) {
$(this).removeClass('hov');
$(this).siblings('.share-sub').stop().animate({
width: 288
}, 500);
} else {
$(this).addClass('hov');
$(this).siblings('.share-sub').stop().animate({
width: 0
}, 500);
}
});
// 鍚堜綔妯″紡
$(".steps").slide({titOnClassName:"current"});
$(".slideTxtBox").slide({effect:"left"});
$("#ichoose").slide({mainCell:".bd ul",autoPage:true,effect:"left",autoPlay:true,vis:4});
$("#newsBox").slide({mainCell:".bd ul",autoPlay:true,effect:"left",delayTime:500,interTime:6000});
$('#toolbar dd').bind({
'mouseenter': function(){
if($(this).children('.slide').length){
var _this = $(this).children('.slide');
_this.stop(true, true).animate({'width': 130}, 200);
}else if($(this).children('.pop').length){
var _this = $(this).children('.pop');
_this.show().animate({'right':150}, 200);
}
},
'mouseleave': function(){
if($(this).children('.slide').length){
var _this = $(this).children('.slide');
_this.stop(false, false).animate({'width': 0}, 200);
}else if($(this).children('.pop').length){
var _this = $(this).children('.pop');
_this.hide().animate({'right': 90}, 200);
}
}
});
}
function imglist(_this){
if ( _this.find(".item").length <= 1) { return false; }
var t, a = _this;
var clone = a.find(".list").html();
a.find(".list").append(clone); // 鍏嬮殕鏁版嵁
var n = 0,
N = a.find(".list").children(".item").length,
wid = a.find(".list").children(".item").width(),
time = 5000,
step = 600;
a.find(".list").width(N * wid);
var func = function() {
if (n >= N / 2) {
n = 0;
a.find(".list").css({
"margin-left": 0
});
func();
} else {
n++;
a.find(".list").stop().animate({
"margin-left": -wid * n
}, step);
}
}
var func2 = function() {
if (n <= 0) {
n = N / 2;
a.find(".list").css({
"margin-left": -wid * n
});
func2();
} else {
n--;
a.find(".list").stop().animate({
"margin-left": -wid * n
}, step);
}
}
// 鎵嬪姩瑙﹀彂婊氬姩鏁堟灉::鍚戝彸绠ご
_this.find(".next").click(function() {
// clearInterval(t);
func();
});
// 鎵嬪姩瑙﹀彂婊氬姩鏁堟灉::鍚戝乏绠ご
_this.find(".prev").click(function() {
// clearInterval(t);
func2();
});
// 鑷姩鎵ц
if(_this.parents(".floor_5").length){
}else{
t = setInterval(func, time);
a.hover(function() {
clearInterval(t);
},function() {
t = setInterval(func, time);
}
);
}
}
function share(){
window._bd_share_config = {
"common": {
"bdSnsKey": {},
"bdText": "",
"bdMini": "2",
"bdMiniList": false,
"bdPic": "",
"bdStyle": "0",
"bdSize": "16"
},
"share": {},
"slide": { // 璺熷浘鏍囧紡鐨勪唬鐮佺浉姣旓紝杩欓噷鏄坊鍔犱簡娴獥寮 slide 灞炴€ч厤缃
"type": "slide",
"bdImg": "5",
"bdPos": "left",
"bdTop": "100"
}
};
window._bd_share_config = {
share : [{
"bdSize" : 16
}],
}
with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
}
/* 鎼滅储鎻愮ず */
function checksearch(the)
{
if ($.trim(the.key.value) == '')
{
alert('璇疯緭鍏ュ叧閿瓧');
the.key.focus();
the.key.value = '';
return false
}
if ($.trim(the.key.value) == '璇疯緭鍏ュ叧閿瓧')
{
alert('璇疯緭鍏ュ叧閿瓧');
the.key.focus();
the.key.value = '';
return false
}
}