var an=1;
function qie1(c){
  an=1;
  qiehuan();
}
function qie2(c){
  an=2;
  qiehuan();
}
function qie3(c){
  an=3;
  qiehuan();
}
function qiehuan(c){
  if (an==1){
	  document.getElementById('k1').style.backgroundImage="url(/images/hui_an.jpg)";
	  document.getElementById('k2').style.backgroundImage="url(/images/hei_an.jpg)";
	  document.getElementById('k3').style.backgroundImage="url(/images/hei_an.jpg)";
	  document.getElementById('k1').style.color="#000";
	  document.getElementById('k2').style.color="#CCC";
	  document.getElementById('k3').style.color="#CCC";
	  document.getElementById('ul_miaoshu').style.display="";
	  document.getElementById('ul_chanshu').style.display="none";
	  document.getElementById('ul_tezen').style.display="none"
  }else if (an==2){
	  document.getElementById('k1').style.backgroundImage="url(/images/hei_an.jpg)";
	  document.getElementById('k2').style.backgroundImage="url(/images/hui_an.jpg)";
	  document.getElementById('k3').style.backgroundImage="url(/images/hei_an.jpg)";
	  document.getElementById('k1').style.color="#CCC";
	  document.getElementById('k2').style.color="#000";
	  document.getElementById('k3').style.color="#CCC";
	  document.getElementById('ul_miaoshu').style.display="none";
	  document.getElementById('ul_chanshu').style.display="";
	  document.getElementById('ul_tezen').style.display="none"
  }else if (an==3){
	  document.getElementById('k1').style.backgroundImage="url(/images/hei_an.jpg)";
	  document.getElementById('k2').style.backgroundImage="url(/images/hei_an.jpg)";
	  document.getElementById('k3').style.backgroundImage="url(/images/hui_an.jpg)";
	  document.getElementById('k1').style.color="#CCC";
	  document.getElementById('k2').style.color="#CCC";
	  document.getElementById('k3').style.color="#000";
	  document.getElementById('ul_miaoshu').style.display="none";
	  document.getElementById('ul_chanshu').style.display="none";
	  document.getElementById('ul_tezen').style.display=""
  }
}
//===============================================================================================================================================================


var jilu=1;//记录上次的图片序列位置，共12个序列
var T_an=1;//记录当前图像按钮位置
var ss=0;//控制滚动轴的主变量
var bs=0;//当前图片位置到终点图片位置之差值
var Timer;//自动跳时对象
var this_gao=0;//当前的高

function TuAn1(c){
  T_an=1;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn2(c){
  T_an=2;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn3(c){
  T_an=3;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn4(c){
  T_an=4;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn5(c){
  T_an=5;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn6(c){
  T_an=6;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn7(c){
  T_an=7;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn8(c){
  T_an=8;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn9(c){
  T_an=9;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn10(c){
  T_an=10;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn11(c){
  T_an=11;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}
function TuAn12(c){
  T_an=12;
  this_gao=window.document.getElementById('ps_tu').scrollTop;
  Timer=window.setInterval("gundongHS()",1);
}


//-------------------------

function gundongHS(c){
  if(T_an!=jilu){
	  
	  if(T_an-jilu>0){
        bs=10*Math.abs(T_an-jilu);
          if (ss<616*Math.abs(T_an-jilu)+this_gao){
	        ss=ss+1*bs;
	        window.document.getElementById('ps_tu').scrollTop=ss;
          }else if(ss>=616*Math.abs(T_an-jilu)+this_gao){
	        PD_stop();
          }
	  }else if(T_an-jilu<0){
		bs=10*Math.abs(T_an-jilu);
          if (ss>616*Math.abs(T_an-1)){
	        ss=ss-1*bs;
	        window.document.getElementById('ps_tu').scrollTop=ss;
          }else if(ss<=616*Math.abs(T_an-1)){
	        PD_stop();
          }
	  }
	
  }
}

function PD_stop(c){
	if(T_an-jilu>0){
      ss=616*Math.abs(T_an-jilu)+this_gao;
	  window.document.getElementById('ps_tu').scrollTop=ss;
	  jilu=T_an;
	  Timer=window.clearInterval(Timer);
	}else if(T_an-jilu<0){
	  ss=616*Math.abs(T_an-1);
	  window.document.getElementById('ps_tu').scrollTop=ss;
	  jilu=T_an;
	  Timer=window.clearInterval(Timer);	
	}
}
