
var dragapproved = false;
var eventsource,x,y;
var popeventsource = "";
var temp1 = 0;
var temp2 = 0;
var xx;
var Xpos=0;
var Ypos=0;
var yidong=null;
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function nodrags()
{
dragapproved = false;
}
function move()
{
if (event.button ==1 && dragapproved)
{
var newleft = temp1 + event.clientX - x;
var newtop = temp2 + event.clientY - y;
eventsource.style.pixelLeft = newleft;
eventsource.style.pixelTop = newtop;
movelines();	
return false;
}
}
function drags()
{
if (event.button != 1)
return;
var objRect = event.srcElement;
if (event.srcElement.tagName.toLowerCase() == 'textbox') objRect = event.srcElement.parentElement;
if ((objRect.tagName == 'roundrect'||objRect.tagName=='polyline'||objRect.tagName=='oval') && (!event.ctrlKey))
{
dragapproved = true;
eventsource = objRect;
temp1 = eventsource.style.pixelLeft;
temp2 = eventsource.style.pixelTop;
x = event.clientX;
y = event.clientY;
document.onmousemove = move;
rect_selected(objRect,"red");
}
}
function rect_selected(objRect,color)
{
clear_selColor("roundrect");
clear_selColor("line");
clear_selColor("polyline");
clear_selColor("oval");
if(objRect)objRect.fillcolor=color;
}
function line_selected(objLine)
{	
clear_selColor("roundrect");
clear_selColor("line");
clear_selColor("polyline");
if(objLine)objLine.strokeColor="red";
}
function clear_selColor(tag)
{
if(tag=="roundrect")
{
var rects=document.getElementsByTagName(tag);
for(var i=0;i<rects.length;i++)
{
rects[i].fillColor="#EEEEEE";	
}
}
else if(tag=="line")
{
var lines=document.getElementsByTagName(tag);
for(var i=0;i<lines.length;i++)
{
lines[i].strokeColor="black";	
}
}
if(tag=="polyline")
{
var pollys=document.getElementsByTagName(tag);
for(var i=0;i<pollys.length;i++)
{
pollys[i].fillColor="#EEEEEE";
}
}
if(tag=="oval")
{
var ovals=document.getElementsByTagName(tag);
for(var i=0;i<ovals.length;i++)
{
ovals[i].fillColor="#EEEEEE";
}
}
}
function movelines()
{
var source;
var object;
var sourceObj;
var objectObj;
var x0,y0,x1,y1;
var p0,p1;
var a = document.getElementsByTagName('line');
for (var i = 0; i < a.length; i++)
{
source = a[i].getAttribute('source');
object = a[i].getAttribute('object');
if ((source != null) && (object != null))
{
sourceObj = document.getElementById(source);
objectObj = document.getElementById(object);
if ((sourceObj == null) || (objectObj == null)) continue;
if (sourceObj.style.pixelLeft > objectObj.style.pixelLeft)
{
if ((sourceObj.style.pixelLeft - objectObj.style.pixelLeft) <= objectObj.style.pixelWidth)
{
x0 = sourceObj.style.pixelLeft + sourceObj.style.pixelWidth / 2;
x1 = objectObj.style.pixelLeft + objectObj.style.pixelWidth / 2;
if (sourceObj.style.pixelTop >  objectObj.style.pixelTop)
{
y0 = sourceObj.style.pixelTop;
y1 = objectObj.style.pixelTop  + objectObj.style.pixelHeight;
}
else
{
y0 = sourceObj.style.pixelTop + sourceObj.style.pixelHeight;
y1 = objectObj.style.pixelTop;
}
}
else
{
x0 = sourceObj.style.pixelLeft;
x1 = objectObj.style.pixelLeft + objectObj.style.pixelWidth;
y0 = sourceObj.style.pixelTop + sourceObj.style.pixelHeight / 2;
y1 = objectObj.style.pixelTop + objectObj.style.pixelHeight / 2;
}
}
else
{
if ((objectObj.style.pixelLeft - sourceObj.style.pixelLeft) <= objectObj.style.pixelWidth)
{
x0 = sourceObj.style.pixelLeft + sourceObj.style.pixelWidth / 2;
x1 = objectObj.style.pixelLeft + objectObj.style.pixelWidth / 2;
if (sourceObj.style.pixelTop >  objectObj.style.pixelTop)
{
y0 = sourceObj.style.pixelTop;
y1 = objectObj.style.pixelTop  + objectObj.style.pixelHeight;
}
else
{
y0 = sourceObj.style.pixelTop + sourceObj.style.pixelHeight;
y1 = objectObj.style.pixelTop;
}
}
else
{
x0 = sourceObj.style.pixelLeft + sourceObj.style.pixelWidth;
x1 = objectObj.style.pixelLeft;
y0 = sourceObj.style.pixelTop + sourceObj.style.pixelHeight / 2;
y1 = objectObj.style.pixelTop + objectObj.style.pixelHeight / 2;
}
}
a[i].from = String(x0) + ',' + String(y0);
a[i].to = String(x1) + ',' + String(y1);
a[i].style.pixelLeft = x0 + 'px';
a[i].style.pixelTop = y0 + 'px';
strIF = a[i].getAttribute('title');
if ((strIF != null) && (strIF != ''))
{
var id = 'if_' + source + '_' + object;
var obj = document.getElementById(id);
var left = (x0 + (x1 - x0) / 2 - 30);
var top = (y0 + (y1 - y0) / 2 - 15);
if (obj != null)
{
obj.style.pixelLeft = left + 'px';
obj.style.pixelTop = top + 'px';
obj.style.left = left + 'px';
obj.style.top = top + 'px';
obj.style.display = '';
}
}
a[i].style.display = '';
}
}
}
function document.onreadystatechange()
{
if (document.readyState=='complete')
{
movelines();
document.onmousedown = drags;  
document.onmouseup = nodrags; 
document.onkeydown = keyDown;
document.onkeyup = keyUp;
}
}
function keyDown() {
movelines();
yidong=get_obj()
if (yidong!=null)
{
Xpos = parseInt(yidong.style.left);
Ypos = parseInt(yidong.style.top);
}
clearTimeout(xx);
key = event.keyCode;
if (key == 108 || key == 37) m(1,2);
if (key == 114 || key == 39) m(1,3);
if (key == 100 || key == 40) m(1,4);
if (key == 117 || key == 38) m(1,5);
}
function keyUp(e) {
clearTimeout(xx);
yidong=null
}
function m(t,u) {
if (yidong==null)
{
return;	
}
if (t==1){
if (u==2){yidong.style.left = Xpos-=0.5;xx = setTimeout("m(1,2)", 40);}
if (u==3){yidong.style.left = Xpos+=0.5;xx = setTimeout("m(1,3)", 40);}
if (u==4){yidong.style.top= Ypos+=0.5;xx = setTimeout("m(1,4)", 40);}
if (u==5){yidong.style.top = Ypos-=0.5;xx = setTimeout("m(1,5)", 40);}
}
}
function get_obj()
{
var obj=null
var rects=document.getElementById("liucheng").getElementsByTagName("roundrect");
for(var i=0;i<rects.length;i++)
{
if(rects[i].fillColor=="red")
{
obj=rects[i]
break;
}	
}
if(obj==null)
{
var ovals=document.getElementById("liucheng").getElementsByTagName("oval");
for(var i=0;i<ovals.length;i++)
{
if(ovals[i].id.substring(0,1)=="o"&&ovals[i].fillColor=="red")
{
obj=ovals[i]
break;
}	
}
if(obj==null)
{
var polys=document.getElementById("liucheng").getElementsByTagName("polyline");
for(var i=0;i<polys.length;i++)
{
if(polys[i].fillColor=="red")
{
obj=polys[i]
break;
}	
}
}
}
return obj;	
}
function set_wenzi()
{
var obj=null
var rects=document.getElementById("liucheng").getElementsByTagName("roundrect");
for(var i=0;i<rects.length;i++)
{
if(rects[i].fillColor=="red")
{
obj=rects[i]
open_dialog('select_tb.htm',600,256,0);	
break;
}	
}
if(obj!=null)
{
return;
}
var polys=document.getElementById("liucheng").getElementsByTagName("polyline");
for(var i=0;i<polys.length;i++)
{
if(polys[i].fillColor=="red")
{
obj=polys[i]	
break;
}	
}
if(obj!=null)
{
var fileName=obj.getElementsByTagName("textbox")[0].getAttribute('data-fileName')
var tb_setName=obj.getElementsByTagName("textbox")[0].getAttribute('data-tbsetName')
if(fileName=="")
{
fromobj=get_fromobj_rect(obj)
if(fromobj)
{		
fileName=fromobj.getElementsByTagName("textbox")[0].getAttribute('data-fileName')
tb_setName=fromobj.getElementsByTagName("textbox")[0].getAttribute('data-tbsetName')
}
}
if(fileName==""&&tbsetName=="")
{
alert("请先设置上一步骤的表名")
}else
{
show_resource_cols(fileName,tb_setName)
}	
return;
}
if(obj==null)
{
alert("请首先选中相应的模块！")	
}
}
function get_fromobj_rect(toobj)
{
var fromobj=null 
var lines=document.getElementById("liucheng").getElementsByTagName("line");
for(var j=0;j<lines.length;j++)
{
if(lines[j].id.split("_")[2]==toobj.id)
{
fromobj=document.getElementById(lines[j].id.split("_")[1])
break;
}
}	
if (fromobj)
{
if (fromobj.tagName!="roundrect")
{
return get_fromobj_rect(fromobj)
}
return 	fromobj
}else
{
return null
}
}
function show_resource_cols(fileName,tb_setName)
{
var url="../"+asp_php+"/set_input_type."+asp_php+"?exe=get_all_cols&tb_setName="+tb_setName+"&fileName="+fileName;
gid('frame_blank').src=url;
}
function show_all_cols(s,n)
{
if(s==""){return}
var arr=s.split('|/tr|'),arr1;
if(n=='')
{
var obj=document.getElementById('all_cols');
}
else
{
var obj=document.getElementById(n);
}
var ss=""
var cnName,col_id,col_id
for (var i=0;i<arr.length;i++)
{
if(arr[i].indexOf('|/td|')>-1)
{
arr1=arr[i].split('|/td|');
cnName=arr1[1]; 
col_id=arr1[0]; 
colName=arr1[2]; 
ss+="<div style='margin:10px;'>"+cnName+"<a onclick=set_poly_ok('"+cnName+"','"+col_id+"','"+colName+"') href='#ytd'>选择</a></div>"
}
}
obj.innerHTML=ss
obj.style.display=""
}
function set_poly_ok(cnName,col_id,colName)
{
var polys=document.getElementById("liucheng").getElementsByTagName("polyline");
for(var i=0;i<polys.length;i++)
{
if(polys[i].fillColor=="red")
{
var obj=polys[i].getElementsByTagName("textbox")[0];
obj.innerHTML=cnName
obj.setAttribute('data-cnName',cnName)
obj.setAttribute('data-colid',col_id)
obj.setAttribute('data-colName',colName)
break;
}	
}
document.getElementById('all_cols').style.display="none"
}
function get_mokuai_tbName(cnName,tb_setName,fileName,tbName)
{
var obj=null
var rects=document.getElementById("liucheng").getElementsByTagName("roundrect");
for(var i=0;i<rects.length;i++)
{
if(rects[i].fillColor=="red")
{
var obj=rects[i].getElementsByTagName("textbox")[0];
if(event.srcElement.parentNode.id=="pmenu")
{
obj.setAttribute('data-pfileName',fileName)	
obj.setAttribute('data-ptbName',tbName)	
}
else
{
obj.innerHTML=cnName
obj.setAttribute('data-fileName',fileName)
obj.setAttribute('data-tbsetName',tb_setName)
obj.setAttribute('data-tbName',tbName)
}
break;
}	
}
if(obj==null)
{
var polys=document.getElementById("liucheng").getElementsByTagName("polyline");
for(var i=0;i<polys.length;i++)
{
if(polys[i].fillColor=="red")
{
var obj=polys[i].getElementsByTagName("textbox")[0];
obj.setAttribute('data-fileName',fileName)
obj.setAttribute('data-tbsetName',tb_setName)
obj.setAttribute('data-tbName',tbName)
break;
}	
}
}
}
function createNode(left,top,tag)
{
var alt=document.getElementById("alt");
if(alt)alt.removeNode(true);
var leixing=tag
if (tag=="jie")
{
leixing="oval"
}
var tags=document.getElementById("liucheng").getElementsByTagName(leixing);
var new_id;
if(tags.length==0){id=1;}
else{
var id=tags[tags.length-1].id
id=id.substring(1)
id=parseInt(id)+1;
}
var flag=null
var s=""
var color="red"
if (tag=="roundrect")
{
flag="r"
new_id=flag+id
s="<v:roundrect inset='2pt,2pt,2pt,2pt'  onmousedown='showMenu()'  id='"+new_id+"' flowtype='' passcount='0'";
s+="flowtitle='<br>"+new_id+"' flowflag='0' readonly='0' receiverid='' receivername=''";
s+="fillcolor='#EEEEEE' ondblclick='change_text(this)' style='left: "+left+"; top: "+top+"; width: 100; position: absolute;";
s+="height: 50; vertical-align: middle; cursor: hand; text-align: center; z-index: 1'";
s+="arcsize='4321f' coordsize='21600,21600' title='流程"+id+",下一步骤:'>";
s+="<v:shadow on='T' type='single' color='#b3b3b3' offset='3px,3px' /><br>";
s+="<v:textbox inset='1pt,2pt,1pt,1pt' data-tbName='' data-fileName='' data-tbsetName=''  onselectstart='return false;'>流程"+new_id+"</v:textbox>";
s+="</v:roundrect>";	
}
else if(tag=="polyline")
{
flag="p"
new_id=flag+id
s="<v:polyline  id='"+new_id+"' onmousedown='showMenu()'  Points='0,30,70,55,140,30,70,5,0,30' flowtype='' passcount='0'";
s+="flowtitle='<br>"+new_id+"' flowflag='0' readonly='0' receiverid='' receivername=''";
s+="fillcolor='#EEEEEE' ondblclick='change_text(this)' style='left: "+left+"; top: "+top+"; width:140; position: absolute;";
s+="height:50; vertical-align: middle; cursor: hand; text-align: center; z-index: 1'";
s+="arcsize='4321f' coordsize='21600,21600' title='条件"+id+",流向:'>";
s+="<v:shadow on='T' type='single' color='#b3b3b3' offset='3px,3px' /><br>";
s+="<v:textbox inset='1pt,2pt,1pt,1pt' data-cnName='' data-colid='' data-tbName='' data-fileName='' data-tbsetName='' style='vertical-align: middle; word-break: break-all;' onselectstart='return false;'>条件"+new_id+"</v:textbox>";
s+="</v:polyline>";	
}
else if(tag=="jie")
{
flag="j"
new_id=flag+id
s="<v:oval  id='"+new_id+"' passcount='0'";
s+="flowtitle='<br>"+new_id+"' flowflag='0' readonly='0' receiverid='' receivername=''";
s+="fillcolor='#EEEEEE' ondblclick='change_text(this)' style='left: "+left+"; top: "+top+"; width:10; position: absolute;";
s+="height:10; vertical-align: middle; cursor: hand; text-align: center; z-index: 1'";
s+="arcsize='4321f' coordsize='21600,21600'>";
s+="<v:shadow on='T' type='single' color='#b3b3b3' offset='3px,3px' /><br>";
s+="</v:oval>";
}
else if(tag=="oval")
{
flag="o"
new_id=flag+id
s="<v:oval  id='"+new_id+"' passcount='0'";
s+="flowtitle='<br>"+new_id+"' flowflag='0' readonly='0' receiverid='' receivername=''";
s+="fillcolor='#EEEEEE' ondblclick='change_text(this)' style='left: "+left+"; top: "+top+"; width:120; position: absolute;";
s+="height:50; vertical-align: middle; cursor: hand; text-align: center; z-index: 1'";
s+="arcsize='4321f' coordsize='21600,21600'>";
s+="<v:shadow on='T' type='single' color='#b3b3b3' offset='3px,3px' /><br>";
s+="<v:textbox inset='1pt,2pt,1pt,1pt'  data-fileName='' data-tbsetName='' style='vertical-align: middle; word-break: break-all;' onselectstart='return false;'>无需修改"+new_id+"</v:textbox>";
s+="</v:oval>";
}
else
{
return;	
}
document.getElementById("liucheng").insertAdjacentHTML("beforeEnd",s);
rect_selected(document.getElementById(new_id),color)
}
function delNode()
{
var selObj=null; 
var ovals=document.getElementById("liucheng").getElementsByTagName("oval");
for(var i=0;i<ovals.length;i++)
{
if(ovals[i].fillcolor=="red")
{
selObj=ovals[i];
}
}	
if(selObj)
{
var lines=document.getElementById("liucheng").getElementsByTagName("line");
var id_sub,j,arr=new Array(),k=0;
for(j=0;j<lines.length;j++)
{
id_sub=lines[j].id.split("_");
if(id_sub[1]==selObj.id||id_sub[2]==selObj.id)
{
arr[k]=lines[j].id;
k++;
}
}
for(var n=0;n<arr.length;n++)
{
delete_line(arr[n])	
}
selObj.removeNode(true);
}
}
function change_text(rect)
{
var obj=rect.getElementsByTagName("textbox")[0];
if(obj.innerHTML.indexOf("<INPUT")==-1)
{
obj.innerHTML="<input value='"+obj.innerText+"' style='width:90px' onkeydown='if(event.keyCode==13){this.blur()}' onblur='change_text_back(this)' class='text'/>"
getSelectPos(obj.getElementsByTagName("INPUT")[0]);
}
}
function change_text_back(obj)
{
obj.parentNode.innerHTML=obj.parentNode.innerHTML.replace(obj.outerHTML,obj.value)	
}
function getSelectPos(esrc)
{ 
if(esrc==null){ 
esrc=event.srcElement; 
} 
var rtextRange =esrc.createTextRange(); 
rtextRange.moveStart('character',esrc.value.length); 
rtextRange.collapse(true); 
rtextRange.select(); 
} 
function drawLine()
{
if(event.button==2)
{
var toObj=event.srcElement;
if (event.srcElement.tagName.toLowerCase() == 'textbox') toObj = event.srcElement.parentElement;
if(toObj.tagName!="roundrect"&&toObj.tagName!="polyline"&&toObj.tagName!="oval")return;
var fromObj=null;
var endarrow="endarrow='block'"
var tiaojian=""
var rects=document.getElementsByTagName("roundrect");
for(var i=0;i<rects.length;i++)
{
if(rects[i].fillcolor=="red")
{
fromObj=rects[i];
break;
}
}
if(fromObj==null)
{
var polys=document.getElementsByTagName("polyline");
for(var i=0;i<polys.length;i++)
{
if(polys[i].fillcolor=="red")
{
fromObj=polys[i];
break;
}
}	
}
if(fromObj==null)
{
var ovals=document.getElementsByTagName("oval");
for(var i=0;i<ovals.length;i++)
{
if(ovals[i].fillcolor=="red")
{
fromObj=ovals[i];
break;
}
}	
}
if(toObj&&fromObj)
{
var source=fromObj.id;
var object=toObj.id;
if(source==object)return;
if (toObj.id.substring(0,1)=="j"){endarrow=""}
if (fromObj.tagName=="polyline"){tiaojian="<v:textbox  style='vertical-align:middle;word-break: break-all;' onselectstart='return false;'>是/否</v:textbox>"}
if(document.getElementById("line_"+source+"_"+object)){return;}
s="<v:line mfrid='"+source+"' id='line_"+source+"_"+object+"' title='' source='"+source+"' object='"+object+"' strokecolor=black from='0,0' to='0,0' ondblclick='change_text(this)' style='position: absolute;display: none; z-index: 2' arcsize='4321f' coordsize='21600,21600' onmousedown='line_selected(this)'>";
s+="<v:stroke "+endarrow+">";
s+="</v:stroke>";
s+="<v:shadow on='T' type='single' color='#b3b3b3' offset='1px,1px' />";
s+=tiaojian;
s+="</v:line>";
document.getElementById("liucheng").insertAdjacentHTML("beforeEnd",s);
rect_selected(toObj,"red");
movelines();
var name=fromObj.getElementsByTagName("textbox")[0].innerText; 
var lines=document.getElementsByTagName("line","red");
var nextStr="";
for(var j=0;j<lines.length;j++)
{
if(lines[j].id.indexOf("line_"+source+"_")>-1)
{
var to_id=lines[j].id.split("_")[2];
var o=document.getElementById(to_id);
nextStr+=o.getElementsByTagName("textbox")[0].innerText+",";
}
}
nextStr=nextStr.substr(0,nextStr.length-1)
var title=name+",下一步骤:"+nextStr;
fromObj.title=title;
}
}
}
function delete_rect()
{
var selObj=null; 
var rects=document.getElementById("liucheng").getElementsByTagName("roundrect");
for(var i=0;i<rects.length;i++)
{
if(rects[i].fillcolor=="red")
{
selObj=rects[i];
}
}	
if(selObj)
{
var lines=document.getElementById("liucheng").getElementsByTagName("line");
var id_sub,j,arr=new Array(),k=0;
for(j=0;j<lines.length;j++)
{
id_sub=lines[j].id.split("_");
if(id_sub[1]==selObj.id||id_sub[2]==selObj.id)
{
arr[k]=lines[j].id;
k++;
}
}
for(var n=0;n<arr.length;n++)
{
delete_line(arr[n])	
}
selObj.removeNode(true);
}
}
function delete_oval()
{
var selObj=null; 
var ovals=document.getElementById("liucheng").getElementsByTagName("oval");
for(var i=0;i<ovals.length;i++)
{
if(ovals[i].fillcolor=="red")
{
selObj=ovals[i];
}
}	
if(selObj)
{
var lines=document.getElementById("liucheng").getElementsByTagName("line");
var id_sub,j,arr=new Array(),k=0;
for(j=0;j<lines.length;j++)
{
id_sub=lines[j].id.split("_");
if(id_sub[1]==selObj.id||id_sub[2]==selObj.id)
{
arr[k]=lines[j].id;
k++;
}
}
for(var n=0;n<arr.length;n++)
{
delete_line(arr[n])	
}
selObj.removeNode(true);
}
}
function delete_poly()
{
var selObj=null; 
var polys=document.getElementById("liucheng").getElementsByTagName("polyline");
for(var i=0;i<polys.length;i++)
{
if(polys[i].fillcolor=="red")
{
selObj=polys[i];
}
}
if(selObj)
{
var lines=document.getElementById("liucheng").getElementsByTagName("line");
var id_sub,j,arr=new Array(),k=0;
for(j=0;j<lines.length;j++)
{
id_sub=lines[j].id.split("_");
if(id_sub[1]==selObj.id||id_sub[2]==selObj.id)
{
arr[k]=lines[j].id;
k++;
}
}
for(var n=0;n<arr.length;n++)
{
delete_line(arr[n])	
}
selObj.removeNode(true);
}
}
function delete_line(id)
{
var line=document.getElementById(id);
if(line){line.removeNode(true)}
}
function delete_sel_line()
{
var lines=document.getElementsByTagName("line");
for(var i=0;i<lines.length;i++)
{
if(lines[i].strokeColor=="red")
{
delete_line(lines[i].id);	
}
}
}
function showMenu()
{
if(event.button==2&&(event.srcElement.tagName=="polyline"||event.srcElement.tagName=="roundrect"))
{
var menu=document.getElementById("pmenu");
var ps=""
var rs=""
if(event.srcElement.tagName=="roundrect") 
{
rs="block"
ps="none"
}
else
{
rs="none"
ps="block"
}
if(menu)
{
menu.style.display="";
document.getElementById("rm").style.display=rs
document.getElementById("pm").style.display=ps
menu.style.top=event.srcElement.offsetTop+30;
menu.style.left=event.srcElement.offsetLeft+50;		
return;
}
var str="<div id=pmenu class=menuStyle ><a href='#ytd;' style='display:"+ps+"' id='pm' onclick=open_dialog('select_tb.htm',600,256,0)>绑定模块表</a> <a href='#ytd;'  style='display:"+rs+"' onclick=open_dialog('select_tb.htm',600,256,0) id='rm'>绑定父表</a></div>";
document.body.insertAdjacentHTML("beforeEnd",str);
menu=document.getElementById("pmenu");
menu.style.top=event.srcElement.offsetTop+30;
menu.style.left=event.srcElement.offsetLeft+50;	
}
else
{
var menu=document.getElementById("pmenu");
if(menu)menu.style.display="none";
if(event.srcElement.parentNode==menu)
{
event.srcElement.click();
}
}
}
function set_main()
{
if(request("exe")=="save")
{
var url="../"+asp_php+"/liucheng_manage."+asp_php+"?exe=set_main&liu_id="+request("liu_id");
_gId("frame_blank").src=url;
}
else
{
alert("请先保存此流程图!");	
}
}
function change_size(wf,hf)
{
var arr=new Array("roundrect","polyline","oval")
for(n=0;n<arr.length;n++)
{
var tag=arr[n]
var nodes=_gTagName(tag);
if(nodes.length>0)
{
for(var i=0;i<nodes.length;i++)
{
var w=nodes[i].style.pixelWidth 
var h=nodes[i].style.pixelHeight
nodes[i].style.width=w*wf;
nodes[i].style.height=h*hf;
}
movelines();
}
}
}
function save_liucheng(exe)
{
var url="../"+asp_php+"/liucheng_manage.asp?exe="+exe;	
form1.action=url;
form1.content.value=document.getElementById("liucheng").innerHTML;
form1.submit();
}
function set_title()
{
var href=document.location.href;
if(href.indexOf("exe=save")>-1)
{
var id=href.split("liu_id=")[1];
save_liucheng("save&liu_id="+id);
}
else
{
window.showModalDialog("../main/liucheng_set_title.htm",window,"dialogHeight=100px;dialogWidth=300px;help=no;scroll=no")		
}
}
function save_ok(id)
{
alert("保存成功")
document.location.href+="?exe=save&liu_id="+id
}
function save_failed(err)
{
alert("error："+err);	
}
function get_liucheng()
{
var href=document.location.href;
if(href.indexOf("exe=save")>-1)
{
var id=href.split("liu_id=")[1]
var url="../asp/liucheng_manage.asp?exe=show&liu_id="+id
var req = getAjax();
req.open("GET", url, true);
req.onreadystatechange = function(){
if(req.readyState==4){
var arr=req.responseText.split("|/td|");
document.getElementById("liucheng").innerHTML= arr[0];
document.title=arr[1];
}
};
req.send(null);
}
}
function getAjax()
{
var oHttpReq = null;
if(window.ActiveXObject)
oHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
else if(window.createRequest)
oHttpReq = window.createRequest();
else
oHttpReq = new XMLHttpRequest();
return oHttpReq;
}