'本皮肤由人字拖(中企狼)修改制作
Dim UserNum
Dim UserStatus
Dim Path
Dim strQQMailTip
Dim ShowStatus
Dim foldbottom
Dim bMsgInside
Dim CurrentWidth
Dim CurrentHeight
Dim PlugMngHeight
Dim PlugCloseState
Dim PetState
Dim ntopdistance
Dim nYellowBanner
Dim nSearchBanner
Dim bShowDNA
Dim strTenpayTip
Dim bShowSoso
Dim PJJG
Dim QQHTzy
Dim QQHTsx
Dim QQHTsxX
Dim starttime,ct,tt  '在线时间的变量
'注释

Sub Window_OnInit()
    Window.GetScriptVersion "1.0"
    UserStatus = "[离线]"
	Path = "NewSkins\\2006\\"
	ShowStatus = 1
	UserNum = "0"
	If 1 = ShowStatus Then
	    UserNum = UserNum + UserStatus
	End If
	strQQMailTip = ""
	bMsginside = 0
	PlugCloseState = 0
	PetState = 1
	bShowDNA = 0
	bShowSoso = 0
         QQHTzy = 0
         QQHTsx = 1

        '在线时间代码开始
	starttime = timer
       ct = 2
	Time.Start
	'在线时间代码结束
        OnlineDate_onClick()
	strTenpayTip = ""
    ImSearchPlugin.bInside = FALSE
End Sub

Sub AdjustStatuePanelSize()
	QZoneMsgCenterButton.width = 16 + QZoneMsgCenterButton.textlength + 6
	
	MailButton.left = QZoneMsgCenterButton.left + QZoneMsgCenterButton.width
	MailButton.width = 16 + MailButton.textlength + 6
	
	PaymentButton.left = MailButton.left + MailButton.width
	If  PaymentButton.textlength > 0 Then 
		PaymentButton.width = 16 + PaymentButton.textlength + 6
	else 
		PaymentButton.width = 16 + 12
	End If
	
	SosoButton.left = PaymentButton.left + PaymentButton.width
	If  SosoButton.textlength > 0 Then 
		SosoButton.width = 16 + SosoButton.textlength + 6
	else 
		SosoButton.width = 16 + 12
	End If
End Sub

