Dim mblnHideMenu
Dim mastrMenuItem(3)
Dim mablnHideMenu(3)
Dim mastrMenuHeader(3)
Dim mastrMenuTxtColor(3)
Dim mastrMenuBGColor(3)
Dim mastrFontHeader(3)
Dim mbytLevel
'------------------------------------------------------------------------------------------------------------------
	Sub ChangeColor(pstrHeadername, pstrTxtColor, pstrBGColor)
		document.all(pstrHeadername).style.color = pstrTxtColor
		document.all(pstrHeadername).style.backgroundColor = pstrBGColor
	End Sub
'------------------------------------------------------------------------------------------------------------------	
	Sub ChangeColorForLinkItem (pstrHeadername, pstrTxtColor, pstrBGColor, pstrFontName)		
		If Trim(pstrTxtColor) <> "" Then
			document.all(pstrFontName).style.color = pstrTxtColor
		Else
			document.all(pstrFontName).style.color = ""
		End If
		
		If Trim(pstrBGColor) <> "" Then
			document.all(pstrHeadername).style.backgroundColor = pstrBGColor
		Else
			document.all(pstrHeadername).style.backgroundColor = ""
		End If		
	End Sub		
'------------------------------------------------------------------------------------------------------------------
'pbytMenuLayoutType  0 - Vertical menu(sol dikey menu); 1 - horizontal menu(yatay menuler)
	Sub ShowMenu(pstrHeadername,pstrTxtColor, pstrBGColor, pstrMenuName, pbytMenuLayoutType, pbytMenuLevel)
	Dim intLeft, intTop, objMainMenu
    Dim objTable, objTR, objTD
		If (pbytMenuLevel = 2) AND (Trim(mastrMenuItem(pbytMenuLevel)) <> Trim(pstrMenuName)) Then
			Call  HideMenu2Later(2)
		End If
		mablnHideMenu(pbytMenuLevel) = false
		mastrMenuItem(pbytMenuLevel) = pstrMenuName
		mastrMenuHeader(pbytMenuLevel) = pstrHeadername		
		
		mastrMenuTxtColor(pbytMenuLevel) = document.all(pstrMenuName).style.color			'menu itemlerinin ilk yazı rengini tutar	
		mastrMenuBGColor(pbytMenuLevel) = document.all(pstrMenuName).style.backgroundColor	'menu itemlerinin ilk zemin rengini tutar	

		Call ChangeColor(pstrHeadername, pstrTxtColor, pstrBGColor)
		Set objMainMenu = document.all(pstrHeadername)
		Set objTD		= objMainMenu.parentElement
		Set objTR		= objTD.parentElement
		Set objTable	= objTR.parentElement.parentElement
		
		intLeft = document.all(pstrHeadername).offsetParent.offsetLeft + document.all(pstrHeadername).parentElement.offsetParent.offsetLeft
'		intTop	= objMainMenu.parentElement.offsetParent.offsetTop + document.all(pstrHeadername).offsetParent.offsetHeight +2
		intTop  = objTable.offsetParent.offsetTop + document.all(pstrHeadername).offsetParent.offsetHeight +2
		if pbytMenuLayoutType = 0 then			
			intLeft =  intLeft + document.all(pstrHeadername).offsetParent.offsetWidth
			intTop =  objMainMenu.parentElement.offsetParent.offsetTop + objMainMenu.offsetParent.offsetTop			
		end if
						
		document.all(pstrMenuName).style.left		= intLeft
		document.all(pstrMenuName).style.top		= intTop
		document.all(pstrMenuName).style.visibility = "visible"
		document.all(pstrMenuName).style.position	= "absolute"
		document.all(pstrMenuName).style.zIndex		= 5000
	End Sub
'------------------------------------------------------------------------------------------------------------------
	'pbytMenuLayoutType  0 - Vertical menu(sol dikey menu); 1 - horizontal menu(yatay menuler)
	Sub ShowMenuForLinkItem(pstrHeadername,pstrTxtColor,pstrBGColor,pstrMenuName,pbytMenuLayoutType,pbytMenuLevel,pstrFontName)
	Dim intLeft, intTop, objMainMenu
    Dim objTable, objTR, objTD
