

document.write('<style type="text/css">' +'/* text */\n.menuItem, .menuItemOpen, .menuSubItem {\n    font-family:verdana,geneva,arial,helvetica ! important;\n    font-size:11px ! important;\n    font-weight:normal ! important;\n    line-height:115% ! important;\n    display: block ! important;\n    text-decoration: none ! important;\n}.menuItem, .menuItemOpen {\n    color: white ! important;\n}/* menu */\nA.menuItem,A.menuItemOpen,A.menuSubItem {\n      padding-left:19px;\n      padding-top:3px;border-bottom: 1px #FFF solid;\n      height:18px;\n      width: 111px;\n      text-decoration: none ! important;\n}\n\nA.menuItem {\n      background:url(http://common.tv2.dk/img/menu/emhf2004/arrow.gif)\n        no-repeat\n        center\n        left;background-color: #B60002;\n      text-decoration: none ! important;\n}\n\nA.menuItemSelected, A.menuItem:hover, A.menuItemOpen:hover {color: #FFF ! important;\nbackground-color: #000 ! important;\n    text-decoration: none ! important;\n}'+ '</style>');


var ua = navigator.userAgent.toUpperCase();
if ( ua.indexOf('MAC') == -1 && document.compatMode != "CSS1Compat" ) {
    if ((ua.indexOf("MSIE 5.") != -1 || ua.indexOf("MSIE 6.") != -1) && (ua.indexOf("OPERA") == -1)) {
        document.write('<style type="text/css">' +'/* menu */\nA.menuItem,A.menuItemOpen,A.menuSubItem {\n  height: 22px;\n  width: 130px;\n  text-decoration: none ! important;\n}'+ '</style>');
    }
}
menuSections = [{'type':'menu','menuitems':{'Forside':'/deal/','Kuffertpigerne':'/deal/pigerne/','Deltagerne':'/deal/deltagerne/','Programmet':'/deal/programmet/','Sms-konkurrence':'/deal/article.php/id-4667333.html','Debat':'http://debat.tv2.dk/deal/','Er du en gambler?':'javascript:void(window.open(\'http://programmer.tv2.dk/deal/flash/DnD-test.swf\', \'flash\', \'width=550,height=268,scrollbars=no,status=no\'))',toString:function(){var o=[];for(var p in this)if(typeof this[p]!="function")o[o.length]=p+":"+this[p];return "{"+o.join(",")+"}"},__serializeType: "__hash"},'submenuitems':[],toString:function(){var o=[];for(var p in this)if(typeof this[p]!="function")o[o.length]=p+":"+this[p];return "{"+o.join(",")+"}"},__serializeType: "__hash"}];
    function getFormattedItem(className, name, url) {
        String.prototype.formatMenuStatstag=function(tag) {
            if (this.indexOf('javascript:')==-1) {
                var url=this;
                var exclude=new Array('folkeborsen.tv2.dk');
                for (var i=0;i<exclude.length;i++) if (url.indexOf(exclude[i])!=-1) return (url);
                return (url+((url.indexOf('?')!=-1)? '&amp;' : '?')+tag);
            }
            return this;
        }
        html  = '<div class="' + className + '">';
        html += '<a id="tv2_menu_id_' + name + '" class="' + className + '" href="' + url.formatMenuStatstag('menu') + '">';
        html += name;
        html += '</a>';
        html +=  '</div>';
        return html;
    }

    var curUrl = document.location.href;
    // strip out -dyn / -static
    var r = /^(http:\/\/[^.]+)-(dyn|static)(\.[^\/]*tv2.dk\/.*)$/.exec(curUrl);
    if (r) {
        curUrl = r[1]+r[3];
    }
    var bestMatch = 0;
    var selectedItem = selectedItemTitle = '';
    var selectedSubItem = selectedSubItemTitle = '';

    // Figure out which item is selected by going through all menus and submenus
    for (menuSectionNo in menuSections) {
        var menuSection = menuSections[menuSectionNo];
        if (menuSection['type'] == 'menu') {
            var menuItems = menuSection['menuitems'];
            for (menuItem in menuItems) {
                var itemUrl = menuItems[menuItem];
                if (typeof(itemUrl)=='string' && menuItem != '__serializeType') {
                    var tmpitemUrl = itemUrl.split('.html')[0];                     if ((itemUrl.length>=bestMatch) && (curUrl.indexOf(tmpitemUrl)!=-1)) {
                        bestMatch = tmpitemUrl.length;
                        selectedItem = itemUrl;
                        selectedItemTitle = menuItem;
                        selectedSubItem = '';
                    }
                    if (typeof(menuSection['submenuitems'])!='undefined') {
                        if (typeof(menuSection['submenuitems'][menuItem])!='undefined') {
                            for (subMenuItem in menuSection['submenuitems'][menuItem]) {
                                var itemSubUrl = menuSection['submenuitems'][menuItem][subMenuItem];
                                if (typeof(itemSubUrl)=='string' && subMenuItem != '__serializeType') {
                                    var tmpitemSubUrl = itemSubUrl.split('.html')[0];                                     if ((itemSubUrl.length>=bestMatch) && (curUrl.indexOf(tmpitemSubUrl)!=-1)) {
                                        bestMatch = tmpitemSubUrl.length;
                                        selectedItem = itemUrl;
                                        selectedItemTitle = menuItem;
                                        selectedSubItem = itemSubUrl;
                                        selectedSubItemTitle = subMenuItem;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // We hopefully found it.
    html = '';
    for (menuSectionNo in menuSections) {
        var menuSection = menuSections[menuSectionNo];
        if (menuSection['type'] == 'menu') {
            var menuItems = menuSection['menuitems'];
            for (var menuItem in menuItems) {
                var itemUrl = menuItems[menuItem];
                if (typeof(itemUrl)=='string' && menuItem != '__serializeType') {
                    if (selectedItem == itemUrl) {
                        if ((typeof(menuSection['submenuitems'])=='undefined') ||
                                (typeof(menuSection['submenuitems'][menuItem])=='undefined')) {
                            className = 'menuItem menuItemSelected';
                        } else {
                            if (selectedSubItem == '') {
                                className = 'menuItemOpen menuItemSelected';
                            } else {
                                className = 'menuItemOpen';
                            }
                        }
                    } else {
                        className = 'menuItem';
                    }
                    html += getFormattedItem(className, menuItem, itemUrl);
                    if ((selectedItem == itemUrl) && (typeof(menuSection['submenuitems'])!='undefined') && (typeof(menuSection['submenuitems'][menuItem])!='undefined')) {
                        var subMenuSections = menuSection['submenuitems'][menuItem];
                        for (subMenuItem in subMenuSections) {
                            var itemSubUrl = subMenuSections[subMenuItem];
                            if (typeof(itemSubUrl)=='string' && subMenuItem != '__serializeType') {
                                if (selectedSubItem == itemSubUrl) {
                                    className = 'menuSubItem menuSubItemSelected';
                                } else {
                                    className = 'menuSubItem';
                                }
                                html += getFormattedItem(className, subMenuItem, itemSubUrl);
                            }
                        }
                    }
                }
            }
        } else if (menuSection['type'] == 'image') {
            html += '<img src="' + menuSection['src'] + '"'
                    + ' width="' + menuSection['width'] + '"'
                   + ' height="' + menuSection['height'] + '"'
                      + ' alt="' + menuSection['alt'] + '"'
                      + ' class="menuSection">';
        } else if (menuSection['type'] == 'header') {
            html += '<h1 class="tv2header">' + menuSection['text'] + '</h1>';
        } else if (menuSection['type'] == 'br') {
			html += '<br />';
	} else if (menuSection['type'] == 'div') {
			html += '<div class="menuSpacer"></div>';
		}

    }
    document.write(html);
    // fill the breadcrumb menu
        tv2navigation.addToBreadcrumb(new Array('deal.tv2.dk','Deal No Deal'));
        if (selectedItem!='' && selectedItem!='/' && selectedItem!='deal.tv2.dk' && selectedItem.indexOf('javascript')==-1) {
        tv2navigation.addToBreadcrumb(new Array(selectedItem,selectedItemTitle));
    }
    if (selectedSubItem!='' && selectedSubItem!='/' && selectedSubItem!='deal.tv2.dk' && selectedSubItem.indexOf('javascript')==-1) {
        tv2navigation.addToBreadcrumb(new Array(selectedSubItem,selectedSubItemTitle));
    }
    