Sub Window_OnSize(cx,cy)
	Window.LockPaint()
	CurrentWidth = cx
	CurrentHeight = cy
	

	BackgroundRT.left  = cx - 79 
        BackgroundRT1.left  = cx - 5
	BackgroundRT2.left  = cx - 108

	BackgroundL3.top = cy - 182
	BackgroundL2.height = cy - 179 - 141


	Background.height = cy - 114 - 56
        Background.width = cx -35.5



	BackgroundT.width = cx - 143
	BackgroundT2.width = cx - 173 
        BackgroundT1.width = cx - 12


        PJJG = (cx - 55 - 5 * 20 ) / 4
        MsgManagerButton.top = cy - 26 	
        MsgManagerButton.left = 55
        SearchButton.top = cy - 26
        SearchButton.left = MsgManagerButton.left + PJJG +20
        LockButton.top = cy - 26
        unLockButton.top = cy - 26
        LockButton.left = SearchButton.left + PJJG +20
        unLockButton.left = SearchButton.left + PJJG +20
        xsButton.top = cy - 26
        ycButton.top = cy - 26
        xsButton.left = SearchButton.left + PJJG +20 + PJJG +20
        ycButton.left = SearchButton.left + PJJG +20 + PJJG +20
	QQTV.top = cy - 26
	QQTV.left = 55
	QQMusic.top = cy - 26
	QQMusic.left = QQTV.left + PJJG +20
        
        OtherButton.top = cy - 53 
        OtherButton.left = 55
        MobileMsgButton.top = cy - 53 
        MobileMsgButton.left = GameButton.left + PJJG +20
	GameButton.top = cy - 53 
        GameButton.left = otherButton.left + PJJG +20
	ChatRoomButton.top = cy - 53 
        ChatRoomButton.left = MobileMsgButton.left + PJJG +20
	petOpenBtn.top = cy - 53 
	petOpenBtn.left = ChatRoomButton.left + PJJG +18

        OnlineDate.left = 55
        OnlineDate.top = cy - 51
	
	foldbottom = 62
	PlugMngHeight = 6

	ntopdistance = 0
        nYellowBanner = 0
	QQPushMsgPlug.AdjustHeight(cx - 4)
	
	If nYellowBanner > 0 Then
		QQPushMsgPlug.width = cx - 4
		QQPushMsgPlug.Height = nYellowBanner
		QQPushMsgPic.width = cx - 6
		QQPushMsgPic.Visible = TRUE
		ntopdistance = nYellowBanner
	Else
		QQPushMsgPic.Visible = FALSE
	End If
	
    If ImSearchPlugin.bInside Then
        nSearchBanner = 0
        ImSearchPlugin.AdjustHeight(cx)
        ImSearchPlugin.left = 0
        ImSearchPlugin.width = cx
        ImSearchPlugin.Height = nSearchBanner
        If (nYellowBanner > 0) Then
              ImSearchPlugin.top = 89 + ntopdistance
        Else
              ImSearchPlugin.top = 88 + ntopdistance
        End If
        ntopdistance = ntopdistance + nSearchBanner
    Else
        ImSearchPlugin.left = 0
        ImSearchPlugin.width = 0
        ImSearchPlugin.Height = 0
        ImSearchPlugin.top = 88 + ntopdistance
    End If
	       
		
	
	If (nYellowBanner > 0) Then

		FolderBackgroundC.top = 80 + ntopdistance		
	Else

		FolderBackgroundC.top = 89 + ntopdistance
	End If
	
	
	    If (nYellowBanner > 0) Then
		NewPanels.top = 89 + ntopdistance
	Else
		NewPanels.top = 88 + ntopdistance
	End If
	
	NewPanels.width = 35
	
	   If (nYellowBanner > 0) Then 
		Bar1.top = 93 + ntopdistance
	Else
		Bar1.top = 89 + ntopdistance
	End If


	StatusWeather.left = cx - 43
	Container_Up.top = 25
	Container_Up.left = StatusButton.left + StatusButton.width
	Container_Up.width = cx - Container_Up.left - StatusWeather.width - 10
	Container_Up.height = 68

	Container_Down.top = cy - 65
	Container_Down.left = 0
	Container_Down.width = cx
	Container_Down.height = 65


	

		

	

    If(PlugCloseState = 0) Then
		FolderBackgroundC.width = cx - 40 
		If (ntopdistance > 0) Then
			FolderBackgroundC.height = cy - 142 - ntopdistance - PlugMngHeight
		Else
			FolderBackgroundC.height = cy - 140 - ntopdistance - PlugMngHeight
		End If
    Else'全部关闭

		If (ntopdistance > 0) Then
			FolderBackgroundC.height = cy - 157 - ntopdistance
		Else
			FolderBackgroundC.height = cy - 155 - ntopdistance 
		End If
	End If
	
	If MainSearchDlg.bInside = True Then
		FolderBackgroundC.height = FolderBackgroundC.height - MainSearchDlg.height
	End if
	
	
	ToolBarBackgroundC.top = cy - 56 
	ToolBarBackgroundC.width = cx - 116 
	ToolBarBackgroundL.top = ToolBarBackgroundC.top 
	ToolBarBackgroundR.left = cx - 71
	ToolBarBackgroundR.top = ToolBarBackgroundC.top 

	PlugMngButton_Down.left = 0
	PlugMngButton_Up.left = 0
	PlugMngButton_Down.width = cx
	PlugMngButton_Up.width = cx
	


	If PlugMngButton_Down.Visible = TRUE Then
		PlugMngButton_Down.top = FolderBackgroundC.top  
		PlugMngButton_Down.height = 6
	End If
	if PlugMngButton_Up.Visible = TRUE Then
		PlugMngButton_Up.top = FolderBackgroundC.top  
		PlugMngButton_Up.height = 6
	End If


	CloseButton.left = cx - 35 

	MinButton.left = cx - 96 

'	QQCaption.width = MinButton.left - QQCaption.left - 2
	ColorButton.left = cx - 66 

	AdjustStatuePanelSize()
	
	MenuButton.top = cy - 43



  
	CalcStatusPos cx, cy
	

    If QQHTzy = 0 then
             Bar1.width = cx - 4
            Bar1.left = 2
        Else 
              Bar1.left = 37
              Bar1.width = cx - 41
  	End If

'    If QQHTsx = 0 then
 '              QQHTsxX = 0      
