// JavaScript Document
var http_request = false;
function send_request(url) {
	http_request = false;
	//初始化XMLHttpRequest 对象
	if(window.XMLHttpRequest) { //Mozilla 浏览器
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {//设置MiME 类别
			http_request.overrideMimeType("text/xml");
		}
	}
	else if (window.ActiveXObject) { // IE 浏览器

		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e){
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	//
	if (!http_request) { 
		window.alert("不能创建XMLHttpRequest 对象实例.");
		return false;
	}
	   http_request.onreadystatechange = processRequest;
	// 确定发送请求的方式和URL 以及是否同步执行下段代码
	http_request.open("GET", url, true);
	http_request.send(null);
}
//----------------------------------------------------------------------------------------------------------//
//
function openwindow(url){
	window.open(url,"");
}
//
function HtmlEnCode(input){
	str="";
	str=input.replace(/&lt;/g,"<");
	str=input.replace(/&gt;/g,">");
	str=input.replace(/\r\n/g,"</p><p class='indent>");
	str=input.replace(/\n/g,"</p><p class='indent'>");
	return str;
}
function toUbb(input){
	var reg;
	
	reg=/\[Color=(\w+|#\d{6})\](.[^\[]+)\[\/Color\]/ig;
	input=input.replace(reg,"<span style=\"color:$1;\">$2</span>");
	reg=/\[URL=(.[^\]]+)\](.[^\[]+)\[\/URL\]/ig;
	input=input.replace(reg,"<a href=\"$1\" target=\"_blank\" >$2</a>");

	reg=/\[IMG\](.[^\[]+)\[\/IMG\]/ig;
	input=input.replace(reg,"<a href=\"javascript:openwindow('lmmanage/files/$1')\" ><img class=\"img\" src=\"lmmanage/files/$1\" onload=\"javascript:if(this.width>550) this.width='550' \"/></a>");
	reg=/\[B\](.[^\[]+)\[\/B\]/ig;
	input=input.replace(reg,"<strong>$1</strong>");
	reg=/\[C\](.[^\[]+)\[\/C\]/ig;
	input=input.replace(reg,"<center>$1</center>");//文字居中
	return input;
}
