var splitstr="~eminer@@split~";
$(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);	
	}
	//innerresizeWeb();
	if(e2279bb72) $("tbody#tb_"+e2279bb72).show();
	else {
		$("tbody#tb_cont").show();
		$("input:radio[name='e2279bb72'][value='2']").attr("checked",true);
	}
	
	var valarr=[];
	trfirst=$("table#arraysettable tr:eq(0)");
	if(e2279bb72=='simplearr'){
		valarr = $("input#e1e9e89bb").val().split(splitstr);
		for(var i in valarr){
			if(i<5){
				$("table#arraysettable textarea[name='e27cdaa1d']:eq("+i+")").val(valarr[i]);
			}else{
				trfirst.clone(true).apendTo($("table#arraysettable")).find("input:text").val(valarr[i]);
			}
			sortindex();
		}
		$("input#e1e9e89bb").val('');	
	}
	
	$("input[name='e2279bb72']").click(function(){
		$("tbody.vartb").hide();
		$("tbody#tb_"+this.value).show();
	});
	$("input.delbutt").click(function(){
		if($("table#arraysettable tr").length<2) {
			alert("删除完变量所有的值无任何意义，如不用这个变量，可直接删除变量");
			return;
		}
		$(this).parents(".arrsettr").remove();
		sortindex();
	});
	$("input.simplearr_newbutt").click(function(){
		trfirst.clone(true).prependTo($("table#arraysettable")).find("input:text").val("");
		sortindex();
	});
	
}); 
function sortindex(){
	var i=0;
	$("table#arraysettable td.indextd").each(function(){
		$(this).text(i++);
	});
}
function submitact(butt){
	if(em_usrrank<10 && $("#eaaed87de").val()=='emusr1') {
		$.poping({height:'auto',overlayCSS:{display:'none'}},{},'信息提示','<img class="os" src="images/dg_face/face_error.png" />此变量为公共示例变量，不能保存修改！');
		return false;
	}
		if($("input#e2b359ce0").val().indexOf("var_")!==0){
			alert("变量名必须以\"var_\"开头!");	
			$("input#e2b359ce0").focus();
			return false;
		}
		var lastminval="";
		if($("input[name='e2279bb72']:checked").val()=="simplearr"){
			itemcount = $("#arraysettable textarea[name='e27cdaa1d']:eq(0)").val().split('|').length;
			var i=0;
			$("#arraysettable textarea[name='e27cdaa1d']").each(function(){				
				if(this.value) {
					if(itemcount != this.value.split('|').length){
						alert("数组各元素的单元数不相等");return;
					} 
					i++;
					if(i==1)lastminval=this.value;
					else lastminval+=splitstr+this.value;
				}
			});
			$("input#e1e9e89bb").val(lastminval);			
		}
		localurl='http://'+window.name.replace('_mr_','.')+'/locallogin.php?eb5707348=dowithdata&e52731e59=var&callback=?';
		$.getJSON(localurl,{},function(){});
		var _object = {
			url:"http://"+cfg_remote_host+"/covar_edit.php",
			params:$(butt.form).serialize(),
			timedelay:3000
		};
		var callbackfunc=function(data){
			if(data.data){
				document.form1.vid.value=data.data;
				document.form1.eb5707348.value='update';
			}
			return true;
		};
		//$.submitajax(_object);
		$.submitajax(_object,'',{},{},'提示信息','<img class="os" src="images/loading.gif" />正在操作中...',callbackfunc);
	
}