'        Else 
 '              QQHTsxX = 25           
 ' 	End If


	Bar1.LockPaint()
	MainSearchDlg.LockPaint()


		If (ntopdistance > 0) Then
			Bar1.height = cy - 145 - ntopdistance + QQHTsxX
		Else
	    	Bar1.height = cy - 145- ntopdistance + QQHTsxX
		End If
 

        BackgroundR.left = cx - 35
        BackgroundR.height = Bar1.height
        BackgroundR.top = Bar1.top 
 
	
	If MainSearchDlg.bInside = True Then
	    Bar1.height = Bar1.height - MainSearchDlg.height
            If PlugCloseState = 1 Then
                MainSearchDlg.top = FolderBackgroundC.top + FolderBackgroundC.height+1
			Else
				MainSearchDlg.top = FolderBackgroundC.top  + PlugMngHeight
			End If		
		MainSearchDlg.width = cx	
	End if


	NewPanels.height = Bar1.height

    Bar1.UnLockPaint()
	MainSearchDlg.UnLockPaint()
	
	MailButton.label = strQQMailTip
	Window.UnLockPaint()	 
End Sub

Sub CalcStatusPos(cx, cy)
	StatusEdit.Left = QQNumber.left
	IF bShowDNA = 1 Then
		DNAButton.visible = True
		QQNumber.width = QQNumber.textlength
		DNAButton.Left = QQNumber.Left + QQNumber.width
		QQStatus.Left = DNAButton.Left + DNAButton.width + 1
		QQStatus.width = QQStatusText.textlength + 3
	Else
		DNAButton.visible = False
		QQNumber.width = QQNumber.textlength
		QQStatus.Left = QQNumber.Left + QQNumber.width + 1
		QQStatus.width = QQStatusText.textlength + 3
	End If

	If QQStatus.Left > cx - 15 Then
		QQStatus.Left = cx - 15
		QQStatus.width = 0
		QQStatus.visible = False
	ElseIf QQStatus.Left + QQStatus.width > cx - 15 Then
		QQStatus.visible = true
		QQStatus.width = cx - 15 - QQStatus.Left
	Else
		QQStatus.visible = True
	End If
	
	StatusEdit.width = cx - StatusEdit.left - 5
End Sub

'上面的三个按钮
Sub MinButton_onClick()
	Window.ExeCommand 1,2
End Sub

Sub CloseButton_onClick()
	Window.ExeCommand 1,3
End Sub

Sub ColorButton_onClick()
        Window.ExeCommand 4,7
End Sub


Sub PlugMngButton_Down_onClick()
	Window.ExeCommand 3,1
	PlugMngButton_Down.Visible = False
	PlugMngButton_Up.Visible = True
	MainSearchDlg.Hide()
End Sub

Sub PlugMngButton_Up_onClick()
	Window.ExeCommand 3,2
	PlugMngButton_Down.Visible = True
	PlugMngButton_Up.Visible = False
	MainSearchDlg.Show()
End Sub


'六个Bar按钮
Sub Window_onClick(code, Name)
	Window.LockPaint()
	Window.DisableBar CStr(Name)
	Window.ExeCommand code,CStr(Name)
	Window.UnLockPaint()
End Sub

'顶部的按钮组 
Sub QQStatus_onClick()
	s = QQStatus.left
	Window.ExeCommand 63,s
End Sub

Sub StatusButton_onClick()
	s = CStr(StatusButton.Left + StatusButton.width - 10)&"."&CStr(StatusButton.Top + StatusButton.height - 8)
	Window.ExeCommand 6,s
End Sub

sub StatusPicBG_onMouseMove(nX,nY)
	s = CStr(StatusPicBG.Left) & "." & CStr(StatusPicBG.Top) & "." & CStr(StatusPicBG.width) & "." & CStr(StatusPicBG.height)
	Window.ExeCommand 20,s
end Sub

sub StatusPicBG_onMouseLeave()
	s = CStr(StatusPicBG.Left) & "." & CStr(StatusPicBG.Top) & "." & CStr(StatusPicBG.width) & "." & CStr(StatusPicBG.height)
	Window.ExeCommand 21,s
end Sub

Sub StatusPic_onClick()
	Window.ExeCommand 60,2
End Sub


sub StatusWeather_onMouseMove(nX,nY)
	s = CStr(StatusWeather.Left) & "." & CStr(StatusWeather.Top) & "." & CStr(StatusWeather.width) & "." & CStr(StatusWeather.height)
	Window.ExeCommand 31,s
end Sub

sub StatusWeather_onMouseLeave()
	s = CStr(StatusWeather.Left) & "." & CStr(StatusWeather.Top) & "." & CStr(StatusWeather.width) & "." & CStr(StatusWeather.height)
	Window.ExeCommand 30,s
