
//#############################################################################
//#############################################################################
//#############################################################################
// KEYS

var TagOpen = "&lt;"
var TagClose = "&gt;"

var KeyBack = 8
var KeyTab = 9
var KeyEnter = 13
var KeyShift = 16
var KeyCtrl = 17
var KeyAlt = 18
var KeyPause = 19
var KeyEscape = 27
var KeySpace = 32
var KeyPageUp = 33
var KeyPageDown = 34
var KeyEnd = 35
var KeyHome = 36
var KeyLeft = 37
var KeyUp = 38
var KeyRight = 39
var KeyDown = 40
var KeyInsert = 45
var KeyDelete = 46
var KeyF1 = 112
var KeyF2 = 113
var KeyF3 = 114
var KeyF4 = 115
var KeyF5 = 116
var KeyF6 = 117
var KeyF7 = 118
var KeyF8 = 119
var KeyF9 = 120
var KeyF10 = 121
var KeyF11 = 122
var KeyF12 = 123
var KeyScroll = 145
var KeyAdd = 187
var KeyMinus = 189

//#############################################################################
//#############################################################################
//#############################################################################
// BROWSER

function IsIE() {
    return (window.navigator.userAgent.toLowerCase().indexOf("msie") != -1)
}
function IsFirefox() {
    return (window.navigator.userAgent.toLowerCase().indexOf("firefox") != -1)
}
function IsSafari() {
    return (window.navigator.userAgent.toLowerCase().indexOf("safari") != -1)
}

//#############################################################################
//#############################################################################
//#############################################################################
// DOM

