function filterSelect()
{
	var ops=new Array(new Array("去掉HTML注释","<!--.+?-->"),
		new Array("去掉内容样式表","(?<=[^<>]+?)style=(?<q>['\\\"]?).+?\\k<q>(?=[\\s>]|/>)"),
		new Array("去掉font字体标签","<font.*?>|</font>"),
		new Array("去掉脚本","(<script.+?</script>)|(\\son\\w+=(?<q>['\\\"]).+?\\k<q>)"),
		new Array("去掉div和span标签","<(?:div|span).*?>|</(?:div|span)>"),
		new Array("去掉超链接","<a\\s[^>]+?>|</a>"),
		new Array("去掉table表格标签","<(?:table|tr|td).*?>|</(?:table|tr|td)>"),
		new Array("去掉图片","<img\\s[^<>]+>"),
		new Array("去掉iframe","<iframe.+?</iframe>"),
		new Array("去掉flash等控件","<object.+?</object>"),
		new Array("去掉所有HTML标签","<(?!br|p|/br|/p).*?>")
		);
	var o_sel=document.getElementById("selFilter");
	for(var i=0; i<ops.length; i++){
		var op=document.createElement("OPTION");
		o_sel.options.add(op);
		op.innerHTML=ops[i][0];
		op.value=ops[i][1];
	}
	o_sel.onchange=filterChange;
}

function filterChange()
{
	var l1,l2,n;	// 行数
	var o_sel=document.getElementById("selFilter");
	if (o_sel.selectedIndex==0 || o_ad1.value.indexOf(o_sel.value)>=0){
		return;
	}
	if (o_ad1.value.length>0 && o_ad1.value.charAt(o_ad1.value.length-1)!="\n"){
		o_ad1.value+="\r\n";
	}
	o_ad1.value+=o_sel.value;
	
	l1=o_ad1.value.split("\n").length;
	l2=o_ad2.value.split("\n").length;
	n=l1-l2;
//	alert(l1+","+l2);
	if (l1==1 && l2==1){
		o_ad2.value+=" ";
	}else{
		while(n>0){
			o_ad2.value+="\r\n ";
			n--;
		}
	}
}

filterSelect();