end Sub

Sub StatusWeather_onClick()
	Window.ExeCommand 61,0
End Sub

Sub OnlineDate_onClick()
	Show_Info 2,1'显示农历
End Sub




sub PaymentButton_onClick()
	Window.ExeCommand 4,8
end Sub

Sub QZoneMsgCenterButton_onClick()
	QZoneMsgCenterButton.label = "0"
	Window.ExeCommand 66,0
End Sub	
Sub MailButton_onClick()
	Window.ExeCommand 7,1		
End Sub

Sub DNAButton_onClick()
	Window.ExeCommand 27,1
End Sub
Sub SosoButton_onClick()
	Window.ExeCommand 4,14
End Sub
'Sub HostingButton_onClick()
'	Window.ExeCommand 15,1	
'End Sub

Sub SecurityButton_onClick()
	Window.ExeCommand 15,1	
End Sub

Sub MyQQButton_onClick()
	Window.ExeCommand 4,13	
End Sub

'下面的按钮组 
Sub MobileMsgButton_onClick()
	Window.ExeCommand 4,2
End Sub

Sub GameButton_onClick()
	Window.ExeCommand 4,5

End Sub

Sub OtherButton_onClick()
	Window.ExeCommand 4,9
End Sub

Sub ChatRoomButton_onClick()
	Window.ExeCommand 4,1
End Sub

Sub MenuButton_onClick()
	'Dim a As Integer
	'a = MenuButton.Left - 3
	's = CStr(Left)&"."&CStr(MenuButton.Top)
	s = CStr(Int(MenuButton.Left))&"."&CStr(MenuButton.Top)
	Window.ExeCommand 5,s
End Sub

Sub MsgManagerButton_onClick()
	Window.ExeCommand 4,6
End Sub

Sub SearchButton_onClick()
	Window.ExeCommand 4,3
End Sub


'Sub QQHome_onClick()
'	Window.ExeCommand 16,1	
'End Sub

Sub ScrollUpButton_OnClick()
        Window.ExeCommand 17,1
End Sub

Sub ScrollDownButton_OnClick()
        Window.ExeCommand 18,1
End Sub
Sub PanelMngButton_OnClick()
	Window.ExeCommand 19,1
End Sub
Sub QQMusic_OnClick()
	Window.ExeCommand 25,1
End Sub
Sub QQTV_onClick()
	Window.ExeCommand 26,1
End Sub

sub petOpenBtn_onClick()
	Window.ExeCommand 40,12
end Sub




'大小变化
Sub unLockButton_onClick()
      LockButton.visible = true
      unLockButton.visible = False
      Window.LockPaint()  
             PreH = CurrentHeight
             PreW = CurrentWidth
             Window.minWidth= PreW
             Window.minHeight = PreH 
             Window.maxWidth= PreW
             Window.maxHeight = PreH 
      Window.UnLockPaint()
End Sub
Sub LockButton_onClick()
      LockButton.visible = False
      unLockButton.visible = true
      Window.LockPaint()            
             Window.minWidth= 177
             Window.minHeight = 500
             Window.maxWidth= 1024
             Window.maxHeight = 1024
      Window.UnLockPaint()
End Sub
'显示隐藏其它功能
Sub xsButton_onClick()
     Window.LockPaint() 
           ycButton.Visible = TRUE
	   xsButton.Visible = FALSE
MsgManagerButton.Visible = TRUE
SearchButton.Visible = TRUE
QQTV.Visible = FALSE
QQMusic.Visible = FALSE
MobileMsgButton.Visible = FALSE
GameButton.Visible = FALSE
OtherButton.Visible = FALSE
ChatRoomButton.Visible = FALSE
petOpenBtn.Visible = FALSE
OnlineDate.Visible = TRUE
'	   QQHTsx = 1
 '      QQHTzy = 1
      window.RebuildRGN
End Sub
Sub ycButton_onClick()
     Window.LockPaint()
	   ycButton.Visible = FALSE
	   xsButton.Visible = TRUE
MsgManagerButton.Visible = FALSE
SearchButton.Visible = FALSE
QQTV.Visible = TRUE
QQMusic.Visible = TRUE
MobileMsgButton.Visible = TRUE
GameButton.Visible = TRUE
OtherButton.Visible = TRUE
ChatRoomButton.Visible = TRUE
petOpenBtn.Visible = TRUE
OnlineDate.Visible = FALSE
'        QQHTsx = 0
      window.RebuildRGN
