<?xml version="1.0" encoding="utf-8"?>
<window screenLeft="0" screenTop="0" width="162" height="154"  titleBar="false" resizeMargins="0,0,0,0" maximizable="false" onload="windowOnLoad();" onactivate="if(!event.activated) window.close();" backgroundColor="#292929" onclose="return window.canClose;">
	<script src="common.js" />
	<script>
	<![CDATA[
		//深拷贝
		//深拷贝
		function AddcloneAll()
		{
			this.cloneAll = function(){
				 function clonePrototype(){}
				 clonePrototype.prototype = this;
				 var obj = new clonePrototype();
				 for(var ele in obj){
					if(typeof(obj[ele])=="object"){
						AddcloneAll.call(obj[ele]);
						obj[ele] = obj[ele].cloneAll();
					}
				 }
				 return obj;
			}
		}
		function windowOnLoad()
		{
			window.canClose = true;
			window.Index = 0;
			var Items = window.dialogArguments.Items;
			AddcloneAll.call(Items);
			window.Items = Items.cloneAll();
			window.Count = window.dialogArguments.Count;
			if(window.Count>5)  window.Count=5;
			window.moveSizeTo(window.dialogArguments.screenLeft, window.dialogArguments.screenTop,window.outerWidth,window.Count*30+4);
			for(var i=0;i<5;i++)
			{
				var Index = i+1;
				if(i<window.Count)
				{
					$("user_" + Index).visible = true;
					$("user_" + Index).setAttribute("tooltip",window.Items[Index].name);
					$("username_" + Index).value = window.Items[Index].name;
				}
				else
				{
					$("user_" + Index).visible = false;
				}
			}
			SelectItemId(1);
		}
		
		function SelectItemInc(nDir)
		{
			var index = window.Index + nDir;
			if(index<1 || index>window.Count) return;
			SelectItemId(index);
		}

		function SelectItemId(nId)
		{
			if(nId<0 || nId>window.Count) return;
			for(var i=0;i<window.Count;i++)
			{
				var Index = i+1;
				window.Index=nId;
				if(Index==nId)
				{
					$("user_" + Index).backgroundImage = "login_IDhover_bg.png";
					$("username_" + Index).fontStyle="bold";
					$("delete_" + Index).visible=true;
				}
				else
				{
					$("user_" + Index).backgroundImage = "";
					$("username_" + Index).fontStyle="normal";
					$("delete_" + Index).visible=false;
				}
			}
		}

		function ChooseItemId(nId)
		{
			if(nId<0 || nId>window.Count) return;
			window.returnValue=window.Items[nId];
			window.close();
		}

		function DeleteItem(nId)
		{
			if(nId<0 || nId>window.Count) return;
			try{
				var userprofile = Components.GetObject("@pplive.com/UserProfile;1");
				if(userprofile)userprofile.DeleteUserProfile(window.Items[nId].name);
			}catch(e){}
			window.canClose=false;
			window.parent.OnDeleteItem(window.Items[nId].name);
			window.canClose=true;
			for(var i=nId;i<window.Count;i++)
			{
				window.Items[i] = window.Items[i+1];
			}
			window.Items[window.Count]=null;
			window.Count--;
			if(window.Count==0)
			{
				window.close();
				return;
			}
			window.moveSizeTo(window.dialogArguments.screenLeft, window.dialogArguments.screenTop,window.outerWidth,window.Count*30+4);
			for(var i=0;i<5;i++)
			{
				var Index = i+1;
				if(i<window.Count)
				{
					$("user_" + Index).visible = true;
					$("user_" + Index).setAttribute("tooltip",window.Items[Index].name);
					$("username_" + Index).value = window.Items[Index].name;
				}
				else
				{
					$("user_" + Index).visible = false;
				}
			}
			SelectItemId(1);
		}
	]]>
	</script>
	<keyset>
		<key modifiers="" keycode="VK_UP" oncommand="SelectItemInc(-1);" scope="app"/>
		<key modifiers="" keycode="VK_DOWN" oncommand="SelectItemInc(1);" scope="app"/>
		<key modifiers="" keycode="VK_RETURN" oncommand="ChooseItemId(window.Index);" scope="app"/>
	</keyset>

	<!-- 描边 -->
	<subwindow left="0" top="0" width="162" height="154" backgroundColor="#19587b" passThrough="false" horizontalAlignment="stretch" verticalAlignment="stretch"/>
	<subwindow left="1" top="1" width="160" height="152" backgroundColor="#000000" passThrough="false" horizontalAlignment="stretch" verticalAlignment="stretch"/>

	<subwindow id="user_1" left="2" top="2" width="158" height="30" backgroundColor="#021c34" passThrough="false" visible="false" backgroundImage="login_IDhover_bg.png" backgroundImageStretchMode="stretch" onmouseover="SelectItemId(1);" onclick="ChooseItemId(1);">
		<label id="username_1" left="0" top="0" width="142" height="30" textOverflow="ellipsis" passThrough="true" foregroundColor="#ffffff" fontSize="12" fontFace="tahoma" textAlignment="left vcenter" value=""/>
		<button id="delete_1" left="142" top="10" width="10" height="10" image="login_IDdelt_normal.png" hoverImage="login_IDdelt_hover.png" downImage="login_IDdelt_down.png" onclick="DeleteItem(1);" cursor="hand" tooltip="删除账号登录信息" visible="false"/>
	</subwindow>
	<subwindow id="user_2" left="2" top="32" width="158" height="30" backgroundColor="#021c34" passThrough="false" visible="false" backgroundImage="login_IDhover_bg.png" backgroundImageStretchMode="stretch" onmouseover="SelectItemId(2);" onclick="ChooseItemId(2);">
		<label id="username_2" left="0" top="0" width="142" height="30" textOverflow="ellipsis" passThrough="true" foregroundColor="#ffffff" fontSize="12" fontFace="tahoma" textAlignment="left vcenter" value=""/>
		<button id="delete_2" left="142" top="10" width="10" height="10" image="login_IDdelt_normal.png" hoverImage="login_IDdelt_hover.png" downImage="login_IDdelt_down.png" onclick="DeleteItem(2);" cursor="hand" tooltip="删除账号登录信息" visible="false"/>
	</subwindow>
	<subwindow id="user_3" left="2" top="62" width="158" height="30" backgroundColor="#021c34" passThrough="false" visible="false" backgroundImage="login_IDhover_bg.png" backgroundImageStretchMode="stretch" onmouseover="SelectItemId(3);" onclick="ChooseItemId(3);">
		<label id="username_3" left="0" top="0" width="142" height="30" textOverflow="ellipsis" passThrough="true" foregroundColor="#ffffff" fontSize="12" fontFace="tahoma" textAlignment="left vcenter" value=""/>
		<button id="delete_3" left="142" top="10" width="10" height="10" image="login_IDdelt_normal.png" hoverImage="login_IDdelt_hover.png" downImage="login_IDdelt_down.png" onclick="DeleteItem(3);" cursor="hand" tooltip="删除账号登录信息" visible="false"/>
	</subwindow>
	<subwindow id="user_4" left="2" top="92" width="158" height="30" backgroundColor="#021c34" passThrough="false" visible="false" backgroundImage="login_IDhover_bg.png" backgroundImageStretchMode="stretch" onmouseover="SelectItemId(4);" onclick="ChooseItemId(4);">
		<label id="username_4" left="0" top="0" width="142" height="30" textOverflow="ellipsis" passThrough="true" foregroundColor="#ffffff" fontSize="12" fontFace="tahoma" textAlignment="left vcenter" value=""/>
		<button id="delete_4" left="142" top="10" width="10" height="10" image="login_IDdelt_normal.png" hoverImage="login_IDdelt_hover.png" downImage="login_IDdelt_down.png" onclick="DeleteItem(4);" cursor="hand" tooltip="删除账号登录信息" visible="false"/>
	</subwindow>
	<subwindow id="user_5" left="2" top="122" width="158" height="30" backgroundColor="#021c34" passThrough="false" visible="false" backgroundImage="login_IDhover_bg.png" backgroundImageStretchMode="stretch" onmouseover="SelectItemId(5);" onclick="ChooseItemId(5);">
		<label id="username_5" left="0" top="0" width="142" height="30" textOverflow="ellipsis" passThrough="true" foregroundColor="#ffffff" fontSize="12" fontFace="tahoma" textAlignment="left vcenter" value=""/>
		<button id="delete_5" left="142" top="10" width="10" height="10" image="login_IDdelt_normal.png" hoverImage="login_IDdelt_hover.png" downImage="login_IDdelt_down.png" onclick="DeleteItem(5);" cursor="hand" tooltip="删除账号登录信息" visible="false"/>
	</subwindow>
</window>