$(document).ready(function(){
	buttnoretry();
	if(top==self){
		var paramarr=[];
		paramarr['webhost'] = location.hostname ;
		paramarr['targeturl']=location.href.replace('http://','').replace(location.hostname,'');		
		$e28dd6773=$e28dd6773?$e28dd6773:request('e28dd6773').replace('_mr_','.');
		$e28dd6773=$e28dd6773?$e28dd6773:location.hostname;
		top.location.href='http://'+ $e28dd6773 +'/index.php?'+http_build_query(paramarr);		
	}
	if(em_usrrank<5) {
		$("#e51663ad9").attr('disabled',true).attr('checked',false);
	}
	innerresizeWeb();
	if($2('l_exportquery') && $2('l_exportquery').value)$2('l_exportquery_false').value = eme64769cac($2('l_exportquery').value ,'l' ,'parse');
	if($2('p_exportquery') && $2('p_exportquery').value)$2('p_exportquery_false').value = eme64769cac($2('p_exportquery').value ,'p' ,'parse');
	if($2('exportquery')&& $2('exportquery').value)$2('exportquery_false').value = eme64769cac($2('exportquery').value ,'c' ,'parse');
	if(document.form1.e535ded19 && document.form1.e535ded19.value){
		$(document.form1.e535ded19.value).addClass('hiddencommon');
		if(document.form1.e535ded19.value.indexOf("lcommontd")!=-1)$("table#l_exportquerytable").css('width',"550px");
		if(document.form1.e535ded19.value.indexOf("pcommontd")!=-1)$("table#p_exportquerytable").css('width',"550px");
		if($2('exportquery_false').value)query2table('exportquery_false','exportquerytable',1);	
		if($2('l_exportquery_false').value)query2table('l_exportquery_false','l_exportquerytable',1);	
		if($2('p_exportquery_false').value)query2table('p_exportquery_false','p_exportquerytable',1);	
	}
	$("table.exportquerytable").each(tablewidthchg);
	if($2('e94e240e5') && !$2('e94e240e5').checked)$("tr#sart").hide();
	if($2('e51663ad9') && !$2('e51663ad9').checked)$("tr#prosettr").hide();
	$("#paddiv").hide();
	
}); 

$paramarr["cfg_editor_textareaheight"]=$paramarr["cfg_editor_textareaheight"]?$paramarr["cfg_editor_textareaheight"]:30;
function updatepropertyjson(){
	tagid=$("table#tagpropertytable input#tagid").val();
	if(!tagid||tagid==0) return;
	var ctrlname=this.tagName;
	var ctrltype;
	if(ctrlname.toLowerCase()=="input"){
		ctrltype=this.type.toLowerCase();
		if(ctrltype=="hidden")return;
	}else ctrltype="text";
	var propertyname=$(this).attr("name");
	var ctrltr;
	if(tagid && $("table#taglisttable tr.handlearea1tr[tagid='"+tagid+"']").length>0){
		ctrltr=$("table#taglisttable tr.handlearea1tr[tagid='"+tagid+"']");
		var ctrltd=ctrltr.find("td[name='"+propertyname+"_td']");
		if(ctrltype=="checkbox"){
			
			if(ctrltd.length>0) ctrltd.text($(this).attr("checked")?"是":"否");
			e4bab7fb7[tagid][propertyname]=adjustval(e4bab7fb7[tagid][propertyname],$(this).val(),$(this).attr("checked"));
		}else {
			if(ctrltype=="radio"){ 
			
			 if(this.checked){e4bab7fb7[tagid][propertyname]=$(this).val();
			 if(ctrltd.length>0) ctrltd.text($(this).next("label").html());
			 
			 }
			}else{
				if(propertyname=='tagname')ctrltd.find("div").text($(this).val());
				else if(ctrltd.length>0) ctrltd.text(this.tagName=="SELECT"?$(this).find("option[value="+$(this).val()+"]").text():$(this).val());
				e4bab7fb7[tagid][propertyname]=$(this).val();
			}
		}
	}
}
function updateebb3f01e2(idx,elem){
	var ctrlname=elem.tagName;
	var ctrltype;
	if(ctrlname.toLowerCase()=="input"){
		ctrltype=elem.type.toLowerCase();
		if(ctrltype=="hidden")return;
	}else ctrltype="text";
	var propertyname=$(elem).attr("name");
	if(ctrltype=="checkbox"){
		ebb3f01e2[propertyname]=adjustval(ebb3f01e2[propertyname],$(elem).val(),$(elem).attr("checked"));
	}else {
		if(ctrltype=="radio"){ 
		 if(elem.checked==true)ebb3f01e2[propertyname]=$(elem).val();
		}else{
			
			ebb3f01e2[propertyname]=$(elem).val();
		}
	}
	
}