End Sub

'处理QQ程序发来的事件
Sub Window_OnNotify(code ,var)
	If code = 1 Then 
	    '设置当前的Uin
	    UserNum = var
	    If 0 = ShowStatus Then
			QQNumber.value = UserNum
		Else
		   	QQNumber.value = UserNum
			QQStatusText.value = UserStatus
			QQStatus.label = UserStatus
		End If	
		CalcStatusPos CurrentWidth, CurrentHeight
	ElseIf code = 2 Then
		'闪系统消息按钮 var 为1是开始闪。为2是停止
		If(var = 1) Then
			MsgManagerButton.StopFlash
			MsgManagerButton.Flash 30
		Else
			MsgManagerButton.StopFlash
		End If
	ElseIf code = 3 then
		'闪状态按钮 var 为0,1,2,3是对应的ico。为4表示停止
		If var = 0 Then
			StatusPic.ico = "Online.ico"		
		ElseIf var = 1 Then
			StatusPic.ico = "leave.ico"		
		ElseIf var = 2 Then
			StatusPic.ico = "invisible.ico"		
		ElseIf var = 3 Then
			StatusPic.ico = "Offline.ico"		
		ElseIf var = 4 Then
			StatusPic.Ico = StatusIco	
		End If
	ElseIf code = 4 Then
		'设置那个Bar在最前
		Window_onClick 2,Var
	ElseIf code = 5 Then
		'设置当前的状态。
		QQStatus.Disabled=0
		If var = 10 Then	
			UserStatus = "[在线]"		
			StatusIco = "online.ico"
		ElseIf var = 20 Then
			UserStatus = "[离线]"	
			QQStatus.Disabled=1		
			StatusIco = "exit.ico"
		ElseIf var = 30 Then	
			UserStatus = "[离开]"		
			StatusIco = "leave.ico"
		ElseIf var = 40 Then	
			UserStatus = "[隐身]"		
			StatusIco = "hide.ico"
		ElseIf var = 50 Then
			UserStatus = "[忙碌]"
			StatusIco = "busy.ico"
		ElseIf var = 60 Then
			UserStatus = "[Q我吧]"
			StatusIco = "qme.ico"
		ElseIf var = 70 Then
			UserStatus = "[静音]"
			StatusIco = "nobother.ico"
		End If
		StatusButton.ico = StatusIco
		If 0 = ShowStatus Then
			QQNumber.value = UserNum
		Else
		   	QQNumber.value = UserNum
			QQStatusText.value = UserStatus
			QQStatus.label = UserStatus
		End If
	ElseIf code  = 6 Then
		'设置Skin的起始路径
		Path = Var	
	ElseIf code = 10 Then
		If(var = 1) Then
			PaymentButton.SetLighting(true)
		Else
			PaymentButton.SetLighting(false)
		End If
	ElseIf code = 15 Then
		If(Var = 1) Then
			SecurityButton.SetLighting(true)
		Else 
		    SecurityButton.SetLighting(false)
		End If
	ElseIf code = 17 Then
		If(Var = 1) Then
		   SecurityButton.ico = "security_alert.ico"
		ElseIf (Var = 2) Then
		   SecurityButton.ico = "security_import.ico"
		ElseIf (Var = 3) Then
		   SecurityButton.ico = "security_infor.ico"
		ElseIf (Var = 4) Then
		   SecurityButton.ico = "security_help.ico"
		ElseIf (Var = 5) Then
		   SecurityButton.ico = "security_normal.ico"
		Else
		   SecurityButton.ico = "security_normal.ico"		
		End If
	ElseIf code = 19 Then
		If(Var = 1) Then
		   SecurityButton.visible = true
		   'MyQQButton.visible = false
		ElseIf(Var = 0)Then
		   SecurityButton.visible = false
		   'MyQQButton.visible = false
		ElseIf(Var = 2)Then
		   SecurityButton.visible = false
		   'MyQQButton.visible = true
		End If
	ElseIf code = 20 Then
		If(Var = 1) Then
			bShowDNA = 1			
		ElseIf(Var = 0) Then
			bShowDNA = 0
		End If
		CalcStatusPos CurrentWidth, CurrentHeight
	ElseIf code = 25 Then
		' 皮肤推送
		if(var = 1) then
			ColorButton.SetLighting(true)
		else
			ColorButton.SetLighting(false)
		end If	
	ElseIf code = 31 then
		if(var = 1) then
			MainSearchDlg.bInside = TRUE
		else
			MainSearchDlg.bInside = FALSE
		end If			
	ElseIf code = 33 then
		if(var = 1) then
			PlugMngButton_Down.Visible = TRUE
			PlugMngButton_Up.Visible = FALSE
		elseif var = 2 then
			PlugMngButton_Down.Visible = FALSE
			PlugMngButton_Up.Visible = TRUE

		else
			PlugMngButton_Down.Visible = FALSE
			PlugMngButton_Up.Visible = FALSE
		End If
	ElseIf code = 34 then
		if(var =1 ) then
			'MsgBox "所有的插件都关闭了"
			PlugCloseState = 1'所有的插件都关闭了
		else
			PlugCloseState = 0'有插件打开了
		End If	
	ElseIf code = 40 then
		if var = 12 then
			PetState = 1
		else
			PetState = 0
		end If
	