function GetFrame(sName,oWindow) {
    if (typeof(sName) == "object") return sName
    sName= ToString(sName)
	oWindow = oWindow || window
	if ((oWindow.frames != null) && (oWindow.frames[sName] != null)) {
	    return oWindow.frames[sName]
	} else {
	    return oWindow.document.getElementById(sName)
	}
}
function GetFrameDocument(oFrame,oWindow) {
	oFrame = GetFrame(oFrame,oWindow)
	var doc = oFrame.contentDocument || oFrame.document
	return doc
}
function GetElement2(sName,oWindow) {
	if (typeof(sName) == "object") return sName
    return document.getElementById(sName) 
}
function GetElement(sName,oWindow) {
	if (typeof(sName) == "object") return sName
	sName= ToString(sName)
    oWindow = oWindow || window
    var oDocument = oWindow.contentDocument || oWindow.document || oWindow
    if ((oDocument.forms.length > 0) && (oDocument.forms[0].name == "aspnetForm")) {
        //try find contol
        return FindElement(sName,oWindow)
    } else {
        //try forms direct
        for (var i=0;i<oWindow.document.forms.length;i++) {
            var ct = oWindow.document.forms[i][sName]
            if (ct != null) return ct
        }
        //try ids direct
        var ct = oDocument.getElementById(sName)
        if ((ct != null) && (ct.id != null) && (ct.id.toLowerCase() == sName.toLowerCase())) return ct
        if ((ct != null) && (ct.name != null) && (ct.name.toLowerCase() == sName.toLowerCase())) return ct
        var ct = oDocument.getElementsByName(sName)
        if ((ct != null) && (ct.name != null) && (ct.name.toLowerCase() == sName.toLowerCase())) return ct
        if ((ct != null) && (ct.length != null) && (ct.length != 0)) return ct
    }
}
var ElementPrefix = null
function FindElement(sName,oWindow) {
    oWindow = oWindow || window
    //try forms direct
    for (var i=0;i<oWindow.document.forms.length;i++) {
        var ct = oWindow.document.forms[i][sName]
        if (ct != null) return ct
    }
    //try ids direct
    var ct = oWindow.document.getElementById(sName)
    if ((ct != null) && (ct.id != null) && (ct.id.toLowerCase() == sName.toLowerCase())) return ct
    if ((ct != null) && (ct.name != null) && (ct.name.toLowerCase() == sName.toLowerCase())) return ct
    var ct = oWindow.document.getElementsByName(sName)
    if ((ct != null) && (ct.name != null) && (ct.name.toLowerCase() == sName.toLowerCase())) return ct
    if ((ct != null) && (ct.length != null) && (ct.length != 0)) return ct
    //get prefixes
    if (ElementPrefix == null) {
        ElementPrefix = new Array()
        for (var ii=0;ii<oWindow.document.forms.length;ii++) {
            var All = oWindow.document.forms[ii].elements
            for (var i=0;i<All.length;i++) {
                var ct = All[i] 
                var Name = (ct.name || "") + ""
                var ar = Name.split("$")
                if (ar.length > 1) {
                    ar.pop()
                    var p = ar.join("$")
                    var b = false
                    for (var j=0;j<ElementPrefix.length;j++) { 
                        if (ElementPrefix[j].toLowerCase() == p.toLowerCase()) { b = true; break }
                    }
                    if (b == false) ElementPrefix[ElementPrefix.length] = p
                }
            }   
        }
        var All = (oWindow.document.all) ? oWindow.document.all : oWindow.document.getElementsByTagName("*")
        for (var i=0;i<All.length;i++) {
            var ct = All[i] 
            var Name = (ct.name || "") + ""
            var ar = Name.split("$")
            if (ar.length > 1) {
                ar.pop()
                var p = ar.join("_")
                var b = false
                for (var j=0;j<ElementPrefix.length;j++) { 
                    if (ElementPrefix[j].toLowerCase() == p.toLowerCase()) { b = true; break }
                }
                if (b == false) ElementPrefix[ElementPrefix.length] = p
            }
        }   
    }    
    //try forms
    for (var ii=0;ii<oWindow.document.forms.length;ii++) {
        for (var i=0;i<ElementPrefix.length;i++) {
            var n = ElementPrefix[i] + "$" + sName
            var ct = oWindow.document.forms[ii][n]
            if ((ct != null) && (ct.name != null)) return ct
            if ((ct != null) && (ct.length != null) && (ct.length != 0)) return ct
        }
    }
    //try ids
    for (var i=0;i<ElementPrefix.length;i++) {
        var n = ElementPrefix[i] + "_" + sName
        var ct = oWindow.document.getElementById(n)
        if ((ct != null) && (ct.id != null)) return ct
    }
    //try forms simple
    for (var ii=0;ii<oWindow.document.forms.length;ii++) {
        var All = oWindow.document.forms[ii].elements
        for (var i=0;i<All.length;i++) {
            var ct = All[i] 
            var n = (ct.name || "") + ""
            if ((n != "") && (n.substring(n.length-sName.length - 1).toLowerCase() == ("$" + sName.toLowerCase()))) {
                return oWindow.document.forms[ii][n] || ct
            }    
        }
    }
    //try ids simple
    var All = (oWindow.document.all) ? oWindow.document.all : oWindow.document.getElementsByTagName("*")
    for (var i=0;i<All.length;i++) {
        var ct = All[i] 
        var n = (ct.id || "") + ""
        if ((n != "") && (n.substring(n.length-sName.length - 1).toLowerCase() == ("_" + sName.toLowerCase()))) {
            return ct
        }    
    }
    return null
}
function AttachEvent(oControl,sName,oFunction) {
	oControl = GetElement(oControl)
	sName = ToString(sName).toLowerCase()
	if (sName.indexOf("on") == 0) sName = sName.replace("on","")
	if (oControl.attachEvent != null) {
        oControl.attachEvent("on" + sName,oFunction)
	} else if (oControl.addEventListener != null) {
        oControl.addEventListener(sName,oFunction,true)
	}    
}
function DetachEvent(oControl,sName,oFunction) {
	oControl = GetElement(oControl)
	sName = ToString(sName).toLowerCase()
	sName = sName.replace("on","")
	if (oControl.detachEvent != null) {
        oControl.detachEvent("on" + sName,oFunction)
	} else if (oControl.removeEventListener != null) {
        oControl.removeEventListener(sName,oFunction,false)
	}	    
}
function GetEvent(oEvent,oWindow) {
    oWindow = oWindow || window
    var oEvent = oEvent || oWindow.event
    return oEvent
}
function GetEventKeyCode(oEvent,oWindow) {
	var oEvent = GetEvent(oEvent,oWindow)
	if ((oEvent.which != null) && (parseInt(oEvent.which) > 0)) return parseInt(oEvent.which)
	return oEvent.keyCode
}
function GetEventCtrlKey(oEvent,oWindow) {
	var oEvent = GetEvent(oEvent,oWindow)
	return oEvent.ctrlKey
}
function GetEventShiftKey(oEvent,oWindow) {
	var oEvent = GetEvent(oEvent,oWindow)
	return oEvent.shiftKey
}
function GetEventTagName(oEvent,oWindow) {
	var oEvent = GetEvent(oEvent,oWindow)
	var oTarget = oEvent.target || oEvent.srcElement
	return oTarget.tagName
}
function GetEventElement(oEvent,oWindow) {
	var oEvent = GetEvent(oEvent,oWindow)
	var oTarget = oEvent.target || oEvent.srcElement
	return oTarget
}
function GetEventID(oEvent,oWindow) {
	var oEvent = GetEvent(oEvent,oWindow)
	var oTarget = oEvent.target || oEvent.srcElement
	return oTarget.id
}
function GetElementValue(oElement,oWindow) {
    oElement = GetElement(oElement,oWindow)
    return oElement.value
}
function GetElementLeft(oElement) {
    oElement = GetElement(oElement)
    if ((oElement == null) || ((oElement.offsetWidth || 0) <= 0)) return 0 //offsetWidth!!!: FF=0 and IE=-1
    var c = 0
    while (oElement != null) {
        if ((oElement.offsetLeft != null) && (oElement.offsetLeft > 0)) c += oElement.offsetLeft
        oElement = oElement.offsetParent
    }
    return c
}
function GetElementRight(oElement) {
    oElement = GetElement(oElement)
    return GetElementLeft(oElement) + GetElementWidth(oElement)
}
function GetElementTop(oElement) {
    oElement = GetElement(oElement)
    if ((oElement == null) || ((oElement.offsetWidth || 0) <= 0)) return 0 //offsetWidth!!!: FF=0 and IE=-1
    var c = 0
    while (oElement != null) {
        if ((oElement.offsetTop != null) && (oElement.offsetTop > 0)) c += oElement.offsetTop
        oElement = oElement.offsetParent
    }
    return c
}
function GetElementBottom(oElement) {
    oElement = GetElement(oElement)
    return GetElementTop(oElement) + GetElementHeight(oElement)
}
function GetElementWidth(oElement) {
    oElement = GetElement(oElement)
    if ((oElement == null) || ((oElement.offsetWidth || 0) <= 0)) return 0 //FF=0 and IE=-1
	return oElement.offsetWidth
}
function GetElementHeight(oElement) {
    oElement = GetElement(oElement)
    if ((oElement == null) || ((oElement.offsetHeight || 0) <= 0)) return 0 //FF=0 and IE=-1
	return oElement.offsetHeight
}
function CallClick(oElement) {
    oElement = GetElement(oElement)
	if (oElement.click) {
        oElement.click()
        return true
	} else if (oElement.onclick) {
        var b = oElement.onclick()
        if ((b != false) && (oElement.href != null) && (oElement.href != "")) {
            if (oElement.href.indexOf("javascript:") == 0) {
                eval(oElement.href.replace("javascript:",""))
            } else {
                window.location.href = oElement.href
            }
        }
        return true
	} else {
	    return false
	}	
}
function CallFocus(oElement) {
    oElement = GetElement(oElement)
    if (oElement == null) return
	if (oElement.focus) {
        oElement.focus()
        return true
	} else if (oElement.onfocus) {
        oElement.onfocus()
        return true
	} else {
	    return false
	}	
}
function CallBlur(oElement) {
    oElement = GetElement(oElement)
    if (oElement == null) return
	if (oElement.blur) {
        oElement.blur()
        return true
	} else if (oElement.onblur) {
        oElement.onblur()
        return true
	} else {
	    return false
	}	
}
function CallSelect(oElement) {
    oElement = GetElement(oElement)
    if (oElement == null) return
	if (oElement.select) {
        oElement.select()
        return true
	} else if (oElement.onselect) {
        oElement.onselect()
        return true
	} else {
	    return false
	}	
}
function GetAttribute(oElement,sAttr) {
	oElement = GetElement(oElement)
    sAttr = ToString(sAttr)
    if ((sAttr.toLowerCase() == "class".toLowerCase()) && (IsIE() == true)) sAttr = "className"
    if ((sAttr.toLowerCase() == "className".toLowerCase()) && (IsIE() == false)) sAttr = "class"
    if (oElement.getAttribute == null) return ""
    return ToString(oElement.getAttribute(sAttr))
}
function SetAttribute(oElement,sAttr,sValue) {
	oElement = GetElement(oElement)
    sAttr = ToString(sAttr)
    sValue = ToString(sValue)
    if ((sAttr.toLowerCase() == "class".toLowerCase()) && (IsIE() == true)) sAttr = "className"
    if ((sAttr.toLowerCase() == "className".toLowerCase()) && (IsIE() == false)) sAttr = "class"
    if (sValue == "") {
        if (IsIE() == true) {
            oElement.removeAttribute(sAttr)
        } else {
            oElement.removeAttribute(sAttr)
            if (oElement.attributes.getNamedItem(sAttr) != null) oElement.attributes.removeNamedItem(sAttr)
        }
    } else {
        oElement.setAttribute(sAttr,sValue)        
    }    
}
function GetActiveElement(oEvent,oWindow) {
    oWindow = oWindow || window
    oEvent = GetEvent(oEvent,oWindow)
    if (oWindow.document.activeElement != null) {
        return oWindow.document.activeElement
    } else if ((oEvent != null) && (oEvent.explicitOriginalTarget != null)) {
        return oEvent.explicitOriginalTarget
    } else if ((oEvent != null) && (oEvent.srcElement != null)) {
        return oEvent.srcElement
    }
}

