<SCRIPT language=JavaScript>
	var i_n=0
	function heightnow(f,m){ //动态高度调整
		var h_now
		var f_p
		var f_n
		var i
		var ii=0
		var ii_p
		
		
		for(i=0;i<ff.length;i++){
		
			
			if(ff[i]==f ){
				ii=i;
				break
			}
		}
				
		if(ii<=0)f_p="no";else f_p=ff[ii-1];
		if(ii>=ff.length-1)f_n="no"; else f_n=ff[ii+1];
		//alert(f_p+"|"+f_n)
		
		h_now=window.document.body.scrollHeight;
		for(i=0;i<ff.length;i++)
		h_now-=document.getElementById(ff[i]).scrollHeight;
	
		h_f=document.getElementById(f).scrollHeight;
		
		if(m==0){
		
			document.getElementById(f).style.height=30;
			//h_ifr[ii]=30;
			
			i=ii+1
			while(i!=ii){

				if(i<ff.length){
					///alert("now->"+i)			
					if (document.getElementById(ff[i]).scrollHeight>30){
					
						hh_ff=document.getElementById(ff[i]).scrollHeight+h_f-30
						
						document.getElementById(ff[i]).style.height=hh_ff
						
						if(hh_ff>30) h_ff[i]=hh_ff
						
						frames("f_"+ff[i]).document.getElementById("label_list").style.height=hh_ff-30
						
						break
					}
					i=i+1
				}else{
					i=0
				}
			}		

		}else{
		
			i=ii+1
            hh_ff=h_ff[ii]
			h_ff[ii]=h_now+30
			
			while(i!=ii){

				if(i<ff.length){

					//alert("check->"+ff[i]+":"+document.getElementById(ff[i]).scrollHeight+" - "+hh_ff)
					if (document.getElementById(ff[i]).scrollHeight>30){
					
						if (document.getElementById(ff[i]).scrollHeight>=hh_ff-30+30+300){
							if(hh_ff>30)h_ff[ii]=hh_ff;else h_ff[ii]=300;
							//alert("findb->"+ff[i]+":"+document.getElementById(ff[i]).scrollHeight+" - "+hh_ff)
							ii_p=i
							break
						}else if(document.getElementById(ff[i]).scrollHeight>=(window.document.body.scrollHeight-30)/(ff.length-1)){
							h_ff[ii]=(window.document.body.scrollHeight-30)/4
							ii_p=i
							//alert("finds->"+ff[i]+":"+document.getElementById(ff[i]).scrollHeight+" - "+hh_ff)
							//alert(ff[i]+hh_ff)
							break
						}
					}
					i=i+1
				}else{
					i=0
				}
				
			}		
									
			if(ii_p>=0){
			
				hh_ff=h_ff[ii_p]-h_ff[ii]+30
				
				if(hh_ff>=300)h_ff[ii_p]=hh_ff
				
				if(hh_ff<=30)frames("f_"+ff[ii_p]).showtitle()
				
				//alert(h_ff)
				document.getElementById(ff[ii_p]).style.height=hh_ff;
				
				frames("f_"+ff[ii_p]).document.getElementById("label_list").style.height=hh_ff-30
				
			}
			document.getElementById(f).style.height=h_ff[ii];
			frames("f_"+f).document.getElementById("label_list").style.height=h_ff[ii]-30
			
		}
	
	}
	
	function changei(o){ //隐藏标签栏图片替换
	//alert(i_n)
	
	//o.src='images/d_a_0_1.gif'
	
	if (i_n==0){
	o.src='images/d_1.gif';
	i_n=1
	return false
	}
	if (i_n==2){
	o.src='images/d_3.gif';
	i_n=3
	return false
	}
	if (i_n==1){
	o.src='images/d_0.gif';
	i_n=0
	return false
	}
	if (i_n==3){
	o.src='images/d_2.gif';
	i_n=2
	return false
	}
	}
	
	function changeii(o){ //隐藏标签栏
	//alert(i_n)
	
	//o.src='images/d_a_0_1.gif'
	
	if (i_n==0 || i_n==1){
	o.src='images/d_3.gif';
	i_n=3
	document.getElementById("label_show").style.display="none"
	//document.getElementById("sql_show").style.width=window.document.body.scrollWidth-30
	//document.getElementById("sql_show").style.width="98%"
	return false
	}
	
	if (i_n==2 || i_n==3){
	o.src='images/d_0.gif';
	i_n=1
	width_body_now=window.document.body.scrollWidth
	document.getElementById("label_show").style.display=""
	//document.getElementById("sql_show").style.width=width_body_now-document.getElementById("label_show").scrollWidth-30
	return false
	}

	}
	
	var object_now //当前选择的输入框
	
	function storeCaret (textEl) { //插入文本函数
	object_now=textEl
	if (textEl.createTextRange) 
	textEl.caretPos = document.selection.createRange().duplicate(); 
	} 
	
	function insertAtCaret (textEl, text) { 
	if (textEl.createTextRange && textEl.caretPos) { 
	var caretPos = textEl.caretPos; 
	caretPos.text =caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?text + 
	' ' : text; 
	} 
	else 
	textEl.value = text; 
	} 

</script>