window.onload=function(){
	WindowHeight(0);
	LoadTableData('def');
}

// 读取数据表名
function LoadTableData(str){
	refTableOption = document.getElementById("refTable").options;
	refTableOption.length=0; 
	if ($id('refDatabase').value=="web"){
		refTableOption.add(new Option("文章","OT_info"));
		refTableOption.add(new Option("评论","OT_infoMessage"));
		refTableOption.add(new Option("留言","OT_message"));

	}else if ($id('refDatabase').value=="coll"){
		refTableOption.add(new Option("采集项目","OT_collItem"));
		refTableOption.add(new Option("采集结果","OT_collResult"));
	}
	if (str=="def" && $id('refTableStr').value!=""){ $id('refTable').value=$id('refTableStr').value; }

	LoadFiledData(str);
}

// 读取数据字段名
function LoadFiledData(str){
	refFiledOption = document.getElementById("refField").options;
	refFiledOption.length=0; 
	if ($id('refTable').value=="OT_info"){
		refFiledOption.add(new Option("标题","IF_theme"));
		refFiledOption.add(new Option("来源","IF_source"));
		refFiledOption.add(new Option("作者","IF_writer"));
		refFiledOption.add(new Option("内容","IF_content"));
		refFiledOption.add(new Option("标签","IF_themeKey"));
		refFiledOption.add(new Option("摘要","IF_contentKey"));

	}else if ($id('refTable').value=="OT_infoMessage"){
		refFiledOption.add(new Option("称呼","IM_username"));
		refFiledOption.add(new Option("内容","IM_content"));
	
	}else if ($id('refTable').value=="OT_message"){
		refFiledOption.add(new Option("称呼","MA_username"));
		refFiledOption.add(new Option("内容","MA_content"));
	
	}else if ($id('refTable').value=="OT_collItem"){
		refFiledOption.add(new Option("项目名称","CI_theme"));
	
	}else if ($id('refTable').value=="OT_collResult"){
		refFiledOption.add(new Option("标题","CR_theme"));
		refFiledOption.add(new Option("来源","CR_source"));
		refFiledOption.add(new Option("作者","CR_writer"));
		refFiledOption.add(new Option("内容","CR_content"));
		refFiledOption.add(new Option("标签","CR_themeKey"));
	
	}
	if (str=="def" && $id('refFieldStr').value!=""){ $id('refField').value=$id('refFieldStr').value; }
}

// 数据处理查询表单
function CheckRefForm(str){
	$id('dealMode').value = str;
	if (str=="refer"){
		if ($id('refStr').value==""){ alert('请先输入要查询的关键词');$id('refStr').focus();return false; }
		$id('refForm').action="";
		$id('refForm').method="get";
	}else if (str=="replace"){
		if ($id('refStr').value==""){ alert('请先输入要查询的关键词');$id('refStr').focus();return false; }
		if ($id('repStr').value==""){ alert('请先输入要替换关键词的内容');$id('repStr').focus();return false; }
		$id('refForm').action="";
		$id('refForm').method="get";
//		$id('refForm').action="dataDeal_deal.asp?mudi=replaceStr";
//		$id('refForm').method="post";
	}
	$id('refForm').submit();
}