// JavaScript Document
//jquery加载html内容
function loadCont(objID,srcUrl){
	$("#"+objID).load(srcUrl,function(data){
					//obj.html(data);
					}
	);
}

function loadXML(XMLPath,callBackSuc){
	jQuery.ajax({
		async: true, // 默认true(异步请求)
		cache: false, // 默认true,设置为 false 将不会从浏览器缓存中加载请求信息。
		type: "GET", // 默认:GET 请求方式:[POST/GET]
		dataType: "xml", //默认["xml"/"html"] 返回数据类型:["xml" / "html" / "script" / "json" / "jsonp"]
		url: XMLPath, // 默认当前地址,发送请求的地址
		//data: { key: "value" }, // 发送到服务器的数
		//beforeSend: function(){alert("start send");},
		//complete: function(){alert("complete");},
		error: function(xml) { alert('Error loading XML document'); }, // 请求失败时调
		timeout: 5000, // 设置请求超时时间
		success: callBackSuc // 请求成功后回调函数 参数：服务器返回数据,数据格式.
			/*
			$(xml).find('user').each(function(i) {
				var loginname = $(xml).find("user loginname").eq(i).text();
				var name = $(xml).find("user name").eq(i).text();
				$("#users").append("<p>" + loginname + "</p>" + "<p>" + name + "</p><Br />");
			})

			$(xml).find("student").each(function(i){
				var id=$(this).children("id"); //取对象
				var id_value=$(this).children("id").text(); //取文本
				alert(id_value);//这里就是ID的值了。
				alert($(this).attr("email")); //这里能显示student下的email属性。

				//最后输出了，这个是cssrain的写法，貌似比macnie更JQ一点
				$('<li></li>').html(id_value).appendTo('ol');
			});
			*/
	})
}

function GetQueryString(name) {
   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
   var r = window.location.search.substr(1).match(reg);
   if (r!=null) return unescape(r[2]); return null;
}

var MBar = '<div id="tempTitle" style="width:90%;height:30px; background-color:#FFF;color:red;cursor:pointer"><span onclick="removeTemp();" style="float:right">关闭窗口</span></div>';

function format()
{
	var temp = ""+document.getElementById("Content").value;
	//alert(temp);//return;
	ClearEmptyB(temp)
	temp = temp.replace(/ |　/ig,"");	
	temp = temp.replace(/\n/ig,"　　");
	temp = temp.replace("\n\n"," ");
	temp = "    "+temp;
	//alert(temp);
	document.getElementById("Content").value=temp;
}
function formatB(temp)
{
	objSubStr = String.fromCharCode(33);
	var hadHz = temp.indexOf("  ");
	if (hadHz >= 0)
	{
		alert("包含");
	}else
	{
		alert("不包含");
		temp = temp.replace(/ |　/ig,"");	
		temp = temp.replace(/\n/ig,"　　");
		temp = temp.replace("\n\n"," ");
	}
	
	return (temp);
}
function ClearEmpty()
{
	var temp = "\n"+document.getElementById("Content").value;
	temp = temp.replace(/ |　/ig,"");
	temp = temp.replace(/\r\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n/ig,"  \n");
	temp = temp.replace("\n\n","\n");
	document.getElementById("Content").value=temp;
}
function ClearEmptyB(str)
{
	var temp = str;
	temp = temp.replace(/ |　/ig,"");
	temp = temp.replace(/\r\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n/ig,"  \n");
	temp = temp.replace("\n\n","\n");
	return temp;
}
function ClearEmpty2()
{
	var temp = "\n"+document.getElementById("Content").value;
	temp = temp.replace(/ |　/ig,"");
//	temp = temp.replace(/\r\n/ig,"\n");
//	temp = temp.replace(/\n\n/ig,"\n");
//	temp = temp.replace(/\n\n/ig,"\n");
//	temp = temp.replace(/\n\n/ig,"\n");
//	temp = temp.replace(/\n\n/ig,"\n");
//	temp = temp.replace(/\n/ig,"  \n");
//	temp = temp.replace("\n\n","\n");
	document.getElementById("Content").value=temp;
}
function AddEmptyLine()
{
	var temp = "\n"+document.getElementById("Content").value;
	temp = temp.replace(/ |　/ig,"");
	temp = temp.replace(/\r\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n\n/ig,"\n");
	temp = temp.replace(/\n/ig,"\n\n");
	temp = temp.replace("\n\n","");
	document.getElementById("Content").value=temp;
}
function chklen() {
	var strlen;
	strlen= infoFrom.Content.value.length;
	alert(strlen);
	return;
}
function changeTab(objTitle,objBody,curID,objCount){
	//alert($("#"+objBody+i).html());
	for(i=1;i<=objCount;i++){
	
		$("#"+objTitle+i).addClass('tabUnActive');
		$("#"+objBody+i).hide();
	}
	$("#"+objTitle+curID).removeClass('tabUnActive');
	$("#"+objTitle+curID).addClass('tabActive');
	$("#"+objBody+curID).show();
}
function getOpenZTList(){
	$.post('UserOP.asp?act=getOpenZTList',function(data){
		$("#ztlistTemp").html(data)
	});
}