function litpicareashow(butt){
if(butt.value==0)
	$('span#e406c8076area').css('display',butt.checked?'none':'');
	else $('span#e406c8076area').css('display',butt.checked?'':'none');

}

function updatetooljson(){
	tagid=$("table#tagpropertytable input#tagid").val();
	if(!tagid||tagid==0) return;
	var funcnamearr=$(this).parents("div.funcpropertydiv").attr("id").split("_");
	var funcname=funcnamearr[0];

	//if(!($("table#toollisttable :checkbox[value='"+funcname+"']").length>0)) return;
	//if(!$("table#toollisttable :checkbox[value='"+funcname+"']").attr("checked")) return;

	var propertyname=$(this).attr("name");
	var funcchecked=$("#toollisttable :checkbox.funcbox[value='"+funcname+"']").attr("checked");

	var ctrlname=this.tagName;
	var ctrltype;
	if(ctrlname.toLowerCase()=="input"){
		ctrltype=this.type.toLowerCase();
		if(ctrltype=="hidden")return;
	}else ctrltype="text";
	
	if(typeof e4bab7fb7[tagid] =="undefined")e4bab7fb7[tagid]={"commontools":{}};
	if(typeof e4bab7fb7[tagid]["commontools"] =="undefined") e4bab7fb7[tagid]["commontools"] ={};
	if(typeof e4bab7fb7[tagid]["commontools"][funcname] =="undefined") e4bab7fb7[tagid]["commontools"][funcname] ={};
	e4bab7fb7[tagid]["commontools"][funcname]["checked"]=funcchecked;
	if(ctrltype=="checkbox")
		e4bab7fb7[tagid]["commontools"][funcname][propertyname]=adjustval(e4bab7fb7[tagid]["commontools"][funcname][propertyname],$(this).val(),$(this).attr("checked"));
	else {
		if(ctrltype=="radio"){ 
			 if(this.checked==true)e4bab7fb7[tagid]["commontools"][funcname][propertyname]=$(this).val();
		}else{
			e4bab7fb7[tagid]["commontools"][funcname][propertyname]=$(this).val();		
		}
	
	}
}
function updatetoolchecked(){
	tagid=$("table#tagpropertytable input#tagid").val();
	if(!tagid||tagid==0) return;
	var toolname=$(this).val();
	if(typeof e4bab7fb7[tagid] =="undefined")e4bab7fb7[tagid]={"commontools":{}};
	if(typeof e4bab7fb7[tagid]["commontools"] =="undefined") e4bab7fb7[tagid]["commontools"] ={};
	if(typeof e4bab7fb7[tagid]["commontools"][toolname] =="undefined") e4bab7fb7[tagid]["commontools"][toolname] ={};
	e4bab7fb7[tagid]["commontools"][toolname]["checked"]=this.checked;
}
function inittoolarea(tagname){
	
	$("table#toollisttable :checkbox").each(function(){
			var toolname=$(this).val();
			if( typeof e4bab7fb7[tagname]!="undefined" && typeof e4bab7fb7[tagname]["commontools"][toolname] !="undefined" && !(typeof e4bab7fb7[tagname]["commontools"][toolname]["checked"]!="undefined" &&!e4bab7fb7[tagname]["commontools"][toolname]["checked"] ) ){//假如有这个工具
				var toolarr=e4bab7fb7[tagname]["commontools"][toolname];
				this.checked=true;//假如有这个工具了，将这个工具打勾
				taghandle($(this).parents("tr.functr"));//改变选中的工具行的背景色，并显示相应的工具的设置区
				$("div#funcproperty div#"+toolname+"_div").find("input,textarea").each(function(){
					var paraname=this.name.replace("[]","");
					if(typeof $(this).attr("type")=="string" && ($(this).attr("type").toLowerCase()=="checkbox" || $(this).attr("type").toLowerCase()=="radio")){
						this.checked=false;
						if(typeof toolarr[paraname] !="undefined") {
							var valplus=adddouhao(toolarr[paraname]);
							if(toolarr[paraname]==$(this).val()||valplus.indexOf(","+$(this).val()+",")!=-1)
							this.checked=true;
						}
					}else{
						if(typeof toolarr[paraname] !="undefined") { 
							$(this).val(toolarr[paraname]);
						}
					}
				});
			}
	});	
}