'		If (pbytMenuLevel = 2) AND (Trim(mastrMenuItem(pbytMenuLevel)) <> Trim(pstrMenuName)) Then
'			Call  HideMenu2Later(2)
'		End If
		If (Trim(mastrMenuItem(pbytMenuLevel)) <> Trim(pstrMenuName)) Then
			Call  HideMenu2Later(pbytMenuLevel)
		End If
		
		mablnHideMenu(pbytMenuLevel)   = false
		mastrMenuItem(pbytMenuLevel)   = pstrMenuName
		mastrMenuHeader(pbytMenuLevel) = pstrHeadername
		mastrFontHeader(pbytMenuLevel) = pstrFontName
		
		mastrMenuTxtColor(pbytMenuLevel) = document.all(pstrFontName).style.color			'menu itemlerinin ilk yazı rengini tutar	
		mastrMenuBGColor(pbytMenuLevel)  = document.all(pstrMenuName).style.backgroundColor	'menu itemlerinin ilk zemin rengini tutar	

		Call ChangeColorForLinkItem (pstrHeadername, pstrTxtColor, pstrBGColor, pstrFontName)
		Set objMainMenu = document.all(pstrHeadername)
		Set objTD = objMainMenu.parentElement
		Set objTR = objTD.parentElement
		Set objTable = objTR.parentElement.parentElement
		
		intLeft = document.all(pstrHeadername).offsetParent.offsetLeft + document.all(pstrHeadername).parentElement.offsetParent.offsetLeft
		intTop = objMainMenu.parentElement.offsetParent.offsetTop + document.all(pstrHeadername).offsetParent.offsetHeight +2		
		if pbytMenuLayoutType = 0 then			
			intLeft =  intLeft + document.all(pstrHeadername).offsetParent.offsetWidth
			intTop =  objMainMenu.parentElement.offsetParent.offsetTop + objMainMenu.offsetParent.offsetTop			
		end if
		
'		Sağ tarafa konulan menülerin alt menüleri açıldığında ekran dışında 
'		görünmesini engellemek için yapılan kontrol.
		if (intLeft + document.all(pstrMenuName).offsetWidth) > window.screen.availWidth then
			intLeft = intLeft - document.all(pstrMenuName).offsetWidth - document.all(pstrHeadername).offsetWidth
		end if
		
		document.all(pstrMenuName).style.position	= "absolute"
		document.all(pstrMenuName).style.zIndex		= 5000
		document.all(pstrMenuName).style.left		= intLeft
		document.all(pstrMenuName).style.top		= intTop
		document.all(pstrMenuName).style.visibility = "visible"		
		
	End Sub
'------------------------------------------------------------------------------------------------------------------	
	Sub HideMenu(pbytMenuLevel)
		mablnHideMenu(pbytMenuLevel) = True
		document.all(mastrMenuHeader(pbytMenuLevel)).style.color = mastrMenuTxtColor(pbytMenuLevel)			'menu itemlerinin ilk yazı geri verir
		document.all(mastrMenuHeader(pbytMenuLevel)).style.backgroundColor = mastrMenuBGColor(pbytMenuLevel)	'menu itemlerinin ilk zemin geri verir
		if pbytMenuLevel = 3 then mablnHideMenu(2) = True
		Call setTimeout("Call HideMenu2Later(" & pbytMenuLevel & ")", 100)
	End Sub
'------------------------------------------------------------------------------------------------------------------
	Sub HideMenuForLinkItem (pbytMenuLevel)
		mablnHideMenu(pbytMenuLevel) = True
		if (Trim(mastrMenuTxtColor(pbytMenuLevel)) <> "") then
			document.all(mastrFontHeader(pbytMenuLevel)).style.color = mastrMenuTxtColor(pbytMenuLevel)			'menu itemlerinin ilk yazı geri verir
		else
			document.all(mastrFontHeader(pbytMenuLevel)).style.color = ""
		end if
		
		if (Trim(mastrMenuBGColor(pbytMenuLevel)) <> "") then
			document.all(mastrMenuHeader(pbytMenuLevel)).style.backgroundColor = mastrMenuBGColor(pbytMenuLevel)	'menu itemlerinin ilk zemin geri verir
		else
			document.all(mastrMenuHeader(pbytMenuLevel)).style.backgroundColor = ""
		end if
		
		if pbytMenuLevel = 3 then mablnHideMenu(2) = True
		Call setTimeout("Call HideMenu2Later(" & pbytMenuLevel & ")", 100)
	End Sub
