$(document).ready(function() {
    var ie7 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 7.0") != -1 && navigator.appVersion.indexOf("MSIE 8.0") == -1);
    $(".confirmAgeBox").wrap('<div class="confirmAgeInner" />');
    $("#mama, .confirmAgeInner").append('<div id="mamaLeft"></div><div id="mamaRight"></div><div id="mamaBottom"></div>');
    $(".confirmAgeBox").append('<div class="float-fix"></div>');
    $(".confirmAgeBox").children('br').remove();
    var age_input_div = $('.confirmAgeButton').parent();
    $(age_input_div).insertBefore($('.confirmAgeText'));
    //if ($("h2.quicklink").length) { $("h2.quicklink").text('Quicklinks'); }
    if ($("#menu-left").length) {
        $("#menu-left ul").filter(function(i) { return $(this).children().length == 0 }).remove();
    }
    $(".related-downloads-description, .related-description").filter(function(i) { return $(this).html() == '' }).css("overflow", "hidden");
    if (ie7) {
        $(".related-downloads-description, .related-description").filter(function(i) { return $(this).html() == '' }).css("height", "0");
    }

	// search field
	$("#searchButton").click(function(event){
		location.href = '/Pages/results.aspx?k=' + $("#searchField").val();
	});
	
	$("#searchField").keyup(function(event){
		if(event.keyCode == 13){
			$("#searchButton").click();
		}
	});
	
})
function ProcessImn() { }
var Carlsberg = { disableIEBackgroundFlicker: function() { try { document.execCommand('BackgroundImageCache', false, true); } catch (e) { } }, Page: { isEditmode: false, resizeLeftMenu: function() { if ($("#col-left-nav")) { try { $("#col-left-nav").style.height = ($("#grid").offsetHeight - 16 - 8) + "px"; } catch (e) { } } }, createAccessiblePopupLinks: function() {
    var aElms = $(".popup"); var dims = { popup: { w: 460, h: 560 }, readmore: { w: 300, h: 300 }, def: { w: 100, h: 100 }, conditions: { w: 800, h: 800} }; var currentDims; for (var i = 0; i < aElms.length; i++) {
        var o = aElms[i]; var sHref = o.getAttribute("href"); sHref = sHref + "?pageUrl=" + window.location.href; sHref = sHref + "&pageTitle=" + document.title; o.setAttribute("savedHrefAtt", sHref); o.onclick = function() {
            if (sHref != "#" && sHref != "") {
                if (!win) {
                    if (o.className.indexOf("popup") != -1) { currentDims = "popup"; } else if (o.className.indexOf("readmore") != -1) { currentDims = "readmore"; } else if (o.className.indexOf("conditions") != -1) { currentDims = "conditions"; } else { currentDims = "def"; }
                    var win = window.open(this.getAttribute("savedHrefAtt"), "Carlsberg", "width=" + dims[currentDims].w + ",height=" + dims[currentDims].h);
                } else { win.focus(); }
                return false;
            } 
        };
    } 
}, Tables: { zebratize: function() { var oTables = $(".stripes"); for (var i = 0; i < oTables.length; i++) { var oTbodys = oTables[i].getElementsByTagName("TBODY"); for (var j = 0; j < oTbodys.length; j++) { for (var k = 0; tr = oTbodys[j].getElementsByTagName("TR")[k]; k++) { tr.className = k % 2 == 0 ? "odd" : "even"; } } } } }, Stylesheet: { initialize: function() { this.buttons(); this.disable($("#ss-fonts-large")); if (Carlsberg.Page.Cookie.read("style") == "largetext") { this.enable($("#ss-fonts-large")); } }, buttons: function() {
    if ($("#menu-tools")) try { $("#menu-tools").$(".link-text-small")[0].onclick = function() { return Carlsberg.Page.Stylesheet.changeTo("small"); } } catch (e) { Carlsberg.Page.Logger.add("stylesheet buttons error"); }
    if ($("#menu-tools")) try { $("#menu-tools").$(".link-text-large")[0].onclick = function() { return Carlsberg.Page.Stylesheet.changeTo("large"); } } catch (e) { Carlsberg.Page.Logger.add("stylesheet buttons error"); } 
}, changeTo: function(sSize) {
    var sHref = "css/fontsLarge.css"; var o = $("#ss-fonts-large"); if (sSize == "large") {
        if (o) { Carlsberg.Page.Stylesheet.enable(o); }
        Carlsberg.Page.Cookie.create("style", "largetext", 365);
    } else if (sSize == "small") {
        if (o) { Carlsberg.Page.Stylesheet.disable(o); }
        Carlsberg.Page.Cookie.create("style", "smalltext", 365);
    }
    return false;
}, disable: function(o) { o.disabled = true; }, enable: function(o) { o.disabled = false; } 
}, Cookie: { create: function(name, value, days) {
    if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); } else { expires = ""; }
    document.cookie = name + "=" + value + expires + "; path=/";
}, read: function(name) {
    var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); }
    return null;
} 
}, Print: { active: false, initialize: function() { if ($("#tools")) { var oThis = this; $("#printpage").click(function() { var sCurrentUrl = window.location.href + "#print"; var win = window.open(sCurrentUrl, "Carlsberg", "width=600,height=600,resizable=1,scrollbars=1"); return false; }); if (oThis.oPrintPreview()) { oThis.oPrintPreview().disabled = true; } } }, oPrintPreview: function() {
    var linkTags = document.getElementsByTagName("link"); for (var i = 0; i < linkTags.length; i++) { if (linkTags[i].getAttribute("HTMLid") != null) { return linkTags[i]; } }
    return false;
}, enablePrintPreview: function() { Carlsberg.Page.Print.oPrintPreview().disabled = false; try { window.print() } catch (e) { } } 
},
    Layout: {
        CsIFR: { initialize: function() {
            if (!Carlsberg.Page.isEditmode) {
                if (typeof sIFR == "function") {
                    var sTeaserColor = $("#col-article").attr("id") ? "#5aab31" : "#ffffff";
                    sIFR.replaceElement(named({ sSelector: "h2.shortcut", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsanslight.swf", sColor: "#ACF07A", sWmode: "transparent" }));
                    sIFR.replaceElement(named({ sSelector: "h2.article, #col-wide h2, h2.replace, h2.header, .headertitle", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsanslight.swf", sColor: "#000", sHoverColor: "#000", sWmode: "transparent" }));
                    sIFR.replaceElement(named({ sSelector: "h4.subheader", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsanslight.swf", sCase: "upper", sColor: "#5AAB51", sWmode: "transparent" }));

                    sIFR.replaceElement(named({ sSelector: "h3.teaser", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsansblack.swf", sColor: "#000", sWmode: "transparent" }));
                    sIFR.replaceElement(named({ sSelector: "h2.listheader, .fItem h2", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsansblack.swf", sCase: "upper", sColor: "#000", sHoverColor: "#000", sWmode: "transparent" }));
                    sIFR.replaceElement(named({ sSelector: ".confirmAgeHeader, .confirmAgeText", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsansblack.swf", sColor: "#ffffff", sHoverColor: "#ffffff", sWmode: "transparent" }));

                    sIFR.replaceElement(named({ sSelector: "#col-right h2.listheader", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsansbold.swf", sCase: "upper", sColor: "#000", sHoverColor: "#000", sWmode: "transparent" }));
                    sIFR.replaceElement(named({ sSelector: "#col-article h2, .quicklink", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsansbold.swf", sColor: "#000", sWmode: "transparent" }));
                    sIFR.replaceElement(named({ sSelector: ".ms-rteCustom-CARTextHeadline", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsansbold.swf", sCase: "upper", sColor: "#094615", sHoverColor: "#5AAB51", sWmode: "transparent" }));
                    this.replaceArticleHeader();
                    this.replaceManchet();
                }
            }
        },
            replaceArticleHeader: function() {
                sIFR.replaceElement(named({ sSelector: "h1.article", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsansbold.swf", sColor: "#000", sWmode: "transparent" }));
                sIFR.replaceElement(named({ sSelector: ".ms-rteCustom-CARNewsHeadLine", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsanslight.swf", sColor: "#014A01", sWmode: "transparent" }));
            },
            replaceManchet: function() {
                sIFR.replaceElement(named({ sSelector: ".manchet div", sFlashSrc: "/Style Library/CWEBTheme/Common/swf/carlsbergsanslight.swf", sColor: "#5a5a5a", sWmode: "transparent" }));
            },
            override: function() { }
        }, PNG: { initialize: function() { if (!Carlsberg.Page.isEditmode) { Carlsberg.Page.Layout.PNG.fixAll(); } }, needsFix: function() { var arVersion = navigator.appVersion.split("MSIE"); var version = parseFloat(arVersion[1]); return ((version >= 5.5) && (version < 7) && (document.body.filters)); }, fixAll: function() { if (Carlsberg.Page.Layout.PNG.needsFix()) { var imgs = $('img.forcepngfix, img[@src$=.png]'); imgs.each(function(index) { Carlsberg.Page.Layout.PNG.fixOne(this); }); } }, fixLoaded: function(img) {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? 'class="' + img.className + '" png-replaced' : 'class="png-replaced"'
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var sizing; if (img.width > 0) { sizing = sizing + " width='" + img.width + "' "; }
            if (img.height > 0) { sizing = sizing + " height='" + img.height + "' "; }
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"><img src='" + img.src + "' style='visibility: hidden;' " + sizing + " /></span>"
            img.outerHTML = strNewHTML;
        }, fixOne: function(img) {
            if (img == null) { img = this; }
            if (img.readyState != "complete") { $(img).bind("load", null, function() { Carlsberg.Page.Layout.PNG.fixLoaded(img) }); }
            else { Carlsberg.Page.Layout.PNG.fixLoaded(img); } 
        } }
        }, addBodyClassHook: function(sClassName) { if ($("#" + sClassName).attr("id")) $("body").addClass(sClassName); }, checkIfEditmode: function() { if (document.getElementById("MSOLayout_InDesignMode") != null) { if (document.getElementById("MSOLayout_InDesignMode").value == "1") { $(document.getElementsByTagName("body")[0]).addClass("editmode"); $(document.getElementsByTagName("html")[0]).removeClass("sIFR-hasFlash"); Carlsberg.Page.isEditmode = true; } else { Carlsberg.Page.isEditmode = false; } } }, ifRightColTabsAreEmpty: function() {
            if (!Carlsberg.Page.isEditmode) 
			{
                if ($("#js-related-downloads").attr("id")) 
				{ 
					if ($("#js-related-downloads .related-downloads-link").length <= 0) 
					{ 
						$("#js-related-downloads").hide(); 
					}
				}
                if ($("#js-related").attr("id")) 
				{
					if ($("#js-related .related-link").length <= 0) 
					{
						$("#js-related").hide(); 
					}
				}
				
                if ($("#js-related-third").text().length<=0 || $("#js-related-third img").length<=0 ) 
				{
					$("#js-related-third").hide(); 
				} 
            } 
        }, start: function() {
            Carlsberg.Page.checkIfEditmode(); Carlsberg.Page.ifRightColTabsAreEmpty(); Carlsberg.disableIEBackgroundFlicker(); Carlsberg.Page.Print.initialize(); Carlsberg.Page.createAccessiblePopupLinks(); Carlsberg.Page.Layout.CsIFR.initialize(); Carlsberg.Page.Layout.PNG.initialize(); Carlsberg.Page.addBodyClassHook("frontpage"); if (!($("#frontpage").attr("id")))
            { $("#mama").addClass("sunburst"); } else { $("#mama").addClass("sunburst_frontpage"); } 
        } }
}
if (window.location.hash.indexOf("print") == -1) { $(document).ready(function() { Carlsberg.Page.start(); }); }
else { $(document).ready(function() { Carlsberg.Page.Print.initialize(); Carlsberg.Page.Print.enablePrintPreview(); }); }