function isretagname(input){
	$("table#taglisttable td[name='tagname_td']").each(function(){
		if($(this).text() && input.value && $(this).text()==input.value){ 
			//alert("该名字已存在，请重新命名！");
			$(input).focus();
			$(input).text('');
			$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />该名字已存在，请重新命名！');
				
			
			 return;
		}
	});
}


 
$(function(){
	document.propertyform.reset();

	$("tr.tagpropertytr input").add("tr.tagpropertytr textarea").add("tr.tagpropertytr select").blur(updatepropertyjson);
	$("tr.tagpropertytr input:checkbox").add("tr.tagpropertytr input:radio").click(updatepropertyjson);
	$("div#funcproperty input").add("div#funcproperty textarea").blur(updatetooljson);
	$("div#funcproperty input:checkbox").add("div#funcproperty input:radio").click(updatetooljson);
	
	$("table#toollisttable :checkbox").click(updatetoolchecked);
	//$("table#toollisttable :checkbox.preselect").attr("checked",true);
	$("img.delimg").click(deltag);
	if(e4bab7fb7['content'] && e4bab7fb7['content']['system']==true){
		$("input[name='maintag']").add("input:radio[id='downmedia1']").attr("disabled",true);
	}
	$("tr.handlearea1tr [title='编辑']").click(function(){
		var tagname=$(this).is(":radio")?$(this).val():($(this).closest("tr").find(":radio").attr('checked',true).val());
		if($("#taglisttable").data('edittag')!=tagname) $("#taglisttable").data('edittag',tagname);
		else return;
		if(typeof tagid !="undefined" && tagid==tagname)return;
		$("table#propertyset").show();
		document.propertyform.reset();
		nlevelselect_reset();
		document.propertyform.tagname.disabled=true;
		tagid=document.propertyform.tagid.value=document.propertyform.tagname.value=tagname;
		$("table#labeledit span#addstartspan").show();//添加新标签 按钮
		$("table#labeledit span#addconfirmspan").hide();//确定 按钮
		$("table#toollisttable :checkbox").attr("checked",false);
		inittoolarea(tagname);

		var item=e4bab7fb7[tagname];
		//tagpropertytable:标签属性表内
		$("tr.tagpropertytr input").add("tr.tagpropertytr textarea").add("tr.tagpropertytr select").each(function(){

			var ctrlname=this.tagName;
			var ctrltype;
			if(ctrlname.toLowerCase()=="input"){
				ctrltype=this.type.toLowerCase();
				if(ctrltype=="hidden")return;
			}else ctrltype="text";
			var propertyname=$(this).attr("name");
			if(typeof e4bab7fb7[tagid][propertyname] != "undefined"){
				var ctrlvalue=e4bab7fb7[tagid][propertyname];			
				if(ctrltype=="checkbox"||ctrltype=="radio"){
					$(this).siblings("input").andSelf().each(function(){
						this.checked=false;
						var adddouhaovalue=adddouhao(ctrlvalue);
						if (adddouhaovalue.indexOf(','+$(this).val()+',')>-1)
						{
							this.checked=true;
						}
					});
				}else {//$("select#nlevel").val(0);
					$(this).val(ctrlvalue);
				}
			}
		});
		
		Accompanychange();
		if(e4bab7fb7[tagname]["system"]){
			
			$("tbody#tb_match").hide();//系统标签由系统自动取值，不需再人为设定选取区域
			
		}else {$("input[name='maintag']").attr("disabled",false);$("tbody#tb_match").show();}
	});

	
	$("input#onlysave_butt").click(function(){
		if(em_usrrank<10 && $("#eaaed87de").val()=='emusr1') {
			//alert("此节点为公共示例节点，不能修改！");
			$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />此节点为公共示例节点，不能修改！');
			return false;
		}
		
		if($("span#addconfirmspan").is(":visible")){
			if(!(addconfirm())) return fasle;
		}
		//document.form1.e535ded19.value =$("tr.commontr").is(":hidden")?1:0;
		if(formupdate()){
			localurl='http://'+window.name.replace('_mr_','.')+'/locallogin.php?eb5707348=dowithdata&e52731e59=co&callback=?';
			$.getJSON(localurl,{},function(){});
			
			if($2('e535ded19') && $2('e535ded19').value){
				if($2('l_exportquery_false') && $2('l_exportquery_false').value && document.form1.e535ded19.value.indexOf("lcommontd")!=-1)table2query('l_exportquery_false','l_exportquerytable',1);
				if($2('p_exportquery_false') && $2('p_exportquery_false').value && document.form1.e535ded19.value.indexOf("pcommontd")!=-1)table2query('p_exportquery_false','p_exportquerytable',1);
				if($2('exportquery_false') && $2('exportquery_false').value && document.form1.e535ded19.value.indexOf("Ccommontd")!=-1)table2query('exportquery_false','exportquerytable',1);
			}
			if($2('l_exportquery_false') && $2('l_exportquery_false').value) document.form1.l_exportquery.value = eme64769cac(document.form1.l_exportquery_false.value ,'l');
			if($2('p_exportquery_false') && $2('p_exportquery_false').value) document.form1.p_exportquery.value = eme64769cac(document.form1.p_exportquery_false.value ,'l');
			if($2('exportquery_false') && $2('exportquery_false').value) document.form1.exportquery.value = eme64769cac(document.form1.exportquery_false.value,'c');
			
			
			
			var _object = {
				url:'?ajax=1&gettype=post',
				params:$(document.form1).serialize(),
				timedelay:3000
			};
			var callbackfunc=function(data){
				if(data.data){
					document.form1.nid.value=data.data;
					document.form1.eb5707348.value='update';
				}
				return true;
			};
			$.submitajax(_object,'',{},{},'提示信息','<img class="os" src="images/loading.gif" />正在操作中...',callbackfunc);
		}
	});
});


