/*****导航滑动渐隐显示*****/
function dropMenu(obj){
	$(obj).each(function(){
		var theSpan = $(this);
		var theMenu = theSpan.find(".down");
		var tarHeight = theMenu.height();
		theMenu.css({height:0,opacity:0});
		theSpan.hover(
			function(){
				$(this).addClass("indexbg");
				theMenu.stop().show().animate({height:tarHeight,opacity:1},500);
			},
			function(){
				$(this).removeClass("indexbg");
				theMenu.stop().animate({height:0,opacity:0},500,function(){
					$(this).css({display:"none"});
				});
			}
		);
	});
}

$(document).ready(function(){
	dropMenu(".pull-down");
});

/*****导航滑动渐隐显示*****/


/***********右侧在线客服***********/
lastScrollY = 0;
function FloatScroll() {
    var diffY;
    if (document.documentElement && document.documentElement.scrollTop){
    	diffY = document.documentElement.scrollTop;
	}
    else if (document.body){
    	diffY = document.body.scrollTop;
	}
    else
    {}
    percent = .1 * (diffY - lastScrollY);
    if (percent > 0){
		percent = Math.ceil(percent);
	}
    else{
		percent = Math.floor(percent);
	}
    document.getElementById("divcs").style.top = parseInt(document.getElementById("divcs").style.top) + percent + "px";
    lastScrollY = lastScrollY + percent;
}

$(function(){
	$("#divcs").hover(
		function(){
			$(this).stop(true,false);
			$(this).animate({right:0},300);	
		},
		function(){
			$(this).animate({right:-171},300);	
		}
	)

	
})

$(function(){
	$(".iHover").hover(
		function(){
			$(this).addClass("iShow");
		},function(){
			$(this).removeClass("iShow");
		}
	);
});
/***********右侧在线客服***********/

/***********兼容各浏览器[点击返回页面top]***********/
 $(function(){
    var topDistance = 500;//go-top距顶端距离

var showDistance = 1;//距离顶端多少距离开始显示go-top
var viewH = document.documentElement.clientHeight == 0 ? document.body.clientHeight : document.documentElement.clientHeight;
var gotopCon = "<div class='go-top'><a href='#'><img src='/images/up.png' border=0 /></a></div>"
var thisTop = $(window).scrollTop() + topDistance;
    $(".head").css("position","relative");
    $(".head").append(gotopCon);
    $(".go-top").css("top",thisTop);
    if($(window).scrollTop() < showDistance){
        $(".go-top").hide();
        }
    $(window).scroll(function(){
        thisTop = $(this).scrollTop() + topDistance;
        $(".go-top").css("top",thisTop);
        if($(this).scrollTop() < showDistance){
            $(".go-top").fadeOut("fast");
            }else{
                $(".go-top").fadeIn("fast");
                }
        });
    $("a",".go-top").click(function(){
        $("html").animate({scrollTop:0},"fast");//IE,FF
        $("body").animate({scrollTop:0},"fast");//Webkit

return
false;
        });
    });
/***********兼容各浏览器[点击返回页面top]***********/ 



/********悬浮广告*********/
$(document).ready(function(){

	$(".ad a").click(function(){
		
		$(".ad").fadeOut(400);
		
	});
	
	$(".ad").floatadv();
	
});

jQuery.fn.floatadv = function(loaded) {
	var obj = this;
	body_height = parseInt($(window).height());
	block_height = parseInt(obj.height());
	
	top_position = parseInt((body_height/10) - (block_height/10) + $(window).scrollTop());
	if (body_height<block_height) { top_position = 0 + $(window).scrollTop(); };
	
	if(!loaded) {
		obj.css({'position': 'absolute'});
		obj.css({ 'top': top_position });
		$(window).bind('resize', function() { 
			obj.floatadv(!loaded);
		});
		$(window).bind('scroll', function() { 
			obj.floatadv(!loaded);
		});
	} else {
		obj.stop();
		obj.css({'position': 'absolute'});
		obj.animate({ 'top': top_position }, 400, 'linear');
	}
}
/********悬浮广告*********/