var old_tb=null;
var cur_tb=null;
var tuo_tb=null;
function tuo_tb_down(win)
{
var obj=win.event.srcElement; 
if(!obj)return;  
while (obj.id!='td_tuo')
{
obj=obj.parentElement;
if(!obj)return;  
}
if(obj.id && obj.id=='td_tuo')
{
while (obj.id!='tb'){obj=obj.parentElement;if(!obj)return; }
tuo_tb=obj;
tuo_tb.setCapture();
var tuo=gid("div_tuo",win)
tuo.innerHTML=tuo_tb.cells[1].innerText;
tuo.style.display='';
}
}
function tuo_tb_move(win)
{
if(!tuo_tb)return;
var obj=win.event.srcElement;
show_mouse_div(win);
while (obj.id!='tb'){obj=obj.parentElement;if(!obj)return; }
if(obj.id && obj.id=='tb')
{
if(cur_tb != obj)
{
old_tb=cur_tb;
cur_tb=obj;
}
if (cur_tb.className!='tuo_over_tb')obj.className='tuo_over_tb';
if (old_tb)old_tb.className='';
}
}
function tuo_tb_up(win)
{
gid("div_tuo",win).style.display='none'
if(!tuo_tb)return;
if(cur_tb)
{
if (cur_tb!=tuo_tb)
{
var s=tuo_tb.outerHTML; 
tuo_tb.removeNode(true)
cur_tb.insertAdjacentHTML("beforeBegin",s) 
}
cur_tb.className='';
}
tuo_tb.releaseCapture();
tuo_tb=null;
var tbs=_gTagName("TABLE",win);
var ids="";
for(var i=0;i<tbs.length;i++)
{
if(tbs[i].col_id&&tbs[i].id=="tb")
{
ids+=tbs[i].col_id+",";	
}
}
ids=ids.substr(0,ids.length-1);
var url=win.asp_php_url+"?exe=save_col_order&ids="+ids+"&fileName="+request("fileName",win);
gid("frame_blank",win).src=url;
}
function show_mouse_div(win)
{
var tuo=gid('div_tuo',win);
tuo.style.top=win.event.y+20  
tuo.style.left=win.event.x+10
}