//#############################################################################
//#############################################################################
//#############################################################################
// PROP

function Props(oObject) {
    var s = ""
    for (p in oObject) {
        try {
            s += p + " "
        } catch(e) { }    
    }    
    return s
}
function PropValues(oObject) {
    var s = ""
    for (p in oObject) {
        try {
            s += p + "=" + oObject[p] + " "
        } catch(e) { }    
    }    
    return s
}

//#############################################################################
//#############################################################################
//#############################################################################
// STRING

//typeof=number,string,boolean,object,function,undefined
function ToString(s,Default) {
    // cast to string
    if (Default == null) Default = ""
    if (s == null) return Default    
    if (typeof(s) == "string") return s
    if (typeof(s) == "boolean") return (s + "")
    if (typeof(s) == "number") return (s + "") 
    if ((typeof(s) == "object") && (s.getDate != null)) return (s + "")
    if (typeof(s) == "object") return Default
    if (typeof(s) == "undefined") return Default
    if (typeof(s) == "function") return Default
}
function ToBoolean(b,Default) {
    // cast to boolean
    if (Default == null) Default = false
    if (b == null) return Default
    if (typeof(b) == "string") return (ListFind("true|yes|on|active|1|-1",b) == true)
    if (typeof(b) == "boolean") return b
    if (typeof(b) == "number") return (parseInt(parseFloat(b)) == 0)
    if (typeof(b) == "object") return Default
    if (typeof(b) == "undefined") return Default
    if (typeof(b) == "function") return Default
}
function ToDouble(d,Default) {
    // cast to double
    if (Default == null) Default = 0
    if (d == null) return Default
    if (typeof(d) == "string") return (parseFloat(d) || Default)
    if (typeof(d) == "boolean") return ((d == true) ? 1 : 0)
    if (typeof(d) == "number") return d
    if (typeof(d) == "object") return Default
    if (typeof(d) == "undefined") return Default
    if (typeof(d) == "function") return Default
}
function ToInteger(i,Default) {
    // cast to integer
    if (Default == null) Default = 0
    if (i == null) return Default
    if (typeof(i) == "string") return (parseInt(parseFloat(i)) || Default)
    if (typeof(i) == "boolean") return ((i == true) ? 1 : 0)
    if (typeof(i) == "number") return (parseInt(i) || Default)
    if (typeof(i) == "object") return Default
    if (typeof(i) == "undefined") return Default
    if (typeof(i) == "function") return Default
}
function ToDate(t,Default) {
    // cast to date
    if (Default == null) Default = new Date()
    if (t == null) return Default
    if (typeof(t) == "string") { 
        var d = new Date(t)
        if ((isNaN(d) == false) && (d.getDate != null)) return d
        return Default 
    }
    if (typeof(t) == "boolean") return Default
    if (typeof(t) == "number") return Default
    if (typeof(t) == "undefined") return Default
    if (typeof(t) == "object") return ((t.getDate != null) ? t : Default)
    if (typeof(t) == "function") return Default
}
function Trim(s,ch) {
    // space trimming
    s = ToString(s)
    ch = ToString(ch," ")
	while ((s.length > 0) && (s.charAt(0) == ch)) s = s.substring(1,s.length)
	while ((s.length > 0) && (s.charAt(s.length-1) == ch)) s = s.substring(0,s.length-1) 
	return s
}
function LTrim(s,ch) {
    // left space trimming
    s = ToString(s)
    ch = ToString(ch," ")
	while ((s.length > 0) && (s.charAt(0) == ch)) s = s.substring(1,s.length)
	return s
}
function RTrim(s,ch) {
    // right space trimming
    s = ToString(s)
    ch = ToString(ch," ")
	while ((s.length > 0) && (s.charAt(s.length-1) == ch)) s = s.substring(0,s.length-1) 
	return s
}
function Left(s, iLength) { 
	s = ToString(s)
	return s.substring(0, iLength)
}
function Right(s, iLength) { 
	s = ToString(s)
	return s.substring(s.length-iLength, s.length)
}
function Space(iLength,sSpace) {
    iLength = iLength || 1
    sSpace = ToString(sSpace) || " "
    var s = ""; for (var i=1;i<=iLength;i++) s += sSpace
    return s
}
function NonBreaking(s) {  
	s = ToString(s)
	while (s.indexOf(" ") != -1) s = s.replace(" ","&nbsp;")
	while (s.indexOf("-") != -1) s = s.replace("-","<s>&nbsp;</s>")
	return s
}
function Compare(s,t,bTextCompare,bTrim) {
	s = ToString(s)
	t = ToString(t)
    bTextCompare = bTextCompare || false
    if (bTrim == true) {
        s = Trim(s)
        t = Trim(t)
    }
	if (bTextCompare == true) {
		var ss = s.toUpperCase()
		var tt = t.toUpperCase()
		return ss == tt
	} else {
		return s == t	
	}
}
function InStr(s,sFind,bTextCompare,iStart) {
    // returns 1 base position 
	s = ToString(s)
	sFind = ToString(sFind)
	iStart = iStart || 0
	if (bTextCompare == true) {
		var ss = s.toUpperCase()
		var tt = sFind.toUpperCase()
		return (ss.indexOf(tt,iStart) + 1)		
	} else {
		return (s.indexOf(sFind,iStart) + 1)	
	}
}
function Find(s,sFind,bTextCompare,iStart) { 
    // returns 0 base position 
	s = ToString(s)
	sFind = ToString(sFind)
	iStart = iStart || 0
	if (bTextCompare == true) {
		var ss = s.toUpperCase()
		var tt = sFind.toUpperCase()
		return ss.indexOf(tt,iStart)
	} else {
		return s.indexOf(sFind,iStart)
	}
}
function Replace(s,sFind,sReplace,bTextCompare,iCount,iStart) {
    s = ToString(s); if (s == "") return s
	sFind = ToString(sFind); if (sFind == "") return s
	sReplace = ToString(sReplace)
	bTextCompare = bTextCompare || false
	iCount = iCount || -1
	iStart = iStart || 0
	if (sFind == sReplace) return s
	if (bTextCompare == true) {
		var ss = s.toUpperCase()
		var ff = sFind.toUpperCase()
		var q = iStart
		var c = 0 
		var i = (sReplace.indexOf(ff) != -1) ? sReplace.length : 0 
		while (true) {
			c++
			q = ss.indexOf(ff, q)
			if (q == -1) { break }
			s = s.substring(0, q) + sReplace + s.substring(q + sFind.length, s.length) 				
			ss = ss.substring(0, q) + sReplace + ss.substring(q + ff.length, ss.length) 				
			q += i
			if (iCount == c) break
		}
	} else {
		var q = iStart
		var c = 0
		var i = (sReplace.indexOf(sFind) != -1) ? sReplace.length : 0 
		while (true) {
			c++
			q = s.indexOf(sFind, q)
			if (q == -1) { break }
			s = s.substring(0, q) + sReplace + s.substring(q + sFind.length, s.length) 				
			q += i
			if (iCount == c) break
		}
	}
	return s
}
function Split(s,sSign,iCount,bTextCompare) {
	s = ToString(s)
	sSign = ToString(sSign)
	iCount = iCount || -1
	bTextCompare = bTextCompare || false
	var ar = new Array()
	if (bTextCompare == true) {
		s += sSign
		var ss = s.toUpperCase()
		var tt = sSign.toUpperCase()
		var a = 0
		var c = 0
		while (true) {
			var b = ss.indexOf(tt, a)
			if (b == -1) break
			c++
			if (iCount == c) {
				ar[ar.length] = s.substring(a,s.length-sSign.length)
				break
			}	
			ar[ar.length] = s.substring(a,b)
			a = b + ((sSign.length > 0) ? sSign.length : 1)
		}
	} else {
		s += sSign
		var a = 0
		var c = 0
		while (true) {
			var b = s.indexOf(sSign, a)
			if (b == -1) break
			c++
			if (iCount == c) {
				ar[ar.length] = s.substring(a,s.length-sSign.length)
				break			
			}	
			ar[ar.length] = s.substring(a,b)
			a = b + ((sSign.length > 0) ? sSign.length : 1)
		}
	}
	return ar
}
function SplitQuick(s,sSign) {
    // quick split
	s = ToString(s)
	sSign = ToString(sSign)
	if (s == "") return new Array()
    if (sSign == "") return new Array()
    return s.split(sSign)
}
function Join(ar,sSign) {
    sSign = ToString(sSign)
	return ar.join(sSign) 
}
function Thousand(s) {
    s = ToString(s)
    if (s.length <= 3) return s
    if (s.length <= 6) return s.substring(0,s.length-3) + "." + s.substring(s.length-3)
    return s.substring(0,s.length-6) + "." + s.substring(s.length-6,s.length-3) + "." + s.substring(s.length-3)
}
function Asc(sChar) {
    sChar = ToString(sChar)
	return sChar.charCodeAt(0)
}
function Chr(iCharCode) {
    iCharCode = iCharCode || 32
	return String.fromCharCode(iCharCode)
}
function GetHTMLEncode(s) {
    s = ToString(s)
	s = Replace(s,"&","&amp;")
	s = Replace(s,"<","&lt;")
	s = Replace(s,">","&gt;")
    return s
}
function GetHTMLExtendedEncode(s) {
    s = ToString(s)
    for (var i=0;(i<s.length)&&(i<100000);i++) {
		var c = s.charCodeAt(i)
		if (c > 127) {
			s = s.substring(0,i) + ("&#" + c + ";") + s.substring(i+1,s.length)
			i += (("&#" + c + ";").length - 1)
		}	
    }
    return s    
}
function Break(s,count,br) {
    s = ToString(s)
    count = count || 60
	br = br || "<br>"
	var t = s.split("")
	for (var i=count;i<t.length;i+=count) t[i] += br 
	var u = t.join("")
	return u
}
function ListFind(sList,sItem,sSeparator) {
    sList = ToString(sList)
    sItem = ToString(sItem)
    sSeparator = sSeparator || "|"
    var ar = SplitQuick(sItem,sSeparator)
    for (var i=0;i<ar.length;i++) {
        if (InStr(sSeparator + sList + sSeparator,sSeparator + ar[i] + sSeparator,true) != 0) return true
    }
    return (InStr(sSeparator + sList + sSeparator,sSeparator + sItem + sSeparator,true) != 0)
}
function ListAdd(sList,sItem,sSeparator) {
    sList = ToString(sList)
    sItem = ToString(sItem)
    sSeparator = sSeparator || "|"
    sList += (((sList != "") && (sItem != "")) ? sSeparator : "") + sItem
    return sList
}
function ListDelete(sList,sItem,sSeparator) {
    sList = ToString(sList)
    sItem = ToString(sItem)
    sSeparator = sSeparator || "|"
    var ar = SplitQuick(sList,sSeparator)
    sList = ""
    for (var i=0;i<ar.length;i++) {
        if (Compare(ar[i],sItem,true) == false) sList = ListAdd(sList,ar[i],sSeparator)
    }
    return sList
}
function RangePosition(s,sStart,sEnd,iStart) {
	s = ToString(s)
	sStart = ToString(sStart)
	sEnd = ToString(sEnd)
	iStart = iStart || 0
	var ss = s.toUpperCase()
	var a = ss.indexOf(sStart.toUpperCase(),iStart)
	if (a == -1) return -1
	var b = a + sStart.length
	var c = ss.indexOf(sEnd.toUpperCase(),b)
	return a
}
function RangeValue(s,sStart,sEnd,iStart) {
	s = ToString(s)
	sStart = ToString(sStart)
	sEnd = ToString(sEnd)
	iStart = iStart || 0
	var ss = s.toUpperCase()
	var a = ss.indexOf(sStart.toUpperCase(),iStart)
	if (a == -1) return ""
	var b = a + sStart.length
	var c = ss.indexOf(sEnd.toUpperCase(),b)
	if (c == -1) return ""
	return s.substring(b,c)    
}
function RangeReplace(s,sStart,sEnd,sReplace,iStart) {
	s = ToString(s)
	sStart = ToString(sStart)
	sEnd = ToString(sEnd)
	sReplace = ToString(sReplace)
	iStart = iStart || 0
	var ss = s.toUpperCase()
	var a = ss.indexOf(sStart.toUpperCase(),iStart)
	if (a == -1) return s
	var b = a + sStart.length
	var c = ss.indexOf(sEnd.toUpperCase(),b)
	if (c == -1) return s
	var d = c + sEnd.length
	return s.substring(0,a) + sReplace + s.substring(d,s.length)    
}
function HTMLToText(s, bNewLine) { 
    s = ToString(s)
    bNewLine = bNewLine || true
    s = Replace(s,"\n","") 
    s = Replace(s,"<tr>",(bNewLine == true) ? "\n" : " ",true) 
    s = Replace(s,"<td>"," ",true) 
    s = Replace(s,"<br>",(bNewLine == true) ? "\n" : " ",true) 
    s = Replace(s,"<p>",(bNewLine == true) ? "\n\n" : " ",true) 
    while (true) {
        var a = s.indexOf("<"); if (a == -1) break
        var b = s.indexOf(">",a); if (b == -1) break 
        s = s.substring(0,a) + s.substring(b+1,s.length) 
    }
    while (s.indexOf("\n ") != -1) s = s.replace("\n ","\n")
    while (s.indexOf(" \n") != -1) s = s.replace(" \n","\n")
    s = Replace(s,"  "," ") 
    s = Replace(s,"&lt;","<") 
    s = Replace(s,"&gt;",">") 
    s = Replace(s,"&nbsp;"," ") 
    return s
}
function GetNameValue(sList,sName,sMaster,sDetail) {
    sList = ToString(sList)
    sName = ToString(sName)
    sMaster = ToString(sMaster) || "|"
    sDetail = ToString(sDetail) || "="
    var ar = SplitQuick(sList,sMaster)
    for (var i=0;i<ar.length;i++) {
        var ar2 = Split(ar[i],sDetail,2,true)
        if (Compare(ar2[0],sName,true,true) == true) return ToString(ar2[1]) 
    }
}
function SetNameValue(sList,sName,sValue,sMaster,sDetail) {
    sList = ToString(sList)
    sName = ToString(sName)
    sMaster = ToString(sMaster) || "|"
    sDetail = ToString(sDetail) || "="
    var ar = SplitQuick(sList,sMaster)
    for (var i=0;i<ar.length;i++) {
        var ar2 = Split(ar[i],sDetail,2,true)
        if (Compare(ar2[0],sName,true,true) == true) ar2[1] = sValue
    }
    return Join(ar,sMaster)
}
function GetNoCacheMeta() {
    var s = ""
	s += "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n"
    s += "<meta http-equiv=\"expires\" content=\"0\">\n"
    s += "<meta http-equiv=\"pragma\" content=\"no-cache\">\n"
    return s
}
function CurrentHrefInfo(){
    var loc = ToString(window.location.href)
    return loc
} 
function CurrentHref(){
    var loc = ToString(window.location.href)
    loc = loc.split("#")[0]
    return loc
} 
function CurrentURL(){
    var loc = ToString(window.location.href)
    loc = loc.split("?")[0]
    return loc
} 
function CurrentURLPath(){
    var loc = ToString(window.location.href)
    loc = loc.split("?")[0]
    loc = Replace(loc,"\\","\/")
    var ar = loc.split("/")
    ar.pop() //remove last index
    var loc = ar.join("/")
    return loc
} 
function ParseHexColor(s) {
    s = ToString(s) 
	s = Replace(s," ","")
	s = s.toLowerCase()
	if ((s.indexOf("rgb(") != -1) && (s.indexOf(")") != -1)) {
		s = Replace(s,"rgb(","")
		s = Replace(s,")","")
		var ar = s.split(",")
		s = "#"
		for (var i=0;i<3;i++) {
			ar[i] = ToInteger(ar[i])
			if (ar[i] > 255) ar[i] = 255
			var h = "0123456789abcdefg"
			s += h.charAt(ar[i] / 16)
			s += h.charAt(ar[i] % 16)
		}		
	}
	return s
}