'	ElseIf code = 51 Then
'		iVarLen = Len(var) - 2
'		StrCaption = Mid(var, 3, iVarLen)
'		QQCaption.value = StrCaption	
	ElseIf code = 102 Then
	    '改变QQMail的提示，QQ2007Beta2后使用102
		strQQMailTip = CStr(var)
		MailButton.label = strQQMailTip			
		AdjustStatuePanelSize()		
	ElseIf code = 103 then
		if(var > 0) then
			MailButton.StartGif(var)			
		Else
			MailButton.EndGif()						
		End If
	ElseIf code = 104 Then
		If(Var = 1) Then
			MailButton.ico = "MailButtonGray.ico"
		Else
			MailButton.ico = "MailButton.ico"	
		End If		
	ElseIf code = 105 Then
		MailButton.toolTip = CStr(var)
	ElseIf code = 106 Then
		if (var = -1) then
		PaymentButton.label = 0
		PaymentButton.width = 18
		PaymentButton.toolTip = "进入我的钱包"
		ElseIf (var = 0) then
		PaymentButton.label = 0
		PaymentButton.width = 43
		PaymentButton.toolTip = "进入我的钱包"
		else
		PaymentButton.width = 43
		PaymentButton.label = CStr(var)
		PaymentButton.toolTip = "您有" + CStr(var) + "笔未处理交易"
		end if
		AdjustStatuePanelSize()
	ElseIf code = 107 Then
		UserStatus = "[" + CStr(var) + "]"
		QQStatusText.value = UserStatus
		QQStatus.label = UserStatus
		CalcStatusPos CurrentWidth, CurrentHeight
	ElseIf code = 108 then
		if(var = 1) then
			StatusEdit.bInside = TRUE
		else
			StatusEdit.bInside = FALSE
		end If	
	ElseIf code = 500 Then
		nYellowBanner = Var
	ElseIf code = 109 Then
		pos = QQStatus.left - QQNumber.left
		if(var = 0) then
			Window.ExeCommand 65,pos
		Else
			Window.ExeCommand 64,pos
		end If
	ElseIf code = 110 Then		
		SosoButton.toolTip = CStr(var)	
	        
	 ElseIf code = 112 then
		If (var = -1) Then
			SosoButton.width = 18
			SosoButton.label = ""
			SosoButton.toolTip = "进入问问首页"
		ElseIf(var = 0)Then
			SosoButton.visible = "true"
			SosoButton.width = 43
			SosoButton.label = CStr(var)
			SosoButton.toolTip = "进入问问首页"
		Else
			SosoButton.visible = "true"
			SosoButton.width = 43
			SosoButton.label = CStr(var)
		end if	
		AdjustStatuePanelSize()
	ElseIf code = 113 then
		If (var = 0) then
			SosoButton.visible = "false"
		Else
			SosoButton.visible = "true"
		end if	
		AdjustStatuePanelSize()
        ElseIf code = 114 Then 
             If (var = 1) Then
                 ImSearchPlugin.bInside = TRUE
               Else 
                  ImSearchPlugin.bInside = FALSE
               End If
        ElseIf code = 115 Then
          nSearchBanner = var
	ElseIf code = 116 then
		If (var = -1) Then
			QZoneMsgCenterButton.label = ""
		Else
			QZoneMsgCenterButton.label = CStr(var)
		end If
		AdjustStatuePanelSize()
	ElseIf code = 117 Then	
		MailButton.toolTip = ""
	End If	
End Sub

Sub MailButton_onGifStop()
	Window.ExeCommand 62,0
End Sub

