<%
function checkstr(str,lx)
	if lx="" then lx="1" 
	if len(str)>0 then
	else
		str=""
	end if			
	
    Set re=new RegExp
    re.IgnoreCase =true
    re.Global=True

    re.Pattern="(script)"
    str=re.Replace(str,"sc ript")

    re.Pattern="(>"+chr(13)+")"
    str=re.Replace(str,">")
    re.Pattern="(> "+chr(13)+")"
    str=re.Replace(str,">")
    re.Pattern="(>  "+chr(13)+")"
    str=re.Replace(str,">")

    re.Pattern="("+chr(13)+")"
	if lx="2" then
		str=re.Replace(str,"<br>")
	else	
	    str=re.Replace(str,"<br>&nbsp;&nbsp;&nbsp;&nbsp;")
	end if
	if left(lcase(str),6)<>"<table" then
		if lx="1" then
			str="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+str
		end if			
	end if	
	checkstr=str
end function	

function cutstr(str,cd,flag)
	dim i,tot,sstot
	if flag="" then
		flag=0
	end if
	str=trim(str)
	a=len(str)
	b=0
	i=0
	do while b<cd and i<a
		i=i+1
		if asc(mid(str,i,1))>0 then
			b=b+1
		else
			b=b+2		
		end if
	loop
	if a>b and flag=0 then
			cutstr=left(str,b)&"..."
		else
			cutstr=left(str,b)
	end if		
end function

function picplacetxt(picplace)
	if picplace=0 then
	       picplacetxt="left"
	elseif picplace=1 then
	       picplacetxt="center"     
    elseif picplace=2 then
           picplacetxt="right"		
	end if	
end function
function checktxt(txt,flag,txtlenstar,txtlenend)
	'txt,检测正文
	'flag,检测类别  ，为1则长度检测  ,2为非法字符检测
    checktxt=0
	if txt="" then	checktxt=1
	if flag=1 and checktxt<>1 then
		if len(txt)<txtlenstar or len(txt)>txtlenend then checktxt=2
	end if
	if flag=2 and checktxt<>1 then
		if checkstr2(txt)=false then checktxt=3
	end if
end function
function picplacetxt(picplace)
	if picplace=0 then
	       picplacetxt="left"
	elseif picplace=1 then
	       picplacetxt="center"     
    elseif picplace=2 then
           picplacetxt="right"		
	end if	
end function
function checkstr1(str)
		checkstr1=replace(str,"'","")
		checkstr1=replace(checkstr1,")","")
		checkstr1=replace(checkstr1,")","")
end function
function checkstr2(str)
		flag=true
		newstr=glstr
     	if instr(newstr,"|")>0 then
				strlist=split(newstr,"|")
				for i = 0 to ubound(strlist)
					if instr(str,strlist(i))>0 and strlist(i)<>"" then
	       					checkstr2=false
						exit function      				
	       			end if
				next
		end if			
		checkstr2=flag
end function
%>