//#############################################################################
//#############################################################################
//#############################################################################
// INTEGER

function TextToInteger(s) {
    s = ToString(s)
	var c = "0123456789"
	var b = (s.indexOf("-") != -1) 
	var r = ""
	for (var i=0;i<s.length;i++) {
		if (c.indexOf(s.charAt(i)) != -1) {
			r += s.charAt(i)	
		}
	}
	r = parseFloat(r); if (isNaN(r) == true) r = 0  
	r = parseInt(r); if (isNaN(r) == true) r = 0  
	if (b == true) r *= -1 	
	return r
}
function IntegerToText(x,Sign,Thousand) {
    x = ToString(x)
    Thousand = Thousand || false
	if (Thousand == true) {
		var c = (Sign == ".") ? "," : "."
		var s = x
		var r = ""
		for (var i=0;i<s.length;i++) {
			if (((i % 3) == 0) && (i > 0)) r = c + r	
			r = s.charAt(s.length-1-i) + r
		}
		x = r 
	}
    return x
}
function GetNum(x, iCount) {
    x = ToString(x)
    iCount = iCount || 2 
    for (var i=x.length;i<iCount;i++) x = "0" + x
    return x
}

//#############################################################################
//#############################################################################
//#############################################################################
// DATE

function TextToDate(s, AsDate) {
	if (s == null) s = ""
	s = Trim(s)
	while (true) {
		var t = s
		t = t.replace("  "," ")
		t = t.replace(".","-")
		t = t.replace("\/","-")
		t = t.replace("\\","-")
		t = t.replace(":","-")
		if (t == s) break
		s = t 
	}
	while (true) {
		var t = s
		t = t.replace(" ","-")
		if (t == s) break
		s = t 
	}
	var ar = s.split("-")
	ar.length = 3
	for (var i=0;i<ar.length;i++) {
		var s = ar[i]
		if (s == null) s = ""
		while ((s.length > 1) && (s.charAt(0) == "0")) s = s.substring(1, s.length) 
		ar[i] = parseInt(parseFloat(s))
	}
	var n = new Date()
	if (isNaN(ar[0]) == true) ar[0] = n.getDate()		
	if (isNaN(ar[1]) == true) ar[1] = n.getMonth()+1		
	if (isNaN(ar[2]) == true) ar[2] = n.getFullYear()		
	if (ar[2] < 50) ar[2] += 2000	
	if (ar[2] < 100) ar[2] += 1900	
	if (ar[2] < 1900) ar[2] = 1900	
	if (ar[2] > 2100) ar[2] = 2100	
	var d = new Date(ar[2],ar[1]-1,ar[0])
	return d
}
function TextToDateText(s) {
    var d = TextToDate(s)
	return GetNum(d.getDate()) + "-" + GetNum(d.getMonth()+1) + "-" + d.getFullYear()
}

