// Layer script v2.2.0.3
// Copyright (C) 2002-2007 Pluginlab Limited. All rights reserved.
// http://www.pluginlab.com
// Registered to: zceep24

function PL_Layer(idScr, url, w, h, pos, x, y, Bst, Bw, Bc, Bcmo, Bgc, Op, Acl, Rsz, Drg, SB, TB, TBpos, TBa, TBw, TBh, TBc, TBcmo, TBb, TBbc, TBbcmo, TBi, TBst, TBIc, TBIcmo, TBIb, TBIbmo, TBIn, TBInmo, TBIa, TBIp, Crot, Opm, Opd, Ops, Opb, Clm, Cld, Cls, zInd, idLayer) {
    function _PLLW_setPathAdjustment(ID) {
        var sl = ''
        var sc = document.getElementsByTagName('script')
        for (var i = 0; i < sc.length; i++) {
            if (sc[i].innerHTML.search(ID) > -1) { sl = sc[i].src; break; }
        }
        _PLLW_SCRIPT_LOCATION = sl.substr(0, sl.lastIndexOf('/') + 1)
    }
    function _PLLW_adjustPath(path) {
        if (path.charAt(0) != '*') return path
        return _PLLW_SCRIPT_LOCATION + path.substr(1)
    }

    if (idScr) _PLLW_setPathAdjustment(idScr)
    var d = document
    if (!d.PL_rszID) d.PL_rszID = ""
    var url = _PLLW_adjustPath(url)

    var ind = (new Date()).getTime()
    var nav = navigator.userAgent
    var L = null
    if (idLayer) L = d.getElementById(idLayer)
    if (!L) {
        L = d.createElement("DIV")
        d.body.appendChild(L)
        L.Mac = nav.indexOf('Mac') >= 0
        L.Saf = nav.indexOf('Safari') >= 0
        L.IE = d.all && !L.Mac && nav.toLowerCase().indexOf('opera') < 0
        L.NS = nav.toLowerCase().indexOf('netscape') >= 0
        L.Fox = nav.toLowerCase().indexOf('firefox') >= 0
        L.style.position = 'absolute'
        L.style.left = '-10000px'
        L.style.top = 0
        L.id = idLayer ? idLayer : "_PLLW" + ind
    }
    var compatMode = (L.IE || L.Fox) && d.compatMode == "CSS1Compat"
    var IECanvas = compatMode ? d.documentElement : d.body
    var db = compatMode ? d : d.body

    if (w < 10) w = 10
    if (h < 10) h = 10
    if (Ops < 1) Ops = 1

    // Content rotation
    var ContentNodes = new Array()
    var Node
    if ((url && url != "#") || !Crot) {
        Node = new Object()
        Node.iType = 0
        Node.sUrlUrl = url
        ContentNodes[ContentNodes.length] = Node
    }
    if (Crot != "") {
        Crot = Crot.split(",")
        for (var i = 0; i < Crot.length; i += 5) {
            Node = new Object()
            Node.iType = parseInt(Crot[i])
            Node.sImageUrl = _PLLW_adjustPath(Crot[i + 1])
            Node.sUrlUrl = _PLLW_adjustPath(Crot[i + 2])
            Node.sFlashFile = _PLLW_adjustPath(Crot[i + 3])
            Node.sImageFile = _PLLW_adjustPath(Crot[i + 4])
            ContentNodes[ContentNodes.length] = Node
        }
    }
    if (!TB || !(TBIb || TBIn)) {	// auto rotate
        L.iContent = GetIdx()		// L.iContent is used in GetNextContent
        L.iContent = GetNextContent()
    }
    else {
        L.iContent = 0
    }
    // Get iframe src
    var strSrc = GetContentUrl(L.iContent)
    SaveIdx(L.iContent)

    // Layer
    L.dw = 2 * Bw
    L.dh = 2 * Bw
    var Ls = L.style
    Ls.zIndex = zInd
    L.align = 'center'
    L.mainMouseUp = L.mainMouseDown = L.mainSelStart = -1
    L.openMethod = Opm
    L.closeMethod = Clm
    L.closeIt = closeLayer
    if (Acl > 0) setTimeout("var d=document,o=d.getElementById('" + L.id + "');if(o)o.closeIt()", Acl * 1000)

    // Layer layout
    var strBody = ""
	+ "<TABLE cellpadding=0 cellspacing=0>"
    var strContent = ""
	+ "<TR><TD><DIV style="
	+ "'border-style:" + Bst
	+ ";border-width:" + Bw + "px"
	+ ";border-color:" + Bc
	+ ";background-color:" + (Bgc ? Bgc : "transparent") + "'"
	+ " onmouseover=\"this.style.borderColor='" + Bcmo + "'\""
	+ " onmouseout=\"this.style.borderColor='" + Bc + "'\">"
	+ "<IFRAME id='PL_LayerFrame" + ind + "' src='" + strSrc + "' style='width:100%' frameborder=0 SCROLLING='" + (SB ? "yes" : "no") + "'></IFRAME>"
	+ "</DIV></TD></TR>"
    if (TB) {
        var strTB = "<TR><TD align='" + (TBa == 0 ? 'left' : TBa == 1 ? 'right' : 'center') + "' valign='middle'>"
        strTB += "<DIV id='PL_LayerTB" + ind + "' align='" + (TBIa == 0 ? 'left' : TBIa == 1 ? 'right' : 'center') + "'>"
        var strImg = ""
        var strImgStl = "style='cursor:pointer;margin:" + TBIp + "px'"
        if (TBIb) strImg += "<IMG id='PL_LayerImgIb" + ind + "' src='" + _PLLW_adjustPath(TBIb) + "' " + strImgStl + ">"
        if (TBIn) strImg += "<IMG id='PL_LayerImgIn" + ind + "' src='" + _PLLW_adjustPath(TBIn) + "' " + strImgStl + ">"
        if (TBIc) strImg += "<IMG id='PL_LayerImgIc" + ind + "' src='" + _PLLW_adjustPath(TBIc) + "' " + strImgStl + ">"
        strTB += strImg + "</DIV></TD></TR>"

        if (TBpos) L.innerHTML = strBody + strContent + strTB + "</TABLE>"
        else L.innerHTML = strBody + strTB + strContent + "</TABLE>"
        var TBdiv = d.getElementById("PL_LayerTB" + ind)
        L.tb = TBdiv
        L.k = TBw / w
        var ts = TBdiv.style
        ts.width = TBw + (d.all && !compatMode ? Bw * 2 : 0) + "px"
        ts.height = TBh + "px"
        L.dh += TBh

        TBdiv.onmouseover = function() { var o = this; if (o.TBbcmo) o.style.borderColor = o.TBbcmo; if (o.TBcmo) o.style.backgroundColor = o.TBcmo }
        TBdiv.onmouseout = function() { var o = this; if (o.TBbc) o.style.borderColor = o.TBbc; if (o.TBc) o.style.backgroundColor = o.TBc }
        var imgTB = d.getElementById("PL_LayerImgIb" + ind)
        if (imgTB) {
            imgTB.imn = imgTB.src
            imgTB.immo = _PLLW_adjustPath(TBIbmo)
            setRollover(imgTB)
            imgTB.onclick = rotateBack
        }
        imgTB = d.getElementById("PL_LayerImgIn" + ind)
        if (imgTB) {
            imgTB.imn = imgTB.src
            imgTB.immo = _PLLW_adjustPath(TBInmo)
            setRollover(imgTB)
            imgTB.onclick = rotateNext
        }
        imgTB = d.getElementById("PL_LayerImgIc" + ind)
        if (imgTB) {
            imgTB.imn = imgTB.src
            imgTB.immo = _PLLW_adjustPath(TBIcmo)
            setRollover(imgTB)
            imgTB.onclick = function() { this.Ldiv.closeIt() }
            imgTB.Ldiv = L
        }
        ts.borderWidth = 0
        if (TBb) {
            ts.borderStyle = Bst
            ts.borderWidth = Bw + "px"
            ts.borderColor = TBdiv.TBbc = TBbc
            TBdiv.TBbcmo = TBbcmo
            L.dh += (TBst + 1) * Bw
        } else ts.borderStyle = "none"
        if (TBpos) {
            ts.borderTopStyle = 'none'
            if (TBst) ts.borderBottomWidth = 2 * parseInt(ts.borderBottomWidth)
        } else {
            ts.borderBottomStyle = 'none'
            if (TBst) ts.borderTopWidth = 2 * parseInt(ts.borderTopWidth)
        }
        if (TBi) {
            ts.backgroundImage = "url(" + _PLLW_adjustPath(TBi) + ")"
        } else {
            ts.backgroundColor = TBdiv.TBc = TBc
            TBdiv.TBcmo = TBcmo
        }
    }
    else {
        L.innerHTML = strBody + strContent + "</TABLE>"
    }

    L.I = d.getElementById("PL_LayerFrame" + ind)
    if (L.I) L.Is = L.I.style
    L.w = w + L.dw
    L.h = h + L.dh
    d.onselectstart = function() { return false }

    // Resize / Drag events
    if (Rsz || Drg) {
        if (!d.PL_LWs) {
            d.PL_LWs = new Array()
            d.mainMouseMove = db.onmousemove
            db.onmousemove = function(evt) {
                d.cur = "default"
                if (d.mainMouseMove) d.mainMouseMove(evt)
                for (var i = 0; i < d.PL_LWs.length; i++)
                    if (d.PL_LWs[i].thisMouseMove(evt)) break
                IECanvas.style.cursor = d.cur
            }

            d.mainMouseUp = db.onmouseup
            db.onmouseup = function(evt) {
                if (d.mainMouseUp) d.mainMouseUp(evt)
                for (var i = 0; i < d.PL_LWs.length; i++)
                    d.PL_LWs[i].on_mouseup(evt)
                showAllIFrames(true)
            }

            d.mainMouseDown = db.onmousedown
            db.onmousedown = function(evt) {
                if (d.mainMouseDown) d.mainMouseDown(evt)
                for (var i = d.PL_LWs.length - 1; i >= 0; i--) {
                    if (d.PL_LWs[i].on_mousedown(evt)) {
                        showAllIFrames(false)
                        break
                    }
                }
            }

            d.mainMouseOut = db.onmouseout
            db.onmouseout = function(evt) {
                if (d.all) evt = event
                if ((evt.clientX < 0) || (evt.clientY < 0))
                    if (db.onmouseup) db.onmouseup(evt)
            }
        }
        L.Act = new Array("w+=dx;h+=dy", "w-=dx;h-=dy;x+=dx;y+=dy", "w+=dx;h-=dy;y+=dy", "w-=dx;h+=dy;x+=dx", "w+=dx", "w-=dx;x+=dx", "h-=dy;y+=dy", "h+=dy")
        L.Cur = new Array("default", "se-resize", "nw-resize", "ne-resize", "sw-resize", "e-resize", "w-resize", "n-resize", "s-resize")
        function thisMouseMove(evt) {
            var RetVal = false
            if (d.PL_anim) return
            if (d.all) evt = event
            var dt = 3
            var cx = evt.clientX + IECanvas.scrollLeft, cy = evt.clientY + IECanvas.scrollTop, ds = d.body.style
            L.drg = Drg && ((cy >= y) && (cy <= y + L.h)) && ((cx >= x) && (cx <= x + L.w))
            L.rsz = 0
            if (Rsz && (!L.resize && ((d.PL_rszID == "") || (d.PL_rszID == L.id)))) {
                if ((cy >= y) && (cy <= y + L.h)) {
                    if ((cx > x - dt) && (cx < x + Bw + dt)) {
                        if (cy < y + Bw + dt) L.rsz = 2
                        else if (cy > y + L.h - Bw - dt) L.rsz = 4
                        else L.rsz = 6
                    } else if ((cx > x + L.w - Bw - dt) && (cx < x + L.w + dt)) {
                        if (cy < y + dt) L.rsz = 3
                        else if (cy > y + L.h - Bw - dt) L.rsz = 1
                        else L.rsz = 5
                    }
                }
                if ((cx >= x) && (cx <= x + L.w)) {
                    if ((cy < y + Bw + dt) && (cy > y - dt)) {
                        if (cx < x + Bw + dt) L.rsz = 2
                        else if (cx > x + L.w - Bw - dt) L.rsz = 3
                        else L.rsz = 7
                    } else if ((cy > y + L.h - Bw - dt) && (cy < y + L.h + dt)) {
                        if (cx < x + Bw + dt) L.rsz = 4
                        else if (cx > x + L.w - Bw - dt) L.rsz = 1
                        else L.rsz = 8
                    }
                }
                d.PL_rszID = L.rsz > 0 ? L.id : ""
            }
            if (!TB && Drg && L.rsz == 7) {
                L.drg = 1
                L.rsz = 0
            }
            if (L.drag) { d.cur = "move"; RetVal = true }
            else if (L.resize) { d.cur = L.Cur[L.resize]; RetVal = true }
            else if (L.rsz) d.cur = L.Cur[L.rsz]
            else if (L.drg) d.cur = "move"
            L.on_mousemove(evt)
            return RetVal
        }
        L.thisMouseMove = thisMouseMove
        d.PL_LWs[d.PL_LWs.length] = L
        L.iMM = d.PL_LWs.length - 1
    }

    // Set size and position
    var cw = L.Saf ? document.clientWidth : IECanvas.clientWidth
    var ch = L.Saf ? document.clientHeight : IECanvas.clientHeight
    var sl = d.all ? IECanvas.scrollLeft : window.pageXOffset
    var st = d.all ? IECanvas.scrollTop : window.pageYOffset
    switch (pos) {
        case 0:
            x = (cw - L.w) * 0.5 + sl
            y = (ch - L.h) * 0.5 + st
            break
        case 1:
            x = (cw - L.w) * Math.random() + sl
            y = (ch - L.h) * Math.random() + st
            break
    }

    // Set event handlers
    L.resize = L.drag = 0
    L.on_mousedown = function(evt) {
        if (d.all) evt = event
        if (L.rsz != 0) {
            L.resize = L.rsz
            L.mx = evt.clientX
            L.my = evt.clientY
            return true
        }
        if (L.drg) {
            L.drag = 1
            L.mx = evt.clientX - L.offsetLeft
            L.my = evt.clientY - L.offsetTop
            return true
        }
        return false
    }
    L.on_mousemove = function(evt) {
        if (d.all) evt = event
        if (Rsz && L.resize) {
            var dx = evt.clientX - L.mx, dy = evt.clientY - L.my
            var r = L.resize
            if (r == 2 || r == 3 || r == 7) if (dy > L.h - 20) dy = L.h - 20; else L.my = evt.clientY
            if (r == 1 || r == 4 || r == 8) if (dy < 20 - L.h) dy = 20 - L.h; else L.my = evt.clientY
            if (r == 2 || r == 4 || r == 6) if (dx > L.w - 20) dx = L.w - 20; else L.mx = evt.clientX
            if (r == 1 || r == 3 || r == 5) if (dx < 20 - L.w) dx = 20 - L.w; else L.mx = evt.clientX
            eval(L.Act[L.resize - 1])
        }
        if (Drg && L.drag) {
            x = evt.clientX - L.mx
            y = evt.clientY - L.my
        }
        setWHXY(1)
    }
    L.on_mouseup = function() { L.resize = L.drag = 0 }
    function showAllIFrames(bShow) {
        if (!d.PL_LWs) return
        for (var i = 0; i < d.PL_LWs.length; i++) d.PL_LWs[i].Is.visibility = bShow ? "" : "hidden"
    }
    function GetIdx() {
        var idx, aCookie = d.cookie.split("; ")
        for (var i = 0; i < aCookie.length; i++) {
            var aCrumb = aCookie[i].split("=")
            if (escape(url) + "_PLLW_ContIdx" == aCrumb[0]) idx = parseInt(unescape(aCrumb[1]))
        }
        if (isNaN(idx)) idx = -1
        return idx
    }
    function SaveIdx(idx) { d.cookie = escape(url) + "_PLLW_ContIdx=" + idx }
    function SetContentUrl(j) {
        var src = GetContentUrl(j)
        if (src) L.I.src = src
        SaveIdx(L.iContent = j)
    }
    function GetContentUrl(j) {
        if ((j < 0) || (j >= ContentNodes.length)) return ''
        var src = ''
        var n = ContentNodes[j]
        switch (n.iType) {
            case 0:
                src = n.sUrlUrl
                break
            case 1:
                src = "javascript:document.write('<html><body style=\"padding:0;margin:0;background-color:" + (Bgc ? Bgc : "transparent") + "\"><table cellpadding=0 cellspacing=0 width=100% height=100% ><tr><td align=center valign=middle><img style=\"cursor:pointer;cursor:hand;\" onclick=\"window.open(\\\'" + n.sImageUrl + "\\\',\\\'_self\\\') \" src=\"" + n.sImageFile + "\"></td></tr></table></body></html>');document.close()"; setWHXY(1)
                break
            case 2:
                src = n.sFlashFile
                break
        }
        return src
    }
    function GetNextContent() { return (L.iContent < ContentNodes.length - 1) ? L.iContent + 1 : 0 }
    function GetPrevContent() { return (L.iContent > 0) ? L.iContent - 1 : ContentNodes.length - 1 }
    function setRollover(i) {
        i.onmouseover = function(e) { this.parentNode.onmouseover(); if (this.immo) this.src = this.immo; this.cancelBubbles(e) }
        i.onmouseout = function(e) { this.src = this.imn; this.cancelBubbles(e) }
        i.onmousemove = function(e) { this.cancelBubbles(e) }
        i.onmousedown = function(e) { this.cancelBubbles(e); return false }
        i.cancelBubbles = function(e) { if (d.all) e = event; e.cancelBubble = true }
    }
    function rotateBack() { SetContentUrl(GetPrevContent()) }
    function rotateNext() { SetContentUrl(GetNextContent()) }
    openLayer()
    // Open/Close & Animation
    function Zoom(dir) {
        var wh0 = 10, N = 30
        Ls.dw = (w - wh0) / N; Ls.dh = (h - wh0) / N
        L.TBw = TBw; L.Bw = Bw
        switch (dir) {
            case "in":
                L.speed = Ops
                L.JScond = "(w<" + w + ")||(h<" + h + ")"
                L.JSaction = "y-=l.dh;x-=l.dw;if(w<" + w + "){w+=2*l.dw};if(h<" + h + ")h+=2*l.dh;setWHXY(1)"
                x += (w - wh0) * 0.5; y += (h - wh0) * 0.5; w = h = wh0
                setWHXY(1)
                break
            case "out":
                if (!d.all && !L.Mac && L.tb) L.tb.style.display = 'none'
                L.speed = Cls
                L.JScond = "(w>2*l.dw)&&(w>2*l.dh)"
                L.JSaction = "y+=l.dh;x+=l.dw;if(w>2*l.dw){w-=2*l.dw};if(h>2*l.dh)h-=2*l.dh;setWHXY(1)"
                L.removeIt = removeLayer
                break
        }
        L.doZoom = function() {
            d.PL_anim = true
            var l = this.style, i = this.I.style, t = this.tb ? this.tb.style : null, k = this.k
            if (eval(this.JScond)) {
                eval(this.JSaction)
                setTimeout("var o=document.getElementById('" + this.id + "');if(o)o.doZoom()", 600 / (1 + this.speed))
            } else {
                if (this.removeIt) this.removeIt()
                else if (t) t.width = (parseInt(t.width) + L.Bw * 2) + "px"
                d.PL_anim = false
                cleanupAnim()
                setWHXY(1)
            }
        }
        L.doZoom()
    }
    function prepAnim(opn) {
        if (d.all && !L.IE) showAllIFrames(false)
        if (opn)
            L.speed = Ops
        else {
            L.speed = Cls
            L.removeIt = removeLayer
        }
        L.b = 0
        L.JSaction = "style.clip='rect"
    }
    function Bounce(dir) {
        var l = L.style, step = 40
        l.jumps = false
        L.Ops = Ops
        l.y = y
        l.x = x
        switch (dir) {
            case 1:
                l.top = (st + ch) + "px"
                L.JScond = "parseInt(l.top)>l.y"
                L.JSmove = "l.top=(parseInt(l.top)-" + step + ")+'px'"
                L.JSjump = "l.top=(l.y+n)+'px';"
                break
            case 0:
                l.top = (st - h) + "px"
                L.JScond = "parseInt(l.top)<l.y"
                L.JSmove = "l.top=(parseInt(l.top)+" + step + ")+'px'"
                L.JSjump = "l.top=(l.y-n)+'px';"
                break
            case 2:
                l.left = (sl - w) + "px"
                L.JScond = "parseInt(l.left)<l.x"
                L.JSmove = "l.left=(parseInt(l.left)+" + step + ")+'px'"
                L.JSjump = "l.left=(l.x-n)+'px';"
                break
            case 3:
                l.left = (sl + cw) + "px"
                L.JScond = "parseInt(l.left)>l.x"
                L.JSmove = "l.left=(parseInt(l.left)-" + step + ")+'px'"
                L.JSjump = "l.left=(l.x+n)+'px';"
                break
        }
        L.doBounce = function(n) {
            d.PL_anim = true
            var l = this.style
            if ((!l.jumps) && (eval(this.JScond))) {
                eval(this.JSmove)
            }
            else {
                l.jumps = true
                eval(this.JSjump)
                if (n < 0) n += 3; else n -= 3
                n *= -1
            }
            if (n) setTimeout("var o=document.getElementById('" + this.id + "');if(o)o.doBounce(" + n + ")", 800 / (1 + this.Ops))
            else { d.PL_anim = false; setWHXY(); cleanupAnim() }
        }
        L.doBounce(Opb * 6)
    }
    function playAnim(dly) {
        d.PL_anim = true
        L.animate = function() {
            with (this) {
                eval(JSaction)
                if (eval(JScond)) {
                    setTimeout("var o=document.getElementById('" + this.id + "');if(o)o.animate()", dly)
                }
                else {
                    if (this.removeIt) this.removeIt()
                    else {
                        cleanupAnim(); setWHXY()
                        if (d.all && !L.IE) showAllIFrames(true)
                    }
                    d.PL_anim = false
                }
            }
        }
        L.animate()
    }
    function cleanupAnim() {
        Ls.clip = L.IE ? "rect(0px auto auto 0px)" : (L.Saf ? "" : "auto")
        if (Op < 100) {
            Ls.filter = "alpha(opacity=" + Op + ")"
            Ls.MozOpacity = Op / 100
        } else {
            if (Ls.filter) Ls.filter = ""
        }
    }
    function Fade(dir) {
        switch (dir) {
            case "in":
                L.Op = 0
                L.speed = Ops
                L.JScond = "this.Op<=" + Op
                L.step = 5
                break
            case "out":
                L.Op = Op
                L.speed = Cls
                L.JScond = "this.Op>0"
                L.step = -5
                L.removeIt = removeLayer
                break
        }
        L.JSaction = "this.style.filter=\"alpha(opacity=\"+this.Op+\")\";this.style.MozOpacity=(this.Op<100)?this.Op/100:0.99; this.Op+=this.step;"
        playAnim(500 / (1 + L.speed))
    }
    function Slide(opn, dir) {
        prepAnim(opn)
        switch (dir) {
            case 1:
                L.JScond = "b<h"
                if (opn) L.JSaction += "(0px auto '+b+'px 0px)';style.top = (y + h - b)+'px'"
                else L.JSaction += "('+b+'px auto auto 0px)';style.top = (y - b)+'px'"
                break
            case 0:
                L.JScond = "b<h"
                if (opn) L.JSaction += "('+(h-b)+'px auto auto 0px)';style.top = (y - h + b)+'px'"
                else L.JSaction += "(0px auto '+(h-b)+'px 0px)';style.top = (y + b)+'px'"
                break
            case 3:
                L.JScond = "b<w"
                if (opn) L.JSaction += "(0px '+b+'px auto 0px)';style.left = (x + w - b)+'px'"
                else L.JSaction += "(0px auto auto '+b+'px)';style.left = (x - b)+'px'"
                break
            case 2:
                L.JScond = "b<w"
                if (opn) L.JSaction += "(0px auto auto '+(w-b)+'px)';style.left = (x - w + b)+'px'"
                else L.JSaction += "(0px '+(w-b)+'px auto 0px)';style.left = (x + b)+'px'"
                break
        }
        L.JSaction += ";b += speed;"
        playAnim(10)
    }
    function Roll(opn, dir) {
        if (L.Saf) {
            if (!opn) removeLayer()
            return
        }
        prepAnim(opn)
        switch (dir) {
            case 2:
                L.JScond = "b<w"
                if (opn) L.JSaction += "(0px '+b+'px auto 0px)'"
                else L.JSaction += "(0px auto auto '+b+'px)'"
                break
            case 3:
                L.JScond = "b<w"
                if (opn) L.JSaction += "(0px auto auto '+(w-b)+'px)'"
                else L.JSaction += "(0px '+(w-b)+'px auto 0px)'"
                break
            case 0:
                L.JScond = "b<h"
                if (opn) L.JSaction += "(0px auto '+b+'px 0px)'"
                else L.JSaction += "('+b+'px auto auto 0px)'"
                break
            case 1:
                L.JScond = "b<h"
                if (opn) L.JSaction += "('+(h-b)+'px auto auto 0px)'"
                else L.JSaction += "(0px auto '+(h-b)+'px 0px)'"
                break
        }
        L.JSaction = "b += speed;" + L.JSaction
        if (L.NS) L.JSaction += ";style.top=(y+1)+'px';style.top=y+'px'"
        playAnim(10)
    }
    function Stretch(opn, dir) {
        if (L.Saf) {
            if (!opn) removeLayer()
            return
        }
        prepAnim(opn)
        var rect, matrix
        L.JSaction = "b+=speed;"
        switch (dir) {
            case 1:
            case 0:
                rect = "0px auto '+b+'px 0px"
                matrix = "M22='+b/h+'"
                if (opn) { L.b = 0; L.JScond = "b<h"; L.JSaction += "if(b>h)b=h;" }
                else { L.b = h; L.JScond = "b>0"; L.JSaction += "if(b<0)b=0;"; L.speed = -L.speed }
                if ((opn && dir == 1) || (!opn && dir == 0)) L.JSaction += "style.top=(y+h-b)+'px';"
                break
            case 2:
            case 3:
                rect = "0px '+b+'px auto 0px"
                matrix = "M11='+b/w+'"
                if (opn) { L.b = 0; L.JScond = "b<w"; L.JSaction += "if(b>w)b=w;" }
                else { L.b = w; L.JScond = "b>0"; L.JSaction += "if(b<0)b=0;"; L.speed = -L.speed }
                if ((opn && dir == 3) || (!opn && dir == 2)) L.JSaction += "style.left=(x+w-b)+'px';"
                break
        }
        L.JSaction += "style.clip='rect(" + rect + ")';style.filter='progid:DXImageTransform.Microsoft.Matrix(" + matrix + ")'"
        if (L.NS) L.JSaction += ";style.top=(y+1)+'px';style.top=y+'px'"
        playAnim(20)
    }
    function MSFilter(opn, fltr) {
        var spd = opn ? Ops : Cls
        L.style.filter = 'progid:DXImageTransform.Microsoft.' + fltr + '(duration=' + 7 / spd + ')'
        if (L.filters) L.filters[0].apply()
        if (!opn) {
            L.onfilterchange = removeLayer
            Ls.visibility = "hidden"
        } else L.onfilterchange = function() { this.onfilterchange = '' }
        if (L.filters) L.filters[0].play()
        else L.onfilterchange()
    }
    function setWHXY(b) {
        L.Is.width = w + "px"; L.w = w + L.dw; Ls.width = L.w + "px"
        L.Is.height = h + "px"; L.h = h + L.dh; Ls.height = L.h + "px"
        L.x = x; Ls.left = x + "px"
        L.y = y; Ls.top = y + "px"
        if (b && L.tb) {
            TBw = w * L.k
            L.tb.style.width = TBw + (d.all && !compatMode ? Bw * 2 : 0) + "px"
        }
    }
    function CheckCompatibility(method) {
        if (d.all && !L.IE && method == 1) return 0
        if (ContentNodes[L.iContent].iType == 2) {
            var sDisabled = d.all ? ",1,3," : ",1,3,4,5,6,"
            if (sDisabled.indexOf("," + method + ",") >= 0)
                return 0 // use snap instead
        }
        return method
    }
    function openLayer() {
        Ls.display = "none"
        setWHXY()
        switch (CheckCompatibility(Opm)) {
            case 0: cleanupAnim(); break
            case 1: Fade("in"); break
            case 2: Zoom("in"); break
            case 3: MSFilter(true, "RandomDissolve"); break
            case 4: Stretch(true, Opd); break
            case 5: Slide(true, Opd); break
            case 6: Roll(true, Opd); break
            case 7: Bounce(Opd); break
        }
        Ls.display = ""
    }
    function closeLayer() {
        switch (CheckCompatibility(this.closeMethod)) {
            case 1: Fade("out"); break
            case 2: Zoom("out"); break
            case 3: MSFilter(false, "RandomDissolve"); break
            case 4: Stretch(false, Cld); break
            case 5: Slide(false, Cld); break
            case 6: Roll(false, Cld); break
            default: removeLayer(); break
        }
    }
    function removeLayer() {
        if (!L.destroyed) {
            L.destroyed = true
            if (Rsz) {
                IECanvas.style.cursor = "default"
                d.PL_rszID = ""
                for (var i = L.iMM; i < d.PL_LWs.length - 1; i++) {
                    d.PL_LWs[i] = d.PL_LWs[i + 1]
                    d.PL_LWs[i].iMM--
                }
                if (L.iMM < d.PL_LWs.length) d.PL_LWs.length--
            }
            if (L.I) L.I.style.display = 'none'
            L.style.display = 'none'
            d.body.removeChild(L)
        }
    }
}
function PL_LayerClose(idLayer) {
    var layer = document.getElementById(idLayer)
    if (layer) layer.closeIt()
}