'------------------------------------------------------------------------------------------------------------------
	Sub HideMenu2Later(pbytMenuLevel)
	Dim intCntr		
		if mablnHideMenu(pbytMenuLevel) = True Then			
			document.all(mastrMenuItem(pbytMenuLevel)).style.visibility = "hidden"
		end if
		
		if pbytMenuLevel = 3 then 
			if mablnHideMenu(2) = True Then
				document.all(mastrMenuItem(2)).style.visibility = "hidden"
			end if
		end if		
	End Sub
'------------------------------------------------------------------------------------------------------------------
'pbytMenuLayoutType  0 - Vertical menu(sol dikey menu); 1 - horizontal menu(yatay menuler)
	Sub ShowMe(pstrMenuName, pbytLevel)
	Dim intLeft, intTop, objMainMenu
		mablnHideMenu(pbytLevel) = false
		if pbytLevel = 3 then mablnHideMenu(2) = false
		mastrMenuItem(pbytMenuLevel) = pstrMenuName
		document.all(pstrMenuName).style.visibility = "visible"
	end Sub
'------------------------------------------------------------------------------------------------------------------
	Sub WriteResult(pstrText)
		document.pageMenu.txtResult.value = pstrText & Chr(13) & document.pageMenu.txtResult.value 	
	End Sub 
'------------------------------------------------------------------------------------------------------------------
	Sub OpenRelWindowWithStatus(pstrUrl, pstrWindowName, pintHeight, pintWidth, pbytScrool, pbytResizable, pbytFuncButton)
	Dim strFeature
	Dim intWidth, intHeight
		if (pintWidth = -1) Then
			pintWidth = screen.availWidth - (screen.availWidth / 5)
		end if
		if (pintHeight = -1) Then
			pintHeight = screen.availHeight - (screen.availHeight / 5)
		end if

		intLeft = (screen.availWidth - pintWidth) / 2
		intTop = (screen.availHeight - pintHeight) / 2
		strFeature = "left=" & intLeft & ",top=" & intTop & ",width=" & pintWidth & ",height=" & pintHeight & ", scrollbars = " & pbytScrool & ", resizable = " & pbytResizable
		if (CInt(pbytFuncButton) = 1) then
			strFeature = strFeature & ",toolbar=yes,menubar=yes,location=no"
		end if
		Set wndOpenRelatedWindow = window.open(pstrURL, pstrWindowName, strFeature)
		wndOpenRelatedWindow.Focus		
	End  Sub
	'------------------------------------------------------------------------------------------------------------------
	Sub OpenRelWindowWithStatus_ForSurvey(pstrUrl, pstrWindowName, pintHeight, pintWidth, pbytScrool, pbytResizable, pbytFuncButton)
	Dim strFeature
	Dim intWidth, intHeight
		if (pintWidth = -1) Then
			pintWidth = screen.availWidth - (screen.availWidth / 3)
		end if
		if (pintHeight = -1) Then
			pintHeight = screen.availHeight - (screen.availHeight / 2)
		end if

		intLeft = (screen.availWidth - pintWidth) / 2
		intTop = (screen.availHeight - pintHeight) / 2
		strFeature = "left=" & intLeft & ",top=" & intTop & ",width=" & pintWidth & ",height=" & pintHeight & ", scrollbars = " & pbytScrool & ", resizable = " & pbytResizable
		if (CInt(pbytFuncButton) = 1) then
			strFeature = strFeature & ",toolbar=yes,menubar=yes,location=no"
		end if
		Set wndOpenRelatedWindow = window.open(pstrURL, pstrWindowName, strFeature)
		wndOpenRelatedWindow.Focus		
	End  Sub
'------------------------------------------------------------------------------------------------------------------
	Function CheckIsNumber()
		If window.event.keyCode < 48 or window.event.keyCode > 59 Then window.event.keyCode = 0
	End Function