//#############################################################################
//#############################################################################
//#############################################################################
// DOUBLE

function TextToDouble(s) {
    s = ToString(s)
    var c = "0123456789,."
	var b = (s.indexOf("-") != -1) 
	var r = ""
	for (var i=s.length-1;i>=0;i--) {
		if (c.indexOf(s.charAt(i)) != -1) {
			if ((s.charAt(i) == ".") || (s.charAt(i) == ",")) { c = c.replace(".",""); c = c.replace(",","") }
			r = s.charAt(i) + r	
		}
	}
	r = r.replace(",",".")
	r = parseFloat(r); if (isNaN(r) == true) r = 0
	if (b == true) r *= -1 
	return r
}
function DoubleToText(d,Sign,Thousand,Digits) {
	d = parseFloat(d); if (isNaN(d) == true) d = 0
	var n = (d < 0)
	Sign = Sign || "."
	Thousand = Thousand || false
	Digits = Digits || 1
	d += ""; d = d.replace(".",Sign); if (d.indexOf(Sign) == -1) d += Sign + "0"; d = d.replace("-","")
	var ar = d.split(Sign)
	if (Thousand == true) {
		var c = (Sign == ".") ? "," : "."
		var s = ar[0]
		var r = ""
		for (var i=0;i<s.length;i++) {
			if (((i % 3) == 0) && (i > 0)) r = c + r	
			r = s.charAt(s.length-1-i) + r
		}
		ar[0] = r
	}
	var s = ar[1]
	while (s.length < Digits) s += "0"
	ar[1] = s
	d = ar.join(Sign)
	if (n == true) d = "-" + d
	return d
}

