document.onmouseup=function()
{
div_window_upDiv();
div_window_upTd();
};
document.onmousemove=function ()
{
div_window_moveDiv();
div_window_moveTd();
};
var a,b,c,d;
function div_window_upDiv()
{
if(!a)return;
if(_gId("index_new_record"))
{
_gId("index_new_record").removeNode(true);		
}
document.all?a.releaseCapture():window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
_gId("div_window_box").style.top=a.style.top;
_gId("div_window_box").style.left=a.style.left;
a.style.display="none";
div_window_hidden_conver();
a="";
}
function div_window_moveDiv(d)
{
if(!a)return;
if(!d)d=event;
a.style.display="block";
a.style.left=(d.clientX-b)+"px";
a.style.top=(d.clientY-c)+"px";
}
function div_window_downDiv(o,e)
{
a=o;
document.all?a.setCapture():window.captureEvents(Event.MOUSEMOVE);
a.style.width=_gId("div_window_box").offsetWidth;
a.style.height=_gId("div_window_box").offsetHeight;
a.style.top=get_top(_gId("div_window_box"));
a.style.left=get_left(_gId("div_window_box"));
div_window_conver();
b=e.clientX-parseInt(get_left(_gId("div_window_box")));
c=e.clientY-parseInt(get_top(_gId("div_window_box")));
}
function div_window_conver()
{
_gId("div_win_hidden_all").style.width=_gId("div_window_box").offsetWidth-20;
_gId("div_win_hidden_all").style.height=_gId("div_window_box").offsetHeight-100<0?0:_gId("div_window_box").offsetHeight-100;
_gId("div_win_hidden_all").style.top=get_top(_gId("div_window_box"))+50;
_gId("div_win_hidden_all").style.left=get_left(_gId("div_window_box"))+10;
_gId("div_win_hidden_all").style.display="block";
}
function div_window_hidden_conver()
{
_gId("div_win_hidden_all").style.top=get_top(_gId("div_window_box"))+50;
_gId("div_win_hidden_all").style.left=get_left(_gId("div_window_box"))+10;
_gId("div_win_hidden_all").style.display="none";
}
var div_window_dir="";
var drag_obj;
var drag_true_obj;
var drag_obj_x;
var drag_obj_y;
var drag_obj_minWidth;
var drag_obj_minHeight;
var do_width=0;
var do_height=0;
function div_window_downTd(obj_id,true_obj_id,dir,minWidth,minHeight) 
{
drag_obj=_gId(obj_id);
drag_obj.setCapture()
drag_true_obj=_gId(true_obj_id);
drag_obj.style.display="block";
drag_obj.style.width=drag_true_obj.offsetWidth;
drag_obj.style.height=drag_true_obj.offsetHeight;
drag_obj.style.top=get_top(drag_true_obj);
drag_obj.style.left=get_left(drag_true_obj);
div_window_dir=dir;
drag_obj_x=get_left(drag_obj);
drag_obj_y=get_top(drag_obj);
drag_obj_minWidth=minWidth;
drag_obj_minHeight=minHeight;
do_width=drag_obj.offsetWidth;
do_height=drag_obj.offsetHeight;
}
function div_window_moveTd()
{
if(div_window_dir!=""&&drag_obj) 
{		
div_window_conver();
if(div_window_dir=="right")
{
var new_width=do_width+(event.x-(drag_obj_x+do_width));
if(new_width<=drag_obj_minWidth)return;
drag_obj.style.width=new_width;
}
else if(div_window_dir=="left") 
{
var new_width=do_width+(drag_obj_x-event.x);
if(new_width<=drag_obj_minWidth)return;
drag_obj.style.left=event.x;
drag_obj.style.width=new_width;
}
else if(div_window_dir=="down")
{
var new_height=do_height+(event.y-(drag_obj_y+do_height));
if(new_height<=drag_obj_minHeight)return;
drag_obj.style.height=new_height;
}
else if(div_window_dir=="up")
{
var new_height=do_height+(drag_obj_y-event.y);
if(new_height<=drag_obj_minHeight)return;
drag_obj.style.top=event.y;
drag_obj.style.height=new_height; 
}
else if(div_window_dir=="rightDown")
{
var new_width=do_width+(event.x-(drag_obj_x+do_width));
var new_height=do_height+(event.y-(drag_obj_y+do_height));
if(new_width>drag_obj_minWidth)
{
drag_obj.style.width=new_width;
}
if(new_height>drag_obj_minHeight)
{	
drag_obj.style.height=new_height; 	
}
}
else if(div_window_dir=="leftUp")
{
var new_width=do_width+(drag_obj_x-event.x);
var new_height=do_height+(drag_obj_y-event.y);
if(new_width>drag_obj_minWidth)
{
drag_obj.style.left=event.x;
drag_obj.style.width=new_width;
}
if(new_height>drag_obj_minHeight)
{
drag_obj.style.top=event.y;
drag_obj.style.height=new_height; 	
}
}
else if(div_window_dir=="rightUp")
{
var new_width=do_width+(event.x-(drag_obj_x+do_width));
var new_height=do_height+(drag_obj_y-event.y);
if(new_width>drag_obj_minWidth)
{
drag_obj.style.width=new_width;
}
if(new_height>drag_obj_minHeight)
{
drag_obj.style.top=event.y;
drag_obj.style.height=new_height; 	
}
}
else if(div_window_dir=="leftDown")
{
var new_width=do_width+(drag_obj_x-event.x);
var new_height=do_height+(event.y-(drag_obj_y+do_height));
if(new_width>drag_obj_minWidth)
{
drag_obj.style.left=event.x;
drag_obj.style.width=new_width;
}
if(new_height>drag_obj_minHeight)
{	
drag_obj.style.height=new_height; 	
}
}
}
}
function div_window_upTd()
{
div_window_dir=null;
if(!drag_true_obj)return;
try
{
var w=drag_obj.offsetWidth;
var h=drag_obj.offsetHeight;
drag_true_obj.style.width=w;  
drag_true_obj.style.height=h;
drag_obj.releaseCapture();
drag_true_obj.style.left=get_left(drag_obj);
drag_true_obj.style.top=get_top(drag_obj);
drag_obj.style.display="none";
drag_obj="";
div_window_hidden_conver();
v=w+","+h;
div_win_w_h=v;
_gId('frame_blank').src='../'+asp_php+'/execute.'+asp_php+'?exe=save_my_config&tag=div_win_w_h&value='+v;
}
catch(e)
{
}
}