// JavaScript Document
function trim(str){ 
  return str.replace(/^\s+|\s+$/g,''); 
 } 
 //删除字符串左侧的空白字符。 
 function ltrim(str){ 
  return str.replace(/^\s+/g,''); 
 } 
 //删除字符串右侧的空白字符。 
 function rtrim(str){ 
  return str.replace(/\s+$/g,''); 
 }
 function testReg(reg,str){ 
  return reg.test(str); 
 }
function dr(x)
{
	document.write(x);
}
function $(x)
{
	return document.getElementById(x);
}
function align_left_center()//等高度
{
var left_div=$("left_tree")//左边的DIV
var content_div=$("content_s")//左边的DIV
var control_height=$("control_height")
var control_height_r=$("control_height_r")
if(left_div&&content_div){//如果两个DIV都存在
   if(left_div.clientHeight-content_div.clientHeight>10)
     {
         control_height_r.style.height=(left_div.clientHeight-content_div.clientHeight+10)+"px"
     }
   if(content_div.clientHeight-left_div.clientHeight>10) 
     {
		 control_height.style.height=(content_div.clientHeight-left_div.clientHeight-10)+"px"
     }
  }
}

function flash(url,w,h){ 
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">'); 
document.write('<param name="movie" value="'+url+'">'); 
document.write('<param name="quality" value="high"> '); 
document.write('<param name="wmode" value="transparent"> '); 
document.write('<param name="menu" value="false"> '); 
document.write('<embed src="'+url+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">'); 
document.write('</embed>'); 
document.write('</object>'); 
}
function show_hide(div,input)
{
	if($(div)&&$(input))
	{
		if($(input).value==0)
		{
		  $(div).style.display="block";
		  $(input).value=1;
		}
		else
		{
		  $(div).style.display="none";
		  $(input).value=0;
		}
	}
	
	
}
function show(div)
{
	if($(div))
	$(div).style.display="block";
}
function hide(div)
{
	if($(div))
	$(div).style.display="none";
}
function GetXmlHttpObject()
{
 var xmlHttp;//声明一个AJAX对象
 //创建一个AJAX对象
 try
    {
   // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
 catch (e)
    {

  // Internet Explorer
   try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   catch (e)
      {

      try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
      catch (e)
         {
         alert("您的浏览器不支持AJAX！");
         return false;
         }
      }
    }
	return xmlHttp;
}
function ajaxFunction(id)//ajax实现页面无刷新show_id用表示显示信息的LI的ID，to_id表示当前的ID号
{
	if($("list_two"+id).style.display=="block")
	{
		$("list_two"+id).style.display="none";
	}
	else
	{
		var xmlHttp=GetXmlHttpObject();
		var url="list_two.asp?id="+id;
		xmlHttp.onreadystatechange=function()
		{
			  if(xmlHttp.readyState==4)
			  {
				 $("list_two"+id).style.display="block";
				 $("list_two"+id).innerHTML=xmlHttp.responseText;
			  }
		}
		xmlHttp.open("post",url,true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
		xmlHttp.send(null);
	}
}
function check(i,obj,type)
{
	var onimg=new Array('images/subgy.gif','images/subal.gif','images/subjj.gif','images/sublx.gif');
	var outimg=new Array('images/subgy1.gif','images/subal1.gif','images/subjj1.gif','images/sublx1.gif');
	if(type=='onimg')
	{
	    obj.childNodes[0].childNodes[0].src=outimg[i-1];
	}
	else
	{
		obj.childNodes[0].childNodes[0].src=onimg[i-1];
	}
}
function qq_roll(num,sspeed,xspeed)//num未初始的top大小取十位的整数，防止出现死循环,speed表示速度
{
	var body_scroll_height=Math.round((document.documentElement.scrollTop)/10)*10;
	var qq_content_top=$("qq_content").style.top;
	var qq_content_top= parseInt(qq_content_top);
	if(qq_content_top<num+body_scroll_height)
	{
		qq_content_top=qq_content_top+sspeed;
		$("qq_content").style.top=qq_content_top+"px";
	}
	if(qq_content_top>num+body_scroll_height)
	{
		qq_content_top=qq_content_top-xspeed;
		$("qq_content").style.top=qq_content_top+"px";
	}
}
function close_qq_roll()
{
	$("qq_content").className="close_qq_roll";
	$("open_qq_roll").style.display="block";
}
function open_qq_roll()
{
	$("qq_content").className="open_qq_roll";
	$("open_qq_roll").style.display="none";
}
function qiuyu()
{
	dr(Math.round(216/10)*10);
	dr(Math.ceil(200.11));//求最小的整数但不小于本身.
	dr(Math.round(204));//求本身的四舍五入。
	dr(Math.floor(200.11));//求最大的整数但不大于本身
}