//将表单的内容更新，为传入后台作准备
function formupdate(form){
	if(!form) form=document.form1;
	var maintagnum=0;
	var commontools={};
	
	if(form.ed946d2b0.value==""){
		//alert("节点名字不能为空！");
		$("input#ed946d2b0").focus();
	$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />节点名字不能为空！');
	return false;}	
	else if(!form.e6863599c && form.ee329075e.value==""){
		//alert("采集网站网址不能为空！");
		$("input#ee329075e").focus();
		$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />采集网站网址不能为空！');
		return false;}
	
	for(var i in e4bab7fb7){
		var item=e4bab7fb7[i];
		if(item["maintag"]=="1") maintagnum++;
		if(maintagnum>1) {
			//alert("只能有一个标签能设为主要字段，请检查！");
			$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />只能有一个标签能设为主要字段，请检查！');
		
			return false;}
		if(typeof item["commontools"]=="object" ){
			commontools[i]={};
			for(var k in item["commontools"]){
				var tool=item["commontools"][k];
				
				if(typeof tool["checked"]=="undefined"  ||!tool["checked"] ){
					delete item["commontools"][k] ;
				}else{
					commontools[i][k]=tool;
				}
			}
			//delete e4bab7fb7[i]["commontools"];
		}
	}
	$("#handlearea2 input").add("#handlearea2 textarea").each(updateebb3f01e2);//精细加工区域
	
	form.e4af104e1.value=JSON.stringify(e4bab7fb7);
	form.commontools.value=JSON.stringify(commontools);
	form.ebb3f01e2.value=JSON.stringify(ebb3f01e2);
	return form;
	
}
function addnewtag(){
	$("table#propertyset").show();
	$("span#addstartspan").hide();
	$("span#addconfirmspan").show();
	
	$("tbody#tb_match").show();//将系统标签隐藏的字段显示出来
		
	document.propertyform.reset();nlevelselect_reset();
	document.propertyform.tagid.value="";
	document.propertyform.tagname.disabled=false;
	$("table#taglisttable td.firsttd :radio").attr("checked",false);
	$("table#tagpropertytable textarea[name='matchrule']").attr("disabled",false);
	Accompanychange();
}
function addconfirm(butt){
	var form;
	if(butt){form=butt.form;}else form=document.propertyform;
	
	var clonetr;
	if(!(form.tagname.value)) {
		//alert("请输入标签名称");
		$("input[name='tagname']",form).focus();
		$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />请输入标签名称!');
		
		return;}
	if(!(/^[A-Za-z0-9_-]+$/.test(form.tagname.value))) {
		//alert("标签名称中含有字母和数字及下划线以外的字符，请检查");
		$("input[name='tagname']",form).focus();
		$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />标签名称中含有字母和数字及下划线以外的字符，请检查');
		return false;}
	if(document.propertyform.tagid.value=="" && typeof e4bab7fb7[form.tagname.value] =="object" ) {
		//alert("标签名称已存在，请修改名称");
		$("input[name='tagname']",form).focus();
		$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />标签名称已存在，请修改名称');
		return false;}
	form.tagname.disabled=true;
	if(document.propertyform.tagid.value==""){
		var clonetr=$("table#parenttable tr").clone(true);
		clonetr.attr("tagid",form.tagname.value);
		clonetr.find("td.firsttd :radio").attr("checked",true);
		clonetr.find("td.firsttd :radio").val(form.tagname.value);
		clonetr.appendTo($("table#taglisttable"));
		tagid=document.propertyform.tagid.value=form.tagname.value;
	}


	if(typeof e4bab7fb7[tagid] == "undefined")e4bab7fb7[tagid]={"commontools":{},'newareavisible':1,'editareavisible':1,'newarea_height':$paramarr["cfg_editor_textareaheight"],'editrea_height':$paramarr["cfg_editor_textareaheight"]};
	//if(typeof e4bab7fb7[tagid][propertyname] == "undefined")e4bab7fb7[tagid][propertyname]='';
	$("tr.tagpropertytr input").add("tr.tagpropertytr textarea").add("tr.tagpropertytr select").each(updatepropertyjson);
	nlevelselect_reset();
	$("table#toollisttable :checkbox:checked").each(updatetoolchecked);
	$("div#funcproperty input").add("div#funcproperty textarea").each(updatetooljson);
	$("span#addstartspan").show();
	$("span#addconfirmspan").hide();
	return true;
}
function addtagconcel(butt){
	var form=butt.form;
	$("table#propertyset").hide();
	form.reset();nlevelselect_reset();
	form.tagname.disabled=true;
	tagid=form.tagid.value="";
	$("span#addstartspan").show();
	$("span#addconfirmspan").hide();
	$("table#taglisttable :radio").attr("checked",false);
}
function deltag(){
	var trtagid=$(this).parents("tr.handlearea1tr").attr("tagid");
	if(typeof e4bab7fb7[trtagid]["nlevel"] != "undefined" && e4bab7fb7[trtagid]["nlevel"]==0)
	{
		
		if(typeof e4bab7fb7[trtagid]["maintag"] != "undefined" && e4bab7fb7[trtagid]["maintag"]==1){
			for(var i in e4bab7fb7){
				var item=e4bab7fb7[i];
				if( typeof item["parentnode"] !="undefined" && item["parentnode"]==trtagid ) {
					$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />该标签是母体标签，尚有子标签，请先将其子标签删除，再删除母体标签');
		
					//alert("该标签是母体标签，尚有子标签，请先将其子标签删除，再删除母体标签");
					return;
				}
			}
		}
		$("select#parentnode option[value='"+trtagid+"']").remove();
	}
	
	if(typeof e4bab7fb7[trtagid]["system"] != "undefined" && e4bab7fb7[trtagid]["system"])
	{
		//alert("该标签为系统固有标签，不能删除");
		$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />该标签为系统固有标签，不能删除');
		
		return;
	}
	$(this).parents("tr.handlearea1tr").remove();		
	
	delete  e4bab7fb7[trtagid];
	$("table#propertyset").hide();
	tagid=document.propertyform.tagid.value="";
	$("span#addstartspan").show();
	$("span#addconfirmspan").hide();
	$("table#taglisttable :radio").attr("checked",false);
}

