﻿$(document).ready(function(){
  $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
    && location.hostname == this.hostname) {
      var $target = $(this.hash);
      $target = $target.length && $target 
      || $('[name=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
        $('html,body')
        .animate({scrollTop: targetOffset}, 1000);
       return false;
      }
    }
  });
});

/********** 平滑锚点效果 2009/08/19 collected by yeziyy **********/

function gotop(){
	window.onscroll=function(){
		if (document.documentElement.scrollTop==0&&document.body.scrollTop==0){
			$("#gotop").get(0).style.display="none";
		}else{
			$("#gotop").get(0).style.display="";
			if ($.browser.msie&&$.browser.version<"7.0"){
				$("#gotop").get(0).style.position="absolute";
				$("#gotop").get(0).style.top=getPosition(180);
			}
		}
	}
}
function getPosition(currObjH){
	return document.documentElement.scrollTop+document.documentElement.clientHeight-currObjH+"px";
}

function shDH(){
    if($("#dh_close").hasClass("closeDH")){
		$("#floatDH,#holdDH").animate({ 
            width: "22px"
        }, 1000 );
		$("#floatDH,#holdDH").animate({ 
			height: "84px"
        }, 1000 );
		$("#dh_close").removeClass("closeDH");
		$("#dh_close").addClass("openDH");
		
		
	} else if($("#dh_close").hasClass("openDH")){
	    $("#dh_close").removeClass("openDH");
	    $("#dh_close").addClass("closeDH");
         
        $("#floatDH,#holdDH").animate({ 
             width: "100%",
			 height: "38px"
        }, 1000 );
		$("#holdDH").animate({ 
             width: "970px"
        }, 1000 );
	}
}/********** 底部导航效果 2009/09/15 designed by yeziyy&doudou **********/



$().ready(function(){
FollowDiv = {
			follow : function(){
				$('#floatDH').css('position','absolute');
				this.initPos();
				$(window).scroll(function(){
				    var f_top = $(window).height() + $(window).scrollTop() - $("#floatDH").height();
					$("#floatDH").css("top",f_top);
				});
			},
			initPos:function(){
			    var f_top = $(window).height() + $(window).scrollTop() - $("#floatDH").height();
				$('#floatDH').css({top:f_top});
			}
	 }
// 如果是IE6， 则执行
if(jQuery.browser.msie && jQuery.browser.version.indexOf("6") != -1){
    FollowDiv.follow();
}
});

/********** 底部导航浮动效果 2009/09/23 designed by yeziyy&doudou **********/

/********** 隔行翻滚的文字 2009/08/05 collected by yeziyy **********/

function Show_Tab(swich_num,Tagnum,num){
	for(var i=0;i<num;i++){
	document.getElementById("tab"+swich_num+i).className="";
	}
	for(var i=0;i<num;i++){
	document.getElementById("swichcont"+swich_num+i).style.display="none";
	}
	document.getElementById("tab"+swich_num+Tagnum).className="selected";
	document.getElementById("swichcont"+swich_num+Tagnum).style.display="block";
}
/********** 选项卡切换效果 2009/08/06 designed by yeziyy **********/


function ObjectLoader() {
 // Do something with this class upon intialization
 }
ObjectLoader.prototype.startRotate = function() {
    if ( !this.count ) {
        this.count = 0;
     }
     if ( !this.container ) {
         alert ("Need container object for marquee effect");
         return;
     }
     if ( !this.timeout ) this.timeout = 3;

// Insert rotating object into container object
     var nextObj = this.objects[this.count];
	 var nextLinkObj = this.linkObjects[this.count];
     for ( var key in nextObj ) {
         this.container[key] = nextObj[key];
     }

	 for ( var key1 in nextLinkObj ) {
         this.linkContainer[key1] = nextLinkObj[key1];
     }
     
     var _self = this;
     function timerRelay() {
         _self.count++;
         if ( _self.count >= _self.objects.length ) _self.count = 0;
         _self.startRotate();
     }
     setTimeout(timerRelay, (this.timeout * 1000));
}
/********** 广告图片定时轮换效果 2009/09/26 designed by yeziyy **********/