Sub MailButton_onMouseMove(nX,nY)
	s = CStr(MailButton.Left) & "." & CStr(MailButton.Top) & "." & CStr(MailButton.width) & "." & CStr(MailButton.height)
	Window.ExeCommand 67,s
End Sub
Sub MailButton_onMouseLeave()
	Window.ExeCommand 68,0
End Sub



'在线时间代码开始
Sub Time_onStopRun()
        Time.Start
       tt = timer - starttime 
      if tt < 0 then
         tt = 86400 + tt
        end if
       if ct<>1 then
              OnlineTime1.visible=false
               OnlineTime.visible=true
              OnlineTime.value = "您已在线" & " " & CStr(tt\3600)& ":" & CStr((tt mod 3600)\60)& ":" & CStr(tt mod 60)
       end if
End Sub


'--------- 农历模块-------------
Function Show_Info(GetType, M_Move) 
    On Error Resume Next
        Dim ty, tm, td, yl, sx
        ty = Year(Now)
        tm = Month(Now)
        td = Day(Now)
        t = GetYLDate(ty, tm, td, yl, sx)
        OnlineDate.Value = yl & "(" & sx & ")年" & t
End Function

'tYear(年), tMonth(月), tDay(日), YLyear(农历), YLShuXing(生肖)
Function GetYLDate(tYear, tMonth, tDay, YLyear, YLShuXing)
    Dim ylData
    '农历常量(1899~2100，共202年）
    ylData = Array("AB500D2", "4BD0883", _
                "4AE00DB", "A5700D0", "54D0581", "D2600D8", "D9500CC", "655147D", "56A00D5", "9AD00CA", "55D027A", "4AE00D2", _
                "A5B0682", "A4D00DA", "D2500CE", "D25157E", "B5500D6", "56A00CC", "ADA027B", "95B00D3", "49717C9", "49B00DC", _
                "A4B00D0", "B4B0580", "6A500D8", "6D400CD", "AB5147C", "2B600D5", "95700CA", "52F027B", "49700D2", "6560682", _
                "D4A00D9", "EA500CE", "6A9157E", "5AD00D6", "2B600CC", "86E137C", "92E00D3", "C8D1783", "C9500DB", "D4A00D0", _
                "D8A167F", "B5500D7", "56A00CD", "A5B147D", "25D00D5", "92D00CA", "D2B027A", "A9500D2", "B550781", "6CA00D9", _
                "B5500CE", "535157F", "4DA00D6", "A5B00CB", "457037C", "52B00D4", "A9A0883", "E9500DA", "6AA00D0", "AEA0680", _
                "AB500D7", "4B600CD", "AAE047D", "A5700D5", "52600CA", "F260379", "D9500D1", "5B50782", "56A00D9", "96D00CE", _
                "4DD057F", "4AD00D7", "A4D00CB", "D4D047B", "D2500D3", "D550883", "B5400DA", "B6A00CF", "95A1680", "95B00D8", _
                "49B00CD", "A97047D", "A4B00D5", "B270ACA", "6A500DC", "6D400D1", "AF40681", "AB600D9", "93700CE", "4AF057F", _
                "49700D7", "64B00CC", "74A037B", "EA500D2", "6B50883", "5AC00DB", "AB600CF", "96D0580", "92E00D8", "C9600CD", _
                "D95047C", "D4A00D4", "DA500C9", "755027A", "56A00D1", "ABB0781", "25D00DA", "92D00CF", "CAB057E", "A9500D6", _
                "B4A00CB", "BAA047B", "B5500D2", "55D0983", "4BA00DB", "A5B00D0", "5171680", "52B00D8", "A9300CD", "795047D", _
                "6AA00D4", "AD500C9", "5B5027A", "4B600D2", "96E0681", "A4E00D9", "D2600CE", "EA6057E", "D5300D5", "5AA00CB", _
                "76A037B", "96D00D3", "4AB0B83", "4AD00DB", "A4D00D0", "D0B1680", "D2500D7", "D5200CC", "DD4057C", "B5A00D4", _
                "56D00C9", "55B027A", "49B00D2", "A570782", "A4B00D9", "AA500CE", "B25157E", "6D200D6", "ADA00CA", "4B6137B", _
                "93700D3", "49F08C9", "49700DB", "64B00D0", "68A1680", "EA500D7", "6AA00CC", "A6C147C", "AAE00D4", "92E00CA", _
                "D2E0379", "C9600D1", "D550781", "D4A00D9", "DA400CD", "5D5057E", "56A00D6", "A6C00CB", "55D047B", "52D00D3", _
                "A9B0883", "A9500DB", "B4A00CF", "B6A067F", "AD500D7", "55A00CD", "ABA047C", "A5A00D4", "52B00CA", "B27037A", _
                "69300D1", "7330781", "6AA00D9", "AD500CE", "4B5157E", "4B600D6", "A5700CB", "54E047C", "D1600D2", "E960882", _
                "D5200DA", "DAA00CF", "6AA167F", "56D00D7", "4AE00CD", "A9D047D", "A2D00D4", "D1500C9", "F250279", "D5200D1")
    Dim daList()
    Dim conDate, setDate
    Dim AddMonth, AddDay, AddYear, getDay
    Dim RunYue,i
    On Error Resume Next
    If tYear > 2100 Or tYear < 1900 Then Exit Function '如果不是有效有日期，退出
    '加载2年内的农历数据
    ReDim daList(tYear)
    daList(tYear - 1) = H2B(ylData(tYear - 1900))
    daList(tYear) = H2B(ylData(tYear - 1900 + 1))
    AddYear = tYear
    RunYue = False
    AddMonth = (Mid(daList(AddYear), 15, 2))
    AddDay = (Mid(daList(AddYear), 17, 2))
    conDate = DateSerial(AddYear, AddMonth, AddDay)
    setDate = DateSerial(tYear, tMonth, tDay)
    getDay = DateDiff("d", conDate, setDate)
    If getDay < 0 Then
        AddYear = AddYear - 1
        AddMonth = (Mid(daList(AddYear), 15, 2))
        AddDay = (Mid(daList(AddYear), 17, 2))
        conDate = DateSerial(AddYear, AddMonth, AddDay)
        setDate = DateSerial(tYear, tMonth, tDay)
        getDay = DateDiff("d", conDate, setDate)
    End If
    ' addday = NearDay
    AddDay = 1: AddMonth = 1
    For i = 1 To getDay
        AddDay = AddDay + 1
        If AddDay = 30 + Mid(daList(AddYear), AddMonth, 1) Or _
            (RunYueAndAddDay = 30 + Mid(daList(AddYear), 13, 1)) Then
            If RunYue = False And AddMonth = ("&H" & Mid(daList(AddYear), 14, 1)) Then
                RunYue = True
                Else
                RunYue = False
                AddMonth = AddMonth + 1
            End If
            AddDay = 1
        End If
    Next
    Dim md, dd, mm, tiangan, dizhi, shu
    md = "初一初二初三初四初五初六初七初八初九初十十一十二十三十四十五十六十七十八十九二十廿一廿二廿三廿四廿五廿六廿七廿八廿九三十 "
    dd = Mid(md, (AddDay - 1) * 2 + 1, 2)
    mm = Mid("正二三四五六七八九十寒腊", AddMonth, 1) + "月"
    YouGetDate = DateSerial(AddYear, AddMonth, AddDay)
    tiangan = "甲乙丙丁戊已庚辛壬癸"
    dizhi = "子丑寅卯辰巳午未申酉戌亥"
    Dim ganzhi(59)
    For i = 0 To 59
        ganzhi(i) = Mid(tiangan, (i Mod 10) + 1, 1) + Mid(dizhi, (iMod12) + 1, 1)
        'ff$ = ff$ + ganzhi(i)
    Next
    'MsgBox ff$, , Len(ff$)
    YLyear = ganzhi((AddYear - 4) Mod 60)
    shu = "鼠牛虎兔龙蛇马羊猴鸡狗猪"
    YLShuXing = Mid(shu, ((AddYear - 4) Mod 12) + 1, 1)
    If RunYue Then mm = "闰" + mm
    GetYLDate = mm + dd
End Function
'将压缩的阴历字符还原
Private Function H2B(ByVal strHex)
    Dim i, i1, tmpV
    Const hStr = "0123456789ABCDEF"
    Const bStr = "0000000100100011010001010110011110001001101010111100110111101111"
    tmpV = UCase(Left(strHex, 3))
    '十六进制转二进制
    For i = 1 To Len(tmpV)
        i1 = InStr(hStr, Mid(tmpV, i, 1))
        H2B = H2B & Mid(bStr, (i1 - 1) * 4 + 1, 4)
    Next
    H2B = H2B & Mid(strHex, 4, 2)
    '十六进制转十进制
    H2B = H2B & "0" & CStr(clng("&H" & Right(strHex, 2)))
End Function



