(function($) {
    $.extend({tablesorter:new
        function() {
            var parsers = [],widgets = [];
            this.defaults = {cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};
            function benchmark(s, d) {
                log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
            }

            this.benchmark = benchmark;
            function log(s) {
                if (typeof console != "undefined" && typeof console.debug != "undefined") {
                    console.log(s);
                } else {
                    alert(s);
                }
            }

            function buildParserCache(table, $headers) {
                if (table.config.debug) {
                    var parsersDebug = "";
                }
                if (table.tBodies.length == 0)return;
                var rows = table.tBodies[0].rows;
                if (rows[0]) {
                    var list = [],cells = rows[0].cells,l = cells.length;
                    for (var i = 0; i < l; i++) {
                        var p = false;
                        if ($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter)) {
                            p = getParserById($($headers[i]).metadata().sorter);
                        } else if ((table.config.headers[i] && table.config.headers[i].sorter)) {
                            p = getParserById(table.config.headers[i].sorter);
                        }
                        if (!p) {
                            p = detectParserForColumn(table, rows, -1, i);
                        }
                        if (table.config.debug) {
                            parsersDebug += "column:" + i + " parser:" + p.id + "\n";
                        }
                        list.push(p);
                    }
                }
                if (table.config.debug) {
                    log(parsersDebug);
                }
                return list;
            }

            ;
            function detectParserForColumn(table, rows, rowIndex, cellIndex) {
                var l = parsers.length,node = false,nodeValue = false,keepLooking = true;
                while (nodeValue == '' && keepLooking) {
                    rowIndex++;
                    if (rows[rowIndex]) {
                        node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex);
                        nodeValue = trimAndGetNodeText(table.config, node);
                        if (table.config.debug) {
                            log('Checking if value was empty on row:' + rowIndex);
                        }
                    } else {
                        keepLooking = false;
                    }
                }
                for (var i = 1; i < l; i++) {
                    if (parsers[i].is(nodeValue, table, node)) {
                        return parsers[i];
                    }
                }
                return parsers[0];
            }

            function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) {
                return rows[rowIndex].cells[cellIndex];
            }

            function trimAndGetNodeText(config, node) {
                return $.trim(getElementText(config, node));
            }

            function getParserById(name) {
                var l = parsers.length;
                for (var i = 0; i < l; i++) {
                    if (parsers[i].id.toLowerCase() == name.toLowerCase()) {
                        return parsers[i];
                    }
                }
                return false;
            }

            function buildCache(table) {
                if (table.config.debug) {
                    var cacheTime = new Date();
                }
                var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,parsers = table.config.parsers,cache = {row:[],normalized:[]};
                for (var i = 0; i < totalRows; ++i) {
                    var c = $(table.tBodies[0].rows[i]),cols = [];
                    if (c.hasClass(table.config.cssChildRow)) {
                        cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c);
                        continue;
                    }
                    cache.row.push(c);
                    for (var j = 0; j < totalCells; ++j) {
                        cols.push(parsers[j].format(getElementText(table.config, c[0].cells[j]), table, c[0].cells[j]));
                    }
                    cols.push(cache.normalized.length);
                    cache.normalized.push(cols);
                    cols = null;
                }
                ;
                if (table.config.debug) {
                    benchmark("Building cache for " + totalRows + " rows:", cacheTime);
                }
                return cache;
            }

            ;
            function getElementText(config, node) {
                var text = "";
                if (!node)return"";
                if (!config.supportsTextContent)config.supportsTextContent = node.textContent || false;
                if (config.textExtraction == "simple") {
                    if (config.supportsTextContent) {
                        text = node.textContent;
                    } else {
                        if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
                            text = node.childNodes[0].innerHTML;
                        } else {
                            text = node.innerHTML;
                        }
                    }
                } else {
                    if (typeof(config.textExtraction) == "function") {
                        text = config.textExtraction(node);
                    } else {
                        text = $(node).text();
                    }
                }
                return text;
            }

            function appendToTable(table, cache) {
                if (table.config.debug) {
                    var appendTime = new Date()
                }
                var c = cache,r = c.row,n = c.normalized,totalRows = n.length,checkCell = (n[0].length - 1),tableBody = $(table.tBodies[0]),rows = [];
                for (var i = 0; i < totalRows; i++) {
                    var pos = n[i][checkCell];
                    rows.push(r[pos]);
                    if (!table.config.appender) {
                        var l = r[pos].length;
                        for (var j = 0; j < l; j++) {
                            tableBody[0].appendChild(r[pos][j]);
                        }
                    }
                }
                if (table.config.appender) {
                    table.config.appender(table, rows);
                }
                rows = null;
                if (table.config.debug) {
                    benchmark("Rebuilt table:", appendTime);
                }
                applyWidget(table);
                setTimeout(function() {
                    $(table).trigger("sortEnd");
                }, 0);
            }

            ;
            function buildHeaders(table) {
                if (table.config.debug) {
                    var time = new Date();
                }
                var meta = ($.metadata) ? true : false;
                var header_index = computeTableHeaderCellIndexes(table);
                $tableHeaders = $(table.config.selectorHeaders, table).each(function(index) {
                    this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
                    this.order = formatSortingOrder(table.config.sortInitialOrder);
                    this.count = this.order;
                    if (checkHeaderMetadata(this) || checkHeaderOptions(table, index))this.sortDisabled = true;
                    if (checkHeaderOptionsSortingLocked(table, index))this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index);
                    if (!this.sortDisabled) {
                        var $th = $(this).addClass(table.config.cssHeader);
                        if (table.config.onRenderHeader)table.config.onRenderHeader.apply($th);
                    }
                    table.config.headerList[index] = this;
                });
                if (table.config.debug) {
                    benchmark("Built headers:", time);
                    log($tableHeaders);
                }
                return $tableHeaders;
            }

            ;
            function computeTableHeaderCellIndexes(t) {
                var matrix = [];
                var lookup = {};
                var thead = t.getElementsByTagName('THEAD')[0];
                var trs = thead.getElementsByTagName('TR');
                for (var i = 0; i < trs.length; i++) {
                    var cells = trs[i].cells;
                    for (var j = 0; j < cells.length; j++) {
                        var c = cells[j];
                        var rowIndex = c.parentNode.rowIndex;
                        var cellId = rowIndex + "-" + c.cellIndex;
                        var rowSpan = c.rowSpan || 1;
                        var colSpan = c.colSpan || 1
                        var firstAvailCol;
                        if (typeof(matrix[rowIndex]) == "undefined") {
                            matrix[rowIndex] = [];
                        }
                        for (var k = 0; k < matrix[rowIndex].length + 1; k++) {
                            if (typeof(matrix[rowIndex][k]) == "undefined") {
                                firstAvailCol = k;
                                break;
                            }
                        }
                        lookup[cellId] = firstAvailCol;
                        for (var k = rowIndex; k < rowIndex + rowSpan; k++) {
                            if (typeof(matrix[k]) == "undefined") {
                                matrix[k] = [];
                            }
                            var matrixrow = matrix[k];
                            for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) {
                                matrixrow[l] = "x";
                            }
                        }
                    }
                }
                return lookup;
            }

            function checkCellColSpan(table, rows, row) {
                var arr = [],r = table.tHead.rows,c = r[row].cells;
                for (var i = 0; i < c.length; i++) {
                    var cell = c[i];
                    if (cell.colSpan > 1) {
                        arr = arr.concat(checkCellColSpan(table, headerArr, row++));
                    } else {
                        if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) {
                            arr.push(cell);
                        }
                    }
                }
                return arr;
            }

            ;
            function checkHeaderMetadata(cell) {
                if (($.metadata) && ($(cell).metadata().sorter === false)) {
                    return true;
                }
                ;
                return false;
            }

            function checkHeaderOptions(table, i) {
                if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) {
                    return true;
                }
                ;
                return false;
            }

            function checkHeaderOptionsSortingLocked(table, i) {
                if ((table.config.headers[i]) && (table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;
                return false;
            }

            function applyWidget(table) {
                var c = table.config.widgets;
                var l = c.length;
                for (var i = 0; i < l; i++) {
                    getWidgetById(c[i]).format(table);
                }
            }

            function getWidgetById(name) {
                var l = widgets.length;
                for (var i = 0; i < l; i++) {
                    if (widgets[i].id.toLowerCase() == name.toLowerCase()) {
                        return widgets[i];
                    }
                }
            }

            ;
            function formatSortingOrder(v) {
                if (typeof(v) != "Number") {
                    return(v.toLowerCase() == "desc") ? 1 : 0;
                } else {
                    return(v == 1) ? 1 : 0;
                }
            }

            function isValueInArray(v, a) {
                var l = a.length;
                for (var i = 0; i < l; i++) {
                    if (a[i][0] == v) {
                        return true;
                    }
                }
                return false;
            }

            function setHeadersCss(table, $headers, list, css) {
                $headers.removeClass(css[0]).removeClass(css[1]);
                var h = [];
                $headers.each(function(offset) {
                    if (!this.sortDisabled) {
                        h[this.column] = $(this);
                    }
                });
                var l = list.length;
                for (var i = 0; i < l; i++) {
                    h[list[i][0]].addClass(css[list[i][1]]);
                }
            }

            function fixColumnWidth(table, $headers) {
                var c = table.config;
                if (c.widthFixed) {
                    var colgroup = $('<colgroup>');
                    $("tr:first td", table.tBodies[0]).each(function() {
                        colgroup.append($('<col>').css('width', $(this).width()));
                    });
                    $(table).prepend(colgroup);
                }
                ;
            }

            function updateHeaderSortCount(table, sortList) {
                var c = table.config,l = sortList.length;
                for (var i = 0; i < l; i++) {
                    var s = sortList[i],o = c.headerList[s[0]];
                    o.count = s[1];
                    o.count++;
                }
            }

            function multisort(table, sortList, cache) {
                if (table.config.debug) {
                    var sortTime = new Date();
                }
                var dynamicExp = "var sortWrapper = function(a,b) {",l = sortList.length;
                for (var i = 0; i < l; i++) {
                    var c = sortList[i][0];
                    var order = sortList[i][1];
                    var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c));
                    var e = "e" + i;
                    dynamicExp += "var " + e + " = " + s;
                    dynamicExp += "if(" + e + ") { return " + e + "; } ";
                    dynamicExp += "else { ";
                }
                var orgOrderCol = cache.normalized[0].length - 1;
                dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";
                for (var i = 0; i < l; i++) {
                    dynamicExp += "}; ";
                }
                dynamicExp += "return 0; ";
                dynamicExp += "}; ";
                if (table.config.debug) {
                    benchmark("Evaling expression:" + dynamicExp, new Date());
                }
                eval(dynamicExp);
                cache.normalized.sort(sortWrapper);
                if (table.config.debug) {
                    benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime);
                }
                return cache;
            }

            ;
            function makeSortFunction(type, direction, index) {
                var a = "a[" + index + "]",b = "b[" + index + "]";
                if (type == 'text' && direction == 'asc') {
                    return"(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));";
                } else if (type == 'text' && direction == 'desc') {
                    return"(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";
                } else if (type == 'numeric' && direction == 'asc') {
                    return"(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";
                } else if (type == 'numeric' && direction == 'desc') {
                    return"(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";
                }
            }

            ;
            function makeSortText(i) {
                return"((a[" + i + "] < b[" + i + "]) ? -1 : ((a[" + i + "] > b[" + i + "]) ? 1 : 0));";
            }

            ;
            function makeSortTextDesc(i) {
                return"((b[" + i + "] < a[" + i + "]) ? -1 : ((b[" + i + "] > a[" + i + "]) ? 1 : 0));";
            }

            ;
            function makeSortNumeric(i) {
                return"a[" + i + "]-b[" + i + "];";
            }

            ;
            function makeSortNumericDesc(i) {
                return"b[" + i + "]-a[" + i + "];";
            }

            ;
            function sortText(a, b) {
                if (table.config.sortLocaleCompare)return a.localeCompare(b);
                return((a < b) ? -1 : ((a > b) ? 1 : 0));
            }

            ;
            function sortTextDesc(a, b) {
                if (table.config.sortLocaleCompare)return b.localeCompare(a);
                return((b < a) ? -1 : ((b > a) ? 1 : 0));
            }

            ;
            function sortNumeric(a, b) {
                return a - b;
            }

            ;
            function sortNumericDesc(a, b) {
                return b - a;
            }

            ;
            function getCachedSortType(parsers, i) {
                return parsers[i].type;
            }

            ;
            this.construct = function(settings) {
                return this.each(function() {
                    if (!this.tHead || !this.tBodies)return;
                    var $this,$document,$headers,cache,config,shiftDown = 0,sortOrder;
                    this.config = {};
                    config = $.extend(this.config, $.tablesorter.defaults, settings);
                    $this = $(this);
                    $.data(this, "tablesorter", config);
                    $headers = buildHeaders(this);
                    this.config.parsers = buildParserCache(this, $headers);
                    cache = buildCache(this);
                    var sortCSS = [config.cssDesc,config.cssAsc];
                    fixColumnWidth(this);
                    $headers.click(
                        function(e) {
                            var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
                            if (!this.sortDisabled && totalRows > 0) {
                                $this.trigger("sortStart");
                                var $cell = $(this);
                                var i = this.column;
                                this.order = this.count++ % 2;
                                if (this.lockedOrder)this.order = this.lockedOrder;
                                if (!e[config.sortMultiSortKey]) {
                                    config.sortList = [];
                                    if (config.sortForce != null) {
                                        var a = config.sortForce;
                                        for (var j = 0; j < a.length; j++) {
                                            if (a[j][0] != i) {
                                                config.sortList.push(a[j]);
                                            }
                                        }
                                    }
                                    config.sortList.push([i,this.order]);
                                } else {
                                    if (isValueInArray(i, config.sortList)) {
                                        for (var j = 0; j < config.sortList.length; j++) {
                                            var s = config.sortList[j],o = config.headerList[s[0]];
                                            if (s[0] == i) {
                                                o.count = s[1];
                                                o.count++;
                                                s[1] = o.count % 2;
                                            }
                                        }
                                    } else {
                                        config.sortList.push([i,this.order]);
                                    }
                                }
                                ;
                                setTimeout(function() {
                                    setHeadersCss($this[0], $headers, config.sortList, sortCSS);
                                    appendToTable($this[0], multisort($this[0], config.sortList, cache));
                                }, 1);
                                return false;
                            }
                        }).mousedown(function() {
                        if (config.cancelSelection) {
                            this.onselectstart = function() {
                                return false
                            };
                            return false;
                        }
                    });
                    $this.bind("update",
                        function() {
                            var me = this;
                            setTimeout(function() {
                                me.config.parsers = buildParserCache(me, $headers);
                                cache = buildCache(me);
                            }, 1);
                        }).bind("updateCell",
                        function(e, cell) {
                            var config = this.config;
                            var pos = [(cell.parentNode.rowIndex - 1),cell.cellIndex];
                            cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(getElementText(config, cell), cell);
                        }).bind("sorton",
                        function(e, list) {
                            $(this).trigger("sortStart");
                            config.sortList = list;
                            var sortList = config.sortList;
                            updateHeaderSortCount(this, sortList);
                            setHeadersCss(this, $headers, sortList, sortCSS);
                            appendToTable(this, multisort(this, sortList, cache));
                        }).bind("appendCache",
                        function() {
                            appendToTable(this, cache);
                        }).bind("applyWidgetId",
                        function(e, id) {
                            getWidgetById(id).format(this);
                        }).bind("applyWidgets", function() {
                        applyWidget(this);
                    });
                    if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
                        config.sortList = $(this).metadata().sortlist;
                    }
                    if (config.sortList.length > 0) {
                        $this.trigger("sorton", [config.sortList]);
                    }
                    applyWidget(this);
                });
            };
            this.addParser = function(parser) {
                var l = parsers.length,a = true;
                for (var i = 0; i < l; i++) {
                    if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {
                        a = false;
                    }
                }
                if (a) {
                    parsers.push(parser);
                }
                ;
            };
            this.addWidget = function(widget) {
                widgets.push(widget);
            };
            this.formatFloat = function(s) {
                var i = parseFloat(s);
                return(isNaN(i)) ? 0 : i;
            };
            this.formatInt = function(s) {
                var i = parseInt(s);
                return(isNaN(i)) ? 0 : i;
            };
            this.isDigit = function(s, config) {
                return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, '')));
            };
            this.clearTableBody = function(table) {
                if ($.browser.msie) {
                    function empty() {
                        while (this.firstChild)this.removeChild(this.firstChild);
                    }

                    empty.apply(table.tBodies[0]);
                } else {
                    table.tBodies[0].innerHTML = "";
                }
            };
        }});
    $.fn.extend({tablesorter:$.tablesorter.construct});
    var ts = $.tablesorter;
    ts.addParser({id:"text",is:function(s) {
        return true;
    },format:function(s) {
        return $.trim(s.toLocaleLowerCase());
    },type:"text"});
    ts.addParser({id:"digit",is:function(s, table) {
        var c = table.config;
        return $.tablesorter.isDigit(s, c);
    },format:function(s) {
        return $.tablesorter.formatFloat(s);
    },type:"numeric"});
    ts.addParser({id:"currency",is:function(s) {
        return/^[Â£$â‚¬?.]/.test(s);
    },format:function(s) {
        return $.tablesorter.formatFloat(s.replace(new RegExp(/[Â£$â‚¬]/g), ""));
    },type:"numeric"});
    ts.addParser({id:"ipAddress",is:function(s) {
        return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);
    },format:function(s) {
        var a = s.split("."),r = "",l = a.length;
        for (var i = 0; i < l; i++) {
            var item = a[i];
            if (item.length == 2) {
                r += "0" + item;
            } else {
                r += item;
            }
        }
        return $.tablesorter.formatFloat(r);
    },type:"numeric"});
    ts.addParser({id:"url",is:function(s) {
        return/^(https?|ftp|file):\/\/$/.test(s);
    },format:function(s) {
        return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), ''));
    },type:"text"});
    ts.addParser({id:"isoDate",is:function(s) {
        return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);
    },format:function(s) {
        return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(new RegExp(/-/g), "/")).getTime() : "0");
    },type:"numeric"});
    ts.addParser({id:"percent",is:function(s) {
        return/\%$/.test($.trim(s));
    },format:function(s) {
        return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""));
    },type:"numeric"});
    ts.addParser({id:"usLongDate",is:function(s) {
        return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));
    },format:function(s) {
        return $.tablesorter.formatFloat(new Date(s).getTime());
    },type:"numeric"});
    ts.addParser({id:"shortDate",is:function(s) {
        return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);
    },format:function(s, table) {
        var c = table.config;
        s = s.replace(/\-/g, "/");
        if (c.dateFormat == "us") {
            s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");
        } else if (c.dateFormat == "uk") {
            s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
        } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
            s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
        }
        return $.tablesorter.formatFloat(new Date(s).getTime());
    },type:"numeric"});
    ts.addParser({id:"time",is:function(s) {
        return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);
    },format:function(s) {
        return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
    },type:"numeric"});
    ts.addParser({id:"metadata",is:function(s) {
        return false;
    },format:function(s, table, cell) {
        var c = table.config,p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;
        return $(cell).metadata()[p];
    },type:"numeric"});
    ts.addWidget({id:"zebra",format:function(table) {
        if (table.config.debug) {
            var time = new Date();
        }
        var $tr,row = -1,odd;
        $("tr:visible", table.tBodies[0]).each(function(i) {
            $tr = $(this);
            if (!$tr.hasClass(table.config.cssChildRow))row++;
            odd = (row % 2 == 0);
            $tr.removeClass(table.config.widgetZebra.css[odd ? 0 : 1]).addClass(table.config.widgetZebra.css[odd ? 1 : 0])
        });
        if (table.config.debug) {
            $.tablesorter.benchmark("Applying Zebra widget", time);
        }
    }});
})(jQuery);


/** autoComplete **/
(function($) {
    $.fn.extend({autocomplete:function(urlOrData, options) {
        var isUrl = typeof urlOrData == "string";
        options = $.extend({}, $.Autocompleter.defaults, {url:isUrl ? urlOrData : null,data:isUrl ? null : urlOrData,delay:isUrl ? $.Autocompleter.defaults.delay : 10,max:options && !options.scroll ? 10 : 150}, options);
        options.highlight = options.highlight || function(value) {
            return value;
        };
        options.formatMatch = options.formatMatch || options.formatItem;
        return this.each(function() {
            new $.Autocompleter(this, options);
        });
    },result:function(handler) {
        return this.bind("result", handler);
    },search:function(handler) {
        return this.trigger("search", [handler]);
    },flushCache:function() {
        return this.trigger("flushCache");
    },setOptions:function(options) {
        return this.trigger("setOptions", [options]);
    },unautocomplete:function() {
        return this.trigger("unautocomplete");
    }});
    $.Autocompleter = function(input, options) {
        var KEY = {UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};
        var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
        var timeout;
        var previousValue = "";
        var cache = $.Autocompleter.Cache(options);
        var hasFocus = 0;
        var lastKeyPressCode;
        var config = {mouseDownOnSelect:false};
        var select = $.Autocompleter.Select(options, input, selectCurrent, config);
        var blockSubmit;
        $.browser.opera && $(input.form).bind("submit.autocomplete", function() {
            if (blockSubmit) {
                blockSubmit = false;
                return false;
            }
        });
        $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete",
            function(event) {
                lastKeyPressCode = event.keyCode;
                switch (event.keyCode) {
                    case KEY.UP:
                        event.preventDefault();
                        if (select.visible()) {
                            select.prev();
                        } else {
                            onChange(0, true);
                        }
                        break;
                    case KEY.DOWN:
                        event.preventDefault();
                        if (select.visible()) {
                            select.next();
                        } else {
                            onChange(0, true);
                        }
                        break;
                    case KEY.PAGEUP:
                        event.preventDefault();
                        if (select.visible()) {
                            select.pageUp();
                        } else {
                            onChange(0, true);
                        }
                        break;
                    case KEY.PAGEDOWN:
                        event.preventDefault();
                        if (select.visible()) {
                            select.pageDown();
                        } else {
                            onChange(0, true);
                        }
                        break;
                    case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
                    case KEY.TAB:
                    case KEY.RETURN:
                        if (selectCurrent()) {
                            event.preventDefault();
                            blockSubmit = true;
                            return false;
                        }
                        break;
                    case KEY.ESC:
                        select.hide();
                        break;
                    default:
                        clearTimeout(timeout);
                        timeout = setTimeout(onChange, options.delay);
                        break;
                }
            }).focus(
            function() {
                hasFocus++;
            }).blur(
            function() {
                hasFocus = 0;
                if (!config.mouseDownOnSelect) {
                    hideResults();
                }
            }).click(
            function() {
                if (hasFocus++ > 1 && !select.visible()) {
                    onChange(0, true);
                }
            }).bind("search",
            function() {
                var fn = (arguments.length > 1) ? arguments[1] : null;

                function findValueCallback(q, data) {
                    var result;
                    if (data && data.length) {
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].result.toLowerCase() == q.toLowerCase()) {
                                result = data[i];
                                break;
                            }
                        }
                    }
                    if (typeof fn == "function")fn(result); else $input.trigger("result", result && [result.data,result.value]);
                }

                $.each(trimWords($input.val()), function(i, value) {
                    request(value, findValueCallback, findValueCallback);
                });
            }).bind("flushCache",
            function() {
                cache.flush();
            }).bind("setOptions",
            function() {
                $.extend(options, arguments[1]);
                if ("data"in arguments[1])
                    cache.populate();
            }).bind("unautocomplete", function() {
                select.unbind();
                $input.unbind();
                $(input.form).unbind(".autocomplete");
            });
        function selectCurrent() {
            var selected = select.selected();
            if (!selected)
                return false;
            var v = selected.result;
            previousValue = v;
            if (options.multiple) {
                var words = trimWords($input.val());
                if (words.length > 1) {
                    v = words.slice(0, words.length - 1).join(options.multipleSeparator) + options.multipleSeparator + v;
                }
                v += options.multipleSeparator;
            }
            $input.val(v);
            hideResultsNow();
            $input.trigger("result", [selected.data,selected.value]);
            return true;
        }

        function onChange(crap, skipPrevCheck) {
            if (lastKeyPressCode == KEY.DEL) {
                select.hide();
                return;
            }
            var currentValue = $input.val();
            if (!skipPrevCheck && currentValue == previousValue)
                return;
            previousValue = currentValue;
            currentValue = lastWord(currentValue);
            if (currentValue.length >= options.minChars) {
                $input.addClass(options.loadingClass);
                if (!options.matchCase)
                    currentValue = currentValue.toLowerCase();
                request(currentValue, receiveData, hideResultsNow);
            } else {
                stopLoading();
                select.hide();
            }
        }

        ;
        function trimWords(value) {
            if (!value) {
                return[""];
            }
            var words = value.split(options.multipleSeparator);
            var result = [];
            $.each(words, function(i, value) {
                if ($.trim(value))
                    result[i] = $.trim(value);
            });
            return result;
        }

        function lastWord(value) {
            if (!options.multiple)
                return value;
            var words = trimWords(value);
            return words[words.length - 1];
        }

        function autoFill(q, sValue) {
            if (options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE) {
                $input.val($input.val() + sValue.substring(lastWord(previousValue).length));
                $.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
            }
        }

        ;
        function hideResults() {
            clearTimeout(timeout);
            timeout = setTimeout(hideResultsNow, 200);
        }

        ;
        function hideResultsNow() {
            var wasVisible = select.visible();
            select.hide();
            clearTimeout(timeout);
            stopLoading();
            if (options.mustMatch) {
                $input.search(function(result) {
                    if (!result) {
                        if (options.multiple) {
                            var words = trimWords($input.val()).slice(0, -1);
                            $input.val(words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : ""));
                        }
                        else
                            $input.val("");
                    }
                });
            }
            if (wasVisible)
                $.Autocompleter.Selection(input, input.value.length, input.value.length);
        }

        ;
        function receiveData(q, data) {
            if (data && data.length && hasFocus) {
                stopLoading();
                select.display(data, q);
                autoFill(q, data[0].value);
                select.show();
            } else {
                hideResultsNow();
            }
        }

        ;
        function request(term, success, failure) {
            if (!options.matchCase)
                term = term.toLowerCase();
            var data = cache.load(term);
            if (data && data.length) {
                success(term, data);
            } else if ((typeof options.url == "string") && (options.url.length > 0)) {
                var extraParams = {timestamp:+new Date()};
                $.each(options.extraParams, function(key, param) {
                    extraParams[key] = typeof param == "function" ? param() : param;
                });
                $.ajax({mode:"abort",port:"autocomplete" + input.name,dataType:options.dataType,url:options.url,data:$.extend({q:lastWord(term),limit:options.max}, extraParams),success:function(data) {
                    var parsed = options.parse && options.parse(data) || parse(data);
                    cache.add(term, parsed);
                    success(term, parsed);
                }});
            } else {
                select.emptyList();
                failure(term);
            }
        }

        ;
        function parse(data) {
            var parsed = [];
            var rows = data.split("\n");
            for (var i = 0; i < rows.length; i++) {
                var row = $.trim(rows[i]);
                if (row) {
                    row = row.split("|");
                    parsed[parsed.length] = {data:row,value:row[0],result:options.formatResult && options.formatResult(row, row[0]) || row[0]};
                }
            }
            return parsed;
        }

        ;
        function stopLoading() {
            $input.removeClass(options.loadingClass);
        }

        ;
    };
    $.Autocompleter.defaults = {inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(row) {
        return row[0];
    },formatMatch:null,autoFill:false,width:"15em",multiple:false,multipleSeparator:", ",highlight:function(value, term) {
        return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
    },scroll:true,scrollHeight:180};
    $.Autocompleter.Cache = function(options) {
        var data = {};
        var length = 0;

        function matchSubset(s, sub) {
            if (!options.matchCase)
                s = s.toLowerCase();
            var i = s.indexOf(sub);
            if (i == -1)return false;
            return i == 0 || options.matchContains;
        }

        ;
        function add(q, value) {
            if (length > options.cacheLength) {
                flush();
            }
            if (!data[q]) {
                length++;
            }
            data[q] = value;
        }

        function populate() {
            if (!options.data)return false;
            var stMatchSets = {},nullData = 0;
            if (!options.url)options.cacheLength = 1;
            stMatchSets[""] = [];
            for (var i = 0,ol = options.data.length; i < ol; i++) {
                var rawValue = options.data[i];
                rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
                var value = options.formatMatch(rawValue, i + 1, options.data.length);
                if (value === false)
                    continue;
                var firstChar = value.charAt(0).toLowerCase();
                if (!stMatchSets[firstChar])
                    stMatchSets[firstChar] = [];
                var row = {value:value,data:rawValue,result:options.formatResult && options.formatResult(rawValue) || value};
                stMatchSets[firstChar].push(row);
                if (nullData++ < options.max) {
                    stMatchSets[""].push(row);
                }
            }
            ;
            $.each(stMatchSets, function(i, value) {
                options.cacheLength++;
                add(i, value);
            });
        }

        setTimeout(populate, 25);
        function flush() {
            data = {};
            length = 0;
        }

        return{flush:flush,add:add,populate:populate,load:function(q) {
            if (!options.cacheLength || !length)
                return null;
            if (!options.url && options.matchContains) {
                var csub = [];
                for (var k in data) {
                    if (k.length > 0) {
                        var c = data[k];
                        $.each(c, function(i, x) {
                            if (matchSubset(x.value, q)) {
                                csub.push(x);
                            }
                        });
                    }
                }
                return csub;
            } else
            if (data[q]) {
                return data[q];
            } else
            if (options.matchSubset) {
                for (var i = q.length - 1; i >= options.minChars; i--) {
                    var c = data[q.substr(0, i)];
                    if (c) {
                        var csub = [];
                        $.each(c, function(i, x) {
                            if (matchSubset(x.value, q)) {
                                csub[csub.length] = x;
                            }
                        });
                        return csub;
                    }
                }
            }
            return null;
        }};
    };
    $.Autocompleter.Select = function(options, input, select, config) {
        var CLASSES = {ACTIVE:"ac_over"};
        var listItems,active = -1,data,term = "",needsInit = true,element,list;

        function init() {
            if (!needsInit)
                return;
            element = $("<div/>").hide().addClass(options.resultsClass).css("position", "absolute").appendTo(document.body);
            list = $("<ul/>").appendTo(element).mouseover(
                function(event) {
                    if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
                        active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
                        $(target(event)).addClass(CLASSES.ACTIVE);
                    }
                }).click(
                function(event) {
                    $(target(event)).addClass(CLASSES.ACTIVE);
                    select();
                    input.focus();
                    return false;
                }).mousedown(
                function() {
                    config.mouseDownOnSelect = true;
                }).mouseup(function() {
                config.mouseDownOnSelect = false;
            });
            if (options.width > 0)
                element.css("width", options.width);
            needsInit = false;
        }

        function target(event) {
            var element = event.target;
            while (element && element.tagName != "LI")
                element = element.parentNode;
            if (!element)
                return[];
            return element;
        }

        function moveSelect(step) {
            listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
            movePosition(step);
            var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
            if (options.scroll) {
                var offset = 0;
                listItems.slice(0, active).each(function() {
                    offset += this.offsetHeight;
                });
                if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
                    list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
                } else if (offset < list.scrollTop()) {
                    list.scrollTop(offset);
                }
            }
        }

        ;
        function movePosition(step) {
            active += step;
            if (active < 0) {
                active = listItems.size() - 1;
            } else if (active >= listItems.size()) {
                active = 0;
            }
        }

        function limitNumberOfItems(available) {
            return options.max && options.max < available ? options.max : available;
        }

        function fillList() {
            list.empty();
            var max = limitNumberOfItems(data.length);
            for (var i = 0; i < max; i++) {
                if (!data[i])
                    continue;
                var formatted = options.formatItem(data[i].data, i + 1, max, data[i].value, term);
                if (formatted === false)
                    continue;
                var li = $("<li/>").html(options.highlight(formatted, term)).addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
                $.data(li, "ac_data", data[i]);
            }
            listItems = list.find("li");
            if (options.selectFirst) {
                listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
                active = 0;
            }
            if ($.fn.bgiframe)
                list.bgiframe();
        }

        return{display:function(d, q) {
            init();
            data = d;
            term = q;
            fillList();
        },next:function() {
            moveSelect(1);
        },prev:function() {
            moveSelect(-1);
        },pageUp:function() {
            if (active != 0 && active - 8 < 0) {
                moveSelect(-active);
            } else {
                moveSelect(-8);
            }
        },pageDown:function() {
            if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
                moveSelect(listItems.size() - 1 - active);
            } else {
                moveSelect(8);
            }
        },hide:function() {
            element && element.hide();
            listItems && listItems.removeClass(CLASSES.ACTIVE);
            active = -1;
        },visible:function() {
            return element && element.is(":visible");
        },current:function() {
            return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
        },show:function() {
            var offset = $(input).offset();
            element.css({width:typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),top:offset.top + input.offsetHeight,left:offset.left}).show();
            if (options.scroll) {
                list.scrollTop(0);
                list.css({maxHeight:options.scrollHeight,overflow:'auto'});
                if ($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
                    var listHeight = 0;
                    listItems.each(function() {
                        listHeight += this.offsetHeight;
                    });
                    var scrollbarsVisible = listHeight > options.scrollHeight;
                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight);
                    if (!scrollbarsVisible) {
                        listItems.width(list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")));
                    }
                }
            }
        },selected:function() {
            var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
            return selected && selected.length && $.data(selected[0], "ac_data");
        },emptyList:function() {
            list && list.empty();
        },unbind:function() {
            element && element.remove();
        }};
    };
    $.Autocompleter.Selection = function(field, start, end) {
        if (field.createTextRange) {
            var selRange = field.createTextRange();
            selRange.collapse(true);
            selRange.moveStart("character", start);
            selRange.moveEnd("character", end);
            selRange.select();
        } else if (field.setSelectionRange) {
            field.setSelectionRange(start, end);
        } else {
            if (field.selectionStart) {
                field.selectionStart = start;
                field.selectionEnd = end;
            }
        }
        field.focus();
    };
})(jQuery);


