﻿

    jQuery.cookie = function (b, j, m) { if (typeof j != "undefined") { m = m || {}; if (j === null) { j = ""; m.expires = -1 } var e = ""; if (m.expires && (typeof m.expires == "number" || m.expires.toUTCString)) { var f; if (typeof m.expires == "number") { f = new Date(); f.setTime(f.getTime() + (m.expires * 24 * 60 * 60 * 1000)) } else { f = m.expires } e = "; expires=" + f.toUTCString() } var l = m.path ? "; path=" + (m.path) : ""; var g = m.domain ? "; domain=" + (m.domain) : ""; var a = m.secure ? "; secure" : ""; document.cookie = [b, "=", encodeURIComponent(j), e, l, g, a].join("") } else { var d = null; if (document.cookie && document.cookie != "") { var k = document.cookie.split(";"); for (var h = 0; h < k.length; h++) { var c = jQuery.trim(k[h]); if (c.substring(0, b.length + 1) == (b + "=")) { d = decodeURIComponent(c.substring(b.length + 1)); break } } } return d } }; $(document).ready(function () { var x = parseFloat($.cookie("cruksupportusfontsize")); if (x > 0) { $("body").css("font-size", x) } });
    function matchHeights(id1, id2) {

        if ($("#" + id1) != null && $("#" + id1) != null) {
            var height1 = $("#" + id1).height();
            var height2 = $("#" + id2).height();

            var finalHeight = 0;

            if (height1 > height2) { finalHeight = height1 } else { finalHeight = height2 }

            $("#" + id1).height(finalHeight);
            $("#" + id2).height(finalHeight);
        }
    }

    function matchHomeHeights() {

        var centreHeight = $("#centre").height();
        var rightTopHeight = $(".rightTop").height();
        var rightBottomHeight = $(".rightBottom").height();
        var rightHeight = rightTopHeight + rightBottomHeight

        var finalHeight = 0;

        if (centreHeight > rightHeight) { finalHeight = centreHeight } else { finalHeight = rightHeight }

        $("#centre").height(finalHeight);
        $("#rightBottom").height(finalHeight - rightTopHeight);
    }

    function roundedCornersEditMode() {
        var masterDiv = document.getElementById("master");
        if (masterDiv.Visible = true)
        {
            roundedCorners();
            cornersEditModeInteral = clearInterval(cornersEditModeInteral);
        }
    }

    function roundedCorners() {

        $('img.rounded,.rounded img').one('load', function () {
            var img = $(this);
            var img_width = img.width();
            var img_height = img.height();

            // build wrapper
            var wrapper = $('<div class="roundedwrapper"></div>');
            wrapper.width(img_width);
            wrapper.height(img_height);

            // wrap image
            img.wrap(wrapper);
            $(".roundedwrapper").corner("12px");


        }).each(function () {
            if (this.complete) $(this).trigger("load");
        });

    }

    $(document).ready(function () {
        $(".shareClose").click(function () {
            $("#popup_window").hide();
        });
        $(".shareOpen").click(function () {
            $("#popup_window").css("top", (($(window).height() - $("#popup_window").outerHeight()) / 2) + $(window).scrollTop() + "px");
            $("#popup_window").css("left", (($(window).width() - $("#popup_window").outerWidth()) / 3) + $(window).scrollLeft() + "px");
            $("#popup_window").show();
        });
    });