//改变选中的工具行的背景色，并显示相应的工具的设置区
function taghandle(trrow){
	$("tr.functr").attr("bgcolor","#ffffff");
	$(trrow).attr("bgcolor","#cccccc");
	$("div#funcproperty div").hide();
	$("div#funcproperty div#"+$("input:checkbox",trrow).val()+"_div").show();
}

function labelgetvalue(butt){
	 if(butt.value>0)
	 {
		 $('tr#tb_lablevaltype1').show().find('td.title').text($(butt).next('label').text());
		 if(butt.value==2) $('tr#tb_lablevaltype2').hide();
		 else  $('tr#tb_lablevaltype2').show();
	 }
	 else {$('tr#tb_lablevaltype1').hide();$('tr#tb_lablevaltype2').show();}
} 
 function litpicget_set(butt){
	 if(butt==1 || butt.value>0)
	 $('#litpicsetdiv').show();
	 else $('#litpicsetdiv').hide();
	 
} 
 function maintag_ch(butt){
	 if(butt==1 || butt.value>0)
		 $('tr#parentsettingdiv').add('tr.mainsettr').show();
	 else $('tr#parentsettingdiv').add('tr.mainsettr').hide();
	 
} 
 function matchmode_ch(butt){
	 if(typeof butt == 'object')butt = butt.value;
	 if(butt==1){
			$('div#splitstrdiv').show();
		}else{
			$('div#splitstrdiv').hide();
		}
	 
} 
 function downmedia_ch(butt){
	 if(butt==1 || butt.value==1)
		 $('#downsuffix_span').show();
	 else  $('#downsuffix_span').hide();
	 
} 

