<!--#include file="top.asp"-->
<%if userflag27=0 then
response.redirect"ok.asp?action=flag"
end if
if request("gs")="save" then
response.write request("d_b2")
response.end
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%=citycss%>
<script language=javascript>
<!--
// 加入已选
function Add() {
	var sel1=document.myform.d_b1;
	if (sel1.selectedIndex<0) {
		alert("请选择一个待选项目！");
		return;}
	var sel2=document.myform.d_b2;
	var obj1=sel1.options[sel1.selectedIndex].value;
//======================判断是否有相同
	for(var i = 0;i < sel2.options.length;i ++) {
		if(sel2.options[i].value == obj1) {
		alert(""+obj1+" 已存在，请不要重复添加!");
		return;	
		}
	}
//======================end
	sel2.options[sel2.length]=new Option(sel1.options[sel1.selectedIndex].innerHTML,sel1.options[sel1.selectedIndex].value);
}


// 从已选中删除
function Del() {
	var sel=document.myform.d_b2;
	var nIndex = sel.selectedIndex;
	var nLen = sel.length;
	if (nLen<1) return;
	if (nIndex<0) {
		alert("请选择一个已选按钮！");
		return;
	}
	for (var i=nIndex;i<nLen-1;i++) {
		sel.options[i].value=sel.options[i+1].value;
		sel.options[i].innerHTML=sel.options[i+1].innerHTML;
	}
	sel.length=nLen-1;
}

// 删除所有
function Delall() {
	var sel=document.myform.d_b2;
sel.options.length=0;
}

// 排序：向上移动
function Up() {
	var sel=document.myform.d_b2;
	var nIndex = sel.selectedIndex;
	var nLen = sel.length;
	if ((nLen<1)||(nIndex==0)) return;
	if (nIndex<0) {
		alert("请选择一个要移动的已选按钮！");
		return;
	}
	var sValue=sel.options[nIndex].value;
	var sHTML=sel.options[nIndex].innerHTML;
	sel.options[nIndex].value=sel.options[nIndex-1].value;
	sel.options[nIndex].innerHTML=sel.options[nIndex-1].innerHTML;
	sel.options[nIndex-1].value=sValue;
	sel.options[nIndex-1].innerHTML=sHTML;
	sel.selectedIndex=nIndex-1;
}

// 排序：向下移动
function Down() {
	var sel=document.myform.d_b2;
	var nIndex = sel.selectedIndex;
	var nLen = sel.length;
	if ((nLen<1)||(nIndex==nLen-1)) return;
	if (nIndex<0) {
		alert("请选择一个要移动的已选按钮！");
		return;
	}
	var sValue=sel.options[nIndex].value;
	var sHTML=sel.options[nIndex].innerHTML;
	sel.options[nIndex].value=sel.options[nIndex+1].value;
	sel.options[nIndex].innerHTML=sel.options[nIndex+1].innerHTML;
	sel.options[nIndex+1].value=sValue;
	sel.options[nIndex+1].innerHTML=sHTML;
	sel.selectedIndex=nIndex+1;
}

// 提交处理
function checkform() {
	var sel=document.myform.d_b2;
	var nLen = sel.length;
	var str="";
	for (var i=0;i<nLen;i++) {
		if (i>0) str+=",";
		str+=sel.options[i].value;
	}
	parent.document.addform['magicfacepic('+<%=request("action")%>+')'].value=str;
	parent.lookmagic(<%=request("action")%>);
}
//-->
</script>
<title><%=citytitle%> - 用户公文包 - 名片选择</title>
</hand>

<body style="margin:0;background:menu">
<%if request("action")="" then
response.write "<div align=center valign=middle style=""height:150px"">参数错误，请重新选择！</div>"
response.end
end if%>
<form action="my_friend_view.asp?gs=save" method=post name=myform>
<!--====================================-->
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr align=center><td>
<select name="d_b1" size=12 style="width:160px" ondblclick="Add()">
<%set rs=server.createobject("adodb.recordset")
sql="select * from dlxf_friend where dlxf_yp_id="&session("id")
rs.open sql,conn,1,1
if not rs.eof then
dlxf_friend=rs("dlxf_friend")
else
response.write "<td align=center>还没有收藏企业名片</td>"
end if
rs.close

if dlxf_friend<>"" then
dlxf_friend=split(dlxf_friend,",")%>
<%for i=0 to ubound(dlxf_friend)
sql="select * from dlxf_yp where dlxf_id=" &dlxf_friend(i)
rs.open sql,conn,1,1%>
<OPTION value="<%=rs("dlxf_coname")%>"><%=rs("dlxf_coname")%></OPTION>
<%rs.close
next%>
<%end if
set rs=nothing%>
</SELECT>
</td>

<td><input type=button name=b1 value=' → ' onclick='Add()'> 
<BR><BR><input type=button name=b1 value=' ← ' onclick='Del()'>
<BR><BR><input type=button name=b1 value=' DEL ' onclick='Delall()'>
</td>

<td><select name="d_b2" size=12 style="width:160px" ondblclick="Del()"></SELECT></td>

</tr>

<tr align=center><td colspan=3>
<input type=button name=b3 value='↑' onclick='Up()'>
<input type=button name=b4 value='↓' onclick='Down()'>
<input type=hidden name='d_button' value=''>
<input type=submit name=b value=' 确定 ' onclick='checkform()'></td></tr>
</table>
</FORM>