//#############################################################################
//#############################################################################
//#############################################################################
// NUMERIC

function RoundNumeric(n,Digits) {
	n = ToDouble(n)
	Digits = ToInteger(Digits,-1) 
	if (Digits > 0) n = Math.round(Math.pow(10,Digits) * n) / Math.pow(10,Digits)
	return n 	
}
function LimitNumeric(n,Min,Max) {
	n = ToDouble(n)
	Min = ToDouble(Min,Math.pow(10,9) * -1)
	Max = ToDouble(Max,Math.pow(10,9)) 
	if (n < Min) n = Min
	if (n > Max) n = Max
	return n	
}
function IsNumeric(n){
    n = ToString(n)
	var c = "0123456789"
	var r = ""
	for (var i=0;i<n.length;i--) {
		if (c.indexOf(n.charAt(i)) != -1) return true
	}
    return false
}

//#############################################################################
//#############################################################################
//#############################################################################
// MESSAGES

var BusyAlerts = false
function ShowPrompt(msg,def,win) {
    msg = ToString(msg)
    def = ToString(def)
    win = win || window
    BusyAlerts = true
    var r = "\n"; r = win.prompt(msg + "\n" + Space(150),def || "")
    if (r == "\n") { 
        ShowAlert("Prompt is currently not supported. Activate active text scripting in your browser options !",win)    
        r = ""
    }    
    win.setTimeout("BusyAlerts=false",200)
    return r || ""
}
function ShowAlert(msg,win) {
    msg = ToString(msg)
    win = win || window
    BusyAlerts = true
    win.alert(msg + "\n" + Space(150))
    win.setTimeout("BusyAlerts=false",200)
}
function ShowConfirm(msg,win) {
    msg = (msg || "") + "" 
    win = win || window
    BusyAlerts = true
    var r = win.confirm(msg + "\n" + Space(150))
    win.setTimeout("BusyAlerts=false",200)
    return (r == true)
}

//#############################################################################
//#############################################################################
//#############################################################################
// DIRECT

function DirectIf(b,t,e) {
	if (b == true) return t
	return e
}
function DirectValue(a,b,c) {
	if (a == null) { a = "" } else { a = Trim(a) }
	if (b == null) { b = "" } else { b = Trim(b) }
	if (c == null) { c = "" } else { c = Trim(c) }
	if (a != "") { return a } else if (b != "") { return b } else { return c }
}

//#############################################################################
//#############################################################################
//#############################################################################
// SELECT