function nlevelchange(select){
	
	if($(select).val()==1) {
		$("#pnodediv").show();
		$("#parentsettingdiv").hide();
		$("label#matchmode_label2").hide();
		$("input#matchmode2").hide();
		$("input#matchmode0").hide();
		$("label#matchmode_label0").hide().text("加入小组循环匹配");
		
		$("input#matchmode1").attr("checked",true);
	}
	else {		
		var tagid=$("table#tagpropertytable input#tagid").val();
		$("#pnodediv").hide();
		$("#parentsettingdiv").show();
		if(e4bab7fb7[tagid]["parentnode"]!=null) delete e4bab7fb7[tagid]["parentnode"];
		$2('parentnode').selectedIndex=0;
		
		$("label#matchmode_label2").show();
		$("input#matchmode2").show();
		$("input#matchmode0").show();
		$("label#matchmode_label0").show().text("全部匹配");
	}
}
//上级节点重置
function nlevelselect_reset(){
	var obj=$2('parentnode');
	obj.options.length=0;
	obj.add(new Option("请选择上级节点",0)); 
	for(var i in e4bab7fb7){
		var item=e4bab7fb7[i];
		if( !(typeof item["nlevel"] !="undefined" && item["nlevel"]==1) ) {
			obj.add(new Option(i,i)); 
		}
	}
	obj.selectedIndex=0;

}

