﻿//------------ header navigation dropdown list ------------//
var menu = function() {
    var t = 15, z = 50, s = 10, a, cc; visibleShim = false;
    var wi = new Array();
    wi["en-US"] = new Array(224, 150, 150, 150, 142);
    wi["ja-JP"] = new Array(255, 180, 155, 150, 142);
    wi["en-GB"] = new Array(224, 150, 150, 150, 142);
    wi["en-AU"] = new Array(224, 150, 150, 150, 142);
    wi["en-CA"] = new Array(224, 150, 150, 150, 142);
    wi["pt-BR"] = new Array(355, 150, 170, 160, 142);
    wi["es-MX"] = new Array(300, 150, 170, 275, 142);
    wi["ko-KR"] = new Array(150, 150, 150, 150, 142);
    wi["zh-HK"] = new Array(180, 150, 150, 150, 142);
    wi["zh-CN"] = new Array(180, 150, 150, 150, 142);
    wi["zh-TW"] = new Array(180, 150, 150, 150, 142);
    function dd(n, cl) { this.n = n; this.h = []; this.c = []; cc = cl != null ? cl : "en-AU"; this.Shims = []; }
    /*n=menu,h=li,c=ul*/
    dd.prototype.init = function(p, c) {
        a = c; var w = document.getElementById(p), s = w.getElementsByTagName('ul'), l = s.length, i = 0;
        for (i; i < l; i++) {
            wt = (wi[cc] != null && wi[cc][i] != null) ? wi[cc][i] : 142;
            s[i].style.width = wt + "px";
            this.enableShim(s[i], i, wt);
            var h = s[i].parentNode; this.h[i] = h; this.c[i] = s[i];
            h.onmouseover = new Function(this.n + '.st(' + i + ',true)');
            h.onmouseout = new Function(this.n + '.st(' + i + ')');
        }
    }
    dd.prototype.st = function(x, f) {
        var c = this.c[x], h = this.h[x], p = h.getElementsByTagName('a')[0]; cl = c.getElementsByTagName('li');
        clearInterval(c.t); c.style.overflow = 'hidden';
        if (f) {
            p.className += ' ' + a;
            if (!c.mh) { c.style.display = 'block'; c.style.height = ''; c.mh = c.offsetHeight; c.style.height = 0; }
            if (visibleShim) {
                this.Shims[x].style.display = 'block';
                this.Shims[x].style.height = c.mh +2+ 'px';
            }
            if (c.mh == c.offsetHeight) { c.style.overflow = 'visible'; }
            else { c.style.zIndex = z; z++; c.t = setInterval(function() { sl(c, 1) }, t) }
        } else { p.className = p.className.replace(a, ''); if (visibleShim) { this.Shims[x].style.display = 'none'; } c.t = setInterval(function() { sl(c, -1) }, t) }
    }
    dd.prototype.enableShim = function(container, i, wt) {
        // Shims is need for IE6 or elder.
        var ua = navigator.userAgent;
        if (ua.indexOf('MSIE 6', 0) > 0
    || ua.indexOf('MSIE 5', 0) > 0
    || ua.indexOf('MSIE 4', 0) > 0) {
            visibleShim = true;

            if (document.getElementById) {
                if (container) {
                    var shim = document.createElement('iframe');
                    shim.setAttribute('class', 'ddshim');
                    shim.setAttribute('id', i + '-ddshim');
                    shim.setAttribute('scrolling', 'no');
                    shim.setAttribute('frameborder', '0');
                    shim.setAttribute('src', 'javascript:false;');
                    shim.style.display = 'none';
                    shim.style.position = 'absolute';
                    shim.style.zIndex = '2';
                    shim.style.width = (wt + 6) + 'px';
                    shim.style.height = '0px';
                    shim.style.filter = 'alpha(opacity=0)';
                    container.parentNode.appendChild(shim);
                    this.Shims[i] = shim;

                    var cl = container.getElementsByTagName('a');
                    for (var i = 0; i < cl.length; i++) {
                        cl[i].style.width = (wt - 24) + 'px';
                    }
                }
            }
        }
        else {
            visibleShim = false;
        }
    }
    function sl(c, f) {
        var h = c.offsetHeight;
        if (((h + 1) <= 0 && f != 1) || (h >= (c.mh) && f == 1)) {
            if (f == 1) { c.style.filter = ''; c.style.opacity = 1; c.style.overflow = 'visible' }
            clearInterval(c.t); return
        }
        var d = (f == 1) ? Math.ceil((c.mh - h) / s) : Math.ceil(h / s), o = h / c.mh;
        c.style.opacity = o; c.style.filter = 'alpha(opacity=' + (o * 100) + ')';
        c.style.height = h + (d * f) + 'px'
    }
    return { dd: dd }
} ();