function ShowSelectValue(oSelect, sValue) {
    if (typeof(oSelect) == "string") oSelect = GetElement(oSelect)
    sValue = ToString(sValue)
	for (var i=0;i<oSelect.options.length;i++) {
		if (oSelect.options[i].value == sValue) {
			oSelect.selectedIndex = i
			break
		}	
	}	
} 
function GetSelectValue(oSelect, sDefault) {
    if (typeof(oSelect) == "string") oSelect = GetElement(oSelect)
	if (oSelect.selectedIndex == -1) return (sDefault || "")
	return oSelect.options[oSelect.selectedIndex].value
} 
function SetSelectValue(oSelect, sValue) {
    if (typeof(oSelect) == "string") oSelect = GetElement(oSelect)
	if (oSelect.selectedIndex == -1) return 
	oSelect.options[oSelect.selectedIndex].value = sValue
} 
function GetSelectText(oSelect, sDefault) {
    if (typeof(oSelect) == "string") oSelect = GetElement(oSelect)
	if (oSelect.selectedIndex == -1) return (sDefault || "")
	return oSelect.options[oSelect.selectedIndex].text
} 
function SetSelectText(oSelect, sText) {
    if (typeof(oSelect) == "string") oSelect = GetElement(oSelect)
	if (oSelect.selectedIndex == -1) return 
	oSelect.options[oSelect.selectedIndex].text = sText || ""
} 

//#############################################################################
//#############################################################################
//#############################################################################
// RADIO

function ShowRadioValue(oRadio, sValue) {
    if (typeof(oRadio) == "string") oRadio = GetElement(oRadio)
    sValue = ToString(sValue)
    for (var i = 0; i < oRadio.length; i++) {
        oRadio[i].checked = (oRadio[i].value == sValue)
		//if (oRadio[i].value == sValue) {
		//	oRadio[i].checked = true
		//	break
		//}	
	}	
} 
function GetRadioIndex(oRadio) {
    if (typeof(oRadio) == "string") oRadio = GetElement(oRadio)
    for (var i=0;i<oRadio.length;i++) {
        if (oRadio[i].checked == true) return i
    }
    return -1
} 
function GetRadioValue(oRadio, sDefault) {
    if (typeof(oRadio) == "string") oRadio = GetElement(oRadio)
    if (sDefault == null) sDefault = ""
    var iIndex = GetRadioIndex(oRadio)
	if (iIndex == -1) return sDefault 
	return oRadio[iIndex].value
} 
function SetRadioValue(oRadio, sValue) {
    if (typeof(oRadio) == "string") oRadio = GetElement(oRadio)
    var iIndex = GetRadioIndex(oRadio)
	if (iIndex == -1) return
	oRadio[iIndex].value = sValue
} 

//#############################################################################
//#############################################################################
//#############################################################################
// COOKIES

function SetCookie(sName, sValue) {
	var s = sName; s = ToString(s)
	var t = sValue; t = ToString(t)
	s = s.toUpperCase()
	var ExpireDate = new Date() //now
	if (t == "") {
	    ExpireDate.setMonth(ExpireDate.getMonth()-6)
	} else {    
	    ExpireDate.setMonth(ExpireDate.getMonth()+6)
	}  
	ExpireDate = ExpireDate.toGMTString()
	var CookieString = s + "=" + escape(t) + "; expires=" + ExpireDate
	document.cookie = CookieString
}
function GetCookie(sName, xDefault) {
	var s = sName; s = ToString(s)
	var d = xDefault; d = ToString(d)
	s = s.toUpperCase()
	var CookieString = document.cookie
	var ar = CookieString.split("; ")
	for (var i=0;i<ar.length;i++) {
		var ar2 = ar[i].split("=")
		if ((ar2.length == 2) && (s == ar2[0])) { 
			var t = ar2[1]; if (t == null) t = ""
			t = unescape(t)
			return t
		}
	}
	return d
}

//#############################################################################
//#############################################################################
//#############################################################################
// IMAGES

function ScaleImage(imgSource, imgDisplay, w, h) {
	var iw = imgSource.width
	var ih = imgSource.height
	var factor
	if ((iw / w) > (ih / h)) {
		factor = w / iw	
	} else {
		factor = h / ih
	}
	var nw = Math.floor(iw * factor)
	var nh = Math.floor(ih * factor)
	if ((nw != iw) || (nh != ih)) {
		imgDisplay.width = nw
		imgDisplay.height = nh
	}	
}

//#############################################################################
//#############################################################################
//#############################################################################
// REG EXP

function CheckPattern(sPattern,sString) {
    sPattern = ToString(sPattern)
    sString = ToString(sString)
    var re = new RegExp(sPattern)
    re.global = true
    re.ignoreCase = false		
    var res = sString.match(re)
    if (res == null) return false
    for (var i=0;i<res.length;i++) {
		if (res[i].toLowerCase() == sString.toLowerCase()) return true
    }
    return false
} 
function CheckEmail(sEmail) {
    try {
        //var sPattern = "^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"	
        var sPattern = "^([a-zA-Z0-9_\\-])+(\\.([a-zA-Z0-9_\\-])+)*@((\\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\\]))|((([a-zA-Z0-9])+(([\\-])+([a-zA-Z0-9])+)*\\.)+([a-zA-Z])+(([\\-])+([a-zA-Z0-9])+)*))$"
        return CheckPattern(sPattern,sEmail)
	} catch(e) {
		ShowAlert(e.message || e)
	}	
}
function CheckURL(sURL) {
    try {
        var sPattern =  "^(http|https|ftp):\\/\\/([\\w.]+\\/?)\\S*$"
        return CheckPattern(sPattern,sURL)
	} catch(e) {
		ShowAlert(e.message || e)
	}	
}
function CheckIP(sIP) {
    try {
        //var sPattern = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
        var sPattern = "^(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)$"
        return CheckPattern(sPattern,sIP)
	} catch(e) {
		ShowAlert(e.message || e)
	}	
} 

//#############################################################################
//#############################################################################
//#############################################################################
// HTTP