function Accompanychange(){
		 labelgetvalue($("input[name='lablevaltype']:checked").get(0));
		 var ismaintag = $("input[name='maintag']:checked").val()==1;
		 litpicget_set(( ismaintag && $("input[name='litpicget']:checked").val()==1)?1:0);
		 maintag_ch( ismaintag?1:0 );
		 downmedia_ch( (ismaintag && $("input[name='maintag']:checked").val()==1) ? 1 : 0 );
		 matchmode_ch( $("input[name='matchmode']:checked").val() );
		
		if($("input#parentarea").attr("checked")) $('#pasplitdiv').show();else  $('#pasplitdiv').hide();
	
		if($("table#tagpropertytable select#nlevel").val()==1 ){
			$("table#tagpropertytable #pnodediv").show();
			
			$("label#matchmode_label2").hide();
			$("input#matchmode2").hide();

			$("input#matchmode0").hide();
			$("label#matchmode_label0").hide().text("加入小组循环匹配");
		
		
		}else {
			$("table#tagpropertytable #pnodediv").hide();
			$("label#matchmode_label2").show();
			$("input#matchmode2").show();
			$("input#matchmode0").show();
			$("label#matchmode_label0").show().text("全部匹配");
		}

		if($("input[name='gettype']:checked").length<1) $("input[name='gettype']").get(0).checked=true;
}


function e5c2df340change(butt){
	
 if(butt.value=="diyrule"){$("div#e5c2df3403area").show();}
 else {$("div#e5c2df3403area").hide();}
}


