function switchTab(tabid){
		var s=document.getElementById(tabid).src;
		var imgs1=s.substring(s.lastIndexOf("/")+1);
      
	   for(var i=1;i<6;i++){
	   var imgs='s'+i;
	   if(imgs==tabid){
	   var dang=imgs1;
	   var imgss='1s'+i+'.png';
	
	  	if (imgss==dang){
	    document.getElementById(tabid).src="images/"+imgs1;
		}else
		{
		document.getElementById(tabid).src="images/1"+imgs1;
		}
		
	   }else{
	   
	   document.getElementById(imgs).src="images/s"+i+".png";
	   }
	   }   
	
}
function fsubmit(obj){
		  obj.submit();
		}


function login(){
var a = document.getElementById("demo"); 

var b = document.getElementById("load"); 

a.style.display = "none"; //隐藏 

b.style.display = "block"; //显示

a.onreadystatechange = function() { 

if (this.readyState=="complete") { //最近才知道的。不然也写不出来。

// 解释：一个iframe加载完毕的状态是complete,

// 就象xmlhttp里的那个==4一样,这些都是规定的



b.style.display = "none"; 

a.style.display = "block"; 

} 

}
}

function addheight(){
	var h=document.getElementById("wei").offsetHeight;	
	var o=document.getElementById("show").offsetHeight;	
	 var j=document.getElementById("wei").offsetTop;

	var addh=300;
	if(h<addh){	
	
	document.getElementById("wei").style.top=j-10+"px";
	document.getElementById("wei").style.height=h+10+"px";
	document.getElementById("show").style.height=o+10+"px";
	
	
	

	setTimeout("addheight()",10); 
	 
	} else{

	setTimeout("jianheight()",3000); 
	}
	
	 
} 
function jianheight(){
		var o=document.getElementById("show").offsetHeight;	
	var h=document.getElementById("wei").offsetHeight;
	 var j=document.getElementById("wei").offsetTop;

	var addh=70;
	if(h>addh){

	
	document.getElementById("wei").style.height=h-10+"px";
	document.getElementById("show").style.height=o-10+"px";
	document.getElementById("wei").style.top=j+10+"px";
	
	
	setTimeout("jianheight()",10);   
	
	} 
	
	 
}


/*首页右侧滑动*/

/*window.onload = function() {
rolinTab("rolin")
}*/
function rolinTab(obj) {
var list = $(obj).getElementsByTagName("LI");
var state = {show:false,hidden:false,showObj:false};

for (var i=0; i<list.length; i++) {
var tmp = new rolinItem(list[i],state);

}
}

function rolinItem(obj,state) {
var speed = 0.0666; 
var range = 1;
var interval;
var tarH;
var tar = this;
var head = getFirstChild(obj);
var content = getNextChild(head);
var isOpen = false;
this.pHidden = function() {
if (isOpen) hidden();
}
this.pShow = show;

var baseH = content.offsetHeight;
content.style.display = "none";
var isOpen = false;



head.onmouseout = mouseout;

head.onclick = function() {

if (!state.show && !state.hidden) {
if (!isOpen) {
head.onmouseout = null;
show();
} else {
hidden();
}

}
}

function mouseout() {
this.style.background = "#FFF"
}
function show() {

state.show = true;
if (state.openObj && state.openObj != tar ) {
state.openObj.pHidden();
}
content.style.height = "0px";
content.style.display = "block";
content.style.overflow = "hidden";
state.openObj = tar;
tarH = baseH;

interval = setInterval(move,10);
}
function showS() {
isOpen = true;
state.show = false;
}

function hidden() {
state.hidden = true;
tarH = 0;
interval = setInterval(move,10);
}

function hiddenS() {
head.style.borderBottom = "none";
head.onmouseout = mouseout;
head.onmouseout();
content.style.display = "none";
isOpen = false;
state.hidden = false;
}

function move() {
var dist = (tarH - content.style.height.pxToNum())*speed;
if (Math.abs(dist) < 1) dist = dist > 0 ? 1: -1;
content.style.height = (content.style.height.pxToNum() + dist) + "px";
if (Math.abs(content.style.height.pxToNum() - tarH) <= range ) {
clearInterval(interval);
content.style.height = tarH + "px";
if (tarH != 0) {
showS()
} else {
hiddenS();
}
}
}

}
var $ = function($) {return document.getElementById($)};
String.prototype.pxToNum = function() {return Number(this.replace("px",""))}
function getFirstChild(obj) {
var result = obj.firstChild;
while (!result.tagName) {
result = result.nextSibling;
}
return result;
}

function getNextChild(obj) {
var result = obj.nextSibling;
while (!result.tagName) {
result = result.nextSibling;
}
return result;
}