function GetHttpResponse(sURL,oData) {
    try {
        sURL += ((sURL.indexOf("?") != -1) ? "?" : "&") + "&rnd=" + Math.random()
		if (sURL.indexOf("?") != -1) {
		    sURL = (Trim(sURL.split("?")[0].split("#")[0]) || window.location.href.split("?")[0].split("#")[0]) + "?" + sURL.split("?")[1]
		} else {
		    sURL = window.location.href.split("?")[0].split("#")[0] + "?" + sURL				
		}    
		var oHttp = (window.XMLHttpRequest != null) ? (new XMLHttpRequest()) : (new ActiveXObject("MSXML2.XMLHTTP"))
		oHttp.open((oData == null) ? "GET" : "POST", sURL, false)
		oHttp.send(oData)
		if (oHttp.status == 200) return oHttp.responseText
		throw ("http error status: " + oHttp.status)
	} catch(e) {
		throw ((e.message != null) ? e.message : e)
	}	
}

//#############################################################################
//#############################################################################
//#############################################################################
// PARSE

function ParseFilePath(sFile) {
	sFile = ToString(sFile)
	if (sFile == "") return ""
	var sSign = (sFile.indexOf("\\") != -1) ? "\\" : "\/"
	sFile = Replace(sFile,"\\",sSign); sFile = Replace(sFile,"\/",sSign) 
	var ar = sFile.split(sSign)
	ar.pop()
	sFile = ar.join(sSign) 
	return sFile
}
function ParseFileName(sFile) {
	sFile = ToString(sFile)
	if (sFile == "") return ""
	var sSign = (sFile.indexOf("\\") != -1) ? "\\" : "\/"
	sFile = Replace(sFile,"\\",sSign); sFile = Replace(sFile,"\/",sSign) 
	if (sFile.indexOf(sSign) == -1) return sFile
	var ar = sFile.split(sSign)
    sFile = ar[ar.length-1]
	return sFile
}
function ParseFileExt(sFile) {
	sFile = ToString(sFile)
	if (sFile == "") return ""
	if (sFile.indexOf(".") == -1) return ""
	var ar = sFile.split(".")
	sFile = ar.pop()
	sFile = sFile.toUpperCase()
	return sFile
}

//#############################################################################
//#############################################################################
//#############################################################################
// ERROR

window.onerror = ShowWindowError
function ShowWindowError(sMsg,sUrl,sLine) {
    var s = "ERROR\n\n"
    s += "MSG: " + sMsg + "\n"
    s += "URL: " + sUrl + "\n"
    s += "LINE: " + sLine + "\n"                
    ShowAlert(s)    
    return false
}

//#############################################################################
//#############################################################################
//#############################################################################
// WINDOW

function ShowWindow(sURL,iLeft,iTop,iWidth,iHeight,bResizable,bScrollbars) {
    iWidth = iWidth || 800
    iHeight = iHeight || 600
    if (iLeft == null) {
        iLeft = iLeft || ((screen.availWidth - iWidth) / 2)
    } else if (iLeft < 0) {
        iLeft = screen.availWidth - iWidth + iLeft
    }
    if (iTop == null) {
        iTop = iTop || ((screen.availHeight - iHeight) / 2)    
    } else if (iTop < 0) {
        iTop = screen.availWidth - iHeight + iTop
    }
    if ((iLeft + iWidth) > (screen.availWidth - 20)) iWidth = screen.availWidth - iLeft - 20
    if ((iTop + iHeight) > (screen.availHeight - 60)) iHeight = screen.availHeight - iTop - 60
    bResizable = bResizable || false
    bScrollbars = bScrollbars || false
    var Fea = "menubar=no,status=no,resizable={r},scrollbars={s},left={x},top={y},width={w},height={h}" //dependent=yes
    Fea = Fea.replace("{x}",iLeft)         
    Fea = Fea.replace("{y}",iTop)         
	Fea = Fea.replace("{w}",iWidth)
	Fea = Fea.replace("{h}",iHeight)
	Fea = Fea.replace("{r}",(bResizable == true) ? "yes" : "no")
	Fea = Fea.replace("{s}",(bScrollbars == true) ? "yes" : "no")
    //alert(Fea) //DEBUG
    var win = window.open(sURL,"",Fea)
    return win
}
function CloseWindow(win) {
    if ((win != null) && (win.closed == false)) win.close()
}
function FocusWindow(win) {
    if ((win != null) && (win.closed == false)) {
        CallFocus(win)
        return true
    } else {
        return false
    }    
}

//#############################################################################
//#############################################################################
//#############################################################################
// LIGHTBOX

function InitLightBox() {
	var s = ""
	s += "<table cellspacing=4 cellpadding=0 border=0 id=\"LightBox\" style=\"border:3px solid #19499F;background-color:lightyellow;width:300px;height:200px;position:absolute;display:none;z-index:2\"><tr>"
	s +=	"<td valign=top id=\"LightBoxText\"></td>"
	s +=	"<td width=10 valign=top><input type=button onclick=\"HideLightBox(event)\" id=\"LightBoxButton\" value=\"x\" style=\"border:0px;width:19px;height:19px;background-color:#19499F;font-size:8pt;font-weight:bold;color:white\"></td>"
	s += "</tr></table>"
	document.write(s)
    AttachEvent(window.document,"keyup",KeyUpLightBox)
    AttachEvent(window.document,"mousedown",MouseDownLightBox)
}
//InitLightBox()
function ShowLightBox(x,y,txt) {
	var LightBox = GetElement("LightBox")
	LightBox.style.left = x + "px"
	LightBox.style.top = y + "px"
	LightBox.style.display = ""
	var LightBoxText = GetElement("LightBoxText")
	LightBoxText.innerHTML = txt
	var LightBoxBody = GetElement("LightBoxBody")
	if (LightBoxBody != null) LightBoxBody.style.display = ""
}
function HideLightBox(evt) {
	var LightBox = GetElement("LightBox")
	LightBox.style.display = "none"
	var LightBoxBody = GetElement("LightBoxBody")
	if (LightBoxBody != null) LightBoxBody.style.display = "none"
}
function KeyUpLightBox(evt) {
	var key = GetEventKeyCode(evt)
	if (key == KeyEscape) HideLightBox(evt)
}
function MouseDownLightBox(evt) {
	var el = GetEventElement(evt)
    var b = true	
	while (el != null) {
	    var id = el.id || ""
	    if (id == "LightBox") b = false
	    if (id == "LightBoxText") b = false
	    if (id == "LightBoxBody") b = false
	    el = el.parentElement
	}
	if (b == true) HideLightBox(evt)
}

//#############################################################################
//#############################################################################
//#############################################################################

