// MSDropDown - jquery.dd.js
// author: Marghoob Suleman - Search me on google
// Date: 12th Aug, 2009
// Version: 2.2 {date: 12 June 2010}
// Revision: 27
// web: www.giftlelo.com | www.marghoobsuleman.com
/*
// msDropDown is free jQuery Plugin: you can redistribute it and/or modify
// it under the terms of the either the MIT License or the Gnu General Public License (GPL) Version 2
*/
;
(function ($) {
    var bi = "";
    var bj = function (p, q) {
            var r = p;
            var t = this;
            var q = $.extend({
                height: 120,
                visibleRows: 7,
                rowHeight: 23,
                showIcon: true,
                zIndex: 9999,
                mainCSS: 'dd',
                useSprite: false,
                onInit: '',
                style: ''
            }, q);
            this.ddProp = new Object();
            var u = "";
            var v = {};
            v.insideWindow = true;
            v.keyboardAction = false;
            v.currentKey = null;
            var w = false;
            var x = {
                postElementHolder: '_msddHolder',
                postID: '_msdd',
                postTitleID: '_title',
                postTitleTextID: '_titletext',
                postChildID: '_child',
                postAID: '_msa',
                postOPTAID: '_msopta',
                postInputID: '_msinput',
                postArrowID: '_arrow',
                postInputhidden: '_inp'
            };
            var y = {
                dd: q.mainCSS,
                ddTitle: 'ddTitle',
                arrow: 'arrow',
                ddChild: 'ddChild',
                ddTitleText: 'ddTitleText',
                disabled: .30,
                ddOutOfVision: 'ddOutOfVision'
            };
            var z = {
                actions: "focus,blur,change,click,dblclick,mousedown,mouseup,mouseover,mousemove,mouseout,keypress,keydown,keyup",
                prop: "size,multiple,disabled,tabindex"
            };
            this.onActions = new Object();
            var A = $(r).attr("id");
            var B = $(r).attr("style");
            q.style += (B == undefined) ? "" : B;
            var C = $(r).children();
            w = ($(r).attr("size") > 0 || $(r).attr("multiple") == true) ? true : false;
            if (w) {
                q.visibleRows = $(r).attr("size")
            };
            var D = {};
            var E = function (a) {
                    return A + x[a]
                };
            var F = function (a) {
                    var b = a;
                    var c = $(b).attr("style");
                    return c
                };
            var G = function (a) {
                    var b = $("#" + A + " option:selected");
                    if (b.length > 1) {
                        for (var i = 0; i < b.length; i++) {
                            if (a == b[i].index) {
                                return true
                            }
                        }
                    } else if (b.length == 1) {
                        if (b[0].index == a) {
                            return true
                        }
                    };
                    return false
                };
            var H = function (a, b, c, d) {
                    var e = "";
                    var f = (d == "opt") ? E("postOPTAID") : E("postAID");
                    var g = (d == "opt") ? f + "_" + (b) + "_" + (c) : f + "_" + (b);
                    var h = "";
                    var i = "";
                    if (q.useSprite != false) {
                        i = ' ' + q.useSprite + ' ' + a.className
                    } else {
                        h = $(a).attr("title");
                        h = (h.length == 0) ? "" : '<img src="' + h + '" align="absmiddle" /> '
                    };
                    var j = $(a).text();
                    var k = $(a).val();
                    var l = ($(a).attr("disabled") == true) ? "disabled" : "enabled";
                    D[g] = {
                        html: h + j,
                        value: k,
                        text: j,
                        index: a.index,
                        id: g
                    };
                    var m = F(a);
                    if (G(a.index) == true) {
                        e += '<a href="javascript:void(0);" class="selected ' + l + i + '"'
                    } else {
                        e += '<a  href="javascript:void(0);" class="' + l + i + '"'
                    };
                    if (m !== false && m !== undefined) {
                        e += " style='" + m + "'"
                    };
                    e += ' id="' + g + '">';
                    e += h + '<span class="' + y.ddTitleText + '">' + j + '</span></a>';
                    return e
                };
            var I = function () {
                    var f = C;
                    if (f.length == 0) return "";
                    var g = "";
                    var h = E("postAID");
                    var i = E("postOPTAID");
                    f.each(function (c) {
                        var d = f[c];
                        if (d.nodeName == "OPTGROUP") {
                            g += "<div class='opta'>";
                            g += "<span style='font-weight:bold;font-style:italic; clear:both;'>" + $(d).attr("label") + "</span>";
                            var e = $(d).children();
                            e.each(function (a) {
                                var b = e[a];
                                g += H(b, c, a, "opt")
                            });
                            g += "</div>"
                        } else {
                            g += H(d, c, "", "")
                        }
                    });
                    return g
                };
            var J = function () {
                    var a = E("postID");
                    var b = E("postChildID");
                    var c = q.style;
                    sDiv = "";
                    sDiv += '<div id="' + b + '" class="' + y.ddChild + '"';
                    if (!w) {
                        sDiv += (c != "") ? ' style="' + c + '"' : ''
                    } else {
                        sDiv += (c != "") ? ' style="border-top:1px solid #c3c3c3;display:block;position:relative;' + c + '"' : ''
                    }
                    sDiv += '>';
                    return sDiv
                };
            var K = function () {
                    var a = E("postTitleID");
                    var b = E("postArrowID");
                    var c = E("postTitleTextID");
                    var d = E("postInputhidden");
                    var e = "";
                    var f = "";
                    if (document.getElementById(A).options.length > 0) {
                        e = $("#" + A + " option:selected").text();
                        f = $("#" + A + " option:selected").attr("title")
                    };
                    f = (f.length == 0 || f == undefined || q.showIcon == false || q.useSprite != false) ? "" : '<img src="' + f + '" align="absmiddle" /> ';
                    var g = '<div id="' + a + '" class="' + y.ddTitle + '"';
                    g += '>';
                    g += '<span id="' + b + '" class="' + y.arrow + '"></span><span class="' + y.ddTitleText + '" id="' + c + '">' + f + '<span class="' + y.ddTitleText + '">' + e + '</span></span></div>';
                    return g
                };
            var L = function () {
                    var c = E("postChildID");
                    $("#" + c + " a.enabled").bind("click", function (a) {
                        a.preventDefault();
                        O(this);
                        if (!w) {
                            $("#" + c).unbind("mouseover");
                            Q(false);
                            var b = (q.showIcon == false) ? $(this).text() : $(this).html();
                            U(b);
                            t.close()
                        };
                        Y()
                    })
                };
            var M = function () {
                    var d = false;
                    var e = E("postID");
                    var f = E("postTitleID");
                    var g = E("postTitleTextID");
                    var h = E("postChildID");
                    var i = E("postArrowID");
                    var j = $("#" + A).width();
                    j = j + 2;
                    var k = q.style;
                    if ($("#" + e).length > 0) {
                        $("#" + e).remove();
                        d = true
                    };
                    var l = '<div id="' + e + '" class="' + y.dd + '"';
                    l += (k != "") ? ' style="' + k + '"' : '';
                    l += '>';
                    l += K();
                    l += J();
                    l += I();
                    l += "</div>";
                    l += "</div>";
                    if (d == true) {
                        var m = E("postElementHolder");
                        $("#" + m).after(l)
                    } else {
                        $("#" + A).after(l)
                    };
                    if (w) {
                        var f = E("postTitleID");
                        $("#" + f).hide()
                    };
                    $("#" + e).css("width", j + "px");
                    $("#" + h).css("width", (j - 2) + "px");
                    if (C.length > q.visibleRows) {
                        var n = parseInt($("#" + h + " a:first").css("padding-bottom")) + parseInt($("#" + h + " a:first").css("padding-top"));
                        var o = ((q.rowHeight) * q.visibleRows) - n;
                        $("#" + h).css("height", o + "px")
                    } else if (w) {
                        var o = $("#" + A).height();
                        $("#" + h).css("height", o + "px")
                    };
                    if (d == false) {
                        T();
                        P(A)
                    };
                    if ($("#" + A).attr("disabled") == true) {
                        $("#" + e).css("opacity", y.disabled)
                    };
                    S();
                    $("#" + f).bind("mouseover", function (a) {
                        bl(1)
                    });
                    $("#" + f).bind("mouseout", function (a) {
                        bl(0)
                    });
                    L();
                    $("#" + h + " a.disabled").css("opacity", y.disabled);
                    if (w) {
                        $("#" + h).bind("mouseover", function (c) {
                            if (!v.keyboardAction) {
                                v.keyboardAction = true;
                                $(document).bind("keydown", function (a) {
                                    var b = a.keyCode;
                                    v.currentKey = b;
                                    if (b == 39 || b == 40) {
                                        a.preventDefault();
                                        a.stopPropagation();
                                        V();
                                        Y()
                                    };
                                    if (b == 37 || b == 38) {
                                        a.preventDefault();
                                        a.stopPropagation();
                                        W();
                                        Y()
                                    }
                                })
                            }
                        })
                    };
                    $("#" + h).bind("mouseout", function (a) {
                        Q(false);
                        $(document).unbind("keydown");
                        v.keyboardAction = false;
                        v.currentKey = null
                    });
                    $("#" + f).bind("click", function (b) {
                        Q(false);
                        if ($("#" + h + ":visible").length == 1) {
                            $("#" + h).unbind("mouseover")
                        } else {
                            $("#" + h).bind("mouseover", function (a) {
                                Q(true)
                            });
                            t.open()
                        }
                    });
                    $("#" + f).bind("mouseout", function (a) {
                        Q(false)
                    });
                    if (q.showIcon && q.useSprite != false) {
                        X()
                    }
                };
            var N = function (a) {
                    for (var i in D) {
                        if (D[i].index == a) {
                            return D[i]
                        }
                    };
                    return -1
                };
            var O = function (a) {
                    var b = E("postChildID");
                    if (!w) {
                        $("#" + b + " a.selected").removeClass("selected")
                    };
                    var c = $("#" + b + " a.selected").attr("id");
                    if (c != undefined) {
                        var d = (v.oldIndex == undefined || v.oldIndex == null) ? D[c].index : v.oldIndex
                    };
                    if (a && !w) {
                        $(a).addClass("selected")
                    };
                    if (w) {
                        var e = v.currentKey;
                        if ($("#" + A).attr("multiple") == true) {
                            if (e == 17) {
                                v.oldIndex = D[$(a).attr("id")].index;
                                $(a).toggleClass("selected")
                            } else if (e == 16) {
                                $("#" + b + " a.selected").removeClass("selected");
                                $(a).addClass("selected");
                                var f = $(a).attr("id");
                                var g = D[f].index;
                                for (var i = Math.min(d, g); i <= Math.max(d, g); i++) {
                                    $("#" + N(i).id).addClass("selected")
                                }
                            } else {
                                $("#" + b + " a.selected").removeClass("selected");
                                $(a).addClass("selected");
                                v.oldIndex = D[$(a).attr("id")].index
                            }
                        } else {
                            $("#" + b + " a.selected").removeClass("selected");
                            $(a).addClass("selected");
                            v.oldIndex = D[$(a).attr("id")].index
                        }
                    }
                };
            var P = function (a) {
                    var b = a;
                    document.getElementById(b).refresh = function (e) {
                        $("#" + b).msDropDown(q)
                    }
                };
            var Q = function (a) {
                    v.insideWindow = a
                };
            var R = function () {
                    return v.insideWindow
                };
            var S = function () {
                    var b = E("postID");
                    var c = z.actions.split(",");
                    for (var d = 0; d < c.length; d++) {
                        var e = c[d];
                        var f = Z(e);
                        if (f == true) {
                            switch (e) {
                            case "focus":
                                $("#" + b).bind("mouseenter", function (a) {
                                    document.getElementById(A).focus()
                                });
                                break;
                            case "click":
                                $("#" + b).bind("click", function (a) {
                                    $("#" + A).trigger("click")
                                });
                                break;
                            case "dblclick":
                                $("#" + b).bind("dblclick", function (a) {
                                    $("#" + A).trigger("dblclick")
                                });
                                break;
                            case "mousedown":
                                $("#" + b).bind("mousedown", function (a) {
                                    $("#" + A).trigger("mousedown")
                                });
                                break;
                            case "mouseup":
                                $("#" + b).bind("mouseup", function (a) {
                                    $("#" + A).trigger("mouseup")
                                });
                                break;
                            case "mouseover":
                                $("#" + b).bind("mouseover", function (a) {
                                    $("#" + A).trigger("mouseover")
                                });
                                break;
                            case "mousemove":
                                $("#" + b).bind("mousemove", function (a) {
                                    $("#" + A).trigger("mousemove")
                                });
                                break;
                            case "mouseout":
                                $("#" + b).bind("mouseout", function (a) {
                                    $("#" + A).trigger("mouseout")
                                });
                                break
                            }
                        }
                    }
                };
            var T = function () {
                    var a = E("postElementHolder");
                    $("#" + A).after("<div class='" + y.ddOutOfVision + "' style='height:0px;overflow:hidden;position:absolute;' id='" + a + "'></div>");
                    $("#" + A).appendTo($("#" + a))
                };
            var U = function (a) {
                    var b = E("postTitleTextID");
                    $("#" + b).html(a)
                };
            var V = function () {
                    var a = E("postTitleTextID");
                    var b = E("postChildID");
                    var c = $("#" + b + " a.enabled");
                    for (var d = 0; d < c.length; d++) {
                        var e = c[d];
                        var f = $(e).attr("id");
                        if ($(e).hasClass("selected") && d < c.length - 1) {
                            $("#" + b + " a.selected").removeClass("selected");
                            $(c[d + 1]).addClass("selected");
                            var g = $("#" + b + " a.selected").attr("id");
                            if (!w) {
                                var h = (q.showIcon == false) ? D[g].text : D[g].html;
                                U(h)
                            };
                            if (parseInt(($("#" + g).position().top + $("#" + g).height())) >= parseInt($("#" + b).height())) {
                                $("#" + b).scrollTop(($("#" + b).scrollTop()) + $("#" + g).height() + $("#" + g).height())
                            };
                            break
                        }
                    }
                };
            var W = function () {
                    var a = E("postTitleTextID");
                    var b = E("postChildID");
                    var c = $("#" + b + " a.enabled");
                    for (var d = 0; d < c.length; d++) {
                        var e = c[d];
                        var f = $(e).attr("id");
                        if ($(e).hasClass("selected") && d != 0) {
                            $("#" + b + " a.selected").removeClass("selected");
                            $(c[d - 1]).addClass("selected");
                            var g = $("#" + b + " a.selected").attr("id");
                            if (!w) {
                                var h = (q.showIcon == false) ? D[g].text : D[g].html;
                                U(h)
                            };
                            if (parseInt(($("#" + g).position().top + $("#" + g).height())) <= 0) {
                                $("#" + b).scrollTop(($("#" + b).scrollTop() - $("#" + b).height()) - $("#" + g).height())
                            };
                            break
                        }
                    }
                };
            var X = function () {
                    if (q.useSprite != false) {
                        var a = E("postTitleTextID");
                        var b = document.getElementById(A).options[document.getElementById(A).selectedIndex].className;
                        if (b.length > 0) {
                            var c = bn("." + b);
                            var d = bn("." + q.useSprite);
                            if (c != null && d != null) {
                                var e = d.backgroundImage.replace(/"/gi, "");
                                e = e.replace(/..\//, "")
                            }
                            $("#" + a).find("." + y.ddTitleText).css('background-image', e);
                            if (c.backgroundPosition != undefined) {
                                $("#" + a).find("." + y.ddTitleText).css('background-position', c.backgroundPosition)
                            };
                            $("#" + a).find("." + y.ddTitleText).css('background-repeat', 'no-repeat');
                            if (d.paddingLeft != undefined) {
                                $("#" + a).find("." + y.ddTitleText).css('padding-left', d.paddingLeft)
                            };
                            $("#" + a).find("." + y.ddTitleText).css('padding-bottom', '2px')
                        }
                    }
                };
            var Y = function () {
                    var a = E("postChildID");
                    var b = $("#" + a + " a.selected");
                    if (b.length == 1) {
                        var c = $("#" + a + " a.selected").text();
                        var d = $("#" + a + " a.selected").attr("id");
                        if (d != undefined) {
                            var e = D[d].value;
                            document.getElementById(A).selectedIndex = D[d].index
                        };
                        if (q.showIcon && q.useSprite != false) X()
                    } else if (b.length > 1) {
                        var f = $("#" + A + " > option:selected").removeAttr("selected");
                        for (var i = 0; i < b.length; i++) {
                            var d = $(b[i]).attr("id");
                            var g = D[d].index;
                            document.getElementById(A).options[g].selected = "selected"
                        }
                    };
                    var h = document.getElementById(A).selectedIndex;
                    t.ddProp["selectedIndex"] = h
                };
            var Z = function (a) {
                    if ($("#" + A).attr("on" + a) != undefined) {
                        return true
                    };
                    var b = $("#" + A).data("events");
                    if (b && b[a]) {
                        return true
                    };
                    return false
                };
            var bk = function () {
                    var b = E("postChildID");
                    if (Z('change') == true) {
                        var c = D[$("#" + b + " a.selected").attr("id")].text;
                        if (u != c) {
                            $("#" + A).trigger("change")
                        }
                    };
                    if (Z('mouseup') == true) {
                        $("#" + A).trigger("mouseup")
                    };
                    if (Z('blur') == true) {
                        $(document).bind("mouseup", function (a) {
                            $("#" + A).focus();
                            $("#" + A)[0].blur();
                            Y();
                            $(document).unbind("mouseup")
                        })
                    }
                };
            var bl = function (a) {
                    var b = E("postArrowID");
                    if (a == 1) $("#" + b).css({
                        backgroundPosition: '0 100%'
                    });
                    else $("#" + b).css({
                        backgroundPosition: '0 0'
                    })
                };
            var bm = function () {
                    for (var i in document.getElementById(A)) {
                        if (typeof (document.getElementById(A)[i]) != 'function' && document.getElementById(A)[i] !== undefined && document.getElementById(A)[i] !== null) {
                            t.set(i, document.getElementById(A)[i], true)
                        }
                    }
                };
            var bn = function (a) {
                    if (document.styleSheets) {
                        for (var i = document.styleSheets.length - 1; i >= 0; i--) {
                            var b = document.styleSheets[i];
                            var c;
                            var d = false;
                            if (b.cssRules) {
                                c = b.cssRules;
                                d = true
                            } else if (b.rules) {
                                c = b.rules
                            };
                            if (c) {
                                var e = ('.' + q.mainCSS + ' .ddChild a' + a).toLowerCase();
                                var f = ('.' + q.mainCSS + ' .ddChild a' + a + ', .' + q.mainCSS + ' .ddChild a' + a + ':visited').toLowerCase();
                                for (var j = c.length - 1; j >= 0; j--) {
                                    if ((c[j].selectorText).toLowerCase() == f || (c[j].selectorText).toLowerCase() == e) {
                                        var g = new Object();
                                        for (var s in c[j].style) {
                                            if (typeof (c[j].style[s]) == "string" && c[j].style[s].length > 0) {
                                                g[s] = c[j].style[s]
                                            }
                                        };
                                        return g
                                    }
                                }
                            }
                        };
                        return null
                    } else {
                        return null
                    }
                };
            var bo = function (a, b) {
                    if (N(b) != -1) {
                        document.getElementById(A)[a] = b;
                        var c = E("postChildID");
                        $("#" + c + " a.selected").removeClass("selected");
                        $("#" + N(b).id).addClass("selected");
                        var d = N(document.getElementById(A).selectedIndex).html;
                        U(d)
                    }
                };
            var bp = function (i, a) {
                    if (a == 'd') {
                        for (var b in D) {
                            if (D[b].index == i) {
                                delete D[b];
                                break
                            }
                        }
                    };
                    var c = 0;
                    for (var b in D) {
                        D[b].index = c;
                        c++
                    }
                };
            this.open = function () {
                if ((t.get("disabled", true) == true) || (t.get("options", true).length == 0)) return;
                var c = E("postChildID");
                if (bi != "" && c != bi) {
                    $("#" + bi).slideUp("fast");
                    $("#" + bi).css({
                        zIndex: '0'
                    })
                };
                if ($("#" + c).css("display") == "none") {
                    $(document).bind("keydown", function (a) {
                        var b = a.keyCode;
                        if (b == 39 || b == 40) {
                            a.preventDefault();
                            a.stopPropagation();
                            V()
                        };
                        if (b == 37 || b == 38) {
                            a.preventDefault();
                            a.stopPropagation();
                            W()
                        };
                        if (b == 27 || b == 13) {
                            t.close();
                            Y()
                        };
                        if ($("#" + A).attr("onkeydown") != undefined) {
                            document.getElementById(A).onkeydown()
                        }
                    });
                    $(document).bind("keyup", function (a) {
                        if ($("#" + A).attr("onkeyup") != undefined) {
                            document.getElementById(A).onkeyup()
                        }
                    });
                    $(document).bind("mouseup", function (a) {
                        if (R() == false) {
                            t.close()
                        }
                    });
                    $("#" + c).css({
                        zIndex: q.zIndex
                    });
                    $("#" + c).slideDown("fast", function () {
                        if (t.onActions["onOpen"] != null) {
                            eval(t.onActions["onOpen"])(t)
                        }
                    });
                    if (c != bi) {
                        bi = c
                    }
                }
            };
            this.close = function () {
                var b = E("postChildID");
                $(document).unbind("keydown");
                $(document).unbind("keyup");
                $(document).unbind("mouseup");
                $("#" + b).slideUp("fast", function (a) {
                    bk();
                    $("#" + b).css({
                        zIndex: '0'
                    });
                    if (t.onActions["onClose"] != null) {
                        eval(t.onActions["onClose"])(t)
                    }
                })
            };
            this.selectedIndex = function (i) {
                t.set("selectedIndex", i)
            };
            this.set = function (a, b, c) {
                if (a == undefined || b == undefined) throw {
                    message: "set to what?"
                };
                t.ddProp[a] = b;
                if (c != true) {
                    switch (a) {
                    case "selectedIndex":
                        bo(a, b);
                        break;
                    case "disabled":
                        t.disabled(b, true);
                        break;
                    case "multiple":
                        document.getElementById(A)[a] = b;
                        w = ($(r).attr("size") > 0 || $(r).attr("multiple") == true) ? true : false;
                        if (w) {
                            var d = $("#" + A).height();
                            var f = E("postChildID");
                            $("#" + f).css("height", d + "px");
                            var g = E("postTitleID");
                            $("#" + g).hide();
                            var f = E("postChildID");
                            $("#" + f).css({
                                display: 'block',
                                position: 'relative'
                            });
                            L()
                        }
                        break;
                    case "size":
                        document.getElementById(A)[a] = b;
                        if (b == 0) {
                            document.getElementById(A).multiple = false
                        };
                        w = ($(r).attr("size") > 0 || $(r).attr("multiple") == true) ? true : false;
                        if (b == 0) {
                            var g = E("postTitleID");
                            $("#" + g).show();
                            var f = E("postChildID");
                            $("#" + f).css({
                                display: 'none',
                                position: 'absolute'
                            });
                            var h = "";
                            if (document.getElementById(A).selectedIndex >= 0) {
                                var i = N(document.getElementById(A).selectedIndex);
                                h = i.html;
                                O($("#" + i.id))
                            };
                            U(h)
                        } else {
                            var g = E("postTitleID");
                            $("#" + g).hide();
                            var f = E("postChildID");
                            $("#" + f).css({
                                display: 'block',
                                position: 'relative'
                            })
                        };
                        break;
                    default:
                        try {
                            document.getElementById(A)[a] = b
                        } catch (e) {};
                        break
                    }
                }
            };
            this.get = function (a, b) {
                if (a == undefined && b == undefined) {
                    return t.ddProp
                };
                if (a != undefined && b == undefined) {
                    return (t.ddProp[a] != undefined) ? t.ddProp[a] : null
                };
                if (a != undefined && b != undefined) {
                    return document.getElementById(A)[a]
                }
            };
            this.visible = function (a) {
                var b = E("postID");
                if (a == true) {
                    $("#" + b).show()
                } else if (a == false) {
                    $("#" + b).hide()
                } else {
                    return $("#" + b).css("display")
                }
            };
            this.add = function (a, b) {
                var c = a;
                var d = c.text;
                var e = (c.value == undefined || c.value == null) ? d : c.value;
                var f = (c.title == undefined || c.title == null) ? '' : c.title;
                var i = (b == undefined || b == null) ? document.getElementById(A).options.length : b;
                document.getElementById(A).options[i] = new Option(d, e);
                if (f != '') document.getElementById(A).options[i].title = f;
                var g = N(i);
                if (g != -1) {
                    var h = H(document.getElementById(A).options[i], i, "", "");
                    $("#" + g.id).html(h)
                } else {
                    var h = H(document.getElementById(A).options[i], i, "", "");
                    var j = E("postChildID");
                    $("#" + j).append(h);
                    L()
                }
            };
            this.remove = function (i) {
                document.getElementById(A).remove(i);
                if ((N(i)) != -1) {
                    $("#" + N(i).id).remove();
                    bp(i, 'd')
                };
                if (document.getElementById(A).length == 0) {
                    U("")
                } else {
                    var a = N(document.getElementById(A).selectedIndex).html;
                    U(a)
                };
                t.set("selectedIndex", document.getElementById(A).selectedIndex)
            };
            this.disabled = function (a, b) {
                document.getElementById(A).disabled = a;
                var c = E("postID");
                if (a == true) {
                    $("#" + c).css("opacity", y.disabled);
                    t.close()
                } else if (a == false) {
                    $("#" + c).css("opacity", 1)
                };
                if (b != true) {
                    t.set("disabled", a)
                }
            };
            this.form = function () {
                return (document.getElementById(A).form == undefined) ? null : document.getElementById(A).form
            };
            this.item = function () {
                if (arguments.length == 1) {
                    return document.getElementById(A).item(arguments[0])
                } else if (arguments.length == 2) {
                    return document.getElementById(A).item(arguments[0], arguments[1])
                } else {
                    throw {
                        message: "An index is required!"
                    }
                }
            };
            this.namedItem = function (a) {
                return document.getElementById(A).namedItem(a)
            };
            this.multiple = function (a) {
                if (a == undefined) {
                    return t.get("multiple")
                } else {
                    t.set("multiple", a)
                }
            };
            this.size = function (a) {
                if (a == undefined) {
                    return t.get("size")
                } else {
                    t.set("size", a)
                }
            };
            this.addMyEvent = function (a, b) {
                t.onActions[a] = b
            };
            this.fireEvent = function (a) {
                eval(t.onActions[a])(t)
            };
            var bq = function () {
                    t.set("version", $.msDropDown.version);
                    t.set("author", $.msDropDown.author)
                };
            var br = function () {
                    M();
                    bm();
                    bq();
                    if (q.onInit != '') {
                        eval(q.onInit)(t)
                    }
                };
            br()
        };
    $.msDropDown = {
        version: 2.2,
        author: "Marghoob Suleman",
        create: function (a, b) {
            return $(a).msDropDown(b).data("dd")
        }
    };
    $.fn.extend({
        msDropDown: function (b) {
            return this.each(function () {
                var a = new bj(this, b);
                $(this).data('dd', a)
            })
        }
    })
})(jQuery);
