﻿// setBackgroundImage
// sets the background image of element o to imageUrl 
function setBackgroundImage(o, imageUrl)
{
    o.style.backgroundImage = 'url(' + imageUrl + ')';
    return true;
}

function languageListLink_Click(sender, language)
{
      if(document.getElementById('m_RememberLanguage').checked)
      {
        sender.setAttribute('href', sender.getAttribute('href') + '&setcookie=1');
//        self.location(sender.setAttribute('href', sender.getAttribute('href') + '&setcookie=1'));
//        alert(sender.getAttribute('href'));
      }

    
    return true;
}



//
//     JQuery Text resize + Cookie recall
//     by Jonny Kamaly
//     based on script written by Faisal &amp; Homar
//

var sitefunctions = {
    textresize: function() {
        // show text resizing links
        $(".FontSize").show();
        var $cookie_name = "sitename-FontSize";
        var originalFontSize = $("html").css("font-size");
        // if exists load saved value, otherwise store it
        if ($.cookie($cookie_name)) {
            var $getSize = $.cookie($cookie_name);
            $("html").css({ fontSize: $getSize + ($getSize.indexOf("px") != -1 ? "" : "px") }); // IE fix for double "pxpx" error
        }

        // reset link
        $(".FontSizeReset").bind("click", function() {
            $("html").css("font-size", originalFontSize);
            $.cookie($cookie_name, originalFontSize);
            return false;
        });
        // text "+" link
        $(".FontSizeInc").bind("click", function() {
            var currentFontSize = $("html").css("font-size");
            var currentFontSizeNum = parseFloat(currentFontSize, 10);
            var newFontSize = currentFontSizeNum * 1.25;
            if (newFontSize, 11) {
                $("html").css("font-size", newFontSize);
                $.cookie($cookie_name, newFontSize);
            }
            return false;
        });
        $(".FontSizeDec").bind("click", function() {
            var currentFontSize = $("html").css("font-size");
            var currentFontSizeNum = parseFloat(currentFontSize, 10);
            var newFontSize = currentFontSizeNum * 0.8;
            if (newFontSize, 11) {
                $("html").css("font-size", newFontSize);
                $.cookie($cookie_name, newFontSize);
            }
            return false;
        });
    }
}