// JavaScript Document

var lastScrollY=0;
function heartBeat(){ 
diffY=document.documentElement.scrollTop; 
percent=0.1*(diffY-lastScrollY); 
if(percent>0)percent=Math.ceil(percent); 
else percent=Math.floor(percent); 
document.getElementById("server").style.top=parseInt(document.getElementById("server").style.top)+percent+"px";
lastScrollY=lastScrollY+percent; 
}
function close_float_left(){document.getElementById("server").style.display='none';}

function resizeimg(ImgD,imgwidth,imgheight){
	var flag=false;  
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		flag=true; 
		if(image.width/image.height>= imgwidth/imgheight){ 
			if(image.width>imgwidth){
				ImgD.width=imgwidth; 
				ImgD.height=(image.height*imgwidth)/image.width; 
			}else{ 
				ImgD.width=image.width;
				ImgD.height=image.height; 
			} 
		} 
		else{ 
			if(image.height>imgheight){
				ImgD.height=imgheight; 
				ImgD.width=(image.width*imgheight)/image.height; 
			}else{ 
				ImgD.width=image.width;
				ImgD.height=image.height; 
			} 
		} 
	}
}


function $id(id){return document.getElementById(id)}

function $ah(id){
	return document.getElementById(id)
}


function check_title(n){
	
	
	/*方法1
	if(n==1){
		$ah("title_2").style.background=""
		$ah("title_div_2").style.display="none"	
	}
	else if(n==2){
		$ah("title_1").style.background=""
		$ah("title_div_1").style.display="none"	
	}
	$ah("title_"+n).style.background="url(/img/over_news.gif)  no-repeat center"
	$ah("title_div_"+n).style.display="block"
	*/
	
	/*方法3
	$ah("title_1").style.background=""
	$ah("title_div_1").style.display="none"	
	$ah("title_2").style.background=""
	$ah("title_div_2").style.display="none"	
	
	$ah("title_"+n).style.background="url(/img/over_news.gif)  no-repeat center"
	$ah("title_div_"+n).style.display="block"
	*/
	
	//方法3
	//for循环给他们初始化的样式
	for(i=1;i<=2;i++){
		$ah("title_"+i).style.background=""
		$ah("title_div_"+i).style.display="none"
		$ah("more_"+i).style.display="none"
	}
	//给他们点击以后的样式
	$ah("title_"+n).style.background="url(/img/over_news.gif)  no-repeat center"
	$ah("title_div_"+n).style.display="block"	
	$ah("more_"+n).style.display="block"

}

var product_timer_
function product_show_ptype(){
	$id("product_ptype_parent_li").className='onli'
	clearTimeout(product_timer_);
	document.getElementById("product_ptype_div").style.display='block'
}
var product_timer_n=1
function product_close_ptype(){
	product_timer_=setTimeout("product_close_ptype()",1000)
	product_timer_n++;
	if(product_timer_n==2) {
		document.getElementById("product_ptype_div").style.display='none'
		$id("product_ptype_parent_li").className=''
		clearTimeout(product_timer_);	
		product_timer_n=1
	}
}