function testgeturl(butt){//采集测试
	if(typeof statichasuse == 'undefined')statichasuse = 0;//全局变量
	var form=formupdate(document.form1);
	if( form.e535ded19 && form.e535ded19.value){
		if($2('l_exportquery_false') && $2('l_exportquery_false').value && document.form1.e535ded19.value.indexOf("lcommontd")!=-1)table2query('l_exportquery_false','l_exportquerytable',1);
		if($2('p_exportquery_false') && $2('p_exportquery_false').value && document.form1.e535ded19.value.indexOf("pcommontd")!=-1)table2query('p_exportquery_false','p_exportquerytable',1);
		if($2('exportquery_false') && $2('exportquery_false').value && document.form1.e535ded19.value.indexOf("Ccommontd")!=-1)table2query('exportquery_false','exportquerytable',1);
	}
	if($2('l_exportquery_false').value) form.l_exportquery.value = eme64769cac(form.l_exportquery_false.value ,'l');
	if($2('p_exportquery_false').value) form.p_exportquery.value = eme64769cac(form.p_exportquery_false.value ,'l');
	if($2('exportquery_false').value) form.exportquery.value = eme64769cac(form.exportquery_false.value ,'c');
	
	if(typeof eminer_test == "undefined")eminer_test = new co_pub();
	if(butt.id=='logintest')eminer_test.eae31a53a=[];
	if($paramarr["cfg_eminercoerr_allownum"])eminer_test.eminercoerr_allownum=$paramarr["cfg_eminercoerr_allownum"];
	if($paramarr["cfg_eminerpuberr_allownum"])eminer_test.eminerpuberr_allownum=$paramarr["cfg_eminerpuberr_allownum"];
	eminer_test.postdata=$(form).serialize();
	eminer_test.aftercocallback = function(eminer,data,info){
		if(info=='clear') $("#contentcotest").data('hascleared',1);	
	};
	if(butt.id=='logintest'){
		if(!$2('e535ded19').value){
			if(form.e8c83ddbe.value==""){
				$("#e8c83ddbe").focus();
				$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />登陆网址不能为空！');
				//alert("登陆网址不能为空！");
				return;}
			else if(form.l_exportquery.value==""){
				$("#l_exportquery").focus();
				$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />登陆配置的提交内容一项不能为空！');
				//alert("登陆配置的提交内容一项不能为空！");
				return;}
			else if(!$("input#e4ae10b601").attr('checked')){
				$("#l_exportquery").focus();
				$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />请选定"是否需要提前登陆"的"是"！');
				//alert("请选定\"是否需要提前登陆\"的\"是\"！");
				return;}
		
		}
		eminer_test.eae31a53a['temp_origin']='1';
		eminer_test.eae31a53a['e95159ca1']='1';
		eminer_test.eae31a53a['temp_phrase']='1';
		eminer_test.eae31a53a['coretrylogin']='1';
		
	}else if(butt.id=='geturltest1'){
		if(form.e5036b431 && form.e8d68ca9a && form.e5036b431.value=="" && form.e8d68ca9a.value==""){
			$("#e5036b431").focus();
			$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />批量生成地址和手工指定网址不能同时为空！');
			//alert("批量生成地址和手工指定网址不能同时为空！");
			return;}
		
		eminer_test.eae31a53a['e95159ca1']='20';
		eminer_test.eae31a53a['temp_phrase']='5';
		eminer_test.eae31a53a['temp_nextstep']='e3e7a45fe';
		if(!$("#contentcotest").data('hascleared')) {
			eminer_test.eae31a53a['temp_clearcache']='1';
		}
	}else if(butt.id=='geturltest'){
		if(form.e5036b431.value==""&&form.e8d68ca9a.value==""){
			$("#e5036b431").focus();
			$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />批量生成地址和手工指定网址不能同时为空！');
			
			//alert("批量生成地址和手工指定网址不能同时为空！");
			return;}
		
		eminer_test.eae31a53a['e95159ca1']='2';
		eminer_test.eae31a53a['temp_phrase']='5';
		eminer_test.eae31a53a['temp_nextstep']='e3e7a45fe';
		if(!$("#contentcotest").data('hascleared')) {
			eminer_test.eae31a53a['temp_clearcache']='1';
		}
	}
	else if(butt.id=='contentcotest'){
		
		if(form.e5036b431.value=="" && form.e8d68ca9a.value==""){
			$("#e5036b431").focus();
			$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />批量生成地址和手工指定网址不能同时为空！');
			//alert("批量生成地址和手工指定网址不能同时为空！");
			return;}
		
		eminer_test.eae31a53a['e95159ca1']='3';
		eminer_test.eae31a53a['temp_phrase']='6';
		eminer_test.eae31a53a['temp_nextstep']='co_run';
		eminer_test.contentcotest=true;
		
		
		if(!$("#contentcotest").data('hascleared')) {
			eminer_test.eae31a53a['temp_clearcache']='1';
		}
	}else return;
	
	var maininfo="<div  id=\"repaircostart\" style=\"display:block;\"><div class='copubbox'><div class='copubbar'><div id='now'></div></div><div id='go'><div class='initmsg'><img class='os' src='images/loading.gif'/>测试工作准备中，请稍等...</div></div></div></div>";
	$.poping({height:'300px'},{},'采集测试',maininfo);
	var c='co_getsource_url_action.php';
	if(statichasuse==0)eminer_test.eae31a53a['temp_origin']='1';statichasuse++;
	eminer_test.eminerco(c + "?e9d2722af=1&action=robot&kw_g=1&ecab1c4fe=1&e6dd1f3ba=1&eabd06204=1&ec7fca41a=1&e05ca0eb9=1&ebee555a9=1&nid=T1&e66756569=1&"+http_build_query(eminer_test.eae31a53a)+"&donow=1&eminer_coindex=0&eminer_innerindex=0&ec6017fed=1");
}
function getpage(butt){//采集测试
	if(eae31a53a && eae31a53a['testurl']){
		var maininfo="<div style=\"height:auto;font-size:10pt;background:#ffffff\"><br><div style=\"width:200px;height:auto;border:1px solid #898989;text-align:left\"><div style=\"width: 95px; height: 0px; background-color: rgb(130, 157, 131);\" id=\"now\"></div></div><br><span id=\"go\"></span><br></div>";
		$.poping({height:'auto'},{},'获取Xpath',maininfo);
		
	}else {
		$("input#geturltest").focus();
		$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />请先点击\"获取网址测试\"按钮，以获得网址测试url。');
		//alert("请先点击\"获取网址测试\"按钮，以获得网址测试url。");
		
	}
}

function sourcechange(butt){
	if(butt.value==0){
		$('#batchset').show();
		$('#rssset').hide();
		if($('tr#arturl').data("visible")) $('tr#arturl').show();
		if($('input#e105c9258').data("checked")) $('input#e105c9258').attr("checked",true);
	}else if(butt.value==2){
		$('tr#arturl').data("visible",$('tr#arturl').is(":visible"));
		$('input#e105c9258').data("checked",$('input#e105c9258').attr("checked"));
		$('#batchset,tr#arturl').hide();		
		$('input#e105c9258').attr("checked",false);
		$('#rssset').show();
	}
}