var sub_iframe=null;
function group_by(obj,groups)
{
if(obj.tagName!='A')return;	
var cobj=_gId("cur_group",parent.window);
if(cobj)
{
cobj.value=obj.id;
}
var zd_groups="";
var tbs=frame_tr_exe.document.getElementsByTagName("TABLE")
var block_tbs=new Array();
var j=0;
for(var k=0;k<tbs.length;k++)
{
if(tbs[k].id && tbs[k].id=='tb')
{
if(groups==tbs[k].groups || groups.length==0)
{
tbs[k].style.display="block";
var ifr=tbs[k].getElementsByTagName("IFRAME")[0]; 
if(ifr&&ifr.typ=="link") 
{
var r_id=giv("new_record_id",frame_tr_exe);
var td=ifr.parentElement;
if(td.style.display!='none')
{
var src=ifr.src2.replace("index.htm?","../"+asp_php+"/main_work."+asp_php+"?show_data=sub_jiandan&");
if(r_id!=""&&ifr.src=="") 
{
var arr=src.split("parent_id=");
if(arr[1]=="0")
{
ifr.src=src.replace("parent_id=0","parent_id="+r_id);
}
else
{
ifr.src=src;
}
}
else if(r_id==""&&ifr.src=="")
{
sub_iframe=ifr;
sub_iframe.src=src.replace("parent_id=0","parent_id=-1");
}
}
else
{
if(r_id!=""&&ifr.src=="") 
{
var arr=ifr.src2.split("parent_id=");
if(arr[1]=="0")
{
ifr.src=ifr.src2.replace("parent_id=0","parent_id="+r_id)
}
else
{
ifr.src=ifr.src2;
}
}
else if(r_id==""&&ifr.src=="")
{
save_2mk_info(2);
sub_iframe=ifr;
save_ok_sub_1(ifr.src2);
}
}
}
block_tbs[j]=tbs[k];
j++;
}
else
{
tbs[k].style.display="none";	
}
}
}	
if(block_tbs.length>1) 
{
for(var i=0;i<block_tbs.length;i++) 
{
var ifr=block_tbs[i].getElementsByTagName("IFRAME")[0]; 
if(ifr&&ifr.typ=="link") 
{
block_tbs[i].style.height="200px";
}
}
}
else if(block_tbs.length==1&&block_tbs[0].getElementsByTagName("IFRAME")[0]) 
{
block_tbs[0].style.height="100%";
}
}
function save_ok_sub_1(url)
{
var r_id=_gId("new_record_id",frame_tr_exe).value;
if(r_id=="")
{
setTimeout("save_ok_sub_1('"+url+"')",100);
}
else
{
var arr=url.split("parent_id=");
if(arr[1]=="0")
{
sub_iframe.src=url.replace("parent_id=0","parent_id="+r_id)
}
}
}
function mov(tag)
{
var s="top,bottom,left,right";
var arr=s.split(",");
for(var i=0;i<arr.length;i++)
{
_gId("td_"+arr[i]).style.display='none';
var a=_gId("move_"+arr[i]);
a.className=a.className.replace(/_ed/gi,'');
}
var o=_gId("td_"+tag)
o.style.display='block';
groups_content.class_a_cur=tag+"_a_cur";
groups_content.class_a_out=tag+"_a_out";
var str=groups_div.outerHTML;
groups_div.removeNode(true);
o.innerHTML=str;
var a=_gId("move_"+tag)
a.className=a.className+"_ed";
var con=groups_content;
var as=con.getElementsByTagName('A');
if(as.length<1)return;
var obj=as[0];
for(var i=0;i<as.length;i++)
{
if(as[i].className.indexOf('_cur')>0){obj=as[i];break;}
}
set_cur_select(window,con,'A',con.class_a_cur,con.class_a_out,obj);
}
function set_groups()
{
window.showModalDialog('edit_select_box.htm?exe=get_value_and_save&fileName='+request("fileName"),window,'resizable:yes;status:no;help:no;dialogHeight:250px;dialogWidth:280px');
}
function send_option_str()
{
return 	work_tr_exe__groups;
}
function get_option_str(s)
{
work_tr_exe__groups=s;
}