/** Cookie **/
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') {
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString();
        }
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');
    } else {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};


/** flashReplace **/
var FlashReplace = {elmToReplace:null,flashIsInstalled:null,defaultFlashVersion:7,replace:function(elmToReplace, src, id, width, height, version, params) {
    this.elmToReplace = document.getElementById(elmToReplace);
    this.flashIsInstalled = this.checkForFlash(version || this.defaultFlashVersion);
    if (this.elmToReplace && this.flashIsInstalled) {
        var obj = '<object' + ((window.ActiveXObject) ? ' id="' + id + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" data="' + src + '"' : '');
        obj += ' width="' + width + '"';
        obj += ' height="' + height + '"';
        obj += '>';
        var param = '<param';
        param += ' name="movie"';
        param += ' value="' + src + '"';
        param += '>';
        param += '';
        var extraParams = '';
        var extraAttributes = '';
        for (var i in params) {
            extraParams += '<param name="' + i + '" value="' + params[i] + '">';
            extraAttributes += ' ' + i + '="' + params[i] + '"';
        }
        var embed = '<embed id="' + id + '" src="' + src + '" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"';
        var embedEnd = extraAttributes + '></embed>';
        var objEnd = '</object>';
        this.elmToReplace.innerHTML = obj + param + extraParams + embed + embedEnd + objEnd;
    }
},checkForFlash:function(version) {
    this.flashIsInstalled = false;
    var flash;
    if (window.ActiveXObject) {
        try {
            flash = new ActiveXObject(("ShockwaveFlash.ShockwaveFlash." + version));
            this.flashIsInstalled = true;
        }
        catch(e) {
        }
    }
    else if (navigator.plugins && navigator.mimeTypes.length > 0) {
        flash = navigator.plugins["Shockwave Flash"];
        if (flash) {
            var flashVersion = navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1");
            if (flashVersion >= version) {
                this.flashIsInstalled = true;
            }
        }
    }
    return this.flashIsInstalled;
}};


/** shadowBox **/
if (typeof jQuery == 'undefined') {
    throw'Unable to load Shadowbox, jQuery library not found';
}
var Shadowbox = {};
Shadowbox.lib = {adapter:'jquery',getStyle:function(el, style) {
    return jQuery(el).css(style);
},setStyle:function(el, style, value) {
    if (typeof style != 'object') {
        var temp = {};
        temp[style] = value;
        style = temp;
    }
    jQuery(el).css(style);
},get:function(el) {
    return(typeof el == 'string') ? document.getElementById(el) : el;
},remove:function(el) {
    jQuery(el).remove();
},getTarget:function(e) {
    return e.target;
},getPageXY:function(e) {
    return[e.pageX,e.pageY];
},preventDefault:function(e) {
    e.preventDefault();
},keyCode:function(e) {
    return e.keyCode;
},addEvent:function(el, name, handler) {
    jQuery(el).bind(name, handler);
},removeEvent:function(el, name, handler) {
    jQuery(el).unbind(name, handler);
},append:function(el, html) {
    jQuery(el).append(html);
}};
(function($) {
    $.fn.shadowbox = function(options) {
        return this.each(function() {
            var $this = $(this);
            var opts = $.extend({}, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {});
            var cls = this.className || '';
            opts.width = parseInt((cls.match(/w:(\d+)/) || [])[1]) || opts.width;
            opts.height = parseInt((cls.match(/h:(\d+)/) || [])[1]) || opts.height;
            Shadowbox.setup($this, opts);
        });
    };
})(jQuery);
if (typeof Shadowbox == 'undefined') {
    throw'Unable to load Shadowbox, no base library adapter found';
}
(function() {
    var version = '2.0';
    var options = {animate:true,animateFade:true,animSequence:'wh',flvPlayer:'flvplayer.swf',modal:false,overlayColor:'#000',overlayOpacity:0.8,flashBgColor:'#000000',autoplayMovies:true,showMovieControls:true,slideshowDelay:0,resizeDuration:0.55,fadeDuration:0.35,displayNav:true,continuous:false,displayCounter:true,counterType:'default',counterLimit:10,viewportPadding:20,handleOversize:'resize',handleException:null,handleUnsupported:'link',initialHeight:160,initialWidth:320,enableKeys:true,onOpen:null,onFinish:null,onChange:null,onClose:null,skipSetup:false,errors:{fla:{name:'Flash',url:'http://www.adobe.com/products/flashplayer/'},qt:{name:'QuickTime',url:'http://www.apple.com/quicktime/download/'},wmp:{name:'Windows Media Player',url:'http://www.microsoft.com/windows/windowsmedia/'},f4m:{name:'Flip4Mac',url:'http://www.flip4mac.com/wmv_download.htm'}},ext:{img:['png','jpg','jpeg','gif','bmp'],swf:['swf'],flv:['flv'],qt:['dv','mov','moov','movie','mp4'],wmp:['asf','wm','wmv'],qtwmp:['avi','mpg','mpeg'],iframe:['asp','aspx','cgi','cfm','htm','html','pl','php','php3','php4','php5','phtml','rb','rhtml','shtml','txt','vbs']}};
    var SB = Shadowbox;
    var SL = SB.lib;
    var default_options;
    var RE = {domain:/:\/\/(.*?)[:\/]/,inline:/#(.+)$/,rel:/^(light|shadow)box/i,gallery:/^(light|shadow)box\[(.*?)\]/i,unsupported:/^unsupported-(\w+)/,param:/\s*([a-z_]*?)\s*=\s*(.+)\s*/,empty:/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i};
    var cache = [];
    var gallery;
    var current;
    var content;
    var content_id = 'shadowbox_content';
    var dims;
    var initialized = false;
    var activated = false;
    var slide_timer;
    var slide_start;
    var slide_delay = 0;
    var ua = navigator.userAgent.toLowerCase();
    var client = {isStrict:document.compatMode == 'CSS1Compat',isOpera:ua.indexOf('opera') > -1,isIE:ua.indexOf('msie') > -1,isIE7:ua.indexOf('msie 7') > -1,isSafari:/webkit|khtml/.test(ua),isWindows:ua.indexOf('windows') != -1 || ua.indexOf('win32') != -1,isMac:ua.indexOf('macintosh') != -1 || ua.indexOf('mac os x') != -1,isLinux:ua.indexOf('linux') != -1};
    client.isBorderBox = client.isIE && !client.isStrict;
    client.isSafari3 = client.isSafari && !!(document.evaluate);
    client.isGecko = ua.indexOf('gecko') != -1 && !client.isSafari;
    var ltIE7 = client.isIE && !client.isIE7;
    var plugins;
    if (navigator.plugins && navigator.plugins.length) {
        var detectPlugin = function(plugin_name) {
            var detected = false;
            for (var i = 0,len = navigator.plugins.length; i < len; ++i) {
                if (navigator.plugins[i].name.indexOf(plugin_name) > -1) {
                    detected = true;
                    break;
                }
            }
            return detected;
        };
        var f4m = detectPlugin('Flip4Mac');
        plugins = {fla:detectPlugin('Shockwave Flash'),qt:detectPlugin('QuickTime'),wmp:!f4m && detectPlugin('Windows Media'),f4m:f4m};
    } else {
        var detectPlugin = function(plugin_name) {
            var detected = false;
            try {
                var axo = new ActiveXObject(plugin_name);
                if (axo)detected = true;
            } catch(e) {
            }
            return detected;
        };
        plugins = {fla:detectPlugin('ShockwaveFlash.ShockwaveFlash'),qt:detectPlugin('QuickTime.QuickTime'),wmp:detectPlugin('wmplayer.ocx'),f4m:false};
    }
    var apply = function(o, e) {
        for (var p in e)o[p] = e[p];
        return o;
    };
    var isLink = function(el) {
        return el && typeof el.tagName == 'string' && (el.tagName.toUpperCase() == 'A' || el.tagName.toUpperCase() == 'AREA');
    };
    SL.getViewportHeight = function() {
        var h = window.innerHeight;
        var mode = document.compatMode;
        if ((mode || client.isIE) && !client.isOpera) {
            h = client.isStrict ? document.documentElement.clientHeight : document.body.clientHeight;
        }
        return h;
    };
    SL.getViewportWidth = function() {
        var w = window.innerWidth;
        var mode = document.compatMode;
        if (mode || client.isIE) {
            w = client.isStrict ? document.documentElement.clientWidth : document.body.clientWidth;
        }
        return w;
    };
    SL.createHTML = function(obj) {
        var html = '<' + obj.tag;
        for (var attr in obj) {
            if (attr == 'tag' || attr == 'html' || attr == 'children')continue;
            if (attr == 'cls') {
                html += ' class="' + obj['cls'] + '"';
            } else {
                html += ' ' + attr + '="' + obj[attr] + '"';
            }
        }
        if (RE.empty.test(obj.tag)) {
            html += '/>';
        } else {
            html += '>';
            var cn = obj.children;
            if (cn) {
                for (var i = 0,len = cn.length; i < len; ++i) {
                    html += this.createHTML(cn[i]);
                }
            }
            if (obj.html)html += obj.html;
            html += '</' + obj.tag + '>';
        }
        return html;
    };
    var ease = function(x) {
        return 1 + Math.pow(x - 1, 3);
    };
    var animate = function(el, p, to, d, cb) {
        var from = parseFloat(SL.getStyle(el, p));
        if (isNaN(from))from = 0;
        if (from == to) {
            if (typeof cb == 'function')cb();
            return;
        }
        var delta = to - from;
        var op = p == 'opacity';
        var unit = op ? '' : 'px';
        var fn = function(ease) {
            SL.setStyle(el, p, from + ease * delta + unit);
        };
        if (!options.animate && !op || op && !options.animateFade) {
            fn(1);
            if (typeof cb == 'function')cb();
            return;
        }
        d *= 1000;
        var begin = new Date().getTime();
        var end = begin + d;
        var timer = setInterval(function() {
            var time = new Date().getTime();
            if (time >= end) {
                clearInterval(timer);
                fn(1);
                if (typeof cb == 'function')cb();
            } else {
                fn(ease((time - begin) / d));
            }
        }, 10);
    };
    var clearOpacity = function(el) {
        var s = el.style;
        if (client.isIE) {
            if (typeof s.filter == 'string' && (/alpha/i).test(s.filter)) {
                s.filter = s.filter.replace(/[\w\.]*alpha\(.*?\);?/i, '');
            }
        } else {
            s.opacity = '';
            s['-moz-opacity'] = '';
            s['-khtml-opacity'] = '';
        }
    };
    var getComputedHeight = function(el) {
        var h = Math.max(el.offsetHeight, el.clientHeight);
        if (!h) {
            h = parseInt(SL.getStyle(el, 'height'), 10);
            if (!client.isBorderBox) {
                h += parseInt(SL.getStyle(el, 'padding-top'), 10)
                    + parseInt(SL.getStyle(el, 'padding-bottom'), 10)
                    + parseInt(SL.getStyle(el, 'border-top-width'), 10)
                    + parseInt(SL.getStyle(el, 'border-bottom-width'), 10);
            }
        }
        return h;
    };
    var getPlayer = function(url) {
        var m = url.match(RE.domain);
        var d = m && document.domain == m[1];
        if (url.indexOf('#') > -1 && d)return'inline';
        var q = url.indexOf('?');
        if (q > -1)url = url.substring(0, q);
        if (RE.img.test(url))return'img';
        if (RE.swf.test(url))return plugins.fla ? 'swf' : 'unsupported-swf';
        if (RE.flv.test(url))return plugins.fla ? 'flv' : 'unsupported-flv';
        if (RE.qt.test(url))return plugins.qt ? 'qt' : 'unsupported-qt';
        if (RE.wmp.test(url)) {
            if (plugins.wmp)return'wmp';
            if (plugins.f4m)return'qt';
            if (client.isMac)return plugins.qt ? 'unsupported-f4m' : 'unsupported-qtf4m';
            return'unsupported-wmp';
        } else if (RE.qtwmp.test(url)) {
            if (plugins.qt)return'qt';
            if (plugins.wmp)return'wmp';
            return client.isMac ? 'unsupported-qt' : 'unsupported-qtwmp';
        } else if (!d || RE.iframe.test(url)) {
            return'iframe';
        }
        return'unsupported';
    };
    var handleClick = function(ev) {
        var link;
        if (isLink(this)) {
            link = this;
        } else {
            link = SL.getTarget(ev);
            while (!isLink(link) && link.parentNode) {
                link = link.parentNode;
            }
        }
        if (link) {
            SB.open(link);
            if (gallery.length)SL.preventDefault(ev);
        }
    };
    var toggleNav = function(id, on) {
        var el = SL.get('shadowbox_nav_' + id);
        if (el)el.style.display = on ? '' : 'none';
    };
    var buildBars = function(cb) {
        var obj = gallery[current];
        var title_i = SL.get('shadowbox_title_inner');
        title_i.innerHTML = obj.title || '';
        var nav = SL.get('shadowbox_nav');
        if (nav) {
            var c,n,pl,pa,p;
            if (options.displayNav) {
                c = true;
                var len = gallery.length;
                if (len > 1) {
                    if (options.continuous) {
                        n = p = true;
                    } else {
                        n = (len - 1) > current;
                        p = current > 0;
                    }
                }
                if (options.slideshowDelay > 0 && hasNext()) {
                    pa = slide_timer != 'paused';
                    pl = !pa;
                }
            } else {
                c = n = pl = pa = p = false;
            }
            toggleNav('close', c);
            toggleNav('next', n);
            toggleNav('play', pl);
            toggleNav('pause', pa);
            toggleNav('previous', p);
        }
        var counter = SL.get('shadowbox_counter');
        if (counter) {
            var co = '';
            if (options.displayCounter && gallery.length > 1) {
                if (options.counterType == 'skip') {
                    var i = 0,len = gallery.length,end = len;
                    var limit = parseInt(options.counterLimit);
                    if (limit < len) {
                        var h = Math.round(limit / 2);
                        i = current - h;
                        if (i < 0)i += len;
                        end = current + (limit - h);
                        if (end > len)end -= len;
                    }
                    while (i != end) {
                        if (i == len)i = 0;
                        co += '<a onclick="Shadowbox.change(' + i + ');"';
                        if (i == current)co += ' class="shadowbox_counter_current"';
                        co += '>' + (++i) + '</a>';
                    }
                } else {
                    co = (current + 1) + ' ' + SB.LANG.of + ' ' + len;
                }
            }
            counter.innerHTML = co;
        }
        cb();
    };
    var hideBars = function(anim, cb) {
        var obj = gallery[current];
        var title = SL.get('shadowbox_title');
        var info = SL.get('shadowbox_info');
        var close = SL.get('shadowbox_nav_close');
        var meta = SL.get('shadowbox_meta');
        var title_i = SL.get('shadowbox_title_inner');
        var info_i = SL.get('shadowbox_info_inner');
        var fn = function() {
            buildBars(cb);
        };
        var title_h = getComputedHeight(title);
        var info_h = getComputedHeight(info) * -1;
        var close_h = getComputedHeight(close);
        close_h = (isNaN(close_h)) ? 16 : close_h;
        var meta_h = getComputedHeight(meta);
        meta_h = (isNaN(meta_h)) ? 16 : meta_h;
        if (anim) {
            animate(info_i, 'margin-top', info_h + close_h + meta_h, 0.35, fn);
        } else {
            SL.setStyle(info_i, 'margin-top', (info_h + close_h + meta_h) + 'px');
            fn();
        }
    };
    var showBars = function(cb) {
        var title_i = SL.get('shadowbox_title_inner');
        var info_i = SL.get('shadowbox_info_inner');
        var t = title_i.innerHTML != '';
        if (t)animate(title_i, 'margin-top', 0, 0.35);
        animate(info_i, 'margin-top', 0, 0.35, cb);
    };
    var loadContent = function() {
        var obj = gallery[current];
        if (!obj)return;
        var changing = false;
        if (content) {
            content.remove();
            changing = true;
        }
        var p = obj.player == 'inline' ? 'html' : obj.player;
        if (typeof SB[p] != 'function') {
            SB.raise('Unknown player ' + obj.player);
        }
        content = new SB[p](content_id, obj);
        listenKeys(false);
        toggleLoading(true);
        hideBars(changing, function() {
            if (!content)return;
            if (!changing) {
                SL.get('shadowbox').style.display = '';
            }
            var fn = function() {
                resizeContent(function() {
                    if (!content)return;
                    showBars(function() {
                        if (!content)return;
                        SL.get('shadowbox_body_inner').innerHTML = SL.createHTML(content.markup(dims));
                        toggleLoading(false, function() {
                            if (!content)return;
                            if (typeof content.onLoad == 'function') {
                                content.onLoad();
                            }
                            if (options.onFinish && typeof options.onFinish == 'function') {
                                options.onFinish(gallery[current]);
                            }
                            if (slide_timer != 'paused') {
                                SB.play();
                            }
                            listenKeys(true);
                        });
                    });
                });
            };
            if (typeof content.ready != 'undefined') {
                var id = setInterval(function() {
                    if (content) {
                        if (content.ready) {
                            clearInterval(id);
                            id = null;
                            fn();
                        }
                    } else {
                        clearInterval(id);
                        id = null;
                    }
                }, 100);
            } else {
                fn();
            }
        });
        if (gallery.length > 1) {
            var next = gallery[current + 1] || gallery[0];
            if (next.player == 'img') {
                var a = new Image();
                a.src = next.content;
            }
            var prev = gallery[current - 1] || gallery[gallery.length - 1];
            if (prev.player == 'img') {
                var b = new Image();
                b.src = prev.content;
            }
        }
    };
    var setDimensions = function(height, width, resizable) {
        resizable = resizable || false;
        var sb = SL.get('shadowbox_body'),h,w;
        h = height = parseInt(height);
        w = width = parseInt(width);
        var view_h = SL.getViewportHeight();
        var view_w = SL.getViewportWidth();
        var border_w = parseInt(SL.getStyle(sb, 'border-left-width'), 10)
            + parseInt(SL.getStyle(sb, 'border-right-width'), 10);
        border_w = (isNaN(border_w)) ? 16 : border_w;
        var extra_w = border_w + 2 * options.viewportPadding;
        if (w + extra_w >= view_w) {
            w = view_w - extra_w;
        }
        var border_h = parseInt(SL.getStyle(sb, 'border-top-width'), 10)
            + parseInt(SL.getStyle(sb, 'border-bottom-width'), 10);
        border_h = (isNaN(border_h)) ? 16 : border_h;
        var bar_h = getComputedHeight(SL.get('shadowbox_title'))
            + getComputedHeight(SL.get('shadowbox_info'))
            + getComputedHeight(SL.get('shadowbox_meta'))
            + getComputedHeight(SL.get('shadowbox_nav_close'));
        var extra_h = border_h + 2 * parseInt(options.viewportPadding) + bar_h;
        if (h + extra_h >= view_h) {
            h = view_h - extra_h;
        }
        var drag = false;
        var resize_h = height;
        var resize_w = width;
        var handle = options.handleOversize;
        if (resizable && (handle == 'resize' || handle == 'drag')) {
            var change_h = (height - h) / height;
            var change_w = (width - w) / width;
            if (handle == 'resize') {
                if (change_h > change_w) {
                    w = Math.round((width / height) * h);
                } else if (change_w > change_h) {
                    h = Math.round((height / width) * w);
                }
                resize_w = w;
                resize_h = h;
            } else {
                var link = gallery[current];
                if (link)drag = link.player == 'img' && (change_h > 0 || change_w > 0);
            }
        }
        dims = {height:h + border_h + bar_h,width:w + border_w,inner_h:h,inner_w:w,top:(view_h - (h + extra_h)) / 2 + options.viewportPadding,resize_h:resize_h,resize_w:resize_w,drag:drag};
    };
    var resizeContent = function(cb) {
        if (!content)return;
        setDimensions(content.height, content.width, content.resizable);
        if (cb) {
            switch (options.animSequence) {
                case'hw':
                    adjustHeight(dims.inner_h, dims.top, true, function() {
                        adjustWidth(dims.width, true, cb);
                    });
                    break;
                case'wh':
                    adjustWidth(dims.width, true, function() {
                        adjustHeight(dims.inner_h, dims.top, true, cb);
                    });
                    break;
                case'sync':
                default:
                    adjustWidth(dims.width, true);
                    adjustHeight(dims.inner_h, dims.top, true, cb);
            }
        } else {
            adjustWidth(dims.width, false);
            adjustHeight(dims.inner_h, dims.top, false);
            var c = SL.get(content_id);
            if (c) {
                if (content.resizable && options.handleOversize == 'resize') {
                    c.height = dims.resize_h;
                    c.width = dims.resize_w;
                }
                if (gallery[current].player == 'img' && options.handleOversize == 'drag') {
                    var top = parseInt(SL.getStyle(c, 'top'));
                    if (top + content.height < dims.inner_h) {
                        SL.setStyle(c, 'top', dims.inner_h - content.height + 'px');
                    }
                    var left = parseInt(SL.getStyle(c, 'left'));
                    if (left + content.width < dims.inner_w) {
                        SL.setStyle(c, 'left', dims.inner_w - content.width + 'px');
                    }
                }
            }
        }
    };
    var adjustHeight = function(height, top, anim, cb) {
        height = parseInt(height);
        var sb = SL.get('shadowbox_body');
        if (anim) {
            animate(sb, 'height', height, options.resizeDuration);
        } else {
            SL.setStyle(sb, 'height', height + 'px');
        }
        var s = SL.get('shadowbox');
        if (anim) {
            animate(s, 'top', top, options.resizeDuration, cb);
        } else {
            SL.setStyle(s, 'top', top + 'px');
            if (typeof cb == 'function')cb();
        }
    };
    var adjustWidth = function(width, anim, cb) {
        width = parseInt(width);
        var s = SL.get('shadowbox');
        if (anim) {
            animate(s, 'width', width, options.resizeDuration, cb);
        } else {
            SL.setStyle(s, 'width', width + 'px');
            if (typeof cb == 'function')cb();
        }
    };
    var listenKeys = function(on) {
        if (!options.enableKeys)return;
        SL[(on ? 'add' : 'remove') + 'Event'](document, 'keydown', handleKey);
    };
    var handleKey = function(e) {
        var code = SL.keyCode(e);
        SL.preventDefault(e);
        if (code == 81 || code == 88 || code == 27) {
            SB.close();
        } else if (code == 37 || code == 38) {
            SB.previous();
        } else if (code == 39 || code == 40) {
            SB.next();
        } else if (code == 32) {
            SB[(typeof slide_timer == 'number' ? 'pause' : 'play')]();
        }
    };
    var toggleLoading = function(on, cb) {
        var loading = SL.get('shadowbox_loading');
        if (on) {
            loading.style.display = '';
            if (typeof cb == 'function')cb();
        } else {
            var p = gallery[current].player;
            var anim = (p == 'img' || p == 'html');
            var fn = function() {
                loading.style.display = 'none';
                clearOpacity(loading);
                if (typeof cb == 'function')cb();
            };
            if (anim) {
                animate(loading, 'opacity', 0, options.fadeDuration, fn);
            } else {
                fn();
            }
        }
    };
    var fixTop = function() {
        SL.get('shadowbox_container').style.top = document.documentElement.scrollTop + 'px';
    };
    var fixHeight = function() {
        SL.get('shadowbox_overlay').style.height = SL.getViewportHeight() + 'px';
    };
    var hasNext = function() {
        return gallery.length > 1 && (current != gallery.length - 1 || options.continuous);
    };
    var toggleVisible = function(cb) {
        var els,v = (cb) ? 'hidden' : 'visible';
        var hide = ['select','object','embed'];
        for (var i = 0; i < hide.length; ++i) {
            els = document.getElementsByTagName(hide[i]);
            for (var j = 0,len = els.length; j < len; ++j) {
                els[j].style.visibility = v;
            }
        }
        var so = SL.get('shadowbox_overlay');
        var sc = SL.get('shadowbox_container');
        var sb = SL.get('shadowbox');
        if (cb) {
            SL.setStyle(so, {backgroundColor:options.overlayColor,opacity:0});
            if (!options.modal)SL.addEvent(so, 'click', SB.close);
            if (ltIE7) {
                fixTop();
                fixHeight();
                SL.addEvent(window, 'scroll', fixTop);
            }
            sb.style.display = 'none';
            sc.style.visibility = 'visible';
            animate(so, 'opacity', parseFloat(options.overlayOpacity), options.fadeDuration, cb);
        } else {
            SL.removeEvent(so, 'click', SB.close);
            if (ltIE7)SL.removeEvent(window, 'scroll', fixTop);
            sb.style.display = 'none';
            animate(so, 'opacity', 0, options.fadeDuration, function() {
                sc.style.visibility = 'hidden';
                sb.style.display = '';
                clearOpacity(so);
            });
        }
    };
    Shadowbox.init = function(opts) {
        if (initialized)return;
        if (typeof SB.LANG == 'undefined') {
            SB.raise('No Shadowbox language loaded');
            return;
        }
        if (typeof SB.SKIN == 'undefined') {
            SB.raise('No Shadowbox skin loaded');
            return;
        }
        apply(options, opts || {});
        var markup = SB.SKIN.markup.replace(/\{(\w+)\}/g, function(m, p) {
            return SB.LANG[p];
        });
        var bd = document.body || document.documentElement;
        SL.append(bd, markup);
        if (ltIE7) {
            SL.setStyle(SL.get('shadowbox_container'), 'position', 'absolute');
            SL.get('shadowbox_body').style.zoom = 1;
            var png = SB.SKIN.png_fix;
            if (png && png.constructor == Array) {
                for (var i = 0; i < png.length; ++i) {
                    var el = SL.get(png[i]);
                    if (el) {
                        var match = SL.getStyle(el, 'background-image').match(/url\("(.*\.png)"\)/);
                        if (match) {
                            SL.setStyle(el, {backgroundImage:'none',filter:'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src=' + match[1] + ',sizingMethod=scale);'});
                        }
                    }
                }
            }
        }
        for (var e in options.ext) {
            RE[e] = new RegExp('\.(' + options.ext[e].join('|') + ')\s*$', 'i');
        }
        var id;
        SL.addEvent(window, 'resize', function() {
            if (id) {
                clearTimeout(id);
                id = null;
            }
            id = setTimeout(function() {
                if (ltIE7)fixHeight();
                resizeContent();
            }, 50);
        });
        if (!options.skipSetup)SB.setup();
        initialized = true;
    };
    Shadowbox.loadSkin = function(skin, dir) {
        if (!(/\/$/.test(dir)))dir += '/';
        skin = dir + skin + '/';
        document.write('<link rel="stylesheet" type="text/css" href="' + skin + 'skin.css">');
        document.write('<scr' + 'ipt type="text/javascript" src="' + skin + 'skin.js"><\/script>');
    };
    Shadowbox.loadLanguage = function(lang, dir) {
        if (!(/\/$/.test(dir)))dir += '/';
        document.write('<scr' + 'ipt type="text/javascript" src="' + dir + 'shadowbox-' + lang + '.js"><\/script>');
    };
    Shadowbox.loadPlayer = function(players, dir) {
        if (typeof players == 'string')players = [players];
        if (!(/\/$/.test(dir)))dir += '/';
        for (var i = 0,len = players.length; i < len; ++i) {
            document.write('<scr' + 'ipt type="text/javascript" src="' + dir + 'shadowbox-' + players[i] + '.js"><\/script>');
        }
    };
    Shadowbox.setup = function(links, opts) {
        if (!links) {
            var links = [];
            var a = document.getElementsByTagName('a'),rel;
            for (var i = 0,len = a.length; i < len; ++i) {
                rel = a[i].getAttribute('rel');
                if (rel && RE.rel.test(rel))links[links.length] = a[i];
            }
        } else if (!links.length) {
            links = [links];
        }
        var link;
        for (var i = 0,len = links.length; i < len; ++i) {
            link = links[i];
            if (typeof link.shadowboxCacheKey == 'undefined') {
                link.shadowboxCacheKey = cache.length;
                SL.addEvent(link, 'click', handleClick);
            }
            cache[link.shadowboxCacheKey] = this.buildCacheObj(link, opts);
        }
    };
    Shadowbox.buildCacheObj = function(link, opts) {
        var href = link.href;
        var o = {el:link,title:link.getAttribute('title'),player:getPlayer(href),options:apply({}, opts || {}),content:href};
        var opt,l_opts = ['player','title','height','width','gallery'];
        for (var i = 0,len = l_opts.length; i < len; ++i) {
            opt = l_opts[i];
            if (typeof o.options[opt] != 'undefined') {
                o[opt] = o.options[opt];
                delete o.options[opt];
            }
        }
        var rel = link.getAttribute('rel');
        if (rel) {
            var match = rel.match(RE.gallery);
            if (match)o.gallery = escape(match[2]);
            var params = rel.split(';');
            for (var i = 0,len = params.length; i < len; ++i) {
                match = params[i].match(RE.param);
                if (match) {
                    if (match[1] == 'options') {
                        eval('apply(o.options, ' + match[2] + ')');
                    } else {
                        o[match[1]] = match[2];
                    }
                }
            }
        }
        return o;
    };
    Shadowbox.applyOptions = function(opts) {
        if (opts) {
            default_options = apply({}, options);
            options = apply(options, opts);
        }
    };
    Shadowbox.revertOptions = function() {
        if (default_options) {
            options = default_options;
            default_options = null;
        }
    };
    Shadowbox.open = function(obj, opts) {
        this.revertOptions();
        if (isLink(obj)) {
            if (typeof obj.shadowboxCacheKey == 'undefined' || typeof cache[obj.shadowboxCacheKey] == 'undefined') {
                obj = this.buildCacheObj(obj, opts);
            } else {
                obj = cache[obj.shadowboxCacheKey];
            }
        }
        if (obj.constructor == Array) {
            gallery = obj;
            current = 0;
        } else {
            var copy = apply({}, obj);
            if (!obj.gallery) {
                gallery = [copy];
                current = 0;
            } else {
                current = null;
                gallery = [];
                var ci;
                for (var i = 0,len = cache.length; i < len; ++i) {
                    ci = cache[i];
                    if (ci.gallery) {
                        if (ci.content == obj.content && ci.gallery == obj.gallery && ci.title == obj.title) {
                            current = gallery.length;
                        }
                        if (ci.gallery == obj.gallery) {
                            gallery.push(apply({}, ci));
                        }
                    }
                }
                if (current == null) {
                    gallery.unshift(copy);
                    current = 0;
                }
            }
        }
        obj = gallery[current];
        if (obj.options || opts) {
            this.applyOptions(apply(apply({}, obj.options || {}), opts || {}));
        }
        var match,r;
        for (var i = 0,len = gallery.length; i < len; ++i) {
            r = false;
            if (gallery[i].player == 'unsupported') {
                r = true;
            } else if (match = RE.unsupported.exec(gallery[i].player)) {
                if (options.handleUnsupported == 'link') {
                    gallery[i].player = 'html';
                    var s,a,oe = options.errors;
                    switch (match[1]) {
                        case'qtwmp':
                            s = 'either';
                            a = [oe.qt.url,oe.qt.name,oe.wmp.url,oe.wmp.name];
                            break;
                        case'qtf4m':
                            s = 'shared';
                            a = [oe.qt.url,oe.qt.name,oe.f4m.url,oe.f4m.name];
                            break;
                        default:
                            s = 'single';
                            if (match[1] == 'swf' || match[1] == 'flv')match[1] = 'fla';
                            a = [oe[match[1]].url,oe[match[1]].name];
                    }
                    var msg = SB.LANG.errors[s].replace(/\{(\d+)\}/g, function(m, i) {
                        return a[i];
                    });
                    gallery[i].content = '<div class="shadowbox_message">' + msg + '</div>';
                } else {
                    r = true;
                }
            } else if (gallery[i].player == 'inline') {
                var match = RE.inline.exec(gallery[i].content);
                if (match) {
                    var el;
                    if (el = SL.get(match[1])) {
                        gallery[i].content = el.innerHTML;
                    } else {
                        SB.raise('Cannot find element with id ' + match[1]);
                    }
                } else {
                    SB.raise('Cannot find element id for inline content');
                }
            }
            if (r) {
                gallery.splice(i, 1);
                if (i < current) {
                    --current;
                } else if (i == current) {
                    current = i > 0 ? current - 1 : i;
                }
                --i;
                len = gallery.length;
            }
        }
        if (gallery.length) {
            if (options.onOpen && typeof options.onOpen == 'function') {
                options.onOpen(obj);
            }
            if (!activated) {
                setDimensions(options.initialHeight, options.initialWidth);
                adjustHeight(dims.inner_h, dims.top, false);
                adjustWidth(dims.width, false);
                toggleVisible(loadContent);
            } else {
                loadContent();
            }
            activated = true;
        }
    };
    Shadowbox.change = function(num) {
        if (!gallery)return;
        if (!gallery[num]) {
            if (!options.continuous) {
                return;
            } else {
                num = num < 0 ? (gallery.length - 1) : 0;
            }
        }
        if (typeof slide_timer == 'number') {
            clearTimeout(slide_timer);
            slide_timer = null;
            slide_delay = slide_start = 0;
        }
        current = num;
        if (options.onChange && typeof options.onChange == 'function') {
            options.onChange(gallery[current]);
        }
        loadContent();
    };
    Shadowbox.next = function() {
        this.change(current + 1);
    };
    Shadowbox.previous = function() {
        this.change(current - 1);
    };
    Shadowbox.play = function() {
        if (!hasNext())return;
        if (!slide_delay)slide_delay = options.slideshowDelay * 1000;
        if (slide_delay) {
            slide_start = new Date().getTime();
            slide_timer = setTimeout(function() {
                slide_delay = slide_start = 0;
                SB.next();
            }, slide_delay);
            toggleNav('play', false);
            toggleNav('pause', true);
        }
    };
    Shadowbox.pause = function() {
        if (typeof slide_timer == 'number') {
            var time = new Date().getTime();
            slide_delay = Math.max(0, slide_delay - (time - slide_start));
            if (slide_delay) {
                clearTimeout(slide_timer);
                slide_timer = 'paused';
            }
            toggleNav('pause', false);
            toggleNav('play', true);
        }
    };
    Shadowbox.close = function() {
        if (!activated)return;
        listenKeys(false);
        toggleVisible(false);
        if (content) {
            content.remove();
            content = null;
        }
        if (typeof slide_timer == 'number')clearTimeout(slide_timer);
        slide_timer = null;
        slide_delay = 0;
        if (options.onClose && typeof options.onClose == 'function') {
            options.onClose(gallery[current]);
        }
        activated = false;
    };
    Shadowbox.clearCache = function() {
        for (var i = 0,len = cache.length; i < len; ++i) {
            if (cache[i].el) {
                SL.removeEvent(cache[i].el, 'click', handleClick);
                delete cache[i].el.shadowboxCacheKey;
            }
        }
        cache = [];
    };
    Shadowbox.getPlugins = function() {
        return plugins;
    };
    Shadowbox.getOptions = function() {
        return options;
    };
    Shadowbox.getCurrent = function() {
        return gallery[current];
    };
    Shadowbox.getVersion = function() {
        return version;
    };
    Shadowbox.getClient = function() {
        return client;
    };
    Shadowbox.getContent = function() {
        return content;
    };
    Shadowbox.getDimensions = function() {
        return dims;
    };
    Shadowbox.raise = function(e) {
        if (typeof options.handleException == 'function') {
            options.handleException(e);
        } else {
            throw e;
        }
    };
})();
if (typeof Shadowbox == 'undefined') {
    throw'Unable to load Shadowbox language file, base library not found.';
}
Shadowbox.LANG = {code:'de',of:'von',loading:'Lädt',cancel:'Abbrechen',next:'Weiter',previous:'Zur�ck',play:'Abspielen',pause:'Pause',close:'Schließen',save:'Speichern',print:'Drucken',errors:{single:'Um den Inhalt anzeigen zu können, muss die Browser-Erweiterung <a href="{0}">{1}</a> installiert werden.',shared:'Um den Inhalt anzeigen zu können müssen die beiden Browser-Erweiterungen <a href="{0}">{1}</a> und <a href="{2}">{3}</a> installiert werden.',either:'Um den Inhalt anzeigen zu können muss eine der beiden Browser-Erweiterungen <a href="{0}">{1}</a> oder <a href="{2}">{3}</a> installiert werden.'}};
if (typeof Shadowbox == 'undefined') {
    throw'Unable to load Shadowbox skin, base library not found.';
}
Shadowbox.SKIN = {markup:'<div id="shadowbox_container">' + '<div id="shadowbox_overlay"></div>' + '<div id="shadowbox">' + '<div id="shadowbox_nav_close"><a onclick="Shadowbox.close()" tabindex="0">{close}</a></div>' + '<div id="shadowbox_body">' + '<div id="shadowbox_body_inner"></div>' + '<div id="shadowbox_loading">' + '<div id="shadowbox_loading_indicator"></div>' + '</div>' + '</div>' + '<div id="shadowbox_title">' + '<div id="shadowbox_title_inner"></div>' + '</div>' + '<div id="shadowbox_info">' + '<div id="shadowbox_info_inner">' + '<div id="shadowbox_nav_prevnext" class="clearfix">' + '<p id="shadowbox_nav_previous"><a onclick="Shadowbox.previous()" tabindex="0">{previous}</a></p>' + '<p id="shadowbox_nav_next"><a onclick="Shadowbox.next()" tabindex="0">{next}</a></p>' + '</div>' + '<div id="shadowbox_nav" class="clearfix">' + '<div id="shadowbox_meta">' + '<a id="shadowbox_meta_save" tabindex="0">{save}</a>' + '<a id="shadowbox_meta_print" tabindex="0" class="print">{print}</a>' + '</div>' + '</div>' + '</div>' + '</div>' + '</div>' + '</div>'};
(function() {
    var SB = Shadowbox;
    var SL = SB.lib;
    Shadowbox.flv = function(id, obj) {
        this.id = id;
        this.obj = obj;
        this.resizable = true;
        this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
        if (SB.getOptions().showMovieControls == true) {
            this.height += 20;
        }
        this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
    };
    Shadowbox.flv.prototype = {markup:function(dims) {
        var obj = this.obj;
        var h = dims.resize_h;
        var w = dims.resize_w;
        var options = SB.getOptions();
        var autoplay = String(options.autoplayMovies);
        var controls = options.showMovieControls;
        var showicons = String(controls);
        var displayheight = h - (controls ? 20 : 0);
        var flashvars = ['file=' + this.obj.content,'height=' + h,'width=' + w,'autostart=' + autoplay,'displayheight=' + displayheight,'showicons=' + showicons,'backcolor=0x000000','frontcolor=0xCCCCCC','lightcolor=0x557722'];
        return{tag:'object',id:this.id,name:this.id,type:'application/x-shockwave-flash',data:options.flvPlayer,children:[
            {tag:'param',name:'movie',value:options.flvPlayer},
            {tag:'param',name:'flashvars',value:flashvars.join('&amp;')},
            {tag:'param',name:'allowfullscreen',value:'true'}
        ],height:h,width:w};
    },remove:function() {
        var el = SL.get(this.id);
        if (el)SL.remove(el);
    }};
})();
(function() {
    var SB = Shadowbox;
    var SL = SB.lib;
    Shadowbox.html = function(id, obj) {
        this.id = id;
        this.obj = obj;
        this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
        this.width = this.obj.width ? parseInt(this.obj.width, 10) : 500;
    };
    Shadowbox.html.prototype = {markup:function(dims) {
        return{tag:'div',id:this.id,cls:'html',html:this.obj.content};
    },remove:function() {
        var el = SL.get(this.id);
        if (el)SL.remove(el);
    }};
})();
(function() {
    var SB = Shadowbox;
    var SL = SB.lib;
    var C = SB.getClient();
    Shadowbox.iframe = function(id, obj) {
        this.id = id;
        this.obj = obj;
        this.height = this.obj.height ? parseInt(this.obj.height, 10) : SL.getViewportHeight();
        this.width = this.obj.width ? parseInt(this.obj.width, 10) : SL.getViewportWidth();
    };
    Shadowbox.iframe.prototype = {markup:function(dims) {
        var markup = {tag:'iframe',id:this.id,name:this.id,height:'100%',width:'100%',frameborder:'0',marginwidth:'0',marginheight:'0',scrolling:'auto'};
        if (C.isIE) {
            markup.allowtransparency = 'true';
            if (!C.isIE7) {
                markup.src = 'javascript:false;document.write("");';
            }
        }
        return markup;
    },onLoad:function() {
        var win = (C.isIE) ? SL.get(this.id).contentWindow : window.frames[this.id];
        win.location = this.obj.content;
    },remove:function() {
        var el = SL.get(this.id);
        if (el) {
            SL.remove(el);
            if (C.isGecko)delete window.frames[this.id];
        }
    }};
})();
(function() {
    var SB = Shadowbox;
    var SL = SB.lib;
    var C = SB.getClient();
    var drag;
    var draggable;
    var drag_id = 'shadowbox_drag_layer';
    var preloader;
    var resetDrag = function() {
        drag = {x:0,y:0,start_x:null,start_y:null};
    };
    var toggleDrag = function(on, h, w) {
        if (on) {
            resetDrag();
            var styles = ['position:absolute','height:' + h + 'px','width:' + w + 'px','cursor:' + (C.isGecko ? '-moz-grab' : 'move'),'background-color:' + (C.isIE ? '#fff;filter:alpha(opacity=0)' : 'transparent')];
            SL.append(SL.get('shadowbox_body_inner'), '<div id="' + drag_id + '" style="' + styles.join(';') + '"></div>');
            SL.addEvent(SL.get(drag_id), 'mousedown', listenDrag);
        } else {
            var d = SL.get(drag_id);
            if (d) {
                SL.removeEvent(d, 'mousedown', listenDrag);
                SL.remove(d);
            }
        }
    };
    var listenDrag = function(e) {
        SL.preventDefault(e);
        var coords = SL.getPageXY(e);
        drag.start_x = coords[0];
        drag.start_y = coords[1];
        draggable = SL.get('shadowbox_content');
        SL.addEvent(document, 'mousemove', positionDrag);
        SL.addEvent(document, 'mouseup', unlistenDrag);
        if (C.isGecko)SL.setStyle(SL.get(drag_id), 'cursor', '-moz-grabbing');
    };
    var unlistenDrag = function() {
        SL.removeEvent(document, 'mousemove', positionDrag);
        SL.removeEvent(document, 'mouseup', unlistenDrag);
        if (C.isGecko)SL.setStyle(SL.get(drag_id), 'cursor', '-moz-grab');
    };
    var positionDrag = function(e) {
        var content = SB.getContent();
        var dims = SB.getDimensions();
        var coords = SL.getPageXY(e);
        var move_x = coords[0] - drag.start_x;
        drag.start_x += move_x;
        drag.x = Math.max(Math.min(0, drag.x + move_x), dims.inner_w - content.width);
        SL.setStyle(draggable, 'left', drag.x + 'px');
        var move_y = coords[1] - drag.start_y;
        drag.start_y += move_y;
        drag.y = Math.max(Math.min(0, drag.y + move_y), dims.inner_h - content.height);
        SL.setStyle(draggable, 'top', drag.y + 'px');
    };
    Shadowbox.img = function(id, obj) {
        this.id = id;
        this.obj = obj;
        this.resizable = true;
        this.ready = false;
        var self = this;
        preloader = new Image();
        preloader.onload = function() {
            self.height = self.obj.height ? parseInt(self.obj.height, 10) : preloader.height;
            self.width = self.obj.width ? parseInt(self.obj.width, 10) : preloader.width;
            self.ready = true;
            preloader.onload = '';
            preloader = null;
        };
        preloader.src = obj.content;
    };
    Shadowbox.img.prototype = {markup:function(dims) {
        return{tag:'img',id:this.id,height:dims.resize_h,width:dims.resize_w,src:this.obj.content,style:'position:absolute'};
    },onLoad:function() {
        var dims = SB.getDimensions();
        if (dims.drag && SB.getOptions().handleOversize == 'drag') {
            toggleDrag(true, dims.resize_h, dims.resize_w);
        }
    },remove:function() {
        var el = SL.get(this.id);
        if (el)SL.remove(el);
        toggleDrag(false);
        if (preloader) {
            preloader.onload = '';
            preloader = null;
        }
    }};
})();
(function() {
    var SB = Shadowbox;
    var SL = SB.lib;
    var C = SB.getClient();
    Shadowbox.qt = function(id, obj) {
        this.id = id;
        this.obj = obj;
        this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
        if (SB.getOptions().showMovieControls == true) {
            this.height += 16;
        }
        this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
    };
    Shadowbox.qt.prototype = {markup:function(dims) {
        var options = SB.getOptions();
        var autoplay = String(options.autoplayMovies);
        var controls = String(options.showMovieControls);
        var markup = {tag:'object',id:this.id,name:this.id,height:this.height,width:this.width,children:[
            {tag:'param',name:'src',value:this.obj.content},
            {tag:'param',name:'scale',value:'aspect'},
            {tag:'param',name:'controller',value:controls},
            {tag:'param',name:'autoplay',value:autoplay}
        ],kioskmode:'true'};
        if (C.isIE) {
            markup.classid = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
            markup.codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
        } else {
            markup.type = 'video/quicktime';
            markup.data = this.obj.content;
        }
        return markup;
    },remove:function() {
        try {
            document[this.id].Stop();
        } catch(e) {
        }
        var el = SL.get(this.id);
        if (el) {
            SL.remove(el);
        }
    }};
})();
(function() {
    var SB = Shadowbox;
    var SL = SB.lib;
    Shadowbox.swf = function(id, obj) {
        this.id = id;
        this.obj = obj;
        this.resizable = true;
        this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
        this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
    };
    Shadowbox.swf.prototype = {markup:function(dims) {
        var bgcolor = SB.getOptions().flashBgColor;
        return{tag:'object',id:this.id,name:this.id,type:'application/x-shockwave-flash',data:this.obj.content,children:[
            {tag:'param',name:'movie',value:this.obj.content},
            {tag:'param',name:'bgcolor',value:bgcolor}
        ],height:dims.resize_h,width:dims.resize_w};
    },remove:function() {
        var el = SL.get(this.id);
        if (el)SL.remove(el);
    }};
})();
(function() {
    var SB = Shadowbox;
    var SL = SB.lib;
    var C = SB.getClient();
    Shadowbox.wmp = function(id, obj) {
        this.id = id;
        this.obj = obj;
        this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
        if (SB.getOptions().showMovieControls) {
            this.height += (C.isIE ? 70 : 45);
        }
        this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
    };
    Shadowbox.wmp.prototype = {markup:function(dims) {
        var options = SB.getOptions();
        var autoplay = options.autoplayMovies ? 1 : 0;
        var markup = {tag:'object',id:this.id,name:this.id,height:this.height,width:this.width,children:[
            {tag:'param',name:'autostart',value:autoplay}
        ]};
        if (C.isIE) {
            var controls = options.showMovieControls ? 'full' : 'none';
            markup.classid = 'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6';
            markup.children[markup.children.length] = {tag:'param',name:'url',value:this.obj.content};
            markup.children[markup.children.length] = {tag:'param',name:'uimode',value:controls};
        } else {
            var controls = options.showMovieControls ? 1 : 0;
            markup.type = 'video/x-ms-wmv';
            markup.data = this.obj.content;
            markup.children[markup.children.length] = {tag:'param',name:'showcontrols',value:controls};
        }
        return markup;
    },remove:function() {
        if (C.isIE) {
            try {
                window[this.id].controls.stop();
                window[this.id].URL = 'non-existent.wmv';
                window[this.id] = function() {
                };
            } catch(e) {
            }
        }
        var el = SL.get(this.id);
        if (el) {
            setTimeout(function() {
                SL.remove(el);
            }, 10);
        }
    }};
})();


/** dynamische Sprachauswahl Shadowbox */

var url = document.URL;

if (url.indexOf('/de/') != -1) {
    Shadowbox.loadLanguage('de', '/static/all/js/shadowboxlang/');
} else if (url.indexOf('/en/') != -1) {
    Shadowbox.loadLanguage('en', '/static/all/js/shadowboxlang/');
} else if (url.indexOf('/fr/') != -1) {
    Shadowbox.loadLanguage('fr', '/static/all/js/shadowboxlang/');
} else if (url.indexOf('/it/') != -1) {
    Shadowbox.loadLanguage('it', '/static/all/js/shadowboxlang/');
} else if (url.indexOf('/es/') != -1) {
    Shadowbox.loadLanguage('es', '/static/all/js/shadowboxlang/');
} else {
    Shadowbox.loadLanguage('de', '/static/all/js/shadowboxlang/');
}


/** fraunhofer.js **/
var FHG = {key_tab:9,key_enter:13,key_esc:27,key_space:32,key_pageup:33,key_pagedown:34,key_left:37,key_up:38,key_right:39,key_down:40,key_minus:86,key_plus:93,key_add:132,key_substract:140,sDatefield:false,oCal:false,init:function() {

    FHG.initVignetteReconstruction();
    FHG.initPresetCalendarValues();
    FHG.initvAlignVignette();
    FHG.initFisheyeVignette();
    FHG.initSlants($('#vignettes .vignette'));
    //FHG.initSlants($('#nav-2'),);
    FHG.initVignetteHover();
    FHG.cleanLinklistItem();
    FHG.detectFlash();


    if (typeof YAHOO !== 'undefined' && $('.datepicker').length > 0) {
        $('div.datepicker_control a.control').click(FHG.onDateClick).bind('keydown', FHG.onDateClick).attr(FHG.nTabindex(), '0');
    }


    FHG.initTablesorter();
    if (window.print) {
        $('#meta-nav a.print').addClass('active').click(function() {
            window.print();
            return false;
        });
    }
    document.createElement('abbr');
    $('input.hasDefault').blur(FHG.inputDefaults).focus(FHG.inputDefaults).click(FHG.inputDefaults);
    FHG.initAutocomplete();
    FHG.initFocus();
    FHG.initContentSlider();
    FHG.initTabs();
    FHG.initSocialBookmarks();
    FHG.carouselInit();
    FHG.initTableHover();
    if ($('ul.searchfilter').length) {
        FHG.initSearchReset();
        FHG.initSearchFilter();
    }

    /** Initialisierung Shadowbox **/
    if (typeof Shadowbox !== 'undefined' && $('ul.image-gallery').length || typeof Shadowbox !== 'undefined') {

        Shadowbox.init({
            onFinish:         FHG.shadowboxFinish,
            onClose:        FHG.shadowboxClose,
            displayCounter: false,
            autoplayMovies: false,
            continuous:     false,
            animate:         false,
            flvPlayer:         '/static/all/assets/mediaplayer/player.swf'
        });
    }

    FHG.viewShadowboxGallery();


    if ($('#key-visual-flash').length > 0 && typeof FlashReplace !== 'undefined') {
        FlashReplace.replace('key-visual-flash', '/assets/flash/frh_banner_fls_v02_574x255_210508.swf', 'key-visual', 524, 210, false, {wmode:'transparent'});
    }
}
    ,initTablesorter:function() {
        $('table.sortable-table').each(function() {
            var headers = new Object;
            $("th", $(this)).each(function(index, element) {
                if ($(element).hasClass("noSort")) {
                    headers[index] === { sorter : false };
                }
            })
            $(this).tablesorter({
                    headers : headers
                }
            );
        });
    },

    initVignetteReconstruction: function() {
        $(".vignette ul").each(
            function(i) {
                var ul = $(this);
                if ($("span[class='linklist']", ul).size()) {
                    ul.addClass("linklist");
                    ul.children("li").each(
                        function(j) {
                            var li = $(this);
                            if (li.children(":first").hasClass("linklist")) {
                                // 	span -> link
                                li.html($(this).children().html());
                            }
                            else {
                                //	link -> span
                                li.children().text($(this).children().text());
                            }
                        }
                    );
                }
                if ($("span[class='linklist']", ul).size()) {
                    ul.addClass("linklist");
                    ul.children("li").each(
                        function(j) {
                            var li = $(this);
                            if (li.children(":first").hasClass("linklist")) {
                                // 	span -> link
                                li.html($(this).children().html());
                            }
                            else {
                                //	link -> span
                                li.children().text($(this).children().text());
                            }
                        }
                    );
                }
            }
        );
    },

    cleanLinklistItem: function() {

        $("li.link").children("div").attr("style", "");

    },

    textExtraction:function(node) {
        start = $(node).find('span.dtstart');
        return(start.length) ? start.attr('title') : node.innerHTML;
    },viewShadowboxGallery:function() {
        $('a.viewGallery').click(function() {
        	var comp_id=this.name;
            var firstInGallery = document.getElementById('first-in-gallery_'+comp_id);
            Shadowbox.open(firstInGallery);
            return false;
        })
    },shadowboxFinish:function(obj) {
        if ($('#searchfilterpopup').length) {
            $('#shadowbox_content div.tablist li').click(FHG.showSearchFilterTab);
            jQuery.each($('#contentboxes input[type="checkbox"]:checked'), function(a, b) {
                $('#shadowbox_content input[name="' + $(b).attr('name') + '"]').attr('checked', 'checked');
            });
            $('#shadowbox_content input[class="cancel"]').click(Shadowbox.close);
            $('#shadowbox_content input[class="submit"]').click(FHG.applySearchFilter);
            $('#shadowbox_meta').css('display', 'none');
        }
        else {
            var player = obj['player'];
            if (player == 'img' || player == 'html' || player == 'inline') {
                $('#shadowbox_meta').css('display', 'block');
                if (player == 'img') {
                    $('#shadowbox_meta_save').attr('href', obj.content.replace(/http:\/\/[^\/]*/, '') + '.spooler.download.file').css('display', 'inline');
                }
                else {
                    $('#shadowbox_meta_save').css('display', 'none');
                }
                if (player == 'html' || player == 'inline' || player == 'img') {
                    $('table.sortable-table').tablesorter({sortList:[
                        [0,0]
                    ]});
                    if (window.print) {
                        $('#shadowbox_meta_print').addClass('active').click(function() {
                            window.print();
                            return false;
                        });
                    }
                }
            }
            else {
                $('#shadowbox_meta_save').attr('href', obj.content.replace(/http:\/\/[^\/]*/, '') + '.spooler.download.file').css('display', 'inline');
            }
        }
        $('body').addClass('boxprint');
        FHG.updateBuffer();
    },shadowboxClose:function() {
        $('body').removeClass('boxprint');
    },onDateClick:function(e) {
        if (typeof e.type !== 'undefined') {
            var event = e || window.event;
            if (event.keyCode && event.keyCode === FHG.key_esc) {
                FHG.oCal.hide();
                return false;
            }
        }
        if (event.type === 'click' || (event.keyCode && event.keyCode === FHG.key_enter)) {
            $('.datepicker').hide();


            FHG.sDatefield = '#' + this.rel;

            if ($(FHG.sDatefield).val() == "") {
                var currentDate = new Date();
                var month = currentDate.getMonth() + 1;
                month = ( month < 10 ? '0' : '' ) + month;
                var date = currentDate.getDate();
                date = ( date < 10 ? '0' : '' ) + date;
                var year = currentDate.getFullYear();

                /**  if datefield end is blank, set to current date **/
                if ($('.datepicker_wrapper #dtend').attr('value') == "") {
                    $('.datepicker_wrapper #dtend').attr('value', date + '.' + month + '.' + year);
                }

                /** if datefield start ist blank, set to current date -1 month **/
                if ($('.datepicker_wrapper #dtstart').attr('value') == "") {
                    $('.datepicker_wrapper #dtstart').attr('value', date + '.' + month + '.' + year);
                }
            }

            aDate = $(FHG.sDatefield).val().split('.');

            aDate[0] = parseInt(aDate[0].replace(/^[0]?([0-9]*)/, '$1'));
            aDate[1] = parseInt(aDate[1].replace(/^[0]?([0-9]*)/, '$1'));
            aDate[2] = parseInt(aDate[2]);


            var datepicker = $(this).siblings('.datepicker');

            FHG.oCal = new YAHOO.widget.Calendar(datepicker[0], {pagedate:aDate[1] + '/' + aDate[2],selected:aDate[1] + '/' + aDate[0] + '/' + aDate[2],start_weekday:1});
            FHG.oCal.cfg.setProperty("DATE_FIELD_DELIMITER", ".");
            FHG.oCal.cfg.setProperty("MDY_DAY_POSITION", 1);
            FHG.oCal.cfg.setProperty("MDY_MONTH_POSITION", 2);
            FHG.oCal.cfg.setProperty("MDY_YEAR_POSITION", 3);
            FHG.oCal.cfg.setProperty("MD_DAY_POSITION", 1);
            FHG.oCal.cfg.setProperty("MD_MONTH_POSITION", 2);
            FHG.oCal.cfg.setProperty("MONTHS_SHORT", ["Jan","Feb","M\u00E4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]);
            FHG.oCal.cfg.setProperty("MONTHS_LONG", ["Januar","Februar","M\u00E4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]);
            FHG.oCal.cfg.setProperty("WEEKDAYS_1CHAR", ["S","M","D","M","D","F","S"]);
            FHG.oCal.cfg.setProperty("WEEKDAYS_SHORT", ["So","Mo","Di","Mi","Do","Fr","Sa"]);
            FHG.oCal.cfg.setProperty("WEEKDAYS_MEDIUM", ["Son","Mon","Die","Mit","Don","Fre","Sam"]);
            FHG.oCal.cfg.setProperty("WEEKDAYS_LONG", ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]);
            FHG.oCal.render();
            FHG.oCal.renderEvent.subscribe(FHG.focusDay, FHG.oCal);
            FHG.oCal.selectEvent.subscribe(FHG.onDatepickerClick, FHG.oCal);
            if ($.browser.msie) {
                $('a.lastcontrol').hide();
            }
            FHG.oCal.show();
            FHG.updateBuffer();
            if (event.keyCode && event.keyCode === FHG.key_return) {
                return false;
            }
        }
    },onDatepickerClick:function() {
        var aDates = FHG.oCal.getSelectedDates();
        var date = aDates[0];
        var displayDate = date.getDate();
        if (displayDate < 10) {
            displayDate = '0' + displayDate;
        }
        var displayMonth = date.getMonth() + 1;
        if (displayMonth < 10) {
            displayMonth = '0' + displayMonth;
        }
        var displayYear = date.getFullYear();
        var date = displayDate + '.' + displayMonth + '.' + displayYear;
        $(FHG.sDatefield).val(date).focus();
        $('.datepicker').hide();
        $('a.lastcontrol').show();
        FHG.oCal.unsubscribe('click', onDatepickerClick);
    },focusDay:function() {
        var aElements = $('.datepicker a'),oAnchor,i = 0;
        if (aElements.length > 0) {
            while (aElements[i]) {
                if (aElements[i].parent().hasClass('today')) {
                    oAnchor = element;
                    break;
                }
                i++;
            }
            ;
            if (!oAnchor) {
                oAnchor = aElements[0];
            }
            YAHOO.lang.later(0, oAnchor, function() {
                try {
                    oAnchor.focus();
                }
                catch(e) {
                }
            });
        }
    },carouselInit:function() {
        var obj = $('.image-gallery'),iKey;
        if (obj.length > 0) {
            for(var i=0; i<obj.length;i++){
        		var o=$(obj[i]);
        		var comp_id=obj[i].className.split("image-gallery-cls__")[1];
        		 o = $.extend({comp_id:comp_id,btnPrev:$('.carousel-prev_'+comp_id),btnNext:$('.carousel-next_'+comp_id),btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:false,visible:5,start:0,scroll_step:1,beforeStart:null,afterEnd:null}, o || {});
            (function($) {
                $.fn.jCarouselLite = function(o) {
                	
                    return this.each(function() {
                    	var comp_id=o.comp_id;
                        var running = false,animCss = 'left',sizeCss = 'width';
                        var div = $('.carousel-wrapper-cls_'+comp_id),ul = o,tLi = ul.children('li'),tl = tLi.size(),v = o.visible;
                        var li = ul.children('li'),itemLength = li.size(),curr = o.start;
                        div.css('visibility', 'visible');
                        FHG.setTabindex(vis(),o);
                        var liSize = FHG.width(li);
                        var ulSize = liSize * itemLength + 16;
                        ul.css(sizeCss, ulSize + 'px').css(animCss, -(curr * liSize));
                        if (o.btnPrev) {
                            $(o.btnPrev).removeAttr('aria-disabled').attr(FHG.nTabindex(), 0).click(
                                function() {
                                	var sc=o.scroll_step;
                                    return go(curr -sc);
                                }).keydown(
                                function(event) {
                                    if (!event.altKey) {
                                        if ((iKey = event.keyCode) && (iKey == FHG.key_enter || iKey == FHG.key_left || iKey == FHG.key_up)) {
                                            return go(curr - o.scroll_step);
                                        } else if (iKey == FHG.key_right || iKey == FHG.key_down) {
                                            return go(curr + o.scroll_step);
                                        } else {
                                            return;
                                        }
                                    }
                                }).addClass('disabled');
                        }
                        if (o.btnNext) {
                            $(o.btnNext).removeAttr('aria-disabled').attr(FHG.nTabindex(), 0).click(
                                function() {
                                    return go(curr + o.scroll_step);
                                }).keydown(function(event) {
                                if (!event.altKey) {
                                    if ((iKey = event.keyCode) && (iKey == FHG.key_enter || iKey == FHG.key_right || iKey == FHG.key_down)) {
                                        return go(curr + o.scroll_step);
                                    } else if (iKey == FHG.key_left || iKey == FHG.key_up) {
                                        return go(curr - o.scroll_step);
                                    } else {
                                        return;
                                    }
                                }
                            });
                        }
                        function vis() {
                            return li.slice(curr).slice(0, v);
                        }

                        function go(to) {
                            if (!running) {
                                var disabledButton = false;
                                $('a.carousel-button_'+o.comp_id).removeClass('disabled');
                                if (o.circular) {
                                    if (to <= o.start - v - 1) {
                                        ul.css(animCss, -((itemLength - (v * 2)) * liSize) + 'px');
                                        curr = (to == o.start - v - 1) ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll_step;
                                    } else if (to >= itemLength - v + 1) {
                                        ul.css(animCss, -((v) * liSize) + "px");
                                        curr = (to == itemLength - v + 1) ? v + 1 : v + o.scroll_step;
                                    } else {
                                        curr = to;
                                    }
                                } else if (to < 0 || to > itemLength - v) {
                                    disabledButton = (to < 0) ? o.btnPrev : o.btnNext;
                                    disabledButton.addClass('disabled');
                                    return;
                                } else {
                                    curr = to;
                                }
                                running = true;
                                ul.animate({left:-(curr * liSize)}, o.speed, o.easing, function() {
                                    FHG.setTabindex(vis(),o);
                                    FHG.updateBuffer();
                                    running = false;
                                });
                            }
                            return false;
                        }
                    });
                };
            })(jQuery);
            jQuery(o).jCarouselLite(o);
        }}
    },css:function(elm, prop) {
        return parseInt($.css(elm[0], prop), 10) || 0;
    },width:function(elm) {
        return elm[0].offsetWidth + FHG.css(elm, 'marginLeft') + FHG.css(elm, 'marginRight');
    },initFocus:function() {
        $('#skiplinks a').bind('focus',
            function() {
                $(this).addClass('hover')
            }).bind('blur', function() {
            $(this).removeClass('hover')
        });
    },


    initTabs: function() {

//	original tablist initialisation
        var aTablist = $('#main ul.tablist'), i = 0;
        $('#main ul.tablist li').attr(FHG.nTabindex(), '-1');
        $('#main ul.tablist li.active').attr(FHG.nTabindex(), '0');
        while (aTablist[i]) {
            if (aTablist[i].addEventListener) {
                aTablist[i].addEventListener('click', FHG.onTabClick, true);
                aTablist[i].addEventListener('focus', FHG.onTabClick, true);
                aTablist[i].addEventListener('keydown', FHG.onTabKeydown, false);
                aTablist[i].addEventListener('keypress', FHG.onTabKeypress, false);
            }
            else if (aTablist[i].attachEvent) {
                $('#main ul.tablist').bind('click', FHG.onTabClick).keydown(FHG.onTabKeydown).keypress(FHG.onTabKeypress);
            }
            i++;
        }

//	get current hash and trigger click event on tab-link referring to currentHash
        if (window.location.hash != "") {
            var currentHash = window.location.hash;
            $("a[href='" + currentHash + "']").bind('click', FHG.onTabClick).triggerHandler("click", FHG.onTabClick);
        }
    },
    onTabClick: function(e) {

        if (typeof e.type !== 'undefined') {
            var event = e || window.event;
        }
        var oTarget = ( typeof event !== 'undefined' ) ? FHG.getTarget(event) : e;

// Find the active sibling
        var oActive = $(oTarget).parent().siblings('li.active');

        // If the clicked tab wasn't the active tab, proceed
        if (oActive.length > 0) {
            // Add link for former active element
            var linkText = $(oActive).text();
            var addLink = $(oActive).attr("id").replace(/(tab-)([0-9])/, "tabpanel-$2");
            $(oActive).html('<a href="#' + addLink + '">' + linkText + '</a>');


            // Adjust class name, change tabindex on former active element
            oActive.removeClass('active').attr(FHG.nTabindex(), '-1');


            // Hide corresponding tabpanel
            var iActivePanelId = oActive.attr('id').replace(/(tab-)([0-9])/, "tabpanel-$2");

            // Add class name, change tabindex on new active element
            var newTab = $(oTarget).parent();
            var newTabLink = newTab.attr("id").replace(/(tab-)([0-9])/, "tabpanel-$2");
            newTab.addClass('active').attr(FHG.nTabindex(), '0');

            //	Write Hashtag in url
            window.location.hash = "#" + newTabLink;

            var oldLinkText = $(oTarget).text();
            $(oTarget).parent().text(oldLinkText);

            $("div#" + newTabLink).addClass("active");
            $('#' + iActivePanelId).removeClass('active');

            // Update screenreader buffer
            FHG.updateBuffer();


        }

    },





    onTabKeydown:function(e) {
        var event = e || window.event,k = new FHG.KeyObject(event);
        var iNum = k.oTarget.id.match(/[tab-]([0-9]*)/),iNum = iNum[1];
        if (((k.iKey === FHG.key_left || k.iKey === FHG.key_up) && !k.bAltKey && !k.bShiftKey && !k.bCtrlKey) || (k.iKey === FHG.key_tab && k.bCtrlKey && k.bShiftKey)) {
            if ($(k.oTarget).is(':first-child')) {
                FHG.onTabClick($(k.oTarget).siblings(':last'));
            }
            else {
                FHG.onTabClick($(k.oTarget).prev());
            }
            FHG.stopPropagation(event);
        }
        else if (((k.iKey === FHG.key_right || k.iKey === FHG.key_down) && !k.bAltKey && !k.bShiftKey && !k.bCtrlKey) || (k.iKey === FHG.key_tab && k.bCtrlKey && !k.bShiftKey)) {
            if ($(k.oTarget).is(':last-child')) {
                FHG.onTabClick($(k.oTarget).siblings(':first'));
            }
            else {
                FHG.onTabClick($(k.oTarget).next());
            }
            FHG.stopPropagation(event);
        }
    },onTabKeypress:function(e) {
        var event = e || window.event,k = new FHG.KeyObject(event);
        if (((k.iKey === FHG.key_left || k.iKey === FHG.key_up || k.iKey === FHG.key_right || k.iKey === FHG.key_down) && !k.bAltKey && !k.bShiftKey && !k.bCtrlKey) || (k.iKey === FHG.key_tab && k.bCtrlKey)) {
            FHG.stopPropagation(event);
        }
    },inputDefaults:function(event) {
        var sDefaultValue = $('#' + this.id + '-default').val();
        if (event.type === 'blur' && this.value === '') {
            $(this).val(sDefaultValue);
        }
        else if (event.type === 'click' && this.value === sDefaultValue) {
            this.value = '';
            return false;
        }
        else if (event.type === 'focus') {
            this.select();
        }
    },initSlants:function(obj) {
        var vmlShape;
        obj.each(function(i) {
            var span = $('span.canvas', this);
            var slantedBottom = ($('#nav-second', this).length === 0);
            if (span.length === 0) {
                return false;
            }
            var spanWidth = span.width();
            var spanHeight = span.height();
            var color = span.css('background-color');
            var a = spanWidth;
            var angle = 5;
            var radians = 360 / angle;
            var c = spanWidth / Math.cos(Math.PI * 2 / radians);
            var b = Math.floor(Math.sqrt(Math.pow(c, 2) - Math.pow(a, 2)));
            var bot = (slantedBottom) ? b : 0;
            var canvas = document.createElement('canvas');
            if (canvas.getContext) {
                canvas.width = spanWidth;
                canvas.height = spanHeight;
                var ctx = canvas.getContext('2d');
                ctx.beginPath();
                ctx.fillStyle = color;
                ctx.moveTo(0, 0);
                ctx.lineTo(a, b);
                ctx.lineTo(a, spanHeight - bot);
                ctx.lineTo(0, spanHeight);
                ctx.fill();
                $(span).replaceWith(canvas);
            }
            else {
                spanHeight = $(this).height() + 28;
                vmlShape = '<v:shape style="position:absolute;width:' + spanWidth + 'px;height:' + spanHeight + 'px" coordsize="' + spanWidth + ',' + spanHeight + '" fillcolor="' + color + '" strokecolor="' + color + '" coordorigin="0 0" strokeweight="1px" path="m 0,0 l ' + a + ',' + b + ',' + a + ',' + (spanHeight - bot) + ',0,' + spanHeight + ' x e"><v:fill opacity="' + (($(this).attr('class').indexOf('top') !== -1) ? '.9' : '.7') + '"></v:fill></v:shape>';
                $(span).replaceWith(vmlShape);
            }
        });
        if (vmlShape) {
            $("body").append('<div style="display:none;">' + vmlShape + '</div>');
        }
        ;
    },


//Vignette hover
    initVignetteHover: function() {
        $('#vignettes .vignette').hover(FHG.vignetteHover, function() {
        });
    },

    vignetteHover: function() {
        $('#vignettes .vignette').addClass("bottom").removeClass("top");
        $(this).addClass("top").removeClass("bottom");

        if (!$(this).find('canvas').length) {
            $('#vignettes .vignette').find('fill').attr('opacity', '70%');
            $(this).find('fill').attr('opacity', '90%');
        }
    },

    detectFlash: function() {

        if (!FlashDetect.installed) {
            $("#key-visual-player").hide();
            $("#key-visual.player dd").show();

            $("dt.key-visual-swf").hide();
            $("dd.key-visual-alt-image").show();
        }

    },

    initContentSlider:function() {
        if ($('.slide-control').length > 0) {
            $('.slide-control:not(.no-icon)').click(FHG.onSliderClick).bind('keydown', FHG.onSliderClick).attr(FHG.nTabindex(), '0');
        }
        if ($('.slide-control-all').length > 0) {
            $('.slide-control-all').click(FHG.toggleAllSlider).bind('keydown', FHG.toggleAllSlider).attr(FHG.nTabindex(), '0');
        }
    },toggleAllSlider:function(e) {
        var event = e || window.event,k = new FHG.KeyObject(event);
        if (event.type === 'click' || (event.type === 'keydown' && (k.iKey === FHG.key_enter || k.iKey === FHG.key_space))) {
            var closed = true;
            if ($(this).hasClass('close')) {
                $(this).removeClass('close');
                $(this).html(expandAll);
                $(this).attr("title", expandAll)
            }
            else {
                $(this).addClass('close');
                $(this).html(closeAll);
                $(this).attr("title", closeAll);
                closed = false;
            }
            var $slider = $(this).parent().find('.slide-control');
            $slider.each(function(i) {
                if (closed) {
                    $slider.eq(i).siblings('.slide-down').css('display', 'block');
                }
                else {
                    $slider.eq(i).siblings('.slide-down').css('display', 'none');
                }
                $slider.eq(i).trigger("click");
            });
        }
    },onSliderClick:function(e) {
        var event = e || window.event,k = new FHG.KeyObject(event);
        if (event.type === 'click' || (event.type === 'keydown' && (k.iKey === FHG.key_enter || k.iKey === FHG.key_space))) {
            $(this).siblings('.slide-down').slideToggle('fast', FHG.sliderFinish);
            return false;
        }
    },sliderFinish:function() {
        if ($(this).css('display') === 'block') {
            $(this).siblings('.slide-control').addClass('close');
            $(this).attr('aria-expanded', 'true');
        }
        else {
            $(this).siblings('.slide-control').removeClass('close');
            $(this).attr('aria-expanded', 'false');
        }
        FHG.updateBuffer;
    },initSocialBookmarks:function() {
        if ($('#social-bookmarks a').length > 0) {
            $('#social-bookmarks p').append('<span></span>')
            $('#social-bookmarks a').hover(FHG.onBookmarkOver, FHG.onBookmarkOut).bind('focus', FHG.onBookmarkOver).bind('blur', FHG.onBookmarkOut);
        }
    },onBookmarkOver:function() {
        $('#social-bookmarks p span').text($(this).text()).prepend('&raquo;').append('&laquo;');
    },onBookmarkOut:function() {
        $('#social-bookmarks p span').text('');
    },initPrefillForms:function() {
    },initAutocomplete:function() {
        var aData = ['Forschung','Fraunhofer International','Termine','Publikationen','Forschungsthemen','Fraunhofer Technology Academy','Podcast','mp3','mp3 Encoder','mp3 Software','mp3 Surround','mp3 Player','mp3 Kodierung','mp3 Codec','Institute','Einrichtungen','Sitemap','Über Fraunhofer','Rechtliche Hinweise','Kontakt','Fraunhofer Gesellschaft','Informationen'];
        aData.sort();
        $('#search-query').autocomplete(aData);
    },initFontResizr:function() {
        $('#font-sizer').click(FHG.fontResize);
        var fontSize = $.cookie('fraunhofer-font');
        if (fontSize !== '' && $('body').attr('class') === '') {
            FHG.fontResize(null, fontSize);
        }
    },fontResize:function(event, fontSize) {
        var oTarget = FHG.getTarget(event),fontsize = (event) ? $(oTarget).attr('class') : fontSize;
        $('body').attr('class', fontsize);
        $.cookie('fraunhofer-font', fontsize, {expires:'',path:'/'});
        return false;
    },fixEolas:function() {
    },initFisheyeVignette:function() {
        $('.fisheye li').mouseover(FHG.fisheyeVignette).mouseout(function() {
            return false;
        });
        FHG.fisheyeVignette(null, $('.fisheye li:first'));
    },fisheyeVignette:function(e, obj) {
        var elm = (typeof obj !== 'undefined') ? obj : $(this);
        elm.siblings().attr('class', 'fisheyeXXXS');
        elm.attr('class', 'fisheyeXXXL').prev().attr('class', 'fisheyeXXL').prev().attr('class', 'fisheyeXL').prev().attr('class', 'fisheyeL').prev().attr('class', 'fisheyeM').prev().attr('class', 'fisheyeS').prev().attr('class', 'fisheyeXS').prev().attr('class', 'fisheyeXXS');
        elm.next().attr('class', 'fisheyeXXL').next().attr('class', 'fisheyeXL').next().attr('class', 'fisheyeL').next().attr('class', 'fisheyeM').next().attr('class', 'fisheyeS').next().attr('class', 'fisheyeXS').next().attr('class', 'fisheyeXXS');
    },initvAlignVignette:function() {
        $('#vignettes .vignette').each(function() {
            var container = 'div';
            var paddingPx = 10;
            $(this).html("<" + container + ">" + $(this).html() + "</" + container + ">");
            var el = $(this).children(container + ":first");
            var elh = $(el).height();
            var ph = $(this).height();
            if (elh > ph) {
                $(this).height(elh + paddingPx);
                ph = elh + paddingPx;
            }
            var nh = (ph - elh) / 2;
            $(el).css('margin-top', nh);
        });
    },
    initPresetCalendarValues: function() {

        if ($('.datepicker_wrapper') !== null) {
            var currentDate = new Date();
            var month = currentDate.getMonth() + 1;
            month = ( month < 10 ? '0' : '' ) + month;
            var date = currentDate.getDate();
            date = ( date < 10 ? '0' : '' ) + date;
            var year = currentDate.getFullYear();

            /**  if datefield end is blank, set to current date **/
            if ($('.datepicker_wrapper #dtend').attr('value') == "") {
                $('.datepicker_wrapper #dtend').attr('value', date + '.' + month + '.' + year);
            }

            /** if datefield start ist blank, set to current date -1 month **/
            if ($('.datepicker_wrapper #dtstart').attr('value') == "") {

                $('.datepicker_wrapper #dtstart').attr('value', date + '.' + ( ( (month = (month - 1) ) < 10 ? '0' : '' ) + month ) + '.' + year);
            }
        }
        else {
            return false;
        }
    },
    initTableHover:function() {
        if ($.browser.msie && $.browser.version == 6) {
            $('table.sortable-table thead th').hover(FHG.tableHover, FHG.tableUnHover);
        }
    },tableHover:function() {
        $(this).addClass('highlight');
    },tableUnHover:function() {
        $(this).removeClass('highlight');
    },initSearchReset:function() {
        $('#contentboxes a.reset').click(FHG.resetSearchFilter).attr(FHG.nTabindex(), '0');
    },resetSearchFilter:function() {
        $(this).parent().find('input:checked').click();
        var li = $(this).next().find('li:gt(2)');
        $(this).next().next().next().append(li);
        return false;
    },initSearchFilter:function() {
        $('#contentboxes ul.searchfilter').click(FHG.moveFilter);
    },moveFilter:function(e) {
        if (typeof e.type !== 'undefined') {
            var event = e || window.event;
        }
        var oTarget = $(FHG.getTarget(event));
        var li = oTarget.parent();
        if (oTarget.is(':checked')) {
            $(this).prev().prev().append(li);
        }
    },stopPropagation:function(event) {
        if (event.stopPropagation)event.stopPropagation();
        if (event.preventDefault)event.preventDefault();
        event.cancelBubble = true;
        event.returnValue = false;
        return false;
    },KeyObject:function(event) {
        var obj = {iKey:event.keyCode,bCtrlKey:event.ctrlKey,bAltKey:event.altKey,bShiftKey:event.shiftKey,oTarget:FHG.getTarget(event)}
        return obj;
    },nTabindex:function() {
        return(document.body && document.body.tabIndex === 0) ? 'tabIndex' : 'tabindex';
    },setTabindex:function(aElms,carouselObj) {
    	if(carouselObj!=null){
    		$('.image-gallery-cls__'+carouselObj.comp_id+' a').attr(FHG.nTabindex(), '-1');
    	}else{
    		$('#carousel a').attr(FHG.nTabindex(), '-1');
    	}
        $('a', aElms).removeAttr(FHG.nTabindex());
    },updateBuffer:function() {
        $('#bufferUpdater').val(Math.random());
    },getTarget:function(event, resolveTextNode) {
        if (!event)return false;
        var t = event.target || event.srcElement;
        return t;
    }};
if (typeof YAHOO == "undefined" || !YAHOO) {
    var YAHOO = {};
}
YAHOO.namespace = function() {
    var A = arguments,E = null,C,B,D;
    for (C = 0; C < A.length; C = C + 1) {
        D = A[C].split(".");
        E = YAHOO;
        for (B = (D[0] == "YAHOO") ? 1 : 0; B < D.length; B = B + 1) {
            E[D[B]] = E[D[B]] || {};
            E = E[D[B]];
        }
    }
    return E;
};
YAHOO.log = function(D, A, C) {
    var B = YAHOO.widget.Logger;
    if (B && B.log) {
        return B.log(D, A, C);
    } else {
        return false;
    }
};
YAHOO.register = function(A, E, D) {
    var I = YAHOO.env.modules;
    if (!I[A]) {
        I[A] = {versions:[],builds:[]};
    }
    var B = I[A],H = D.version,G = D.build,F = YAHOO.env.listeners;
    B.name = A;
    B.version = H;
    B.build = G;
    B.versions.push(H);
    B.builds.push(G);
    B.mainClass = E;
    for (var C = 0; C < F.length; C = C + 1) {
        F[C](B);
    }
    if (E) {
        E.VERSION = H;
        E.BUILD = G;
    } else {
        YAHOO.log("mainClass is undefined for module " + A, "warn");
    }
};
YAHOO.env = YAHOO.env || {modules:[],listeners:[]};
YAHOO.env.getVersion = function(A) {
    return YAHOO.env.modules[A] || null;
};
YAHOO.env.ua = function() {
    var C = {ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0};
    var B = navigator.userAgent,A;
    if ((/KHTML/).test(B)) {
        C.webkit = 1;
    }
    A = B.match(/AppleWebKit\/([^\s]*)/);
    if (A && A[1]) {
        C.webkit = parseFloat(A[1]);
        if (/ Mobile\//.test(B)) {
            C.mobile = "Apple";
        } else {
            A = B.match(/NokiaN[^\/]*/);
            if (A) {
                C.mobile = A[0];
            }
        }
        A = B.match(/AdobeAIR\/([^\s]*)/);
        if (A) {
            C.air = A[0];
        }
    }
    if (!C.webkit) {
        A = B.match(/Opera[\s\/]([^\s]*)/);
        if (A && A[1]) {
            C.opera = parseFloat(A[1]);
            A = B.match(/Opera Mini[^;]*/);
            if (A) {
                C.mobile = A[0];
            }
        } else {
            A = B.match(/MSIE\s([^;]*)/);
            if (A && A[1]) {
                C.ie = parseFloat(A[1]);
            } else {
                A = B.match(/Gecko\/([^\s]*)/);
                if (A) {
                    C.gecko = 1;
                    A = B.match(/rv:([^\s\)]*)/);
                    if (A && A[1]) {
                        C.gecko = parseFloat(A[1]);
                    }
                }
            }
        }
    }
    return C;
}();
(function() {
    YAHOO.namespace("util", "widget", "example");
    if ("undefined" !== typeof YAHOO_config) {
        var B = YAHOO_config.listener,A = YAHOO.env.listeners,D = true,C;
        if (B) {
            for (C = 0; C < A.length; C = C + 1) {
                if (A[C] == B) {
                    D = false;
                    break;
                }
            }
            if (D) {
                A.push(B);
            }
        }
    }
})();
YAHOO.lang = YAHOO.lang || {};
(function() {
    var A = YAHOO.lang,C = ["toString","valueOf"],B = {isArray:function(D) {
        if (D) {
            return A.isNumber(D.length) && A.isFunction(D.splice);
        }
        return false;
    },isBoolean:function(D) {
        return typeof D === "boolean";
    },isFunction:function(D) {
        return typeof D === "function";
    },isNull:function(D) {
        return D === null;
    },isNumber:function(D) {
        return typeof D === "number" && isFinite(D);
    },isObject:function(D) {
        return(D && (typeof D === "object" || A.isFunction(D))) || false;
    },isString:function(D) {
        return typeof D === "string";
    },isUndefined:function(D) {
        return typeof D === "undefined";
    },_IEEnumFix:(YAHOO.env.ua.ie) ? function(F, E) {
        for (var D = 0; D < C.length; D = D + 1) {
            var H = C[D],G = E[H];
            if (A.isFunction(G) && G != Object.prototype[H]) {
                F[H] = G;
            }
        }
    } : function() {
    },extend:function(H, I, G) {
        if (!I || !H) {
            throw new Error("extend failed, please check that " + "all dependencies are included.");
        }
        var E = function() {
        };
        E.prototype = I.prototype;
        H.prototype = new E();
        H.prototype.constructor = H;
        H.superclass = I.prototype;
        if (I.prototype.constructor == Object.prototype.constructor) {
            I.prototype.constructor = I;
        }
        if (G) {
            for (var D in G) {
                if (A.hasOwnProperty(G, D)) {
                    H.prototype[D] = G[D];
                }
            }
            A._IEEnumFix(H.prototype, G);
        }
    },augmentObject:function(H, G) {
        if (!G || !H) {
            throw new Error("Absorb failed, verify dependencies.");
        }
        var D = arguments,F,I,E = D[2];
        if (E && E !== true) {
            for (F = 2; F < D.length; F = F + 1) {
                H[D[F]] = G[D[F]];
            }
        } else {
            for (I in G) {
                if (E || !(I in H)) {
                    H[I] = G[I];
                }
            }
            A._IEEnumFix(H, G);
        }
    },augmentProto:function(G, F) {
        if (!F || !G) {
            throw new Error("Augment failed, verify dependencies.");
        }
        var D = [G.prototype,F.prototype];
        for (var E = 2; E < arguments.length; E = E + 1) {
            D.push(arguments[E]);
        }
        A.augmentObject.apply(this, D);
    },dump:function(D, I) {
        var F,H,K = [],L = "{...}",E = "f(){...}",J = ", ",G = " => ";
        if (!A.isObject(D)) {
            return D + "";
        } else {
            if (D instanceof Date || ("nodeType"in D && "tagName"in D)) {
                return D;
            } else {
                if (A.isFunction(D)) {
                    return E;
                }
            }
        }
        I = (A.isNumber(I)) ? I : 3;
        if (A.isArray(D)) {
            K.push("[");
            for (F = 0,H = D.length; F < H; F = F + 1) {
                if (A.isObject(D[F])) {
                    K.push((I > 0) ? A.dump(D[F], I - 1) : L);
                } else {
                    K.push(D[F]);
                }
                K.push(J);
            }
            if (K.length > 1) {
                K.pop();
            }
            K.push("]");
        } else {
            K.push("{");
            for (F in D) {
                if (A.hasOwnProperty(D, F)) {
                    K.push(F + G);
                    if (A.isObject(D[F])) {
                        K.push((I > 0) ? A.dump(D[F], I - 1) : L);
                    } else {
                        K.push(D[F]);
                    }
                    K.push(J);
                }
            }
            if (K.length > 1) {
                K.pop();
            }
            K.push("}");
        }
        return K.join("");
    },substitute:function(S, E, L) {
        var I,H,G,O,P,R,N = [],F,J = "dump",M = " ",D = "{",Q = "}";
        for (; ;) {
            I = S.lastIndexOf(D);
            if (I < 0) {
                break;
            }
            H = S.indexOf(Q, I);
            if (I + 1 >= H) {
                break;
            }
            F = S.substring(I + 1, H);
            O = F;
            R = null;
            G = O.indexOf(M);
            if (G > -1) {
                R = O.substring(G + 1);
                O = O.substring(0, G);
            }
            P = E[O];
            if (L) {
                P = L(O, P, R);
            }
            if (A.isObject(P)) {
                if (A.isArray(P)) {
                    P = A.dump(P, parseInt(R, 10));
                } else {
                    R = R || "";
                    var K = R.indexOf(J);
                    if (K > -1) {
                        R = R.substring(4);
                    }
                    if (P.toString === Object.prototype.toString || K > -1) {
                        P = A.dump(P, parseInt(R, 10));
                    } else {
                        P = P.toString();
                    }
                }
            } else {
                if (!A.isString(P) && !A.isNumber(P)) {
                    P = "~-" + N.length + "-~";
                    N[N.length] = F;
                }
            }
            S = S.substring(0, I) + P + S.substring(H + 1);
        }
        for (I = N.length - 1; I >= 0; I = I - 1) {
            S = S.replace(new RegExp("~-" + I + "-~"), "{" + N[I] + "}", "g");
        }
        return S;
    },trim:function(D) {
        try {
            return D.replace(/^\s+|\s+$/g, "");
        } catch(E) {
            return D;
        }
    },merge:function() {
        var G = {},E = arguments;
        for (var F = 0,D = E.length; F < D; F = F + 1) {
            A.augmentObject(G, E[F], true);
        }
        return G;
    },later:function(K, E, L, G, H) {
        K = K || 0;
        E = E || {};
        var F = L,J = G,I,D;
        if (A.isString(L)) {
            F = E[L];
        }
        if (!F) {
            throw new TypeError("method undefined");
        }
        if (!A.isArray(J)) {
            J = [G];
        }
        I = function() {
            F.apply(E, J);
        };
        D = (H) ? setInterval(I, K) : setTimeout(I, K);
        return{interval:H,cancel:function() {
            if (this.interval) {
                clearInterval(D);
            } else {
                clearTimeout(D);
            }
        }};
    },isValue:function(D) {
        return(A.isObject(D) || A.isString(D) || A.isNumber(D) || A.isBoolean(D));
    }};
    A.hasOwnProperty = (Object.prototype.hasOwnProperty) ? function(D, E) {
        return D && D.hasOwnProperty(E);
    } : function(D, E) {
        return!A.isUndefined(D[E]) && D.constructor.prototype[E] !== D[E];
    };
    B.augmentObject(A, B, true);
    YAHOO.util.Lang = A;
    A.augment = A.augmentProto;
    YAHOO.augment = A.augmentProto;
    YAHOO.extend = A.extend;
})();
YAHOO.register("yahoo", YAHOO, {version:"2.6.0",build:"1321"});
(function() {
    var B = YAHOO.util,F = YAHOO.lang,L,J,K = {},G = {},N = window.document;
    YAHOO.env._id_counter = YAHOO.env._id_counter || 0;
    var C = YAHOO.env.ua.opera,M = YAHOO.env.ua.webkit,A = YAHOO.env.ua.gecko,H = YAHOO.env.ua.ie;
    var E = {HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i,OP_SCROLL:/^(?:inline|table-row)$/i};
    var O = function(Q) {
        if (!E.HYPHEN.test(Q)) {
            return Q;
        }
        if (K[Q]) {
            return K[Q];
        }
        var R = Q;
        while (E.HYPHEN.exec(R)) {
            R = R.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());
        }
        K[Q] = R;
        return R;
    };
    var P = function(R) {
        var Q = G[R];
        if (!Q) {
            Q = new RegExp("(?:^|\\s+)" + R + "(?:\\s+|$)");
            G[R] = Q;
        }
        return Q;
    };
    if (N.defaultView && N.defaultView.getComputedStyle) {
        L = function(Q, T) {
            var S = null;
            if (T == "float") {
                T = "cssFloat";
            }
            var R = Q.ownerDocument.defaultView.getComputedStyle(Q, "");
            if (R) {
                S = R[O(T)];
            }
            return Q.style[T] || S;
        };
    } else {
        if (N.documentElement.currentStyle && H) {
            L = function(Q, S) {
                switch (O(S)) {
                    case"opacity":
                        var U = 100;
                        try {
                            U = Q.filters["DXImageTransform.Microsoft.Alpha"].opacity;
                        } catch(T) {
                            try {
                                U = Q.filters("alpha").opacity;
                            } catch(T) {
                            }
                        }
                        return U / 100;
                    case"float":
                        S = "styleFloat";
                    default:
                        var R = Q.currentStyle ? Q.currentStyle[S] : null;
                        return(Q.style[S] || R);
                }
            };
        } else {
            L = function(Q, R) {
                return Q.style[R];
            };
        }
    }
    if (H) {
        J = function(Q, R, S) {
            switch (R) {
                case"opacity":
                    if (F.isString(Q.style.filter)) {
                        Q.style.filter = "alpha(opacity=" + S * 100 + ")";
                        if (!Q.currentStyle || !Q.currentStyle.hasLayout) {
                            Q.style.zoom = 1;
                        }
                    }
                    break;
                case"float":
                    R = "styleFloat";
                default:
                    Q.style[R] = S;
            }
        };
    } else {
        J = function(Q, R, S) {
            if (R == "float") {
                R = "cssFloat";
            }
            Q.style[R] = S;
        };
    }
    var D = function(Q, R) {
        return Q && Q.nodeType == 1 && (!R || R(Q));
    };
    YAHOO.util.Dom = {get:function(S) {
        if (S) {
            if (S.nodeType || S.item) {
                return S;
            }
            if (typeof S === "string") {
                return N.getElementById(S);
            }
            if ("length"in S) {
                var T = [];
                for (var R = 0,Q = S.length; R < Q; ++R) {
                    T[T.length] = B.Dom.get(S[R]);
                }
                return T;
            }
            return S;
        }
        return null;
    },getStyle:function(Q, S) {
        S = O(S);
        var R = function(T) {
            return L(T, S);
        };
        return B.Dom.batch(Q, R, B.Dom, true);
    },setStyle:function(Q, S, T) {
        S = O(S);
        var R = function(U) {
            J(U, S, T);
        };
        B.Dom.batch(Q, R, B.Dom, true);
    },getXY:function(Q) {
        var R = function(S) {
            if ((S.parentNode === null || S.offsetParent === null || this.getStyle(S, "display") == "none") && S != S.ownerDocument.body) {
                return false;
            }
            return I(S);
        };
        return B.Dom.batch(Q, R, B.Dom, true);
    },getX:function(Q) {
        var R = function(S) {
            return B.Dom.getXY(S)[0];
        };
        return B.Dom.batch(Q, R, B.Dom, true);
    },getY:function(Q) {
        var R = function(S) {
            return B.Dom.getXY(S)[1];
        };
        return B.Dom.batch(Q, R, B.Dom, true);
    },setXY:function(Q, T, S) {
        var R = function(W) {
            var V = this.getStyle(W, "position");
            if (V == "static") {
                this.setStyle(W, "position", "relative");
                V = "relative";
            }
            var Y = this.getXY(W);
            if (Y === false) {
                return false;
            }
            var X = [parseInt(this.getStyle(W, "left"), 10),parseInt(this.getStyle(W, "top"), 10)];
            if (isNaN(X[0])) {
                X[0] = (V == "relative") ? 0 : W.offsetLeft;
            }
            if (isNaN(X[1])) {
                X[1] = (V == "relative") ? 0 : W.offsetTop;
            }
            if (T[0] !== null) {
                W.style.left = T[0] - Y[0] + X[0] + "px";
            }
            if (T[1] !== null) {
                W.style.top = T[1] - Y[1] + X[1] + "px";
            }
            if (!S) {
                var U = this.getXY(W);
                if ((T[0] !== null && U[0] != T[0]) || (T[1] !== null && U[1] != T[1])) {
                    this.setXY(W, T, true);
                }
            }
        };
        B.Dom.batch(Q, R, B.Dom, true);
    },setX:function(R, Q) {
        B.Dom.setXY(R, [Q,null]);
    },setY:function(Q, R) {
        B.Dom.setXY(Q, [null,R]);
    },getRegion:function(Q) {
        var R = function(S) {
            if ((S.parentNode === null || S.offsetParent === null || this.getStyle(S, "display") == "none") && S != S.ownerDocument.body) {
                return false;
            }
            var T = B.Region.getRegion(S);
            return T;
        };
        return B.Dom.batch(Q, R, B.Dom, true);
    },getClientWidth:function() {
        return B.Dom.getViewportWidth();
    },getClientHeight:function() {
        return B.Dom.getViewportHeight();
    },getElementsByClassName:function(U, Y, V, W) {
        U = F.trim(U);
        Y = Y || "*";
        V = (V) ? B.Dom.get(V) : null || N;
        if (!V) {
            return[];
        }
        var R = [],Q = V.getElementsByTagName(Y),X = P(U);
        for (var S = 0,T = Q.length; S < T; ++S) {
            if (X.test(Q[S].className)) {
                R[R.length] = Q[S];
                if (W) {
                    W.call(Q[S], Q[S]);
                }
            }
        }
        return R;
    },hasClass:function(S, R) {
        var Q = P(R);
        var T = function(U) {
            return Q.test(U.className);
        };
        return B.Dom.batch(S, T, B.Dom, true);
    },addClass:function(R, Q) {
        var S = function(T) {
            if (this.hasClass(T, Q)) {
                return false;
            }
            T.className = F.trim([T.className,Q].join(" "));
            return true;
        };
        return B.Dom.batch(R, S, B.Dom, true);
    },removeClass:function(S, R) {
        var Q = P(R);
        var T = function(W) {
            var V = false,X = W.className;
            if (R && X && this.hasClass(W, R)) {
                W.className = X.replace(Q, " ");
                if (this.hasClass(W, R)) {
                    this.removeClass(W, R);
                }
                W.className = F.trim(W.className);
                if (W.className === "") {
                    var U = (W.hasAttribute) ? "class" : "className";
                    W.removeAttribute(U);
                }
                V = true;
            }
            return V;
        };
        return B.Dom.batch(S, T, B.Dom, true);
    },replaceClass:function(T, R, Q) {
        if (!Q || R === Q) {
            return false;
        }
        var S = P(R);
        var U = function(V) {
            if (!this.hasClass(V, R)) {
                this.addClass(V, Q);
                return true;
            }
            V.className = V.className.replace(S, " " + Q + " ");
            if (this.hasClass(V, R)) {
                this.removeClass(V, R);
            }
            V.className = F.trim(V.className);
            return true;
        };
        return B.Dom.batch(T, U, B.Dom, true);
    },generateId:function(Q, S) {
        S = S || "yui-gen";
        var R = function(T) {
            if (T && T.id) {
                return T.id;
            }
            var U = S + YAHOO.env._id_counter++;
            if (T) {
                T.id = U;
            }
            return U;
        };
        return B.Dom.batch(Q, R, B.Dom, true) || R.apply(B.Dom, arguments);
    },isAncestor:function(R, S) {
        R = B.Dom.get(R);
        S = B.Dom.get(S);
        var Q = false;
        if ((R && S) && (R.nodeType && S.nodeType)) {
            if (R.contains && R !== S) {
                Q = R.contains(S);
            } else {
                if (R.compareDocumentPosition) {
                    Q = !!(R.compareDocumentPosition(S) & 16);
                }
            }
        } else {
        }
        return Q;
    },inDocument:function(Q) {
        return this.isAncestor(N.documentElement, Q);
    },getElementsBy:function(X, R, S, U) {
        R = R || "*";
        S = (S) ? B.Dom.get(S) : null || N;
        if (!S) {
            return[];
        }
        var T = [],W = S.getElementsByTagName(R);
        for (var V = 0,Q = W.length; V < Q; ++V) {
            if (X(W[V])) {
                T[T.length] = W[V];
                if (U) {
                    U(W[V]);
                }
            }
        }
        return T;
    },batch:function(U, X, W, S) {
        U = (U && (U.tagName || U.item)) ? U : B.Dom.get(U);
        if (!U || !X) {
            return false;
        }
        var T = (S) ? W : window;
        if (U.tagName || U.length === undefined) {
            return X.call(T, U, W);
        }
        var V = [];
        for (var R = 0,Q = U.length; R < Q; ++R) {
            V[V.length] = X.call(T, U[R], W);
        }
        return V;
    },getDocumentHeight:function() {
        var R = (N.compatMode != "CSS1Compat") ? N.body.scrollHeight : N.documentElement.scrollHeight;
        var Q = Math.max(R, B.Dom.getViewportHeight());
        return Q;
    },getDocumentWidth:function() {
        var R = (N.compatMode != "CSS1Compat") ? N.body.scrollWidth : N.documentElement.scrollWidth;
        var Q = Math.max(R, B.Dom.getViewportWidth());
        return Q;
    },getViewportHeight:function() {
        var Q = self.innerHeight;
        var R = N.compatMode;
        if ((R || H) && !C) {
            Q = (R == "CSS1Compat") ? N.documentElement.clientHeight : N.body.clientHeight;
        }
        return Q;
    },getViewportWidth:function() {
        var Q = self.innerWidth;
        var R = N.compatMode;
        if (R || H) {
            Q = (R == "CSS1Compat") ? N.documentElement.clientWidth : N.body.clientWidth;
        }
        return Q;
    },getAncestorBy:function(Q, R) {
        while ((Q = Q.parentNode)) {
            if (D(Q, R)) {
                return Q;
            }
        }
        return null;
    },getAncestorByClassName:function(R, Q) {
        R = B.Dom.get(R);
        if (!R) {
            return null;
        }
        var S = function(T) {
            return B.Dom.hasClass(T, Q);
        };
        return B.Dom.getAncestorBy(R, S);
    },getAncestorByTagName:function(R, Q) {
        R = B.Dom.get(R);
        if (!R) {
            return null;
        }
        var S = function(T) {
            return T.tagName && T.tagName.toUpperCase() == Q.toUpperCase();
        };
        return B.Dom.getAncestorBy(R, S);
    },getPreviousSiblingBy:function(Q, R) {
        while (Q) {
            Q = Q.previousSibling;
            if (D(Q, R)) {
                return Q;
            }
        }
        return null;
    },getPreviousSibling:function(Q) {
        Q = B.Dom.get(Q);
        if (!Q) {
            return null;
        }
        return B.Dom.getPreviousSiblingBy(Q);
    },getNextSiblingBy:function(Q, R) {
        while (Q) {
            Q = Q.nextSibling;
            if (D(Q, R)) {
                return Q;
            }
        }
        return null;
    },getNextSibling:function(Q) {
        Q = B.Dom.get(Q);
        if (!Q) {
            return null;
        }
        return B.Dom.getNextSiblingBy(Q);
    },getFirstChildBy:function(Q, S) {
        var R = (D(Q.firstChild, S)) ? Q.firstChild : null;
        return R || B.Dom.getNextSiblingBy(Q.firstChild, S);
    },getFirstChild:function(Q, R) {
        Q = B.Dom.get(Q);
        if (!Q) {
            return null;
        }
        return B.Dom.getFirstChildBy(Q);
    },getLastChildBy:function(Q, S) {
        if (!Q) {
            return null;
        }
        var R = (D(Q.lastChild, S)) ? Q.lastChild : null;
        return R || B.Dom.getPreviousSiblingBy(Q.lastChild, S);
    },getLastChild:function(Q) {
        Q = B.Dom.get(Q);
        return B.Dom.getLastChildBy(Q);
    },getChildrenBy:function(R, T) {
        var S = B.Dom.getFirstChildBy(R, T);
        var Q = S ? [S] : [];
        B.Dom.getNextSiblingBy(S, function(U) {
            if (!T || T(U)) {
                Q[Q.length] = U;
            }
            return false;
        });
        return Q;
    },getChildren:function(Q) {
        Q = B.Dom.get(Q);
        if (!Q) {
        }
        return B.Dom.getChildrenBy(Q);
    },getDocumentScrollLeft:function(Q) {
        Q = Q || N;
        return Math.max(Q.documentElement.scrollLeft, Q.body.scrollLeft);
    },getDocumentScrollTop:function(Q) {
        Q = Q || N;
        return Math.max(Q.documentElement.scrollTop, Q.body.scrollTop);
    },insertBefore:function(R, Q) {
        R = B.Dom.get(R);
        Q = B.Dom.get(Q);
        if (!R || !Q || !Q.parentNode) {
            return null;
        }
        return Q.parentNode.insertBefore(R, Q);
    },insertAfter:function(R, Q) {
        R = B.Dom.get(R);
        Q = B.Dom.get(Q);
        if (!R || !Q || !Q.parentNode) {
            return null;
        }
        if (Q.nextSibling) {
            return Q.parentNode.insertBefore(R, Q.nextSibling);
        } else {
            return Q.parentNode.appendChild(R);
        }
    },getClientRegion:function() {
        var S = B.Dom.getDocumentScrollTop(),R = B.Dom.getDocumentScrollLeft(),T = B.Dom.getViewportWidth() + R,Q = B.Dom.getViewportHeight() + S;
        return new B.Region(S, T, Q, R);
    }};
    var I = function() {
        if (N.documentElement.getBoundingClientRect) {
            return function(S) {
                var T = S.getBoundingClientRect(),R = Math.round;
                var Q = S.ownerDocument;
                return[R(T.left + B.Dom.getDocumentScrollLeft(Q)),R(T.top + B.Dom.getDocumentScrollTop(Q))];
            };
        } else {
            return function(S) {
                var T = [S.offsetLeft,S.offsetTop];
                var R = S.offsetParent;
                var Q = (M && B.Dom.getStyle(S, "position") == "absolute" && S.offsetParent == S.ownerDocument.body);
                if (R != S) {
                    while (R) {
                        T[0] += R.offsetLeft;
                        T[1] += R.offsetTop;
                        if (!Q && M && B.Dom.getStyle(R, "position") == "absolute") {
                            Q = true;
                        }
                        R = R.offsetParent;
                    }
                }
                if (Q) {
                    T[0] -= S.ownerDocument.body.offsetLeft;
                    T[1] -= S.ownerDocument.body.offsetTop;
                }
                R = S.parentNode;
                while (R.tagName && !E.ROOT_TAG.test(R.tagName)) {
                    if (R.scrollTop || R.scrollLeft) {
                        T[0] -= R.scrollLeft;
                        T[1] -= R.scrollTop;
                    }
                    R = R.parentNode;
                }
                return T;
            };
        }
    }();
})();
YAHOO.util.Region = function(C, D, A, B) {
    this.top = C;
    this[1] = C;
    this.right = D;
    this.bottom = A;
    this.left = B;
    this[0] = B;
};
YAHOO.util.Region.prototype.contains = function(A) {
    return(A.left >= this.left && A.right <= this.right && A.top >= this.top && A.bottom <= this.bottom);
};
YAHOO.util.Region.prototype.getArea = function() {
    return((this.bottom - this.top) * (this.right - this.left));
};
YAHOO.util.Region.prototype.intersect = function(E) {
    var C = Math.max(this.top, E.top);
    var D = Math.min(this.right, E.right);
    var A = Math.min(this.bottom, E.bottom);
    var B = Math.max(this.left, E.left);
    if (A >= C && D >= B) {
        return new YAHOO.util.Region(C, D, A, B);
    } else {
        return null;
    }
};
YAHOO.util.Region.prototype.union = function(E) {
    var C = Math.min(this.top, E.top);
    var D = Math.max(this.right, E.right);
    var A = Math.max(this.bottom, E.bottom);
    var B = Math.min(this.left, E.left);
    return new YAHOO.util.Region(C, D, A, B);
};
YAHOO.util.Region.prototype.toString = function() {
    return("Region {" + "top: " + this.top + ", right: " + this.right + ", bottom: " + this.bottom + ", left: " + this.left + "}");
};
YAHOO.util.Region.getRegion = function(D) {
    var F = YAHOO.util.Dom.getXY(D);
    var C = F[1];
    var E = F[0] + D.offsetWidth;
    var A = F[1] + D.offsetHeight;
    var B = F[0];
    return new YAHOO.util.Region(C, E, A, B);
};
YAHOO.util.Point = function(A, B) {
    if (YAHOO.lang.isArray(A)) {
        B = A[1];
        A = A[0];
    }
    this.x = this.right = this.left = this[0] = A;
    this.y = this.top = this.bottom = this[1] = B;
};
YAHOO.util.Point.prototype = new YAHOO.util.Region();
YAHOO.register("dom", YAHOO.util.Dom, {version:"2.6.0",build:"1321"});
YAHOO.util.CustomEvent = function(D, B, C, A) {
    this.type = D;
    this.scope = B || window;
    this.silent = C;
    this.signature = A || YAHOO.util.CustomEvent.LIST;
    this.subscribers = [];
    if (!this.silent) {
    }
    var E = "_YUICEOnSubscribe";
    if (D !== E) {
        this.subscribeEvent = new YAHOO.util.CustomEvent(E, this, true);
    }
    this.lastError = null;
};
YAHOO.util.CustomEvent.LIST = 0;
YAHOO.util.CustomEvent.FLAT = 1;
YAHOO.util.CustomEvent.prototype = {subscribe:function(B, C, A) {
    if (!B) {
        throw new Error("Invalid callback for subscriber to '" + this.type + "'");
    }
    if (this.subscribeEvent) {
        this.subscribeEvent.fire(B, C, A);
    }
    this.subscribers.push(new YAHOO.util.Subscriber(B, C, A));
},unsubscribe:function(D, F) {
    if (!D) {
        return this.unsubscribeAll();
    }
    var E = false;
    for (var B = 0,A = this.subscribers.length; B < A; ++B) {
        var C = this.subscribers[B];
        if (C && C.contains(D, F)) {
            this._delete(B);
            E = true;
        }
    }
    return E;
},fire:function() {
    this.lastError = null;
    var K = [],E = this.subscribers.length;
    if (!E && this.silent) {
        return true;
    }
    var I = [].slice.call(arguments, 0),G = true,D,J = false;
    if (!this.silent) {
    }
    var C = this.subscribers.slice(),A = YAHOO.util.Event.throwErrors;
    for (D = 0; D < E; ++D) {
        var M = C[D];
        if (!M) {
            J = true;
        } else {
            if (!this.silent) {
            }
            var L = M.getScope(this.scope);
            if (this.signature == YAHOO.util.CustomEvent.FLAT) {
                var B = null;
                if (I.length > 0) {
                    B = I[0];
                }
                try {
                    G = M.fn.call(L, B, M.obj);
                } catch(F) {
                    this.lastError = F;
                    if (A) {
                        throw F;
                    }
                }
            } else {
                try {
                    G = M.fn.call(L, this.type, I, M.obj);
                } catch(H) {
                    this.lastError = H;
                    if (A) {
                        throw H;
                    }
                }
            }
            if (false === G) {
                if (!this.silent) {
                }
                break;
            }
        }
    }
    return(G !== false);
},unsubscribeAll:function() {
    for (var A = this.subscribers.length - 1; A > -1; A--) {
        this._delete(A);
    }
    this.subscribers = [];
    return A;
},_delete:function(A) {
    var B = this.subscribers[A];
    if (B) {
        delete B.fn;
        delete B.obj;
    }
    this.subscribers.splice(A, 1);
},toString:function() {
    return"CustomEvent: " + "'" + this.type + "', " + "scope: " + this.scope;
}};
YAHOO.util.Subscriber = function(B, C, A) {
    this.fn = B;
    this.obj = YAHOO.lang.isUndefined(C) ? null : C;
    this.override = A;
};
YAHOO.util.Subscriber.prototype.getScope = function(A) {
    if (this.override) {
        if (this.override === true) {
            return this.obj;
        } else {
            return this.override;
        }
    }
    return A;
};
YAHOO.util.Subscriber.prototype.contains = function(A, B) {
    if (B) {
        return(this.fn == A && this.obj == B);
    } else {
        return(this.fn == A);
    }
};
YAHOO.util.Subscriber.prototype.toString = function() {
    return"Subscriber { obj: " + this.obj + ", override: " + (this.override || "no") + " }";
};
if (!YAHOO.util.Event) {
    YAHOO.util.Event = function() {
        var H = false;
        var I = [];
        var J = [];
        var G = [];
        var E = [];
        var C = 0;
        var F = [];
        var B = [];
        var A = 0;
        var D = {63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};
        var K = YAHOO.env.ua.ie ? "focusin" : "focus";
        var L = YAHOO.env.ua.ie ? "focusout" : "blur";
        return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function() {
            if (!this._interval) {
                var M = this;
                var N = function() {
                    M._tryPreloadAttach();
                };
                this._interval = setInterval(N, this.POLL_INTERVAL);
            }
        },onAvailable:function(R, O, S, Q, P) {
            var M = (YAHOO.lang.isString(R)) ? [R] : R;
            for (var N = 0; N < M.length; N = N + 1) {
                F.push({id:M[N],fn:O,obj:S,override:Q,checkReady:P});
            }
            C = this.POLL_RETRYS;
            this.startInterval();
        },onContentReady:function(O, M, P, N) {
            this.onAvailable(O, M, P, N, true);
        },onDOMReady:function(M, O, N) {
            if (this.DOMReady) {
                setTimeout(function() {
                    var P = window;
                    if (N) {
                        if (N === true) {
                            P = O;
                        } else {
                            P = N;
                        }
                    }
                    M.call(P, "DOMReady", [], O);
                }, 0);
            } else {
                this.DOMReadyEvent.subscribe(M, O, N);
            }
        },_addListener:function(O, M, X, S, N, a) {
            if (!X || !X.call) {
                return false;
            }
            if (this._isValidCollection(O)) {
                var Y = true;
                for (var T = 0,V = O.length; T < V; ++T) {
                    Y = this._addListener(O[T], M, X, S, N, a) && Y;
                }
                return Y;
            } else {
                if (YAHOO.lang.isString(O)) {
                    var R = this.getEl(O);
                    if (R) {
                        O = R;
                    } else {
                        this.onAvailable(O, function() {
                            YAHOO.util.Event._addListener(O, M, X, S, N, a);
                        });
                        return true;
                    }
                }
            }
            if (!O) {
                return false;
            }
            if ("unload" == M && S !== this) {
                J[J.length] = [O,M,X,S,N,a];
                return true;
            }
            var b = O;
            if (N) {
                if (N === true) {
                    b = S;
                } else {
                    b = N;
                }
            }
            var P = function(c) {
                return X.call(b, YAHOO.util.Event.getEvent(c, O), S);
            };
            var Z = [O,M,X,P,b,S,N,a];
            var U = I.length;
            I[U] = Z;
            if (this.useLegacyEvent(O, M)) {
                var Q = this.getLegacyIndex(O, M);
                if (Q == -1 || O != G[Q][0]) {
                    Q = G.length;
                    B[O.id + M] = Q;
                    G[Q] = [O,M,O["on" + M]];
                    E[Q] = [];
                    O["on" + M] = function(c) {
                        YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(c), Q);
                    };
                }
                E[Q].push(Z);
            } else {
                try {
                    this._simpleAdd(O, M, P, a);
                } catch(W) {
                    this.lastError = W;
                    this._removeListener(O, M, X, a);
                    return false;
                }
            }
            return true;
        },addListener:function(O, Q, N, P, M) {
            return this._addListener(O, Q, N, P, M, false);
        },addFocusListener:function(O, N, P, M) {
            return this._addListener(O, K, N, P, M, true);
        },removeFocusListener:function(N, M) {
            return this._removeListener(N, K, M, true);
        },addBlurListener:function(O, N, P, M) {
            return this._addListener(O, L, N, P, M, true);
        },removeBlurListener:function(N, M) {
            return this._removeListener(N, L, M, true);
        },fireLegacyEvent:function(Q, O) {
            var S = true,M,U,T,V,R;
            U = E[O].slice();
            for (var N = 0,P = U.length; N < P; ++N) {
                T = U[N];
                if (T && T[this.WFN]) {
                    V = T[this.ADJ_SCOPE];
                    R = T[this.WFN].call(V, Q);
                    S = (S && R);
                }
            }
            M = G[O];
            if (M && M[2]) {
                M[2](Q);
            }
            return S;
        },getLegacyIndex:function(N, O) {
            var M = this.generateId(N) + O;
            if (typeof B[M] == "undefined") {
                return-1;
            } else {
                return B[M];
            }
        },useLegacyEvent:function(M, N) {
            return(this.webkit && this.webkit < 419 && ("click" == N || "dblclick" == N));
        },_removeListener:function(N, M, V, Y) {
            var Q,T,X;
            if (typeof N == "string") {
                N = this.getEl(N);
            } else {
                if (this._isValidCollection(N)) {
                    var W = true;
                    for (Q = N.length - 1; Q > -1; Q--) {
                        W = (this._removeListener(N[Q], M, V, Y) && W);
                    }
                    return W;
                }
            }
            if (!V || !V.call) {
                return this.purgeElement(N, false, M);
            }
            if ("unload" == M) {
                for (Q = J.length - 1; Q > -1; Q--) {
                    X = J[Q];
                    if (X && X[0] == N && X[1] == M && X[2] == V) {
                        J.splice(Q, 1);
                        return true;
                    }
                }
                return false;
            }
            var R = null;
            var S = arguments[4];
            if ("undefined" === typeof S) {
                S = this._getCacheIndex(N, M, V);
            }
            if (S >= 0) {
                R = I[S];
            }
            if (!N || !R) {
                return false;
            }
            if (this.useLegacyEvent(N, M)) {
                var P = this.getLegacyIndex(N, M);
                var O = E[P];
                if (O) {
                    for (Q = 0,T = O.length; Q < T; ++Q) {
                        X = O[Q];
                        if (X && X[this.EL] == N && X[this.TYPE] == M && X[this.FN] == V) {
                            O.splice(Q, 1);
                            break;
                        }
                    }
                }
            } else {
                try {
                    this._simpleRemove(N, M, R[this.WFN], Y);
                } catch(U) {
                    this.lastError = U;
                    return false;
                }
            }
            delete I[S][this.WFN];
            delete I[S][this.FN];
            I.splice(S, 1);
            return true;
        },removeListener:function(N, O, M) {
            return this._removeListener(N, O, M, false);
        },getTarget:function(O, N) {
            var M = O.target || O.srcElement;
            return this.resolveTextNode(M);
        },resolveTextNode:function(N) {
            try {
                if (N && 3 == N.nodeType) {
                    return N.parentNode;
                }
            } catch(M) {
            }
            return N;
        },getPageX:function(N) {
            var M = N.pageX;
            if (!M && 0 !== M) {
                M = N.clientX || 0;
                if (this.isIE) {
                    M += this._getScrollLeft();
                }
            }
            return M;
        },getPageY:function(M) {
            var N = M.pageY;
            if (!N && 0 !== N) {
                N = M.clientY || 0;
                if (this.isIE) {
                    N += this._getScrollTop();
                }
            }
            return N;
        },getXY:function(M) {
            return[this.getPageX(M),this.getPageY(M)];
        },getRelatedTarget:function(N) {
            var M = N.relatedTarget;
            if (!M) {
                if (N.type == "mouseout") {
                    M = N.toElement;
                } else {
                    if (N.type == "mouseover") {
                        M = N.fromElement;
                    }
                }
            }
            return this.resolveTextNode(M);
        },getTime:function(O) {
            if (!O.time) {
                var N = new Date().getTime();
                try {
                    O.time = N;
                } catch(M) {
                    this.lastError = M;
                    return N;
                }
            }
            return O.time;
        },stopEvent:function(M) {
            this.stopPropagation(M);
            this.preventDefault(M);
        },stopPropagation:function(M) {
            if (M.stopPropagation) {
                M.stopPropagation();
            } else {
                M.cancelBubble = true;
            }
        },preventDefault:function(M) {
            if (M.preventDefault) {
                M.preventDefault();
            } else {
                M.returnValue = false;
            }
        },getEvent:function(O, M) {
            var N = O || window.event;
            if (!N) {
                var P = this.getEvent.caller;
                while (P) {
                    N = P.arguments[0];
                    if (N && Event == N.constructor) {
                        break;
                    }
                    P = P.caller;
                }
            }
            return N;
        },getCharCode:function(N) {
            var M = N.keyCode || N.charCode || 0;
            if (YAHOO.env.ua.webkit && (M in D)) {
                M = D[M];
            }
            return M;
        },_getCacheIndex:function(Q, R, P) {
            for (var O = 0,N = I.length; O < N; O = O + 1) {
                var M = I[O];
                if (M && M[this.FN] == P && M[this.EL] == Q && M[this.TYPE] == R) {
                    return O;
                }
            }
            return-1;
        },generateId:function(M) {
            var N = M.id;
            if (!N) {
                N = "yuievtautoid-" + A;
                ++A;
                M.id = N;
            }
            return N;
        },_isValidCollection:function(N) {
            try {
                return(N && typeof N !== "string" && N.length && !N.tagName && !N.alert && typeof N[0] !== "undefined");
            } catch(M) {
                return false;
            }
        },elCache:{},getEl:function(M) {
            return(typeof M === "string") ? document.getElementById(M) : M;
        },clearCache:function() {
        },DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady", this),_load:function(N) {
            if (!H) {
                H = true;
                var M = YAHOO.util.Event;
                M._ready();
                M._tryPreloadAttach();
            }
        },_ready:function(N) {
            var M = YAHOO.util.Event;
            if (!M.DOMReady) {
                M.DOMReady = true;
                M.DOMReadyEvent.fire();
                M._simpleRemove(document, "DOMContentLoaded", M._ready);
            }
        },_tryPreloadAttach:function() {
            if (F.length === 0) {
                C = 0;
                clearInterval(this._interval);
                this._interval = null;
                return;
            }
            if (this.locked) {
                return;
            }
            if (this.isIE) {
                if (!this.DOMReady) {
                    this.startInterval();
                    return;
                }
            }
            this.locked = true;
            var S = !H;
            if (!S) {
                S = (C > 0 && F.length > 0);
            }
            var R = [];
            var T = function(V, W) {
                var U = V;
                if (W.override) {
                    if (W.override === true) {
                        U = W.obj;
                    } else {
                        U = W.override;
                    }
                }
                W.fn.call(U, W.obj);
            };
            var N,M,Q,P,O = [];
            for (N = 0,M = F.length; N < M; N = N + 1) {
                Q = F[N];
                if (Q) {
                    P = this.getEl(Q.id);
                    if (P) {
                        if (Q.checkReady) {
                            if (H || P.nextSibling || !S) {
                                O.push(Q);
                                F[N] = null;
                            }
                        } else {
                            T(P, Q);
                            F[N] = null;
                        }
                    } else {
                        R.push(Q);
                    }
                }
            }
            for (N = 0,M = O.length; N < M; N = N + 1) {
                Q = O[N];
                T(this.getEl(Q.id), Q);
            }
            C--;
            if (S) {
                for (N = F.length - 1; N > -1; N--) {
                    Q = F[N];
                    if (!Q || !Q.id) {
                        F.splice(N, 1);
                    }
                }
                this.startInterval();
            } else {
                clearInterval(this._interval);
                this._interval = null;
            }
            this.locked = false;
        },purgeElement:function(Q, R, T) {
            var O = (YAHOO.lang.isString(Q)) ? this.getEl(Q) : Q;
            var S = this.getListeners(O, T),P,M;
            if (S) {
                for (P = S.length - 1; P > -1; P--) {
                    var N = S[P];
                    this._removeListener(O, N.type, N.fn, N.capture);
                }
            }
            if (R && O && O.childNodes) {
                for (P = 0,M = O.childNodes.length; P < M; ++P) {
                    this.purgeElement(O.childNodes[P], R, T);
                }
            }
        },getListeners:function(O, M) {
            var R = [],N;
            if (!M) {
                N = [I,J];
            } else {
                if (M === "unload") {
                    N = [J];
                } else {
                    N = [I];
                }
            }
            var T = (YAHOO.lang.isString(O)) ? this.getEl(O) : O;
            for (var Q = 0; Q < N.length; Q = Q + 1) {
                var V = N[Q];
                if (V) {
                    for (var S = 0,U = V.length; S < U; ++S) {
                        var P = V[S];
                        if (P && P[this.EL] === T && (!M || M === P[this.TYPE])) {
                            R.push({type:P[this.TYPE],fn:P[this.FN],obj:P[this.OBJ],adjust:P[this.OVERRIDE],scope:P[this.ADJ_SCOPE],capture:P[this.CAPTURE],index:S});
                        }
                    }
                }
            }
            return(R.length) ? R : null;
        },_unload:function(S) {
            var M = YAHOO.util.Event,P,O,N,R,Q,T = J.slice();
            for (P = 0,R = J.length; P < R; ++P) {
                N = T[P];
                if (N) {
                    var U = window;
                    if (N[M.ADJ_SCOPE]) {
                        if (N[M.ADJ_SCOPE] === true) {
                            U = N[M.UNLOAD_OBJ];
                        } else {
                            U = N[M.ADJ_SCOPE];
                        }
                    }
                    N[M.FN].call(U, M.getEvent(S, N[M.EL]), N[M.UNLOAD_OBJ]);
                    T[P] = null;
                    N = null;
                    U = null;
                }
            }
            J = null;
            if (I) {
                for (O = I.length - 1; O > -1; O--) {
                    N = I[O];
                    if (N) {
                        M._removeListener(N[M.EL], N[M.TYPE], N[M.FN], N[M.CAPTURE], O);
                    }
                }
                N = null;
            }
            G = null;
            M._simpleRemove(window, "unload", M._unload);
        },_getScrollLeft:function() {
            return this._getScroll()[1];
        },_getScrollTop:function() {
            return this._getScroll()[0];
        },_getScroll:function() {
            var M = document.documentElement,N = document.body;
            if (M && (M.scrollTop || M.scrollLeft)) {
                return[M.scrollTop,M.scrollLeft];
            } else {
                if (N) {
                    return[N.scrollTop,N.scrollLeft];
                } else {
                    return[0,0];
                }
            }
        },regCE:function() {
        },_simpleAdd:function() {
            if (window.addEventListener) {
                return function(O, P, N, M) {
                    O.addEventListener(P, N, (M));
                };
            } else {
                if (window.attachEvent) {
                    return function(O, P, N, M) {
                        O.attachEvent("on" + P, N);
                    };
                } else {
                    return function() {
                    };
                }
            }
        }(),_simpleRemove:function() {
            if (window.removeEventListener) {
                return function(O, P, N, M) {
                    O.removeEventListener(P, N, (M));
                };
            } else {
                if (window.detachEvent) {
                    return function(N, O, M) {
                        N.detachEvent("on" + O, M);
                    };
                } else {
                    return function() {
                    };
                }
            }
        }()};
    }();
    (function() {
        var EU = YAHOO.util.Event;
        EU.on = EU.addListener;
        EU.onFocus = EU.addFocusListener;
        EU.onBlur = EU.addBlurListener;
        if (EU.isIE) {
            YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach, YAHOO.util.Event, true);
            var n = document.createElement("p");
            EU._dri = setInterval(function() {
                try {
                    n.doScroll("left");
                    clearInterval(EU._dri);
                    EU._dri = null;
                    EU._ready();
                    n = null;
                } catch(ex) {
                }
            }, EU.POLL_INTERVAL);
        } else {
            if (EU.webkit && EU.webkit < 525) {
                EU._dri = setInterval(function() {
                    var rs = document.readyState;
                    if ("loaded" == rs || "complete" == rs) {
                        clearInterval(EU._dri);
                        EU._dri = null;
                        EU._ready();
                    }
                }, EU.POLL_INTERVAL);
            } else {
                EU._simpleAdd(document, "DOMContentLoaded", EU._ready);
            }
        }
        EU._simpleAdd(window, "load", EU._load);
        EU._simpleAdd(window, "unload", EU._unload);
        EU._tryPreloadAttach();
    })();
}
YAHOO.util.EventProvider = function() {
};
YAHOO.util.EventProvider.prototype = {__yui_events:null,__yui_subscribers:null,subscribe:function(A, C, F, E) {
    this.__yui_events = this.__yui_events || {};
    var D = this.__yui_events[A];
    if (D) {
        D.subscribe(C, F, E);
    } else {
        this.__yui_subscribers = this.__yui_subscribers || {};
        var B = this.__yui_subscribers;
        if (!B[A]) {
            B[A] = [];
        }
        B[A].push({fn:C,obj:F,override:E});
    }
},unsubscribe:function(C, E, G) {
    this.__yui_events = this.__yui_events || {};
    var A = this.__yui_events;
    if (C) {
        var F = A[C];
        if (F) {
            return F.unsubscribe(E, G);
        }
    } else {
        var B = true;
        for (var D in A) {
            if (YAHOO.lang.hasOwnProperty(A, D)) {
                B = B && A[D].unsubscribe(E, G);
            }
        }
        return B;
    }
    return false;
},unsubscribeAll:function(A) {
    return this.unsubscribe(A);
},createEvent:function(G, D) {
    this.__yui_events = this.__yui_events || {};
    var A = D || {};
    var I = this.__yui_events;
    if (I[G]) {
    } else {
        var H = A.scope || this;
        var E = (A.silent);
        var B = new YAHOO.util.CustomEvent(G, H, E, YAHOO.util.CustomEvent.FLAT);
        I[G] = B;
        if (A.onSubscribeCallback) {
            B.subscribeEvent.subscribe(A.onSubscribeCallback);
        }
        this.__yui_subscribers = this.__yui_subscribers || {};
        var F = this.__yui_subscribers[G];
        if (F) {
            for (var C = 0; C < F.length; ++C) {
                B.subscribe(F[C].fn, F[C].obj, F[C].override);
            }
        }
    }
    return I[G];
},fireEvent:function(E, D, A, C) {
    this.__yui_events = this.__yui_events || {};
    var G = this.__yui_events[E];
    if (!G) {
        return null;
    }
    var B = [];
    for (var F = 1; F < arguments.length; ++F) {
        B.push(arguments[F]);
    }
    return G.fire.apply(G, B);
},hasEvent:function(A) {
    if (this.__yui_events) {
        if (this.__yui_events[A]) {
            return true;
        }
    }
    return false;
}};
YAHOO.util.KeyListener = function(A, F, B, C) {
    if (!A) {
    } else {
        if (!F) {
        } else {
            if (!B) {
            }
        }
    }
    if (!C) {
        C = YAHOO.util.KeyListener.KEYDOWN;
    }
    var D = new YAHOO.util.CustomEvent("keyPressed");
    this.enabledEvent = new YAHOO.util.CustomEvent("enabled");
    this.disabledEvent = new YAHOO.util.CustomEvent("disabled");
    if (typeof A == "string") {
        A = document.getElementById(A);
    }
    if (typeof B == "function") {
        D.subscribe(B);
    } else {
        D.subscribe(B.fn, B.scope, B.correctScope);
    }
    function E(J, I) {
        if (!F.shift) {
            F.shift = false;
        }
        if (!F.alt) {
            F.alt = false;
        }
        if (!F.ctrl) {
            F.ctrl = false;
        }
        if (J.shiftKey == F.shift && J.altKey == F.alt && J.ctrlKey == F.ctrl) {
            var G;
            if (F.keys instanceof Array) {
                for (var H = 0; H < F.keys.length; H++) {
                    G = F.keys[H];
                    if (G == J.charCode) {
                        D.fire(J.charCode, J);
                        break;
                    } else {
                        if (G == J.keyCode) {
                            D.fire(J.keyCode, J);
                            break;
                        }
                    }
                }
            } else {
                G = F.keys;
                if (G == J.charCode) {
                    D.fire(J.charCode, J);
                } else {
                    if (G == J.keyCode) {
                        D.fire(J.keyCode, J);
                    }
                }
            }
        }
    }

    this.enable = function() {
        if (!this.enabled) {
            YAHOO.util.Event.addListener(A, C, E);
            this.enabledEvent.fire(F);
        }
        this.enabled = true;
    };
    this.disable = function() {
        if (this.enabled) {
            YAHOO.util.Event.removeListener(A, C, E);
            this.disabledEvent.fire(F);
        }
        this.enabled = false;
    };
    this.toString = function() {
        return"KeyListener [" + F.keys + "] " + A.tagName + (A.id ? "[" + A.id + "]" : "");
    };
};
YAHOO.util.KeyListener.KEYDOWN = "keydown";
YAHOO.util.KeyListener.KEYUP = "keyup";
YAHOO.util.KeyListener.KEY = {ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};
YAHOO.register("event", YAHOO.util.Event, {version:"2.6.0",build:"1321"});
YAHOO.register("yahoo-dom-event", YAHOO, {version:"2.6.0",build:"1321"});
(function() {
    YAHOO.util.Config = function(owner) {
        if (owner) {
            this.init(owner);
        }
    };
    var Lang = YAHOO.lang,CustomEvent = YAHOO.util.CustomEvent,Config = YAHOO.util.Config;
    Config.CONFIG_CHANGED_EVENT = "configChanged";
    Config.BOOLEAN_TYPE = "boolean";
    Config.prototype = {owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(owner) {
        this.owner = owner;
        this.configChangedEvent = this.createEvent(Config.CONFIG_CHANGED_EVENT);
        this.configChangedEvent.signature = CustomEvent.LIST;
        this.queueInProgress = false;
        this.config = {};
        this.initialConfig = {};
        this.eventQueue = [];
    },checkBoolean:function(val) {
        return(typeof val == Config.BOOLEAN_TYPE);
    },checkNumber:function(val) {
        return(!isNaN(val));
    },fireEvent:function(key, value) {
        var property = this.config[key];
        if (property && property.event) {
            property.event.fire(value);
        }
    },addProperty:function(key, propertyObject) {
        key = key.toLowerCase();
        this.config[key] = propertyObject;
        propertyObject.event = this.createEvent(key, {scope:this.owner});
        propertyObject.event.signature = CustomEvent.LIST;
        propertyObject.key = key;
        if (propertyObject.handler) {
            propertyObject.event.subscribe(propertyObject.handler, this.owner);
        }
        this.setProperty(key, propertyObject.value, true);
        if (!propertyObject.suppressEvent) {
            this.queueProperty(key, propertyObject.value);
        }
    },getConfig:function() {
        var cfg = {},currCfg = this.config,prop,property;
        for (prop in currCfg) {
            if (Lang.hasOwnProperty(currCfg, prop)) {
                property = currCfg[prop];
                if (property && property.event) {
                    cfg[prop] = property.value;
                }
            }
        }
        return cfg;
    },getProperty:function(key) {
        var property = this.config[key.toLowerCase()];
        if (property && property.event) {
            return property.value;
        } else {
            return undefined;
        }
    },resetProperty:function(key) {
        key = key.toLowerCase();
        var property = this.config[key];
        if (property && property.event) {
            if (this.initialConfig[key] && !Lang.isUndefined(this.initialConfig[key])) {
                this.setProperty(key, this.initialConfig[key]);
                return true;
            }
        } else {
            return false;
        }
    },setProperty:function(key, value, silent) {
        var property;
        key = key.toLowerCase();
        if (this.queueInProgress && !silent) {
            this.queueProperty(key, value);
            return true;
        } else {
            property = this.config[key];
            if (property && property.event) {
                if (property.validator && !property.validator(value)) {
                    return false;
                } else {
                    property.value = value;
                    if (!silent) {
                        this.fireEvent(key, value);
                        this.configChangedEvent.fire([key,value]);
                    }
                    return true;
                }
            } else {
                return false;
            }
        }
    },queueProperty:function(key, value) {
        key = key.toLowerCase();
        var property = this.config[key],foundDuplicate = false,iLen,queueItem,queueItemKey,queueItemValue,sLen,supercedesCheck,qLen,queueItemCheck,queueItemCheckKey,queueItemCheckValue,i,s,q;
        if (property && property.event) {
            if (!Lang.isUndefined(value) && property.validator && !property.validator(value)) {
                return false;
            } else {
                if (!Lang.isUndefined(value)) {
                    property.value = value;
                } else {
                    value = property.value;
                }
                foundDuplicate = false;
                iLen = this.eventQueue.length;
                for (i = 0; i < iLen; i++) {
                    queueItem = this.eventQueue[i];
                    if (queueItem) {
                        queueItemKey = queueItem[0];
                        queueItemValue = queueItem[1];
                        if (queueItemKey == key) {
                            this.eventQueue[i] = null;
                            this.eventQueue.push([key,(!Lang.isUndefined(value) ? value : queueItemValue)]);
                            foundDuplicate = true;
                            break;
                        }
                    }
                }
                if (!foundDuplicate && !Lang.isUndefined(value)) {
                    this.eventQueue.push([key,value]);
                }
            }
            if (property.supercedes) {
                sLen = property.supercedes.length;
                for (s = 0; s < sLen; s++) {
                    supercedesCheck = property.supercedes[s];
                    qLen = this.eventQueue.length;
                    for (q = 0; q < qLen; q++) {
                        queueItemCheck = this.eventQueue[q];
                        if (queueItemCheck) {
                            queueItemCheckKey = queueItemCheck[0];
                            queueItemCheckValue = queueItemCheck[1];
                            if (queueItemCheckKey == supercedesCheck.toLowerCase()) {
                                this.eventQueue.push([queueItemCheckKey,queueItemCheckValue]);
                                this.eventQueue[q] = null;
                                break;
                            }
                        }
                    }
                }
            }
            return true;
        } else {
            return false;
        }
    },refireEvent:function(key) {
        key = key.toLowerCase();
        var property = this.config[key];
        if (property && property.event && !Lang.isUndefined(property.value)) {
            if (this.queueInProgress) {
                this.queueProperty(key);
            } else {
                this.fireEvent(key, property.value);
            }
        }
    },applyConfig:function(userConfig, init) {
        var sKey,oConfig;
        if (init) {
            oConfig = {};
            for (sKey in userConfig) {
                if (Lang.hasOwnProperty(userConfig, sKey)) {
                    oConfig[sKey.toLowerCase()] = userConfig[sKey];
                }
            }
            this.initialConfig = oConfig;
        }
        for (sKey in userConfig) {
            if (Lang.hasOwnProperty(userConfig, sKey)) {
                this.queueProperty(sKey, userConfig[sKey]);
            }
        }
    },refresh:function() {
        var prop;
        for (prop in this.config) {
            if (Lang.hasOwnProperty(this.config, prop)) {
                this.refireEvent(prop);
            }
        }
    },fireQueue:function() {
        var i,queueItem,key,value,property;
        this.queueInProgress = true;
        for (i = 0; i < this.eventQueue.length; i++) {
            queueItem = this.eventQueue[i];
            if (queueItem) {
                key = queueItem[0];
                value = queueItem[1];
                property = this.config[key];
                property.value = value;
                this.fireEvent(key, value);
            }
        }
        this.queueInProgress = false;
        this.eventQueue = [];
    },subscribeToConfigEvent:function(key, handler, obj, override) {
        var property = this.config[key.toLowerCase()];
        if (property && property.event) {
            if (!Config.alreadySubscribed(property.event, handler, obj)) {
                property.event.subscribe(handler, obj, override);
            }
            return true;
        } else {
            return false;
        }
    },unsubscribeFromConfigEvent:function(key, handler, obj) {
        var property = this.config[key.toLowerCase()];
        if (property && property.event) {
            return property.event.unsubscribe(handler, obj);
        } else {
            return false;
        }
    },toString:function() {
        var output = "Config";
        if (this.owner) {
            output += " [" + this.owner.toString() + "]";
        }
        return output;
    },outputEventQueue:function() {
        var output = "",queueItem,q,nQueue = this.eventQueue.length;
        for (q = 0; q < nQueue; q++) {
            queueItem = this.eventQueue[q];
            if (queueItem) {
                output += queueItem[0] + "=" + queueItem[1] + ", ";
            }
        }
        return output;
    },destroy:function() {
        var oConfig = this.config,sProperty,oProperty;
        for (sProperty in oConfig) {
            if (Lang.hasOwnProperty(oConfig, sProperty)) {
                oProperty = oConfig[sProperty];
                oProperty.event.unsubscribeAll();
                oProperty.event = null;
            }
        }
        this.configChangedEvent.unsubscribeAll();
        this.configChangedEvent = null;
        this.owner = null;
        this.config = null;
        this.initialConfig = null;
        this.eventQueue = null;
    }};
    Config.alreadySubscribed = function(evt, fn, obj) {
        var nSubscribers = evt.subscribers.length,subsc,i;
        if (nSubscribers > 0) {
            i = nSubscribers - 1;
            do{
                subsc = evt.subscribers[i];
                if (subsc && subsc.obj == obj && subsc.fn == fn) {
                    return true;
                }
            }
            while (i--);
        }
        return false;
    };
    YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
}());
YAHOO.widget.DateMath = {DAY:"D",WEEK:"W",YEAR:"Y",MONTH:"M",ONE_DAY_MS:1000 * 60 * 60 * 24,WEEK_ONE_JAN_DATE:1,add:function(date, field, amount) {
    var d = new Date(date.getTime());
    switch (field) {
        case this.MONTH:
            var newMonth = date.getMonth() + amount;
            var years = 0;
            if (newMonth < 0) {
                while (newMonth < 0) {
                    newMonth += 12;
                    years -= 1;
                }
            } else if (newMonth > 11) {
                while (newMonth > 11) {
                    newMonth -= 12;
                    years += 1;
                }
            }
            d.setMonth(newMonth);
            d.setFullYear(date.getFullYear() + years);
            break;
        case this.DAY:
            this._addDays(d, amount);
            break;
        case this.YEAR:
            d.setFullYear(date.getFullYear() + amount);
            break;
        case this.WEEK:
            this._addDays(d, (amount * 7));
            break;
    }
    return d;
},_addDays:function(d, nDays) {
    if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420) {
        if (nDays < 0) {
            for (var min = -128; nDays < min; nDays -= min) {
                d.setDate(d.getDate() + min);
            }
        } else {
            for (var max = 96; nDays > max; nDays -= max) {
                d.setDate(d.getDate() + max);
            }
        }
    }
    d.setDate(d.getDate() + nDays);
},subtract:function(date, field, amount) {
    return this.add(date, field, (amount * -1));
},before:function(date, compareTo) {
    var ms = compareTo.getTime();
    if (date.getTime() < ms) {
        return true;
    } else {
        return false;
    }
},after:function(date, compareTo) {
    var ms = compareTo.getTime();
    if (date.getTime() > ms) {
        return true;
    } else {
        return false;
    }
},between:function(date, dateBegin, dateEnd) {
    if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
        return true;
    } else {
        return false;
    }
},getJan1:function(calendarYear) {
    return this.getDate(calendarYear, 0, 1);
},getDayOffset:function(date, calendarYear) {
    var beginYear = this.getJan1(calendarYear);
    var dayOffset = Math.ceil((date.getTime() - beginYear.getTime()) / this.ONE_DAY_MS);
    return dayOffset;
},getWeekNumber:function(date, firstDayOfWeek, janDate) {
    firstDayOfWeek = firstDayOfWeek || 0;
    janDate = janDate || this.WEEK_ONE_JAN_DATE;
    var targetDate = this.clearTime(date),startOfWeek,endOfWeek;
    if (targetDate.getDay() === firstDayOfWeek) {
        startOfWeek = targetDate;
    } else {
        startOfWeek = this.getFirstDayOfWeek(targetDate, firstDayOfWeek);
    }
    var startYear = startOfWeek.getFullYear(),startTime = startOfWeek.getTime();
    endOfWeek = new Date(startOfWeek.getTime() + 6 * this.ONE_DAY_MS);
    var weekNum;
    if (startYear !== endOfWeek.getFullYear() && endOfWeek.getDate() >= janDate) {
        weekNum = 1;
    } else {
        var weekOne = this.clearTime(this.getDate(startYear, 0, janDate)),weekOneDayOne = this.getFirstDayOfWeek(weekOne, firstDayOfWeek);
        var daysDiff = Math.round((targetDate.getTime() - weekOneDayOne.getTime()) / this.ONE_DAY_MS);
        var rem = daysDiff % 7;
        var weeksDiff = (daysDiff - rem) / 7;
        weekNum = weeksDiff + 1;
    }
    return weekNum;
},getFirstDayOfWeek:function(dt, startOfWeek) {
    startOfWeek = startOfWeek || 0;
    var dayOfWeekIndex = dt.getDay(),dayOfWeek = (dayOfWeekIndex - startOfWeek + 7) % 7;
    return this.subtract(dt, this.DAY, dayOfWeek);
},isYearOverlapWeek:function(weekBeginDate) {
    var overlaps = false;
    var nextWeek = this.add(weekBeginDate, this.DAY, 6);
    if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
        overlaps = true;
    }
    return overlaps;
},isMonthOverlapWeek:function(weekBeginDate) {
    var overlaps = false;
    var nextWeek = this.add(weekBeginDate, this.DAY, 6);
    if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
        overlaps = true;
    }
    return overlaps;
},findMonthStart:function(date) {
    var start = this.getDate(date.getFullYear(), date.getMonth(), 1);
    return start;
},findMonthEnd:function(date) {
    var start = this.findMonthStart(date);
    var nextMonth = this.add(start, this.MONTH, 1);
    var end = this.subtract(nextMonth, this.DAY, 1);
    return end;
},clearTime:function(date) {
    date.setHours(12, 0, 0, 0);
    return date;
},getDate:function(y, m, d) {
    var dt = null;
    if (YAHOO.lang.isUndefined(d)) {
        d = 1;
    }
    if (y >= 100) {
        dt = new Date(y, m, d);
    } else {
        dt = new Date();
        dt.setFullYear(y);
        dt.setMonth(m);
        dt.setDate(d);
        dt.setHours(0, 0, 0, 0);
    }
    return dt;
}};
(function() {
    var Dom = YAHOO.util.Dom,Event = YAHOO.util.Event,Lang = YAHOO.lang,DateMath = YAHOO.widget.DateMath;

    function Calendar(id, containerId, config) {
        this.init.apply(this, arguments);
    }

    Calendar.IMG_ROOT = null;
    Calendar.DATE = "D";
    Calendar.MONTH_DAY = "MD";
    Calendar.WEEKDAY = "WD";
    Calendar.RANGE = "R";
    Calendar.MONTH = "M";
    Calendar.DISPLAY_DAYS = 42;
    Calendar.STOP_RENDER = "S";
    Calendar.SHORT = "short";
    Calendar.LONG = "long";
    Calendar.MEDIUM = "medium";
    Calendar.ONE_CHAR = "1char";
    Calendar._DEFAULT_CONFIG = {PAGEDATE:{key:"pagedate",value:null},SELECTED:{key:"selected",value:null},TITLE:{key:"title",value:""},CLOSE:{key:"close",value:false},IFRAME:{key:"iframe",value:(YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) ? true : false},MINDATE:{key:"mindate",value:null},MAXDATE:{key:"maxdate",value:null},MULTI_SELECT:{key:"multi_select",value:false},START_WEEKDAY:{key:"start_weekday",value:0},SHOW_WEEKDAYS:{key:"show_weekdays",value:true},SHOW_WEEK_HEADER:{key:"show_week_header",value:false},SHOW_WEEK_FOOTER:{key:"show_week_footer",value:false},HIDE_BLANK_WEEKS:{key:"hide_blank_weeks",value:false},NAV_ARROW_LEFT:{key:"nav_arrow_left",value:null},NAV_ARROW_RIGHT:{key:"nav_arrow_right",value:null},MONTHS_SHORT:{key:"months_short",value:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},MONTHS_LONG:{key:"months_long",value:["January","February","March","April","May","June","July","August","September","October","November","December"]},WEEKDAYS_1CHAR:{key:"weekdays_1char",value:["S","M","T","W","T","F","S"]},WEEKDAYS_SHORT:{key:"weekdays_short",value:["Su","Mo","Tu","We","Th","Fr","Sa"]},WEEKDAYS_MEDIUM:{key:"weekdays_medium",value:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},WEEKDAYS_LONG:{key:"weekdays_long",value:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},LOCALE_MONTHS:{key:"locale_months",value:"long"},LOCALE_WEEKDAYS:{key:"locale_weekdays",value:"short"},DATE_DELIMITER:{key:"date_delimiter",value:","},DATE_FIELD_DELIMITER:{key:"date_field_delimiter",value:"/"},DATE_RANGE_DELIMITER:{key:"date_range_delimiter",value:"-"},MY_MONTH_POSITION:{key:"my_month_position",value:1},MY_YEAR_POSITION:{key:"my_year_position",value:2},MD_MONTH_POSITION:{key:"md_month_position",value:1},MD_DAY_POSITION:{key:"md_day_position",value:2},MDY_MONTH_POSITION:{key:"mdy_month_position",value:1},MDY_DAY_POSITION:{key:"mdy_day_position",value:2},MDY_YEAR_POSITION:{key:"mdy_year_position",value:3},MY_LABEL_MONTH_POSITION:{key:"my_label_month_position",value:1},MY_LABEL_YEAR_POSITION:{key:"my_label_year_position",value:2},MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix",value:" "},MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix",value:""},NAV:{key:"navigator",value:null},STRINGS:{key:"strings",value:{previousMonth:"Previous Month",nextMonth:"Next Month",close:"Close"},supercedes:["close","title"]}};
    var DEF_CFG = Calendar._DEFAULT_CONFIG;
    Calendar._EVENT_TYPES = {BEFORE_SELECT:"beforeSelect",SELECT:"select",BEFORE_DESELECT:"beforeDeselect",DESELECT:"deselect",CHANGE_PAGE:"changePage",BEFORE_RENDER:"beforeRender",RENDER:"render",BEFORE_DESTROY:"beforeDestroy",DESTROY:"destroy",RESET:"reset",CLEAR:"clear",BEFORE_HIDE:"beforeHide",HIDE:"hide",BEFORE_SHOW:"beforeShow",SHOW:"show",BEFORE_HIDE_NAV:"beforeHideNav",HIDE_NAV:"hideNav",BEFORE_SHOW_NAV:"beforeShowNav",SHOW_NAV:"showNav",BEFORE_RENDER_NAV:"beforeRenderNav",RENDER_NAV:"renderNav"};
    Calendar._STYLES = {CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTOR:"selector",CSS_CELL_SELECTED:"selected",CSS_CELL_SELECTABLE:"selectable",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_BODY:"calbody",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"yui-calendar",CSS_SINGLE:"single",CSS_CONTAINER:"yui-calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_NAV:"calnav",CSS_CLOSE:"calclose",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};
    Calendar.prototype = {Config:null,parent:null,index:-1,cells:null,cellDates:null,id:null,containerId:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,oNavigator:null,_selectedDates:null,domEventMap:null,_parseArgs:function(args) {
        var nArgs = {id:null,container:null,config:null};
        if (args && args.length && args.length > 0) {
            switch (args.length) {
                case 1:
                    nArgs.id = null;
                    nArgs.container = args[0];
                    nArgs.config = null;
                    break;
                case 2:
                    if (Lang.isObject(args[1]) && !args[1].tagName && !(args[1]instanceof String)) {
                        nArgs.id = null;
                        nArgs.container = args[0];
                        nArgs.config = args[1];
                    } else {
                        nArgs.id = args[0];
                        nArgs.container = args[1];
                        nArgs.config = null;
                    }
                    break;
                default:
                    nArgs.id = args[0];
                    nArgs.container = args[1];
                    nArgs.config = args[2];
                    break;
            }
        } else {
        }
        return nArgs;
    },init:function(id, container, config) {
        var nArgs = this._parseArgs(arguments);
        id = nArgs.id;
        container = nArgs.container;
        config = nArgs.config;
        this.oDomContainer = Dom.get(container);
        if (!this.oDomContainer.id) {
            this.oDomContainer.id = Dom.generateId();
        }
        if (!id) {
            id = this.oDomContainer.id + "_t";
        }
        this.id = id;
        this.containerId = this.oDomContainer.id;
        this.initEvents();
        this.today = new Date();
        DateMath.clearTime(this.today);
        this.cfg = new YAHOO.util.Config(this);
        this.Options = {};
        this.Locale = {};
        this.initStyles();
        Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
        Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
        this.cellDates = [];
        this.cells = [];
        this.renderStack = [];
        this._renderStack = [];
        this.setupConfig();
        if (config) {
            this.cfg.applyConfig(config, true);
        }
        this.cfg.fireQueue();
    },configIframe:function(type, args, obj) {
        var useIframe = args[0];
        if (!this.parent) {
            if (Dom.inDocument(this.oDomContainer)) {
                if (useIframe) {
                    var pos = Dom.getStyle(this.oDomContainer, "position");
                    if (pos == "absolute" || pos == "relative") {
                        if (!Dom.inDocument(this.iframe)) {
                            this.iframe = document.createElement("iframe");
                            this.iframe.src = "javascript:false;";
                            Dom.setStyle(this.iframe, "opacity", "0");
                            if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
                                Dom.addClass(this.iframe, "fixedsize");
                            }
                            this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
                        }
                    }
                } else {
                    if (this.iframe) {
                        if (this.iframe.parentNode) {
                            this.iframe.parentNode.removeChild(this.iframe);
                        }
                        this.iframe = null;
                    }
                }
            }
        }
    },configTitle:function(type, args, obj) {
        var title = args[0];
        if (title) {
            this.createTitleBar(title);
        } else {
            var close = this.cfg.getProperty(DEF_CFG.CLOSE.key);
            if (!close) {
                this.removeTitleBar();
            } else {
                this.createTitleBar("&#160;");
            }
        }
    },configClose:function(type, args, obj) {
        var close = args[0],title = this.cfg.getProperty(DEF_CFG.TITLE.key);
        if (close) {
            if (!title) {
                this.createTitleBar("&#160;");
            }
            this.createCloseButton();
        } else {
            this.removeCloseButton();
            if (!title) {
                this.removeTitleBar();
            }
        }
    },initEvents:function() {
        var defEvents = Calendar._EVENT_TYPES,CE = YAHOO.util.CustomEvent,cal = this;
        cal.beforeSelectEvent = new CE(defEvents.BEFORE_SELECT);
        cal.selectEvent = new CE(defEvents.SELECT);
        cal.beforeDeselectEvent = new CE(defEvents.BEFORE_DESELECT);
        cal.deselectEvent = new CE(defEvents.DESELECT);
        cal.changePageEvent = new CE(defEvents.CHANGE_PAGE);
        cal.beforeRenderEvent = new CE(defEvents.BEFORE_RENDER);
        cal.renderEvent = new CE(defEvents.RENDER);
        cal.beforeDestroyEvent = new CE(defEvents.BEFORE_DESTROY);
        cal.destroyEvent = new CE(defEvents.DESTROY);
        cal.resetEvent = new CE(defEvents.RESET);
        cal.clearEvent = new CE(defEvents.CLEAR);
        cal.beforeShowEvent = new CE(defEvents.BEFORE_SHOW);
        cal.showEvent = new CE(defEvents.SHOW);
        cal.beforeHideEvent = new CE(defEvents.BEFORE_HIDE);
        cal.hideEvent = new CE(defEvents.HIDE);
        cal.beforeShowNavEvent = new CE(defEvents.BEFORE_SHOW_NAV);
        cal.showNavEvent = new CE(defEvents.SHOW_NAV);
        cal.beforeHideNavEvent = new CE(defEvents.BEFORE_HIDE_NAV);
        cal.hideNavEvent = new CE(defEvents.HIDE_NAV);
        cal.beforeRenderNavEvent = new CE(defEvents.BEFORE_RENDER_NAV);
        cal.renderNavEvent = new CE(defEvents.RENDER_NAV);
        cal.beforeSelectEvent.subscribe(cal.onBeforeSelect, this, true);
        cal.selectEvent.subscribe(cal.onSelect, this, true);
        cal.beforeDeselectEvent.subscribe(cal.onBeforeDeselect, this, true);
        cal.deselectEvent.subscribe(cal.onDeselect, this, true);
        cal.changePageEvent.subscribe(cal.onChangePage, this, true);
        cal.renderEvent.subscribe(cal.onRender, this, true);
        cal.resetEvent.subscribe(cal.onReset, this, true);
        cal.clearEvent.subscribe(cal.onClear, this, true);
    },doPreviousMonthNav:function(e, cal) {
        Event.preventDefault(e);
        setTimeout(function() {
            cal.previousMonth();
            var navs = Dom.getElementsByClassName(cal.Style.CSS_NAV_LEFT, "a", cal.oDomContainer);
            if (navs && navs[0]) {
                try {
                    navs[0].focus();
                } catch(e) {
                }
            }
        }, 0);
    },doNextMonthNav:function(e, cal) {
        Event.preventDefault(e);
        setTimeout(function() {
            cal.nextMonth();
            var navs = Dom.getElementsByClassName(cal.Style.CSS_NAV_RIGHT, "a", cal.oDomContainer);
            if (navs && navs[0]) {
                try {
                    navs[0].focus();
                } catch(e) {
                }
            }
        }, 0);
    },doSelectCell:function(e, cal) {
        var cell,d,date,index;
        var target = Event.getTarget(e),tagName = target.tagName.toLowerCase(),defSelector = false;
        while (tagName != "td" && !Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
            if (!defSelector && tagName == "a" && Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
                defSelector = true;
            }
            target = target.parentNode;
            tagName = target.tagName.toLowerCase();
            if (target == this.oDomContainer || tagName == "html") {
                return;
            }
        }
        if (defSelector) {
            Event.preventDefault(e);
        }
        cell = target;
        if (Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
            index = cal.getIndexFromId(cell.id);
            if (index > -1) {
                d = cal.cellDates[index];
                if (d) {
                    date = DateMath.getDate(d[0], d[1] - 1, d[2]);
                    var link;
                    if (cal.Options.MULTI_SELECT) {
                        link = cell.getElementsByTagName("a")[0];
                        if (link) {
                            link.blur();
                        }
                        var cellDate = cal.cellDates[index];
                        var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
                        if (cellDateIndex > -1) {
                            cal.deselectCell(index);
                        } else {
                            cal.selectCell(index);
                        }
                    } else {
                        link = cell.getElementsByTagName("a")[0];
                        if (link) {
                            link.blur();
                        }
                        cal.selectCell(index);
                    }
                }
            }
        }
    },doCellMouseOver:function(e, cal) {
        var target;
        if (e) {
            target = Event.getTarget(e);
        } else {
            target = this;
        }
        while (target.tagName && target.tagName.toLowerCase() != "td") {
            target = target.parentNode;
            if (!target.tagName || target.tagName.toLowerCase() == "html") {
                return;
            }
        }
        if (Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
            Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
        }
    },doCellMouseOut:function(e, cal) {
        var target;
        if (e) {
            target = Event.getTarget(e);
        } else {
            target = this;
        }
        while (target.tagName && target.tagName.toLowerCase() != "td") {
            target = target.parentNode;
            if (!target.tagName || target.tagName.toLowerCase() == "html") {
                return;
            }
        }
        if (Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
            Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
        }
    },setupConfig:function() {
        var cfg = this.cfg;
        cfg.addProperty(DEF_CFG.PAGEDATE.key, {value:new Date(),handler:this.configPageDate});
        cfg.addProperty(DEF_CFG.SELECTED.key, {value:[],handler:this.configSelected});
        cfg.addProperty(DEF_CFG.TITLE.key, {value:DEF_CFG.TITLE.value,handler:this.configTitle});
        cfg.addProperty(DEF_CFG.CLOSE.key, {value:DEF_CFG.CLOSE.value,handler:this.configClose});
        cfg.addProperty(DEF_CFG.IFRAME.key, {value:DEF_CFG.IFRAME.value,handler:this.configIframe,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.MINDATE.key, {value:DEF_CFG.MINDATE.value,handler:this.configMinDate});
        cfg.addProperty(DEF_CFG.MAXDATE.key, {value:DEF_CFG.MAXDATE.value,handler:this.configMaxDate});
        cfg.addProperty(DEF_CFG.MULTI_SELECT.key, {value:DEF_CFG.MULTI_SELECT.value,handler:this.configOptions,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.START_WEEKDAY.key, {value:DEF_CFG.START_WEEKDAY.value,handler:this.configOptions,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key, {value:DEF_CFG.SHOW_WEEKDAYS.value,handler:this.configOptions,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key, {value:DEF_CFG.SHOW_WEEK_HEADER.value,handler:this.configOptions,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key, {value:DEF_CFG.SHOW_WEEK_FOOTER.value,handler:this.configOptions,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key, {value:DEF_CFG.HIDE_BLANK_WEEKS.value,handler:this.configOptions,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key, {value:DEF_CFG.NAV_ARROW_LEFT.value,handler:this.configOptions});
        cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key, {value:DEF_CFG.NAV_ARROW_RIGHT.value,handler:this.configOptions});
        cfg.addProperty(DEF_CFG.MONTHS_SHORT.key, {value:DEF_CFG.MONTHS_SHORT.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.MONTHS_LONG.key, {value:DEF_CFG.MONTHS_LONG.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key, {value:DEF_CFG.WEEKDAYS_1CHAR.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key, {value:DEF_CFG.WEEKDAYS_SHORT.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key, {value:DEF_CFG.WEEKDAYS_MEDIUM.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key, {value:DEF_CFG.WEEKDAYS_LONG.value,handler:this.configLocale});
        var refreshLocale = function() {
            cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);
            cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);
        };
        cfg.subscribeToConfigEvent(DEF_CFG.START_WEEKDAY.key, refreshLocale, this, true);
        cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_SHORT.key, refreshLocale, this, true);
        cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_LONG.key, refreshLocale, this, true);
        cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
        cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_SHORT.key, refreshLocale, this, true);
        cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
        cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_LONG.key, refreshLocale, this, true);
        cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key, {value:DEF_CFG.LOCALE_MONTHS.value,handler:this.configLocaleValues});
        cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key, {value:DEF_CFG.LOCALE_WEEKDAYS.value,handler:this.configLocaleValues});
        cfg.addProperty(DEF_CFG.DATE_DELIMITER.key, {value:DEF_CFG.DATE_DELIMITER.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key, {value:DEF_CFG.DATE_FIELD_DELIMITER.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key, {value:DEF_CFG.DATE_RANGE_DELIMITER.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key, {value:DEF_CFG.MY_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key, {value:DEF_CFG.MY_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key, {value:DEF_CFG.MD_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key, {value:DEF_CFG.MD_DAY_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key, {value:DEF_CFG.MDY_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key, {value:DEF_CFG.MDY_DAY_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key, {value:DEF_CFG.MDY_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key, {value:DEF_CFG.MY_LABEL_MONTH_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key, {value:DEF_CFG.MY_LABEL_YEAR_POSITION.value,handler:this.configLocale,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key, {value:DEF_CFG.MY_LABEL_MONTH_SUFFIX.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key, {value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value,handler:this.configLocale});
        cfg.addProperty(DEF_CFG.NAV.key, {value:DEF_CFG.NAV.value,handler:this.configNavigator});
        cfg.addProperty(DEF_CFG.STRINGS.key, {value:DEF_CFG.STRINGS.value,handler:this.configStrings,validator:function(val) {
            return Lang.isObject(val);
        },supercedes:DEF_CFG.STRINGS.supercedes});
    },configStrings:function(type, args, obj) {
        var val = Lang.merge(DEF_CFG.STRINGS.value, args[0]);
        this.cfg.setProperty(DEF_CFG.STRINGS.key, val, true);
    },configPageDate:function(type, args, obj) {
        this.cfg.setProperty(DEF_CFG.PAGEDATE.key, this._parsePageDate(args[0]), true);
    },configMinDate:function(type, args, obj) {
        var val = args[0];
        if (Lang.isString(val)) {
            val = this._parseDate(val);
            this.cfg.setProperty(DEF_CFG.MINDATE.key, DateMath.getDate(val[0], (val[1] - 1), val[2]));
        }
    },configMaxDate:function(type, args, obj) {
        var val = args[0];
        if (Lang.isString(val)) {
            val = this._parseDate(val);
            this.cfg.setProperty(DEF_CFG.MAXDATE.key, DateMath.getDate(val[0], (val[1] - 1), val[2]));
        }
    },configSelected:function(type, args, obj) {
        var selected = args[0],cfgSelected = DEF_CFG.SELECTED.key;
        if (selected) {
            if (Lang.isString(selected)) {
                this.cfg.setProperty(cfgSelected, this._parseDates(selected), true);
            }
        }
        if (!this._selectedDates) {
            this._selectedDates = this.cfg.getProperty(cfgSelected);
        }
    },configOptions:function(type, args, obj) {
        this.Options[type.toUpperCase()] = args[0];
    },configLocale:function(type, args, obj) {
        this.Locale[type.toUpperCase()] = args[0];
        this.cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);
        this.cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);
    },configLocaleValues:function(type, args, obj) {
        type = type.toLowerCase();
        var val = args[0],cfg = this.cfg,Locale = this.Locale;
        switch (type) {
            case DEF_CFG.LOCALE_MONTHS.key:
                switch (val) {
                    case Calendar.SHORT:
                        Locale.LOCALE_MONTHS = cfg.getProperty(DEF_CFG.MONTHS_SHORT.key).concat();
                        break;
                    case Calendar.LONG:
                        Locale.LOCALE_MONTHS = cfg.getProperty(DEF_CFG.MONTHS_LONG.key).concat();
                        break;
                }
                break;
            case DEF_CFG.LOCALE_WEEKDAYS.key:
                switch (val) {
                    case Calendar.ONE_CHAR:
                        Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_1CHAR.key).concat();
                        break;
                    case Calendar.SHORT:
                        Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_SHORT.key).concat();
                        break;
                    case Calendar.MEDIUM:
                        Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_MEDIUM.key).concat();
                        break;
                    case Calendar.LONG:
                        Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_LONG.key).concat();
                        break;
                }
                var START_WEEKDAY = cfg.getProperty(DEF_CFG.START_WEEKDAY.key);
                if (START_WEEKDAY > 0) {
                    for (var w = 0; w < START_WEEKDAY; ++w) {
                        Locale.LOCALE_WEEKDAYS.push(Locale.LOCALE_WEEKDAYS.shift());
                    }
                }
                break;
        }
    },configNavigator:function(type, args, obj) {
        var val = args[0];
        if (YAHOO.widget.CalendarNavigator && (val === true || Lang.isObject(val))) {
            if (!this.oNavigator) {
                this.oNavigator = new YAHOO.widget.CalendarNavigator(this);
                this.beforeRenderEvent.subscribe(function() {
                    if (!this.pages) {
                        this.oNavigator.erase();
                    }
                }, this, true);
            }
        } else {
            if (this.oNavigator) {
                this.oNavigator.destroy();
                this.oNavigator = null;
            }
        }
    },initStyles:function() {
        var defStyle = Calendar._STYLES;
        this.Style = {CSS_ROW_HEADER:defStyle.CSS_ROW_HEADER,CSS_ROW_FOOTER:defStyle.CSS_ROW_FOOTER,CSS_CELL:defStyle.CSS_CELL,CSS_CELL_SELECTOR:defStyle.CSS_CELL_SELECTOR,CSS_CELL_SELECTED:defStyle.CSS_CELL_SELECTED,CSS_CELL_SELECTABLE:defStyle.CSS_CELL_SELECTABLE,CSS_CELL_RESTRICTED:defStyle.CSS_CELL_RESTRICTED,CSS_CELL_TODAY:defStyle.CSS_CELL_TODAY,CSS_CELL_OOM:defStyle.CSS_CELL_OOM,CSS_CELL_OOB:defStyle.CSS_CELL_OOB,CSS_HEADER:defStyle.CSS_HEADER,CSS_HEADER_TEXT:defStyle.CSS_HEADER_TEXT,CSS_BODY:defStyle.CSS_BODY,CSS_WEEKDAY_CELL:defStyle.CSS_WEEKDAY_CELL,CSS_WEEKDAY_ROW:defStyle.CSS_WEEKDAY_ROW,CSS_FOOTER:defStyle.CSS_FOOTER,CSS_CALENDAR:defStyle.CSS_CALENDAR,CSS_SINGLE:defStyle.CSS_SINGLE,CSS_CONTAINER:defStyle.CSS_CONTAINER,CSS_NAV_LEFT:defStyle.CSS_NAV_LEFT,CSS_NAV_RIGHT:defStyle.CSS_NAV_RIGHT,CSS_NAV:defStyle.CSS_NAV,CSS_CLOSE:defStyle.CSS_CLOSE,CSS_CELL_TOP:defStyle.CSS_CELL_TOP,CSS_CELL_LEFT:defStyle.CSS_CELL_LEFT,CSS_CELL_RIGHT:defStyle.CSS_CELL_RIGHT,CSS_CELL_BOTTOM:defStyle.CSS_CELL_BOTTOM,CSS_CELL_HOVER:defStyle.CSS_CELL_HOVER,CSS_CELL_HIGHLIGHT1:defStyle.CSS_CELL_HIGHLIGHT1,CSS_CELL_HIGHLIGHT2:defStyle.CSS_CELL_HIGHLIGHT2,CSS_CELL_HIGHLIGHT3:defStyle.CSS_CELL_HIGHLIGHT3,CSS_CELL_HIGHLIGHT4:defStyle.CSS_CELL_HIGHLIGHT4};
    },buildMonthLabel:function() {
        return this._buildMonthLabel(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));
    },_buildMonthLabel:function(date) {
        var monthLabel = this.Locale.LOCALE_MONTHS[date.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX,yearLabel = date.getFullYear() + this.Locale.MY_LABEL_YEAR_SUFFIX;
        if (this.Locale.MY_LABEL_MONTH_POSITION == 2 || this.Locale.MY_LABEL_YEAR_POSITION == 1) {
            return yearLabel + monthLabel;
        } else {
            return monthLabel + yearLabel;
        }
    },buildDayLabel:function(workingDate) {
        return workingDate.getDate();
    },createTitleBar:function(strTitle) {
        var tDiv = Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
        tDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
        tDiv.innerHTML = strTitle;
        this.oDomContainer.insertBefore(tDiv, this.oDomContainer.firstChild);
        Dom.addClass(this.oDomContainer, "withtitle");
        return tDiv;
    },removeTitleBar:function() {
        var tDiv = Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
        if (tDiv) {
            Event.purgeElement(tDiv);
            this.oDomContainer.removeChild(tDiv);
        }
        Dom.removeClass(this.oDomContainer, "withtitle");
    },createCloseButton:function() {
        var cssClose = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,DEPR_CLOSE_PATH = "us/my/bn/x_d.gif",lnk = Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0],strings = this.cfg.getProperty(DEF_CFG.STRINGS.key),closeStr = (strings && strings.close) ? strings.close : "";
        if (!lnk) {
            lnk = document.createElement("a");
            Event.addListener(lnk, "click", function(e, cal) {
                cal.hide();
                Event.preventDefault(e);
            }, this);
        }
        lnk.href = "#";
        lnk.className = "link-close";
        if (Calendar.IMG_ROOT !== null) {
            var img = Dom.getElementsByClassName(cssClose, "img", lnk)[0] || document.createElement("img");
            img.src = Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
            img.className = cssClose;
            lnk.appendChild(img);
        } else {
            lnk.innerHTML = '<span class="' + cssClose + ' ' + this.Style.CSS_CLOSE + '">' + closeStr + '</span>';
        }
        this.oDomContainer.appendChild(lnk);
        return lnk;
    },removeCloseButton:function() {
        var btn = Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
        if (btn) {
            Event.purgeElement(btn);
            this.oDomContainer.removeChild(btn);
        }
    },renderHeader:function(html) {
        var colSpan = 7,DEPR_NAV_LEFT = "us/tr/callt.gif",DEPR_NAV_RIGHT = "us/tr/calrt.gif",cfg = this.cfg,pageDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),strings = cfg.getProperty(DEF_CFG.STRINGS.key),prevStr = (strings && strings.previousMonth) ? strings.previousMonth : "",nextStr = (strings && strings.nextMonth) ? strings.nextMonth : "",monthLabel;
        if (cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
            colSpan += 1;
        }
        if (cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)) {
            colSpan += 1;
        }
        html[html.length] = "<thead>";
        html[html.length] = "<tr>";
        html[html.length] = '<th colspan="' + colSpan + '" class="' + this.Style.CSS_HEADER_TEXT + '">';
        html[html.length] = '<div class="' + this.Style.CSS_HEADER + '">';
        var renderLeft,renderRight = false;
        if (this.parent) {
            if (this.index === 0) {
                renderLeft = true;
            }
            if (this.index == (this.parent.cfg.getProperty("pages") - 1)) {
                renderRight = true;
            }
        } else {
            renderLeft = true;
            renderRight = true;
        }
        if (renderLeft) {
            monthLabel = this._buildMonthLabel(DateMath.subtract(pageDate, DateMath.MONTH, 1));
            var leftArrow = cfg.getProperty(DEF_CFG.NAV_ARROW_LEFT.key);
            if (leftArrow === null && Calendar.IMG_ROOT !== null) {
                leftArrow = Calendar.IMG_ROOT + DEPR_NAV_LEFT;
            }
            var leftStyle = (leftArrow === null) ? "" : ' style="background-image:url(' + leftArrow + ')"';
            html[html.length] = '<a class="' + this.Style.CSS_NAV_LEFT + '"' + leftStyle + ' href="#">' + prevStr + ' (' + monthLabel + ')' + '</a>';
        }
        var lbl = this.buildMonthLabel();
        var cal = this.parent || this;
        if (cal.cfg.getProperty("navigator")) {
            lbl = "<a class=\"" + this.Style.CSS_NAV + "\" href=\"#\">" + lbl + "</a>";
        }
        html[html.length] = lbl;
        if (renderRight) {
            monthLabel = this._buildMonthLabel(DateMath.add(pageDate, DateMath.MONTH, 1));
            var rightArrow = cfg.getProperty(DEF_CFG.NAV_ARROW_RIGHT.key);
            if (rightArrow === null && Calendar.IMG_ROOT !== null) {
                rightArrow = Calendar.IMG_ROOT + DEPR_NAV_RIGHT;
            }
            var rightStyle = (rightArrow === null) ? "" : ' style="background-image:url(' + rightArrow + ')"';
            html[html.length] = '<a class="' + this.Style.CSS_NAV_RIGHT + '"' + rightStyle + ' href="#">' + nextStr + ' (' + monthLabel + ')' + '</a>';
        }
        html[html.length] = '</div>\n</th>\n</tr>';
        if (cfg.getProperty(DEF_CFG.SHOW_WEEKDAYS.key)) {
            html = this.buildWeekdays(html);
        }
        html[html.length] = '</thead>';
        return html;
    },buildWeekdays:function(html) {
        html[html.length] = '<tr class="' + this.Style.CSS_WEEKDAY_ROW + '">';
        if (this.cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
            html[html.length] = '<th>&#160;</th>';
        }
        for (var i = 0; i < this.Locale.LOCALE_WEEKDAYS.length; ++i) {
            html[html.length] = '<th class="calweekdaycell">' + this.Locale.LOCALE_WEEKDAYS[i] + '</th>';
        }
        if (this.cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)) {
            html[html.length] = '<th>&#160;</th>';
        }
        html[html.length] = '</tr>';
        return html;
    },renderBody:function(workingDate, html) {
        var startDay = this.cfg.getProperty(DEF_CFG.START_WEEKDAY.key);
        this.preMonthDays = workingDate.getDay();
        if (startDay > 0) {
            this.preMonthDays -= startDay;
        }
        if (this.preMonthDays < 0) {
            this.preMonthDays += 7;
        }
        this.monthDays = DateMath.findMonthEnd(workingDate).getDate();
        this.postMonthDays = Calendar.DISPLAY_DAYS - this.preMonthDays - this.monthDays;
        workingDate = DateMath.subtract(workingDate, DateMath.DAY, this.preMonthDays);
        var weekNum,weekClass,weekPrefix = "w",cellPrefix = "_cell",workingDayPrefix = "wd",dayPrefix = "d",cellRenderers,renderer,t = this.today,cfg = this.cfg,todayYear = t.getFullYear(),todayMonth = t.getMonth(),todayDate = t.getDate(),useDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),hideBlankWeeks = cfg.getProperty(DEF_CFG.HIDE_BLANK_WEEKS.key),showWeekFooter = cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key),showWeekHeader = cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key),mindate = cfg.getProperty(DEF_CFG.MINDATE.key),maxdate = cfg.getProperty(DEF_CFG.MAXDATE.key);
        if (mindate) {
            mindate = DateMath.clearTime(mindate);
        }
        if (maxdate) {
            maxdate = DateMath.clearTime(maxdate);
        }
        html[html.length] = '<tbody class="m' + (useDate.getMonth() + 1) + ' ' + this.Style.CSS_BODY + '">';
        var i = 0,tempDiv = document.createElement("div"),cell = document.createElement("td");
        tempDiv.appendChild(cell);
        var cal = this.parent || this;
        for (var r = 0; r < 6; r++) {
            weekNum = DateMath.getWeekNumber(workingDate, startDay);
            weekClass = weekPrefix + weekNum;
            if (r !== 0 && hideBlankWeeks === true && workingDate.getMonth() != useDate.getMonth()) {
                break;
            } else {
                html[html.length] = '<tr class="' + weekClass + '">';
                if (showWeekHeader) {
                    html = this.renderRowHeader(weekNum, html);
                }
                for (var d = 0; d < 7; d++) {
                    cellRenderers = [];
                    this.clearElement(cell);
                    cell.className = this.Style.CSS_CELL;
                    cell.id = this.id + cellPrefix + i;
                    if (workingDate.getDate() == todayDate && workingDate.getMonth() == todayMonth && workingDate.getFullYear() == todayYear) {
                        cellRenderers[cellRenderers.length] = cal.renderCellStyleToday;
                    }
                    var workingArray = [workingDate.getFullYear(),workingDate.getMonth() + 1,workingDate.getDate()];
                    this.cellDates[this.cellDates.length] = workingArray;
                    if (workingDate.getMonth() != useDate.getMonth()) {
                        cellRenderers[cellRenderers.length] = cal.renderCellNotThisMonth;
                    } else {
                        Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
                        Dom.addClass(cell, dayPrefix + workingDate.getDate());
                        for (var s = 0; s < this.renderStack.length; ++s) {
                            renderer = null;
                            var rArray = this.renderStack[s],type = rArray[0],month,day,year;
                            switch (type) {
                                case Calendar.DATE:
                                    month = rArray[1][1];
                                    day = rArray[1][2];
                                    year = rArray[1][0];
                                    if (workingDate.getMonth() + 1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {
                                        renderer = rArray[2];
                                        this.renderStack.splice(s, 1);
                                    }
                                    break;
                                case Calendar.MONTH_DAY:
                                    month = rArray[1][0];
                                    day = rArray[1][1];
                                    if (workingDate.getMonth() + 1 == month && workingDate.getDate() == day) {
                                        renderer = rArray[2];
                                        this.renderStack.splice(s, 1);
                                    }
                                    break;
                                case Calendar.RANGE:
                                    var date1 = rArray[1][0],date2 = rArray[1][1],d1month = date1[1],d1day = date1[2],d1year = date1[0],d1 = DateMath.getDate(d1year, d1month - 1, d1day),d2month = date2[1],d2day = date2[2],d2year = date2[0],d2 = DateMath.getDate(d2year, d2month - 1, d2day);
                                    if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
                                        renderer = rArray[2];
                                        if (workingDate.getTime() == d2.getTime()) {
                                            this.renderStack.splice(s, 1);
                                        }
                                    }
                                    break;
                                case Calendar.WEEKDAY:
                                    var weekday = rArray[1][0];
                                    if (workingDate.getDay() + 1 == weekday) {
                                        renderer = rArray[2];
                                    }
                                    break;
                                case Calendar.MONTH:
                                    month = rArray[1][0];
                                    if (workingDate.getMonth() + 1 == month) {
                                        renderer = rArray[2];
                                    }
                                    break;
                            }
                            if (renderer) {
                                cellRenderers[cellRenderers.length] = renderer;
                            }
                        }
                    }
                    if (this._indexOfSelectedFieldArray(workingArray) > -1) {
                        cellRenderers[cellRenderers.length] = cal.renderCellStyleSelected;
                    }
                    if ((mindate && (workingDate.getTime() < mindate.getTime())) || (maxdate && (workingDate.getTime() > maxdate.getTime()))) {
                        cellRenderers[cellRenderers.length] = cal.renderOutOfBoundsDate;
                    } else {
                        cellRenderers[cellRenderers.length] = cal.styleCellDefault;
                        cellRenderers[cellRenderers.length] = cal.renderCellDefault;
                    }
                    for (var x = 0; x < cellRenderers.length; ++x) {
                        if (cellRenderers[x].call(cal, workingDate, cell) == Calendar.STOP_RENDER) {
                            break;
                        }
                    }
                    workingDate.setTime(workingDate.getTime() + DateMath.ONE_DAY_MS);
                    workingDate = DateMath.clearTime(workingDate);
                    if (i >= 0 && i <= 6) {
                        Dom.addClass(cell, this.Style.CSS_CELL_TOP);
                    }
                    if ((i % 7) === 0) {
                        Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
                    }
                    if (((i + 1) % 7) === 0) {
                        Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
                    }
                    var postDays = this.postMonthDays;
                    if (hideBlankWeeks && postDays >= 7) {
                        var blankWeeks = Math.floor(postDays / 7);
                        for (var p = 0; p < blankWeeks; ++p) {
                            postDays -= 7;
                        }
                    }
                    if (i >= ((this.preMonthDays + postDays + this.monthDays) - 7)) {
                        Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
                    }
                    html[html.length] = tempDiv.innerHTML;
                    i++;
                }
                if (showWeekFooter) {
                    html = this.renderRowFooter(weekNum, html);
                }
                html[html.length] = '</tr>';
            }
        }
        html[html.length] = '</tbody>';
        return html;
    },renderFooter:function(html) {
        return html;
    },render:function() {
        this.beforeRenderEvent.fire();
        var workingDate = DateMath.findMonthStart(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));
        this.resetRenderers();
        this.cellDates.length = 0;
        Event.purgeElement(this.oDomContainer, true);
        var html = [];
        html[html.length] = '<table cellspacing="0" class="' + this.Style.CSS_CALENDAR + ' y' + workingDate.getFullYear() + '" id="' + this.id + '">';
        html = this.renderHeader(html);
        html = this.renderBody(workingDate, html);
        html = this.renderFooter(html);
        html[html.length] = '</table>';
        this.oDomContainer.innerHTML = html.join("\n");
        this.applyListeners();
        this.cells = this.oDomContainer.getElementsByTagName("td");
        this.cfg.refireEvent(DEF_CFG.TITLE.key);
        this.cfg.refireEvent(DEF_CFG.CLOSE.key);
        this.cfg.refireEvent(DEF_CFG.IFRAME.key);
        this.renderEvent.fire();
    },applyListeners:function() {
        var root = this.oDomContainer,cal = this.parent || this,anchor = "a",click = "click";
        var linkLeft = Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root),linkRight = Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
        if (linkLeft && linkLeft.length > 0) {
            this.linkLeft = linkLeft[0];
            Event.addListener(this.linkLeft, click, this.doPreviousMonthNav, cal, true);
        }
        if (linkRight && linkRight.length > 0) {
            this.linkRight = linkRight[0];
            Event.addListener(this.linkRight, click, this.doNextMonthNav, cal, true);
        }
        if (cal.cfg.getProperty("navigator") !== null) {
            this.applyNavListeners();
        }
        if (this.domEventMap) {
            var el,elements;
            for (var cls in this.domEventMap) {
                if (Lang.hasOwnProperty(this.domEventMap, cls)) {
                    var items = this.domEventMap[cls];
                    if (!(items instanceof Array)) {
                        items = [items];
                    }
                    for (var i = 0; i < items.length; i++) {
                        var item = items[i];
                        elements = Dom.getElementsByClassName(cls, item.tag, this.oDomContainer);
                        for (var c = 0; c < elements.length; c++) {
                            el = elements[c];
                            Event.addListener(el, item.event, item.handler, item.scope, item.correct);
                        }
                    }
                }
            }
        }
        Event.addListener(this.oDomContainer, "click", this.doSelectCell, this);
        Event.addListener(this.oDomContainer, "mouseover", this.doCellMouseOver, this);
        Event.addListener(this.oDomContainer, "mouseout", this.doCellMouseOut, this);
    },applyNavListeners:function() {
        var calParent = this.parent || this,cal = this,navBtns = Dom.getElementsByClassName(this.Style.CSS_NAV, "a", this.oDomContainer);
        if (navBtns.length > 0) {
            Event.addListener(navBtns, "click", function(e, obj) {
                var target = Event.getTarget(e);
                if (this === target || Dom.isAncestor(this, target)) {
                    Event.preventDefault(e);
                }
                var navigator = calParent.oNavigator;
                if (navigator) {
                    var pgdate = cal.cfg.getProperty("pagedate");
                    navigator.setYear(pgdate.getFullYear());
                    navigator.setMonth(pgdate.getMonth());
                    navigator.show();
                }
            });
        }
    },getDateByCellId:function(id) {
        var date = this.getDateFieldsByCellId(id);
        return(date) ? DateMath.getDate(date[0], date[1] - 1, date[2]) : null;
    },getDateFieldsByCellId:function(id) {
        id = this.getIndexFromId(id);
        return(id > -1) ? this.cellDates[id] : null;
    },getCellIndex:function(date) {
        var idx = -1;
        if (date) {
            var m = date.getMonth(),y = date.getFullYear(),d = date.getDate(),dates = this.cellDates;
            for (var i = 0; i < dates.length; ++i) {
                var cellDate = dates[i];
                if (cellDate[0] === y && cellDate[1] === m + 1 && cellDate[2] === d) {
                    idx = i;
                    break;
                }
            }
        }
        return idx;
    },getIndexFromId:function(strId) {
        var idx = -1,li = strId.lastIndexOf("_cell");
        if (li > -1) {
            idx = parseInt(strId.substring(li + 5), 10);
        }
        return idx;
    },renderOutOfBoundsDate:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_OOB);
        cell.innerHTML = workingDate.getDate();
        return Calendar.STOP_RENDER;
    },renderRowHeader:function(weekNum, html) {
        html[html.length] = '<th class="calrowhead">' + weekNum + '</th>';
        return html;
    },renderRowFooter:function(weekNum, html) {
        html[html.length] = '<th class="calrowfoot">' + weekNum + '</th>';
        return html;
    },renderCellDefault:function(workingDate, cell) {
        cell.innerHTML = '<a href="#" class="' + this.Style.CSS_CELL_SELECTOR + '">' + this.buildDayLabel(workingDate) + "</a>";
    },styleCellDefault:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
    },renderCellStyleHighlight1:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
    },renderCellStyleHighlight2:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
    },renderCellStyleHighlight3:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
    },renderCellStyleHighlight4:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
    },renderCellStyleToday:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
    },renderCellStyleSelected:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
    },renderCellNotThisMonth:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL_OOM);
        cell.innerHTML = workingDate.getDate();
        return Calendar.STOP_RENDER;
    },renderBodyCellRestricted:function(workingDate, cell) {
        Dom.addClass(cell, this.Style.CSS_CELL);
        Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
        cell.innerHTML = workingDate.getDate();
        return Calendar.STOP_RENDER;
    },addMonths:function(count) {
        var cfgPageDate = DEF_CFG.PAGEDATE.key;
        this.cfg.setProperty(cfgPageDate, DateMath.add(this.cfg.getProperty(cfgPageDate), DateMath.MONTH, count));
        this.resetRenderers();
        this.changePageEvent.fire();
    },subtractMonths:function(count) {
        var cfgPageDate = DEF_CFG.PAGEDATE.key;
        this.cfg.setProperty(cfgPageDate, DateMath.subtract(this.cfg.getProperty(cfgPageDate), DateMath.MONTH, count));
        this.resetRenderers();
        this.changePageEvent.fire();
    },addYears:function(count) {
        var cfgPageDate = DEF_CFG.PAGEDATE.key;
        this.cfg.setProperty(cfgPageDate, DateMath.add(this.cfg.getProperty(cfgPageDate), DateMath.YEAR, count));
        this.resetRenderers();
        this.changePageEvent.fire();
    },subtractYears:function(count) {
        var cfgPageDate = DEF_CFG.PAGEDATE.key;
        this.cfg.setProperty(cfgPageDate, DateMath.subtract(this.cfg.getProperty(cfgPageDate), DateMath.YEAR, count));
        this.resetRenderers();
        this.changePageEvent.fire();
    },nextMonth:function() {
        this.addMonths(1);
    },previousMonth:function() {
        this.subtractMonths(1);
    },nextYear:function() {
        this.addYears(1);
    },previousYear:function() {
        this.subtractYears(1);
    },reset:function() {
        this.cfg.resetProperty(DEF_CFG.SELECTED.key);
        this.cfg.resetProperty(DEF_CFG.PAGEDATE.key);
        this.resetEvent.fire();
    },clear:function() {
        this.cfg.setProperty(DEF_CFG.SELECTED.key, []);
        this.cfg.setProperty(DEF_CFG.PAGEDATE.key, new Date(this.today.getTime()));
        this.clearEvent.fire();
    },select:function(date) {
        var aToBeSelected = this._toFieldArray(date),validDates = [],selected = [],cfgSelected = DEF_CFG.SELECTED.key;
        for (var a = 0; a < aToBeSelected.length; ++a) {
            var toSelect = aToBeSelected[a];
            if (!this.isDateOOB(this._toDate(toSelect))) {
                if (validDates.length === 0) {
                    this.beforeSelectEvent.fire();
                    selected = this.cfg.getProperty(cfgSelected);
                }
                validDates.push(toSelect);
                if (this._indexOfSelectedFieldArray(toSelect) == -1) {
                    selected[selected.length] = toSelect;
                }
            }
        }
        if (validDates.length > 0) {
            if (this.parent) {
                this.parent.cfg.setProperty(cfgSelected, selected);
            } else {
                this.cfg.setProperty(cfgSelected, selected);
            }
            this.selectEvent.fire(validDates);
        }
        return this.getSelectedDates();
    },selectCell:function(cellIndex) {
        var cell = this.cells[cellIndex],cellDate = this.cellDates[cellIndex],dCellDate = this._toDate(cellDate),selectable = Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
        if (selectable) {
            this.beforeSelectEvent.fire();
            var cfgSelected = DEF_CFG.SELECTED.key;
            var selected = this.cfg.getProperty(cfgSelected);
            var selectDate = cellDate.concat();
            if (this._indexOfSelectedFieldArray(selectDate) == -1) {
                selected[selected.length] = selectDate;
            }
            if (this.parent) {
                this.parent.cfg.setProperty(cfgSelected, selected);
            } else {
                this.cfg.setProperty(cfgSelected, selected);
            }
            this.renderCellStyleSelected(dCellDate, cell);
            this.selectEvent.fire([selectDate]);
            this.doCellMouseOut.call(cell, null, this);
        }
        return this.getSelectedDates();
    },deselect:function(date) {
        var aToBeDeselected = this._toFieldArray(date),validDates = [],selected = [],cfgSelected = DEF_CFG.SELECTED.key;
        for (var a = 0; a < aToBeDeselected.length; ++a) {
            var toDeselect = aToBeDeselected[a];
            if (!this.isDateOOB(this._toDate(toDeselect))) {
                if (validDates.length === 0) {
                    this.beforeDeselectEvent.fire();
                    selected = this.cfg.getProperty(cfgSelected);
                }
                validDates.push(toDeselect);
                var index = this._indexOfSelectedFieldArray(toDeselect);
                if (index != -1) {
                    selected.splice(index, 1);
                }
            }
        }
        if (validDates.length > 0) {
            if (this.parent) {
                this.parent.cfg.setProperty(cfgSelected, selected);
            } else {
                this.cfg.setProperty(cfgSelected, selected);
            }
            this.deselectEvent.fire(validDates);
        }
        return this.getSelectedDates();
    },deselectCell:function(cellIndex) {
        var cell = this.cells[cellIndex],cellDate = this.cellDates[cellIndex],cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
        var selectable = Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
        if (selectable) {
            this.beforeDeselectEvent.fire();
            var selected = this.cfg.getProperty(DEF_CFG.SELECTED.key),dCellDate = this._toDate(cellDate),selectDate = cellDate.concat();
            if (cellDateIndex > -1) {
                if (this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth() == dCellDate.getMonth() && this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) {
                    Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
                }
                selected.splice(cellDateIndex, 1);
            }
            if (this.parent) {
                this.parent.cfg.setProperty(DEF_CFG.SELECTED.key, selected);
            } else {
                this.cfg.setProperty(DEF_CFG.SELECTED.key, selected);
            }
            this.deselectEvent.fire(selectDate);
        }
        return this.getSelectedDates();
    },deselectAll:function() {
        this.beforeDeselectEvent.fire();
        var cfgSelected = DEF_CFG.SELECTED.key,selected = this.cfg.getProperty(cfgSelected),count = selected.length,sel = selected.concat();
        if (this.parent) {
            this.parent.cfg.setProperty(cfgSelected, []);
        } else {
            this.cfg.setProperty(cfgSelected, []);
        }
        if (count > 0) {
            this.deselectEvent.fire(sel);
        }
        return this.getSelectedDates();
    },_toFieldArray:function(date) {
        var returnDate = [];
        if (date instanceof Date) {
            returnDate = [
                [date.getFullYear(),date.getMonth() + 1,date.getDate()]
            ];
        } else if (Lang.isString(date)) {
            returnDate = this._parseDates(date);
        } else if (Lang.isArray(date)) {
            for (var i = 0; i < date.length; ++i) {
                var d = date[i];
                returnDate[returnDate.length] = [d.getFullYear(),d.getMonth() + 1,d.getDate()];
            }
        }
        return returnDate;
    },toDate:function(dateFieldArray) {
        return this._toDate(dateFieldArray);
    },_toDate:function(dateFieldArray) {
        if (dateFieldArray instanceof Date) {
            return dateFieldArray;
        } else {
            return DateMath.getDate(dateFieldArray[0], dateFieldArray[1] - 1, dateFieldArray[2]);
        }
    },_fieldArraysAreEqual:function(array1, array2) {
        var match = false;
        if (array1[0] == array2[0] && array1[1] == array2[1] && array1[2] == array2[2]) {
            match = true;
        }
        return match;
    },_indexOfSelectedFieldArray:function(find) {
        var selected = -1,seldates = this.cfg.getProperty(DEF_CFG.SELECTED.key);
        for (var s = 0; s < seldates.length; ++s) {
            var sArray = seldates[s];
            if (find[0] == sArray[0] && find[1] == sArray[1] && find[2] == sArray[2]) {
                selected = s;
                break;
            }
        }
        return selected;
    },isDateOOM:function(date) {
        return(date.getMonth() != this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth());
    },isDateOOB:function(date) {
        var minDate = this.cfg.getProperty(DEF_CFG.MINDATE.key),maxDate = this.cfg.getProperty(DEF_CFG.MAXDATE.key),dm = DateMath;
        if (minDate) {
            minDate = dm.clearTime(minDate);
        }
        if (maxDate) {
            maxDate = dm.clearTime(maxDate);
        }
        var clearedDate = new Date(date.getTime());
        clearedDate = dm.clearTime(clearedDate);
        return((minDate && clearedDate.getTime() < minDate.getTime()) || (maxDate && clearedDate.getTime() > maxDate.getTime()));
    },_parsePageDate:function(date) {
        var parsedDate;
        if (date) {
            if (date instanceof Date) {
                parsedDate = DateMath.findMonthStart(date);
            } else {
                var month,year,aMonthYear;
                aMonthYear = date.split(this.cfg.getProperty(DEF_CFG.DATE_FIELD_DELIMITER.key));
                month = parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_MONTH_POSITION.key) - 1], 10) - 1;
                year = parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_YEAR_POSITION.key) - 1], 10);
                parsedDate = DateMath.getDate(year, month, 1);
            }
        } else {
            parsedDate = DateMath.getDate(this.today.getFullYear(), this.today.getMonth(), 1);
        }
        return parsedDate;
    },onBeforeSelect:function() {
        if (this.cfg.getProperty(DEF_CFG.MULTI_SELECT.key) === false) {
            if (this.parent) {
                this.parent.callChildFunction("clearAllBodyCellStyles", this.Style.CSS_CELL_SELECTED);
                this.parent.deselectAll();
            } else {
                this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);
                this.deselectAll();
            }
        }
    },onSelect:function(selected) {
    },onBeforeDeselect:function() {
    },onDeselect:function(deselected) {
    },onChangePage:function() {
        this.render();
    },onRender:function() {
    },onReset:function() {
        this.render();
    },onClear:function() {
        this.render();
    },validate:function() {
        return true;
    },_parseDate:function(sDate) {
        var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER),rArray;
        if (aDate.length == 2) {
            rArray = [aDate[this.Locale.MD_MONTH_POSITION - 1],aDate[this.Locale.MD_DAY_POSITION - 1]];
            rArray.type = Calendar.MONTH_DAY;
        } else {
            rArray = [aDate[this.Locale.MDY_YEAR_POSITION - 1],aDate[this.Locale.MDY_MONTH_POSITION - 1],aDate[this.Locale.MDY_DAY_POSITION - 1]];
            rArray.type = Calendar.DATE;
        }
        for (var i = 0; i < rArray.length; i++) {
            rArray[i] = parseInt(rArray[i], 10);
        }
        return rArray;
    },_parseDates:function(sDates) {
        var aReturn = [],aDates = sDates.split(this.Locale.DATE_DELIMITER);
        for (var d = 0; d < aDates.length; ++d) {
            var sDate = aDates[d];
            if (sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER) != -1) {
                var aRange = sDate.split(this.Locale.DATE_RANGE_DELIMITER),dateStart = this._parseDate(aRange[0]),dateEnd = this._parseDate(aRange[1]),fullRange = this._parseRange(dateStart, dateEnd);
                aReturn = aReturn.concat(fullRange);
            } else {
                var aDate = this._parseDate(sDate);
                aReturn.push(aDate);
            }
        }
        return aReturn;
    },_parseRange:function(startDate, endDate) {
        var dCurrent = DateMath.add(DateMath.getDate(startDate[0], startDate[1] - 1, startDate[2]), DateMath.DAY, 1),dEnd = DateMath.getDate(endDate[0], endDate[1] - 1, endDate[2]),results = [];
        results.push(startDate);
        while (dCurrent.getTime() <= dEnd.getTime()) {
            results.push([dCurrent.getFullYear(),dCurrent.getMonth() + 1,dCurrent.getDate()]);
            dCurrent = DateMath.add(dCurrent, DateMath.DAY, 1);
        }
        return results;
    },resetRenderers:function() {
        this.renderStack = this._renderStack.concat();
    },removeRenderers:function() {
        this._renderStack = [];
        this.renderStack = [];
    },clearElement:function(cell) {
        cell.innerHTML = "&#160;";
        cell.className = "";
    },addRenderer:function(sDates, fnRender) {
        var aDates = this._parseDates(sDates);
        for (var i = 0; i < aDates.length; ++i) {
            var aDate = aDates[i];
            if (aDate.length == 2) {
                if (aDate[0]instanceof Array) {
                    this._addRenderer(Calendar.RANGE, aDate, fnRender);
                } else {
                    this._addRenderer(Calendar.MONTH_DAY, aDate, fnRender);
                }
            } else if (aDate.length == 3) {
                this._addRenderer(Calendar.DATE, aDate, fnRender);
            }
        }
    },_addRenderer:function(type, aDates, fnRender) {
        var add = [type,aDates,fnRender];
        this.renderStack.unshift(add);
        this._renderStack = this.renderStack.concat();
    },addMonthRenderer:function(month, fnRender) {
        this._addRenderer(Calendar.MONTH, [month], fnRender);
    },addWeekdayRenderer:function(weekday, fnRender) {
        this._addRenderer(Calendar.WEEKDAY, [weekday], fnRender);
    },clearAllBodyCellStyles:function(style) {
        for (var c = 0; c < this.cells.length; ++c) {
            Dom.removeClass(this.cells[c], style);
        }
    },setMonth:function(month) {
        var cfgPageDate = DEF_CFG.PAGEDATE.key,current = this.cfg.getProperty(cfgPageDate);
        current.setMonth(parseInt(month, 10));
        this.cfg.setProperty(cfgPageDate, current);
    },setYear:function(year) {
        var cfgPageDate = DEF_CFG.PAGEDATE.key,current = this.cfg.getProperty(cfgPageDate);
        current.setFullYear(parseInt(year, 10));
        this.cfg.setProperty(cfgPageDate, current);
    },getSelectedDates:function() {
        var returnDates = [],selected = this.cfg.getProperty(DEF_CFG.SELECTED.key);
        for (var d = 0; d < selected.length; ++d) {
            var dateArray = selected[d];
            var date = DateMath.getDate(dateArray[0], dateArray[1] - 1, dateArray[2]);
            returnDates.push(date);
        }
        returnDates.sort(function(a, b) {
            return a - b;
        });
        return returnDates;
    },hide:function() {
        if (this.beforeHideEvent.fire()) {
            this.oDomContainer.style.display = "none";
            this.hideEvent.fire();
        }
    },show:function() {
        if (this.beforeShowEvent.fire()) {
            this.oDomContainer.style.display = "block";
            this.showEvent.fire();
        }
    },browser:(function() {
        var ua = navigator.userAgent.toLowerCase();
        if (ua.indexOf('opera') != -1) {
            return'opera';
        } else if (ua.indexOf('msie 7') != -1) {
            return'ie7';
        } else if (ua.indexOf('msie') != -1) {
            return'ie';
        } else if (ua.indexOf('safari') != -1) {
            return'safari';
        } else if (ua.indexOf('gecko') != -1) {
            return'gecko';
        } else {
            return false;
        }
    })(),toString:function() {
        return"Calendar " + this.id;
    },destroy:function() {
        if (this.beforeDestroyEvent.fire()) {
            var cal = this;
            if (cal.navigator) {
                cal.navigator.destroy();
            }
            if (cal.cfg) {
                cal.cfg.destroy();
            }
            Event.purgeElement(cal.oDomContainer, true);
            Dom.removeClass(cal.oDomContainer, "withtitle");
            Dom.removeClass(cal.oDomContainer, cal.Style.CSS_CONTAINER);
            Dom.removeClass(cal.oDomContainer, cal.Style.CSS_SINGLE);
            cal.oDomContainer.innerHTML = "";
            cal.oDomContainer = null;
            cal.cells = null;
            this.destroyEvent.fire();
        }
    }};
    YAHOO.widget.Calendar = Calendar;
    YAHOO.widget.Calendar_Core = YAHOO.widget.Calendar;
    YAHOO.widget.Cal_Core = YAHOO.widget.Calendar;
})();
(function() {
    var Dom = YAHOO.util.Dom,DateMath = YAHOO.widget.DateMath,Event = YAHOO.util.Event,Lang = YAHOO.lang,Calendar = YAHOO.widget.Calendar;

    function CalendarGroup(id, containerId, config) {
        if (arguments.length > 0) {
            this.init.apply(this, arguments);
        }
    }

    CalendarGroup._DEFAULT_CONFIG = Calendar._DEFAULT_CONFIG;
    CalendarGroup._DEFAULT_CONFIG.PAGES = {key:"pages",value:2};
    var DEF_CFG = CalendarGroup._DEFAULT_CONFIG;
    CalendarGroup.prototype = {init:function(id, container, config) {
        var nArgs = this._parseArgs(arguments);
        id = nArgs.id;
        container = nArgs.container;
        config = nArgs.config;
        this.oDomContainer = Dom.get(container);
        if (!this.oDomContainer.id) {
            this.oDomContainer.id = Dom.generateId();
        }
        if (!id) {
            id = this.oDomContainer.id + "_t";
        }
        this.id = id;
        this.containerId = this.oDomContainer.id;
        this.initEvents();
        this.initStyles();
        this.pages = [];
        Dom.addClass(this.oDomContainer, CalendarGroup.CSS_CONTAINER);
        Dom.addClass(this.oDomContainer, CalendarGroup.CSS_MULTI_UP);
        this.cfg = new YAHOO.util.Config(this);
        this.Options = {};
        this.Locale = {};
        this.setupConfig();
        if (config) {
            this.cfg.applyConfig(config, true);
        }
        this.cfg.fireQueue();
        if (YAHOO.env.ua.opera) {
            this.renderEvent.subscribe(this._fixWidth, this, true);
            this.showEvent.subscribe(this._fixWidth, this, true);
        }
    },setupConfig:function() {
        var cfg = this.cfg;
        cfg.addProperty(DEF_CFG.PAGES.key, {value:DEF_CFG.PAGES.value,validator:cfg.checkNumber,handler:this.configPages});
        cfg.addProperty(DEF_CFG.PAGEDATE.key, {value:new Date(),handler:this.configPageDate});
        cfg.addProperty(DEF_CFG.SELECTED.key, {value:[],handler:this.configSelected});
        cfg.addProperty(DEF_CFG.TITLE.key, {value:DEF_CFG.TITLE.value,handler:this.configTitle});
        cfg.addProperty(DEF_CFG.CLOSE.key, {value:DEF_CFG.CLOSE.value,handler:this.configClose});
        cfg.addProperty(DEF_CFG.IFRAME.key, {value:DEF_CFG.IFRAME.value,handler:this.configIframe,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.MINDATE.key, {value:DEF_CFG.MINDATE.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.MAXDATE.key, {value:DEF_CFG.MAXDATE.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.MULTI_SELECT.key, {value:DEF_CFG.MULTI_SELECT.value,handler:this.delegateConfig,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.START_WEEKDAY.key, {value:DEF_CFG.START_WEEKDAY.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key, {value:DEF_CFG.SHOW_WEEKDAYS.value,handler:this.delegateConfig,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key, {value:DEF_CFG.SHOW_WEEK_HEADER.value,handler:this.delegateConfig,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key, {value:DEF_CFG.SHOW_WEEK_FOOTER.value,handler:this.delegateConfig,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key, {value:DEF_CFG.HIDE_BLANK_WEEKS.value,handler:this.delegateConfig,validator:cfg.checkBoolean});
        cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key, {value:DEF_CFG.NAV_ARROW_LEFT.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key, {value:DEF_CFG.NAV_ARROW_RIGHT.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.MONTHS_SHORT.key, {value:DEF_CFG.MONTHS_SHORT.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.MONTHS_LONG.key, {value:DEF_CFG.MONTHS_LONG.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key, {value:DEF_CFG.WEEKDAYS_1CHAR.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key, {value:DEF_CFG.WEEKDAYS_SHORT.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key, {value:DEF_CFG.WEEKDAYS_MEDIUM.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key, {value:DEF_CFG.WEEKDAYS_LONG.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key, {value:DEF_CFG.LOCALE_MONTHS.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key, {value:DEF_CFG.LOCALE_WEEKDAYS.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.DATE_DELIMITER.key, {value:DEF_CFG.DATE_DELIMITER.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key, {value:DEF_CFG.DATE_FIELD_DELIMITER.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key, {value:DEF_CFG.DATE_RANGE_DELIMITER.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key, {value:DEF_CFG.MY_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key, {value:DEF_CFG.MY_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key, {value:DEF_CFG.MD_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key, {value:DEF_CFG.MD_DAY_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key, {value:DEF_CFG.MDY_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key, {value:DEF_CFG.MDY_DAY_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key, {value:DEF_CFG.MDY_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key, {value:DEF_CFG.MY_LABEL_MONTH_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key, {value:DEF_CFG.MY_LABEL_YEAR_POSITION.value,handler:this.delegateConfig,validator:cfg.checkNumber});
        cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key, {value:DEF_CFG.MY_LABEL_MONTH_SUFFIX.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key, {value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value,handler:this.delegateConfig});
        cfg.addProperty(DEF_CFG.NAV.key, {value:DEF_CFG.NAV.value,handler:this.configNavigator});
        cfg.addProperty(DEF_CFG.STRINGS.key, {value:DEF_CFG.STRINGS.value,handler:this.configStrings,validator:function(val) {
            return Lang.isObject(val);
        },supercedes:DEF_CFG.STRINGS.supercedes});
    },initEvents:function() {
        var me = this,strEvent = "Event",CE = YAHOO.util.CustomEvent;
        var sub = function(fn, obj, bOverride) {
            for (var p = 0; p < me.pages.length; ++p) {
                var cal = me.pages[p];
                cal[this.type + strEvent].subscribe(fn, obj, bOverride);
            }
        };
        var unsub = function(fn, obj) {
            for (var p = 0; p < me.pages.length; ++p) {
                var cal = me.pages[p];
                cal[this.type + strEvent].unsubscribe(fn, obj);
            }
        };
        var defEvents = Calendar._EVENT_TYPES;
        me.beforeSelectEvent = new CE(defEvents.BEFORE_SELECT);
        me.beforeSelectEvent.subscribe = sub;
        me.beforeSelectEvent.unsubscribe = unsub;
        me.selectEvent = new CE(defEvents.SELECT);
        me.selectEvent.subscribe = sub;
        me.selectEvent.unsubscribe = unsub;
        me.beforeDeselectEvent = new CE(defEvents.BEFORE_DESELECT);
        me.beforeDeselectEvent.subscribe = sub;
        me.beforeDeselectEvent.unsubscribe = unsub;
        me.deselectEvent = new CE(defEvents.DESELECT);
        me.deselectEvent.subscribe = sub;
        me.deselectEvent.unsubscribe = unsub;
        me.changePageEvent = new CE(defEvents.CHANGE_PAGE);
        me.changePageEvent.subscribe = sub;
        me.changePageEvent.unsubscribe = unsub;
        me.beforeRenderEvent = new CE(defEvents.BEFORE_RENDER);
        me.beforeRenderEvent.subscribe = sub;
        me.beforeRenderEvent.unsubscribe = unsub;
        me.renderEvent = new CE(defEvents.RENDER);
        me.renderEvent.subscribe = sub;
        me.renderEvent.unsubscribe = unsub;
        me.resetEvent = new CE(defEvents.RESET);
        me.resetEvent.subscribe = sub;
        me.resetEvent.unsubscribe = unsub;
        me.clearEvent = new CE(defEvents.CLEAR);
        me.clearEvent.subscribe = sub;
        me.clearEvent.unsubscribe = unsub;
        me.beforeShowEvent = new CE(defEvents.BEFORE_SHOW);
        me.showEvent = new CE(defEvents.SHOW);
        me.beforeHideEvent = new CE(defEvents.BEFORE_HIDE);
        me.hideEvent = new CE(defEvents.HIDE);
        me.beforeShowNavEvent = new CE(defEvents.BEFORE_SHOW_NAV);
        me.showNavEvent = new CE(defEvents.SHOW_NAV);
        me.beforeHideNavEvent = new CE(defEvents.BEFORE_HIDE_NAV);
        me.hideNavEvent = new CE(defEvents.HIDE_NAV);
        me.beforeRenderNavEvent = new CE(defEvents.BEFORE_RENDER_NAV);
        me.renderNavEvent = new CE(defEvents.RENDER_NAV);
        me.beforeDestroyEvent = new CE(defEvents.BEFORE_DESTROY);
        me.destroyEvent = new CE(defEvents.DESTROY);
    },configPages:function(type, args, obj) {
        var pageCount = args[0],cfgPageDate = DEF_CFG.PAGEDATE.key,sep = "_",groupCalClass = "groupcal",firstClass = "first-of-type",lastClass = "last-of-type";
        for (var p = 0; p < pageCount; ++p) {
            var calId = this.id + sep + p,calContainerId = this.containerId + sep + p,childConfig = this.cfg.getConfig();
            childConfig.close = false;
            childConfig.title = false;
            childConfig.navigator = null;
            var cal = this.constructChild(calId, calContainerId, childConfig);
            var caldate = cal.cfg.getProperty(cfgPageDate);
            this._setMonthOnDate(caldate, caldate.getMonth() + p);
            cal.cfg.setProperty(cfgPageDate, caldate);
            Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
            Dom.addClass(cal.oDomContainer, groupCalClass);
            if (p === 0) {
                Dom.addClass(cal.oDomContainer, firstClass);
            }
            if (p == (pageCount - 1)) {
                Dom.addClass(cal.oDomContainer, lastClass);
            }
            cal.parent = this;
            cal.index = p;
            this.pages[this.pages.length] = cal;
        }
    },configPageDate:function(type, args, obj) {
        var val = args[0],firstPageDate;
        var cfgPageDate = DEF_CFG.PAGEDATE.key;
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            if (p === 0) {
                firstPageDate = cal._parsePageDate(val);
                cal.cfg.setProperty(cfgPageDate, firstPageDate);
            } else {
                var pageDate = new Date(firstPageDate);
                this._setMonthOnDate(pageDate, pageDate.getMonth() + p);
                cal.cfg.setProperty(cfgPageDate, pageDate);
            }
        }
    },configSelected:function(type, args, obj) {
        var cfgSelected = DEF_CFG.SELECTED.key;
        this.delegateConfig(type, args, obj);
        var selected = (this.pages.length > 0) ? this.pages[0].cfg.getProperty(cfgSelected) : [];
        this.cfg.setProperty(cfgSelected, selected, true);
    },delegateConfig:function(type, args, obj) {
        var val = args[0];
        var cal;
        for (var p = 0; p < this.pages.length; p++) {
            cal = this.pages[p];
            cal.cfg.setProperty(type, val);
        }
    },setChildFunction:function(fnName, fn) {
        var pageCount = this.cfg.getProperty(DEF_CFG.PAGES.key);
        for (var p = 0; p < pageCount; ++p) {
            this.pages[p][fnName] = fn;
        }
    },callChildFunction:function(fnName, args) {
        var pageCount = this.cfg.getProperty(DEF_CFG.PAGES.key);
        for (var p = 0; p < pageCount; ++p) {
            var page = this.pages[p];
            if (page[fnName]) {
                var fn = page[fnName];
                fn.call(page, args);
            }
        }
    },constructChild:function(id, containerId, config) {
        var container = document.getElementById(containerId);
        if (!container) {
            container = document.createElement("div");
            container.id = containerId;
            this.oDomContainer.appendChild(container);
        }
        return new Calendar(id, containerId, config);
    },setMonth:function(month) {
        month = parseInt(month, 10);
        var currYear;
        var cfgPageDate = DEF_CFG.PAGEDATE.key;
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            var pageDate = cal.cfg.getProperty(cfgPageDate);
            if (p === 0) {
                currYear = pageDate.getFullYear();
            } else {
                pageDate.setFullYear(currYear);
            }
            this._setMonthOnDate(pageDate, month + p);
            cal.cfg.setProperty(cfgPageDate, pageDate);
        }
    },setYear:function(year) {
        var cfgPageDate = DEF_CFG.PAGEDATE.key;
        year = parseInt(year, 10);
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            var pageDate = cal.cfg.getProperty(cfgPageDate);
            if ((pageDate.getMonth() + 1) == 1 && p > 0) {
                year += 1;
            }
            cal.setYear(year);
        }
    },render:function() {
        this.renderHeader();
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.render();
        }
        this.renderFooter();
    },select:function(date) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.select(date);
        }
        return this.getSelectedDates();
    },selectCell:function(cellIndex) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.selectCell(cellIndex);
        }
        return this.getSelectedDates();
    },deselect:function(date) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.deselect(date);
        }
        return this.getSelectedDates();
    },deselectAll:function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.deselectAll();
        }
        return this.getSelectedDates();
    },deselectCell:function(cellIndex) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.deselectCell(cellIndex);
        }
        return this.getSelectedDates();
    },reset:function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.reset();
        }
    },clear:function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.clear();
        }
        this.cfg.setProperty(DEF_CFG.SELECTED.key, []);
        this.cfg.setProperty(DEF_CFG.PAGEDATE.key, new Date(this.pages[0].today.getTime()));
        this.render();
    },nextMonth:function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.nextMonth();
        }
    },previousMonth:function() {
        for (var p = this.pages.length - 1; p >= 0; --p) {
            var cal = this.pages[p];
            cal.previousMonth();
        }
    },nextYear:function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.nextYear();
        }
    },previousYear:function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.previousYear();
        }
    },getSelectedDates:function() {
        var returnDates = [];
        var selected = this.cfg.getProperty(DEF_CFG.SELECTED.key);
        for (var d = 0; d < selected.length; ++d) {
            var dateArray = selected[d];
            var date = DateMath.getDate(dateArray[0], dateArray[1] - 1, dateArray[2]);
            returnDates.push(date);
        }
        returnDates.sort(function(a, b) {
            return a - b;
        });
        return returnDates;
    },addRenderer:function(sDates, fnRender) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.addRenderer(sDates, fnRender);
        }
    },addMonthRenderer:function(month, fnRender) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.addMonthRenderer(month, fnRender);
        }
    },addWeekdayRenderer:function(weekday, fnRender) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.addWeekdayRenderer(weekday, fnRender);
        }
    },removeRenderers:function() {
        this.callChildFunction("removeRenderers");
    },renderHeader:function() {
    },renderFooter:function() {
    },addMonths:function(count) {
        this.callChildFunction("addMonths", count);
    },subtractMonths:function(count) {
        this.callChildFunction("subtractMonths", count);
    },addYears:function(count) {
        this.callChildFunction("addYears", count);
    },subtractYears:function(count) {
        this.callChildFunction("subtractYears", count);
    },getCalendarPage:function(date) {
        var cal = null;
        if (date) {
            var y = date.getFullYear(),m = date.getMonth();
            var pages = this.pages;
            for (var i = 0; i < pages.length; ++i) {
                var pageDate = pages[i].cfg.getProperty("pagedate");
                if (pageDate.getFullYear() === y && pageDate.getMonth() === m) {
                    cal = pages[i];
                    break;
                }
            }
        }
        return cal;
    },_setMonthOnDate:function(date, iMonth) {
        if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420 && (iMonth < 0 || iMonth > 11)) {
            var newDate = DateMath.add(date, DateMath.MONTH, iMonth - date.getMonth());
            date.setTime(newDate.getTime());
        } else {
            date.setMonth(iMonth);
        }
    },_fixWidth:function() {
        var w = 0;
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            w += cal.oDomContainer.offsetWidth;
        }
        if (w > 0) {
            this.oDomContainer.style.width = w + "px";
        }
    },toString:function() {
        return"CalendarGroup " + this.id;
    },destroy:function() {
        if (this.beforeDestroyEvent.fire()) {
            var cal = this;
            if (cal.navigator) {
                cal.navigator.destroy();
            }
            if (cal.cfg) {
                cal.cfg.destroy();
            }
            Event.purgeElement(cal.oDomContainer, true);
            Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_CONTAINER);
            Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_MULTI_UP);
            for (var i = 0,l = cal.pages.length; i < l; i++) {
                cal.pages[i].destroy();
                cal.pages[i] = null;
            }
            cal.oDomContainer.innerHTML = "";
            cal.oDomContainer = null;
            this.destroyEvent.fire();
        }
    }};
    CalendarGroup.CSS_CONTAINER = "yui-calcontainer";
    CalendarGroup.CSS_MULTI_UP = "multi";
    CalendarGroup.CSS_2UPTITLE = "title";
    CalendarGroup.CSS_2UPCLOSE = "close-icon";
    YAHOO.lang.augmentProto(CalendarGroup, Calendar, "buildDayLabel", "buildMonthLabel", "renderOutOfBoundsDate", "renderRowHeader", "renderRowFooter", "renderCellDefault", "styleCellDefault", "renderCellStyleHighlight1", "renderCellStyleHighlight2", "renderCellStyleHighlight3", "renderCellStyleHighlight4", "renderCellStyleToday", "renderCellStyleSelected", "renderCellNotThisMonth", "renderBodyCellRestricted", "initStyles", "configTitle", "configClose", "configIframe", "configStrings", "configNavigator", "createTitleBar", "createCloseButton", "removeTitleBar", "removeCloseButton", "hide", "show", "toDate", "_toDate", "_parseArgs", "browser");
    YAHOO.widget.CalGrp = CalendarGroup;
    YAHOO.widget.CalendarGroup = CalendarGroup;
    YAHOO.widget.Calendar2up = function(id, containerId, config) {
        this.init(id, containerId, config);
    };
    YAHOO.extend(YAHOO.widget.Calendar2up, CalendarGroup);
    YAHOO.widget.Cal2up = YAHOO.widget.Calendar2up;
})();
YAHOO.widget.CalendarNavigator = function(cal) {
    this.init(cal);
};
(function() {
    var CN = YAHOO.widget.CalendarNavigator;
    CN.CLASSES = {NAV:"yui-cal-nav",NAV_VISIBLE:"yui-cal-nav-visible",MASK:"yui-cal-nav-mask",YEAR:"yui-cal-nav-y",MONTH:"yui-cal-nav-m",BUTTONS:"yui-cal-nav-b",BUTTON:"yui-cal-nav-btn",ERROR:"yui-cal-nav-e",YEAR_CTRL:"yui-cal-nav-yc",MONTH_CTRL:"yui-cal-nav-mc",INVALID:"yui-invalid",DEFAULT:"yui-default"};
    CN._DEFAULT_CFG = {strings:{month:"Month",year:"Year",submit:"Okay",cancel:"Cancel",invalidYear:"Year needs to be a number"},monthFormat:YAHOO.widget.Calendar.LONG,initialFocus:"year"};
    CN.ID_SUFFIX = "_nav";
    CN.MONTH_SUFFIX = "_month";
    CN.YEAR_SUFFIX = "_year";
    CN.ERROR_SUFFIX = "_error";
    CN.CANCEL_SUFFIX = "_cancel";
    CN.SUBMIT_SUFFIX = "_submit";
    CN.YR_MAX_DIGITS = 4;
    CN.YR_MINOR_INC = 1;
    CN.YR_MAJOR_INC = 10;
    CN.UPDATE_DELAY = 50;
    CN.YR_PATTERN = /^\d+$/;
    CN.TRIM = /^\s*(.*?)\s*$/;
})();
YAHOO.widget.CalendarNavigator.prototype = {id:null,cal:null,navEl:null,maskEl:null,yearEl:null,monthEl:null,errorEl:null,submitEl:null,cancelEl:null,firstCtrl:null,lastCtrl:null,_doc:null,_year:null,_month:0,__rendered:false,init:function(cal) {
    var calBox = cal.oDomContainer;
    this.cal = cal;
    this.id = calBox.id + YAHOO.widget.CalendarNavigator.ID_SUFFIX;
    this._doc = calBox.ownerDocument;
    var ie = YAHOO.env.ua.ie;
    this.__isIEQuirks = (ie && ((ie <= 6) || (ie === 7 && this._doc.compatMode == "BackCompat")));
},show:function() {
    var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
    if (this.cal.beforeShowNavEvent.fire()) {
        if (!this.__rendered) {
            this.render();
        }
        this.clearErrors();
        this._updateMonthUI();
        this._updateYearUI();
        this._show(this.navEl, true);
        this.setInitialFocus();
        this.showMask();
        YAHOO.util.Dom.addClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
        this.cal.showNavEvent.fire();
    }
},hide:function() {
    var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
    if (this.cal.beforeHideNavEvent.fire()) {
        this._show(this.navEl, false);
        this.hideMask();
        YAHOO.util.Dom.removeClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
        this.cal.hideNavEvent.fire();
    }
},showMask:function() {
    this._show(this.maskEl, true);
    if (this.__isIEQuirks) {
        this._syncMask();
    }
},hideMask:function() {
    this._show(this.maskEl, false);
},getMonth:function() {
    return this._month;
},getYear:function() {
    return this._year;
},setMonth:function(nMonth) {
    if (nMonth >= 0 && nMonth < 12) {
        this._month = nMonth;
    }
    this._updateMonthUI();
},setYear:function(nYear) {
    var yrPattern = YAHOO.widget.CalendarNavigator.YR_PATTERN;
    if (YAHOO.lang.isNumber(nYear) && yrPattern.test(nYear + "")) {
        this._year = nYear;
    }
    this._updateYearUI();
},render:function() {
    this.cal.beforeRenderNavEvent.fire();
    if (!this.__rendered) {
        this.createNav();
        this.createMask();
        this.applyListeners();
        this.__rendered = true;
    }
    this.cal.renderNavEvent.fire();
},createNav:function() {
    var NAV = YAHOO.widget.CalendarNavigator;
    var doc = this._doc;
    var d = doc.createElement("div");
    d.className = NAV.CLASSES.NAV;
    var htmlBuf = this.renderNavContents([]);
    d.innerHTML = htmlBuf.join('');
    this.cal.oDomContainer.appendChild(d);
    this.navEl = d;
    this.yearEl = doc.getElementById(this.id + NAV.YEAR_SUFFIX);
    this.monthEl = doc.getElementById(this.id + NAV.MONTH_SUFFIX);
    this.errorEl = doc.getElementById(this.id + NAV.ERROR_SUFFIX);
    this.submitEl = doc.getElementById(this.id + NAV.SUBMIT_SUFFIX);
    this.cancelEl = doc.getElementById(this.id + NAV.CANCEL_SUFFIX);
    if (YAHOO.env.ua.gecko && this.yearEl && this.yearEl.type == "text") {
        this.yearEl.setAttribute("autocomplete", "off");
    }
    this._setFirstLastElements();
},createMask:function() {
    var C = YAHOO.widget.CalendarNavigator.CLASSES;
    var d = this._doc.createElement("div");
    d.className = C.MASK;
    this.cal.oDomContainer.appendChild(d);
    this.maskEl = d;
},_syncMask:function() {
    var c = this.cal.oDomContainer;
    if (c && this.maskEl) {
        var r = YAHOO.util.Dom.getRegion(c);
        YAHOO.util.Dom.setStyle(this.maskEl, "width", r.right - r.left + "px");
        YAHOO.util.Dom.setStyle(this.maskEl, "height", r.bottom - r.top + "px");
    }
},renderNavContents:function(html) {
    var NAV = YAHOO.widget.CalendarNavigator,C = NAV.CLASSES,h = html;
    h[h.length] = '<div class="' + C.MONTH + '">';
    this.renderMonth(h);
    h[h.length] = '</div>';
    h[h.length] = '<div class="' + C.YEAR + '">';
    this.renderYear(h);
    h[h.length] = '</div>';
    h[h.length] = '<div class="' + C.BUTTONS + '">';
    this.renderButtons(h);
    h[h.length] = '</div>';
    h[h.length] = '<div class="' + C.ERROR + '" id="' + this.id + NAV.ERROR_SUFFIX + '"></div>';
    return h;
},renderMonth:function(html) {
    var NAV = YAHOO.widget.CalendarNavigator,C = NAV.CLASSES;
    var id = this.id + NAV.MONTH_SUFFIX,mf = this.__getCfg("monthFormat"),months = this.cal.cfg.getProperty((mf == YAHOO.widget.Calendar.SHORT) ? "MONTHS_SHORT" : "MONTHS_LONG"),h = html;
    if (months && months.length > 0) {
        h[h.length] = '<label for="' + id + '">';
        h[h.length] = this.__getCfg("month", true);
        h[h.length] = '</label>';
        h[h.length] = '<select name="' + id + '" id="' + id + '" class="' + C.MONTH_CTRL + '">';
        for (var i = 0; i < months.length; i++) {
            h[h.length] = '<option value="' + i + '">';
            h[h.length] = months[i];
            h[h.length] = '</option>';
        }
        h[h.length] = '</select>';
    }
    return h;
},renderYear:function(html) {
    var NAV = YAHOO.widget.CalendarNavigator,C = NAV.CLASSES;
    var id = this.id + NAV.YEAR_SUFFIX,size = NAV.YR_MAX_DIGITS,h = html;
    h[h.length] = '<label for="' + id + '">';
    h[h.length] = this.__getCfg("year", true);
    h[h.length] = '</label>';
    h[h.length] = '<input type="text" name="' + id + '" id="' + id + '" class="' + C.YEAR_CTRL + '" maxlength="' + size + '"/>';
    return h;
},renderButtons:function(html) {
    var C = YAHOO.widget.CalendarNavigator.CLASSES;
    var h = html;
    h[h.length] = '<span class="' + C.BUTTON + ' ' + C.DEFAULT + '">';
    h[h.length] = '<button type="button" id="' + this.id + '_submit' + '">';
    h[h.length] = this.__getCfg("submit", true);
    h[h.length] = '</button>';
    h[h.length] = '</span>';
    h[h.length] = '<span class="' + C.BUTTON + '">';
    h[h.length] = '<button type="button" id="' + this.id + '_cancel' + '">';
    h[h.length] = this.__getCfg("cancel", true);
    h[h.length] = '</button>';
    h[h.length] = '</span>';
    return h;
},applyListeners:function() {
    var E = YAHOO.util.Event;

    function yearUpdateHandler() {
        if (this.validate()) {
            this.setYear(this._getYearFromUI());
        }
    }

    function monthUpdateHandler() {
        this.setMonth(this._getMonthFromUI());
    }

    E.on(this.submitEl, "click", this.submit, this, true);
    E.on(this.cancelEl, "click", this.cancel, this, true);
    E.on(this.yearEl, "blur", yearUpdateHandler, this, true);
    E.on(this.monthEl, "change", monthUpdateHandler, this, true);
    if (this.__isIEQuirks) {
        YAHOO.util.Event.on(this.cal.oDomContainer, "resize", this._syncMask, this, true);
    }
    this.applyKeyListeners();
},purgeListeners:function() {
    var E = YAHOO.util.Event;
    E.removeListener(this.submitEl, "click", this.submit);
    E.removeListener(this.cancelEl, "click", this.cancel);
    E.removeListener(this.yearEl, "blur");
    E.removeListener(this.monthEl, "change");
    if (this.__isIEQuirks) {
        E.removeListener(this.cal.oDomContainer, "resize", this._syncMask);
    }
    this.purgeKeyListeners();
},applyKeyListeners:function() {
    var E = YAHOO.util.Event,ua = YAHOO.env.ua;
    var arrowEvt = (ua.ie || ua.webkit) ? "keydown" : "keypress";
    var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown" : "keypress";
    E.on(this.yearEl, "keypress", this._handleEnterKey, this, true);
    E.on(this.yearEl, arrowEvt, this._handleDirectionKeys, this, true);
    E.on(this.lastCtrl, tabEvt, this._handleTabKey, this, true);
    E.on(this.firstCtrl, tabEvt, this._handleShiftTabKey, this, true);
},purgeKeyListeners:function() {
    var E = YAHOO.util.Event,ua = YAHOO.env.ua;
    var arrowEvt = (ua.ie || ua.webkit) ? "keydown" : "keypress";
    var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown" : "keypress";
    E.removeListener(this.yearEl, "keypress", this._handleEnterKey);
    E.removeListener(this.yearEl, arrowEvt, this._handleDirectionKeys);
    E.removeListener(this.lastCtrl, tabEvt, this._handleTabKey);
    E.removeListener(this.firstCtrl, tabEvt, this._handleShiftTabKey);
},submit:function() {
    if (this.validate()) {
        this.hide();
        this.setMonth(this._getMonthFromUI());
        this.setYear(this._getYearFromUI());
        var cal = this.cal;
        var delay = YAHOO.widget.CalendarNavigator.UPDATE_DELAY;
        if (delay > 0) {
            var nav = this;
            window.setTimeout(function() {
                nav._update(cal);
            }, delay);
        } else {
            this._update(cal);
        }
    }
},_update:function(cal) {
    cal.setYear(this.getYear());
    cal.setMonth(this.getMonth());
    cal.render();
},cancel:function() {
    this.hide();
},validate:function() {
    if (this._getYearFromUI() !== null) {
        this.clearErrors();
        return true;
    } else {
        this.setYearError();
        this.setError(this.__getCfg("invalidYear", true));
        return false;
    }
},setError:function(msg) {
    if (this.errorEl) {
        this.errorEl.innerHTML = msg;
        this._show(this.errorEl, true);
    }
},clearError:function() {
    if (this.errorEl) {
        this.errorEl.innerHTML = "";
        this._show(this.errorEl, false);
    }
},setYearError:function() {
    YAHOO.util.Dom.addClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
},clearYearError:function() {
    YAHOO.util.Dom.removeClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
},clearErrors:function() {
    this.clearError();
    this.clearYearError();
},setInitialFocus:function() {
    var el = this.submitEl,f = this.__getCfg("initialFocus");
    if (f && f.toLowerCase) {
        f = f.toLowerCase();
        if (f == "year") {
            el = this.yearEl;
            try {
                this.yearEl.select();
            } catch(selErr) {
            }
        } else if (f == "month") {
            el = this.monthEl;
        }
    }
    if (el && YAHOO.lang.isFunction(el.focus)) {
        try {
            el.focus();
        } catch(focusErr) {
        }
    }
},erase:function() {
    if (this.__rendered) {
        this.purgeListeners();
        this.yearEl = null;
        this.monthEl = null;
        this.errorEl = null;
        this.submitEl = null;
        this.cancelEl = null;
        this.firstCtrl = null;
        this.lastCtrl = null;
        if (this.navEl) {
            this.navEl.innerHTML = "";
        }
        var p = this.navEl.parentNode;
        if (p) {
            p.removeChild(this.navEl);
        }
        this.navEl = null;
        var pm = this.maskEl.parentNode;
        if (pm) {
            pm.removeChild(this.maskEl);
        }
        this.maskEl = null;
        this.__rendered = false;
    }
},destroy:function() {
    this.erase();
    this._doc = null;
    this.cal = null;
    this.id = null;
},_show:function(el, bShow) {
    if (el) {
        YAHOO.util.Dom.setStyle(el, "display", (bShow) ? "block" : "none");
    }
},_getMonthFromUI:function() {
    if (this.monthEl) {
        return this.monthEl.selectedIndex;
    } else {
        return 0;
    }
},_getYearFromUI:function() {
    var NAV = YAHOO.widget.CalendarNavigator;
    var yr = null;
    if (this.yearEl) {
        var value = this.yearEl.value;
        value = value.replace(NAV.TRIM, "$1");
        if (NAV.YR_PATTERN.test(value)) {
            yr = parseInt(value, 10);
        }
    }
    return yr;
},_updateYearUI:function() {
    if (this.yearEl && this._year !== null) {
        this.yearEl.value = this._year;
    }
},_updateMonthUI:function() {
    if (this.monthEl) {
        this.monthEl.selectedIndex = this._month;
    }
},_setFirstLastElements:function() {
    this.firstCtrl = this.monthEl;
    this.lastCtrl = this.cancelEl;
    if (this.__isMac) {
        if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420) {
            this.firstCtrl = this.monthEl;
            this.lastCtrl = this.yearEl;
        }
        if (YAHOO.env.ua.gecko) {
            this.firstCtrl = this.yearEl;
            this.lastCtrl = this.yearEl;
        }
    }
},_handleEnterKey:function(e) {
    var KEYS = YAHOO.util.KeyListener.KEY;
    if (YAHOO.util.Event.getCharCode(e) == KEYS.ENTER) {
        YAHOO.util.Event.preventDefault(e);
        this.submit();
    }
},_handleDirectionKeys:function(e) {
    var E = YAHOO.util.Event,KEYS = YAHOO.util.KeyListener.KEY,NAV = YAHOO.widget.CalendarNavigator;
    var value = (this.yearEl.value) ? parseInt(this.yearEl.value, 10) : null;
    if (isFinite(value)) {
        var dir = false;
        switch (E.getCharCode(e)) {
            case KEYS.UP:
                this.yearEl.value = value + NAV.YR_MINOR_INC;
                dir = true;
                break;
            case KEYS.DOWN:
                this.yearEl.value = Math.max(value - NAV.YR_MINOR_INC, 0);
                dir = true;
                break;
            case KEYS.PAGE_UP:
                this.yearEl.value = value + NAV.YR_MAJOR_INC;
                dir = true;
                break;
            case KEYS.PAGE_DOWN:
                this.yearEl.value = Math.max(value - NAV.YR_MAJOR_INC, 0);
                dir = true;
                break;
            default:
                break;
        }
        if (dir) {
            E.preventDefault(e);
            try {
                this.yearEl.select();
            } catch(err) {
            }
        }
    }
},_handleTabKey:function(e) {
    var E = YAHOO.util.Event,KEYS = YAHOO.util.KeyListener.KEY;
    if (E.getCharCode(e) == KEYS.TAB && !e.shiftKey) {
        try {
            E.preventDefault(e);
            this.firstCtrl.focus();
        } catch(err) {
        }
    }
},_handleShiftTabKey:function(e) {
    var E = YAHOO.util.Event,KEYS = YAHOO.util.KeyListener.KEY;
    if (e.shiftKey && E.getCharCode(e) == KEYS.TAB) {
        try {
            E.preventDefault(e);
            this.lastCtrl.focus();
        } catch(err) {
        }
    }
},__getCfg:function(prop, bIsStr) {
    var DEF_CFG = YAHOO.widget.CalendarNavigator._DEFAULT_CFG;
    var cfg = this.cal.cfg.getProperty("navigator");
    if (bIsStr) {
        return(cfg !== true && cfg.strings && cfg.strings[prop]) ? cfg.strings[prop] : DEF_CFG.strings[prop];
    } else {
        return(cfg !== true && cfg[prop]) ? cfg[prop] : DEF_CFG[prop];
    }
},__isMac:(navigator.userAgent.toLowerCase().indexOf("macintosh") != -1)};
YAHOO.register("calendar", YAHOO.widget.Calendar, {version:"2.6.0",build:"1321"});
$(document).ready(function() {
    FHG.init();
});
