	// 计算字符串的字节长度，一个汉字作为2
	String.prototype.len= function (){
		var str=this;
		return str.replace(/[^\x00-\xff]/g, "**").length
	}

	// 获取String的左边指定字节数的子串
	String.prototype.leftByByte = function (byteLen){
		var str = this;
		if (str.len() <= byteLen || byteLen < 1) {
			return str;
		}
		var start = 0;
		var end  = str.length;

		do{
			var middle = parseInt((start + end) / 2);
			if (middle == start || middle == end) {
				break;
			}
			var middleByteLen = str.substring(0, middle).len();
			if (middleByteLen < byteLen) {
				start = middle;
			} else if (middleByteLen > byteLen) {
				end = middle;
			} else{
				break;
			}
		}  while (start < end);
		return str.substring(0, middle);
	}
	
	// 删除字符串，截取指定的字符串长度
	function truncateText(){
		var spans = document.getElementsByTagName("span");
		for (var i=0; i<spans.length; i++) {
			var spanObj = spans[i];
			if (spanObj.dispLength) {
				var dispLength = parseFloat(spanObj.dispLength);
				if (dispLength >= 0 && spanObj.innerText.len() > dispLength) {
					spanObj.title=spanObj.innerText;
					spanObj.innerText = spanObj.innerText.leftByByte(dispLength-2)+"…";
				}
			}
		}
	}
	

	function filterWordStyle(html){
	   html  =  html.replace(/<\/?SPAN[^>]*>/gi,  ""  );//  Remove  all  SPAN  tags  
	   html  =  html.replace(/<(\w[^>]*)  class=([^    |>]*)([^>]*)/gi,  "<$1$3")  ;  //  Remove  Class  attributes  
	   html  =  html.replace(/<(\w[^>]*)  style="([^"]*)"([^>]*)/gi,  "<$1$3")  ;  //  Remove  Style  attributes
	   html  =  html.replace(/size="\d*\.?\d*"/gi,  "")  ;  //  Remove  size  info Chenlin 2008.04.07
	   //html  =  html.replace(/<a.+?>/gi,"");  //  Remove  href  info Chenlin 2008.04.25
	   //html  =  html.replace(/<\/a>/gi,"");   //  Remove  href  info Chenlin 2008.04.25
	   html  =  html.replace(/<(\w[^>]*)  lang=([^    |>]*)([^>]*)/gi,  "<$1$3")  ;//  Remove  Lang  attributes  
	   html  =  html.replace(/<\\?\?xml[^>]*>/gi,  "")  ;//  Remove  XML  elements  and  declarations  
	   html  =  html.replace(/<\/?\w+:[^>]*>/gi,  "")  ;//  Remove  Tags  with  XML  namespace  declarations:  <o:p></o:p>  
	   html  =  html.replace(/ /,  "  "  );//  Replace  the     
	   //  Transform  <P>  to  <DIV>  
	   var  re  =  new  RegExp("(<P)([^>]*>.*?)(<\/P>)","gi")  ; 
	   //  Different  because  of  a  IE  5.0  error  
	   html  =  html.replace(  re,  "<p><div$2</div></p>"  )  ;  
	   return html;
	}
	
	
	function showTextInSpan(){
		var spans = document.getElementsByTagName("span");
		for (var i=0; i<spans.length; i++) {
			var spanObj = spans[i];
			if (spanObj.textSource) {
				var textSourceObj = document.getElementById(spanObj.textSource);
				//spanObj.innerHTML = filterWordStyle(textSourceObj.value);
				spanObj.innerHTML = textSourceObj.value;				
			}
		}
	}
	
	//触摸屏详细页面的滚动条控制
	function scroll_down(){
		document.all.div_scroll.scrollTop = document.all.div_scroll.scrollTop+470;
	} 
	function scroll_up(){
		document.all.div_scroll.scrollTop = document.all.div_scroll.scrollTop-470;
	} 
	
	//点击链接时IE状态栏的文字修改
	function document.onmouseover()
	{
	    setTimeout("window.status='欢迎访问北京市政府信息公开专栏！'",10);
	    return true;
	}
	function document.onmousedown()
	{
	    setTimeout("window.status='欢迎访问北京市政府信息公开专栏！'",10);
	    return true;
	}	