﻿(function ($) { var queue = [], interval, check = function () { for (var i = 0; i < queue.length; i++) { if ($(queue[i][0])[0] && (queue[i][2] || $(queue[i][0]).next()[0] || $.isReady)) { try { queue[i][1].apply($(queue[i][0]).eq(0)) } catch (e) { if (typeof console != "undefined") { console.log(e) } } queue.splice(i, 1); i-- } } if (!queue.length || $.isReady) { interval = clearInterval(interval) } }; $.fn.available = function (fn, turbo) { turbo = turbo || false; queue.push([this.selector, fn, turbo]); if (!interval) { interval = setInterval(check, 5) } return this } })(jQuery); (function ($) { $.fn.jqm = function (o) { var p = { overlay: 50, overlayClass: "jqmOverlay", closeClass: "jqmClose", trigger: ".jqModal", ajax: F, ajaxText: "", target: F, modal: F, toTop: F, onShow: F, onHide: F, onLoad: F }; return this.each(function () { if (this._jqm) { return H[this._jqm].c = $.extend({}, H[this._jqm].c, o) } s++; this._jqm = s; H[s] = { c: $.extend(p, $.jqm.params, o), a: F, w: $(this).addClass("jqmID" + s), s: s }; if (p.trigger) { $(this).jqmAddTrigger(p.trigger) } }) }; $.fn.jqmAddClose = function (e) { return hs(this, e, "jqmHide") }; $.fn.jqmAddTrigger = function (e) { return hs(this, e, "jqmShow") }; $.fn.jqmShow = function (t) { return this.each(function () { t = t || window.event; $.jqm.open(this._jqm, t) }) }; $.fn.jqmHide = function (t) { return this.each(function () { t = t || window.event; $.jqm.close(this._jqm, t) }) }; $.jqm = { hash: {}, open: function (s, t) { var h = H[s], c = h.c, cc = "." + c.closeClass, z = (parseInt(h.w.css("z-index"))), z = (z > 0) ? z : 3000, o = $("<div></div>").css({ height: $(document).height(), width: "100%", position: "fixed", left: 0, top: 0, "z-index": z - 1, opacity: c.overlay / 100 }); if (h.a) { return F } h.t = t; h.a = true; h.w.css("z-index", z); if (c.modal) { if (!A[0]) { L("bind") } A.push(s) } else { if (c.overlay > 0) { h.w.jqmAddClose(o) } else { o = F } } h.o = (o) ? o.addClass(c.overlayClass).prependTo("body") : F; ie6 = $.browser.msie && ($.browser.version == "6.0") && !window.XMLHttpRequest; if (ie6) { $("html,body").css({ height: "100%", width: "100%" }); if (o) { o = o.css({ position: "absolute" })[0]; for (var y in { Top: 1, Left: 1 }) { } o.style.setExpression(y.toLowerCase(), "(_=(document.documentElement.scroll" + y + " || document.body.scroll" + y + "))+'px'") } } if (c.ajax) { var r = c.target || h.w, u = c.ajax, r = (typeof r == "string") ? $(r, h.w) : $(r), u = (u.substr(0, 1) == "@") ? $(t).attr(u.substring(1)) : u; r.html(c.ajaxText).load(u, function () { if (c.onLoad) { c.onLoad.call(this, h) } if (cc) { h.w.jqmAddClose($(cc, h.w)) } e(h) }) } else { if (cc) { h.w.jqmAddClose($(cc, h.w)) } } if (c.toTop && h.o) { h.w.before('<span id="jqmP' + h.w[0]._jqm + '"></span>').insertAfter(h.o) } (c.onShow) ? c.onShow(h) : h.w.show(); e(h); return F }, close: function (s) { var h = H[s]; if (!h.a) { return F } h.a = F; if (A[0]) { A.pop(); if (!A[0]) { L("unbind") } } if (h.c.toTop && h.o) { $("#jqmP" + h.w[0]._jqm).after(h.w).remove() } if (h.c.onHide) { h.c.onHide(h) } else { h.w.hide(); if (h.o) { h.o.remove() } } return F }, params: {} }; var s = 0, H = $.jqm.hash, A = [], ie6 = $.browser.msie && ($.browser.version == "6.0"), F = false, i = $('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({ opacity: 0 }), e = function (h) { if (ie6) { if (h.o) { h.o.html('<p style="width:100%;height:100%"/>').prepend(i) } else { if (!$("iframe.jqm", h.w)[0]) { h.w.prepend(i) } } } f(h) }, f = function (h) { try { $(":input:visible", h.w)[0].focus() } catch (_) { } }, L = function (t) { $()[t]("keypress", m)[t]("keydown", m)[t]("mousedown", m) }, m = function (e) { var h = H[A[A.length - 1]], r = (!$(e.target).parents(".jqmID" + h.s)[0]); if (r) { f(h) } return !r }, hs = function (w, t, c) { return w.each(function () { var s = this._jqm; $(t).each(function () { if (!this[c]) { this[c] = []; $(this).click(function () { for (var i in { jqmShow: 1, jqmHide: 1 }) { for (var s in this[i]) { if (H[this[i][s]]) { H[this[i][s]].w[i](this) } } } return F }) } this[c].push(s) }) }) } })(jQuery); (function ($) { $.fn.imagesLoaded = function (callback) { var elems = this.filter("img"), len = elems.length; elems.bind("load", function () { if (--len <= 0) { callback.call(elems, this) } }).each(function () { if (this.complete || this.complete === undefined) { var src = this.src; this.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; this.src = src } }); return this } })(jQuery); (function () { function modifyLocationNavi() { var language = $("html").attr("lang").toLowerCase(); var txt; if (language == "sv-se") { txt = "Välj land" } else { if (language == "sv-fi") { txt = "Välj land" } else { if (language == "fi-fi") { txt = "Valitse maa" } else { if (language == "de-de") { txt = "Wählen Sie ein Land" } else { if (language == "pl-pl") { txt = "Wybierz" } else { if (language == "ru-ru") { txt = "Выбор страны" } else { if (language == "no-no") { txt = "Velg land" } else { if (language == "fr-fr") { txt = "Choisir le pays" } else { txt = "Select country" } } } } } } } } var $this = $(this); var links = $this.find("a"); $this.find("ul").remove(); var $sel = $('<select name="locationSelection" id="locationSelection"><option class="makeSelection">' + txt + "</option></select>"); var $changeLoc = $('<input type="button" id="changeLocation" />'); $this.find("div.countrySelectionBoxWrapper").append($sel).append($changeLoc); links.each(function () { var $link = $(this); var $opt = $("<option />").addClass(this.className).attr("value", $link.attr("href")).html($link.html()); if ($link.hasClass("selected")) { $opt.attr("selected", "selected") } $sel.append($opt) }); $changeLoc.click(function () { if (!$("#locationSelection option.makeSelection:selected").length) { window.location = $("#locationSelection option:selected").attr("value") } }) } $("#countrySelectionBox").available(modifyLocationNavi, true) })(); function linkSelection_OpenLink(ddlLinksID, openInNewWindow) { var ddlLinks = $('#' + ddlLinksID); ddlLinks.each(function () { var url = this.options[this.selectedIndex].value; if ((url != null) && (url.length > 0)) { if (openInNewWindow) window.open(url); else window.location = url; } }); } (function () { function enhanceFrontPageTeasers() { if ($("div.pressReleases").length && $("div.topical").length) { var pressReleases = $("div.pressReleases ul"); var topical = $("div.topical ul"); var hPressReleases = $(pressReleases).height(); var hTopical = $(topical).height(); if (hPressReleases > hTopical) { $(topical).height(hPressReleases) } else { if (hTopical > hPressReleases) { $(pressReleases).height(hTopical) } } } } $("div.pressReleases").available(function () { $(this).data("loaded", true); if ($("div.pressReleases").data("loaded") && $("div.topical").data("loaded")) { $("div.topical img").imagesLoaded(enhanceFrontPageTeasers) } }); $("div.topical").available(function () { $(this).data("loaded", true); if ($("div.pressReleases").data("loaded") && $("div.topical").data("loaded")) { $("div.topical img").imagesLoaded(enhanceFrontPageTeasers) } }) })(); $(document).ready(function () { var language = $("html").attr("lang").toLowerCase(); function searchBox() { var searchInput = $("input.searchInput"); if (language == "sv-se") { $(searchInput).attr("value", "Sök...") } else { if (language == "fi-fi") { $(searchInput).attr("value", "Hae...") } else { if (language == "sv-fi") { $(searchInput).attr("value", "Sök...") } else { if (language == "de-de") { $(searchInput).attr("value", "Suche...") } else { if (language == "pl-pl") { $(searchInput).attr("value", "Szukaj...") } else { if (language == "ru-ru") { $(searchInput).attr("value", "Поиск по сайту...") } else { if (language == "no-no") { $(searchInput).attr("value", "Søk...") } else { if (language == "fr-fr") { $(searchInput).attr("value", "Recherche...") } else { $(searchInput).attr("value", "Search...") } } } } } } } } $(searchInput).focus(function () { $(this).attr("value", "") }) } searchBox(); function enhanceSubNavigation() { if ($("div.subNavigation li li").not("div.subNavigation li li li").find("ul")) { $("div.subNavigation li li:last-child").not("div.subNavigation li li li").addClass("last") } $("div.subNavigation a").bind("mouseover focus", function () { $(this).parent().addClass("over") }); $("div.subNavigation a").bind("mouseout blur", function () { $(this).parent().removeClass("over") }); $("div.subNavigation a + ul").prev().addClass("open"); $("div.subNavigation a.strong + ul").prev().addClass("open") } enhanceSubNavigation(); function allCategories() { if ($("#archiveFilter").length) { var txt; if (language == "sv-se") { txt = "Alla kategorier" } else { if (language == "sv-fi") { txt = "Alla kategorier" } else { if (language == "fi-fi") { txt = "Kaikki kategoriat" } else { if (language == "de-de") { txt = "Alle Kategorien" } else { if (language == "pl-pl") { txt = "Wszystkie kategorie" } else { if (language == "ru-ru") { txt = "Все категории" } else { if (language == "no-no") { txt = "Alle kategorier" } else { if (language == "fr-fr") { txt = "Toutes les catégories" } else { txt = "All categories" } } } } } } } } var selector = $('<li id="all"><div><div><input type="checkbox" id="allCategories"></div></div><label for="allCategories">' + txt + "</label></li>"); $("#archiveFilter li:first-child").before(selector); var checkChecked = function () { if ($('#archiveFilter input[type="checkbox"]:not(:checked)').not("#allCategories").length) { $("#allCategories").attr("checked", "") } else { $("#allCategories").attr("checked", "checked") } }; checkChecked(); $('#archiveFilter input[type="checkbox"]').not("#allCategories").click(function () { checkChecked() }); $("#allCategories").click(function () { if ($(this).attr("checked") === true) { $('#archiveFilter input[type="checkbox"]').attr("checked", "checked") } else { $('#archiveFilter input[type="checkbox"]').attr("checked", "") } }) } } allCategories(); $.jqm.params.modal = false; $.jqm.params.overlay = 50; $.jqm.params.closeClass = "close"; $("a.modal").each(function (i) { $("body").append('<div id="dialog' + i + '" class="jqmWindow"><p class="close"><a href="#" title="Close window">X</a></p><div id="dcontent' + i + '" class="jqmWrapper"></div></div>'); var selector = ""; if ($(this).attr("name").length) { selector = " " + $(this).attr("name") } $("#dialog" + i).jqm({ trigger: this, ajax: this.href + selector, target: "#dcontent" + i }); if (this.href == window.location) { $(selector).not(".jqmWindow" + selector).remove() } }); function patchValidation() { if (typeof (ValidatorUpdateIsValid) != "function") { return } var originalUpdateIsValid = ValidatorUpdateIsValid; ValidatorUpdateIsValid = (function (originalFunction) { return function () { if ((typeof (Page_Validators) != "undefined") && (Page_Validators != null)) { var controlStates = {}; jQuery.each(Page_Validators, function () { var state = controlStates[this.controltovalidate]; if (typeof (state) == "undefined") { state = { validator: this, errors: 0 }; controlStates[this.controltovalidate] = state } if (!this.isvalid) { state.errors++ } }); jQuery.each(controlStates, function () { var $parent = $(this.validator).parent(); if (this.errors > 0) { if (!$parent.hasClass("error")) { $parent.addClass("error") } } else { if ($parent.hasClass("error")) { $parent.removeClass("error") } } }) } originalFunction() } })(originalUpdateIsValid) } patchValidation() }); var Services = (function () { function ctor() { } var caches = {}; function GetCacheKey(args) { var key = ""; for (var i = 0; i < args.length && typeof (args[i]) != "function"; i++) { key += "#" + args[i] } return key } function AjaxCall(options) { var settings = jQuery.extend({ type: "GET", timeout: 30000, dataType: "json", dataFilter: filterAjaxResponse, error: function () { } }, options); $.ajax(settings) } function filterAjaxResponse(data, type) { var res = eval("(" + data + ")"); if (typeof (res.d) != "undefined") { if (typeof (res.d) == "string") { return '"' + res.d + '"' } return res.d } if (typeof (res) == "string") { return '"' + res + '"' } return res } function Call(options, args, successCallback, noCache) { if (noCache) { var settings = jQuery.extend({ success: successCallback }, options); AjaxCall(settings) } else { if ((typeof (caches[options.url]) == "undefined") || (caches[options.url] == null)) { caches[options.url] = {} } var cache = caches[options.url]; var key = GetCacheKey(args); if (cache[key] != null) { successCallback(cache[key].data); return } var settings = jQuery.extend({ success: (function (url, key, callback) { return function (data) { if ((typeof (caches[url]) == "undefined") || (caches[url] == null)) { caches[url] = {} } var cache = caches[url]; cache[key] = { data: data }; callback(data) } })(options.url, key, successCallback) }, options); AjaxCall(settings) } } ctor.SendLinkToFriend = function (friendName, friendEmail, ownName, ownEmail, message, securitycode, culture, pageTitle, pageUrl, successCallback) { Call({ url: "/_layouts/Fortum.Internet.ContentEnhancements/ClientService.svc/SendLinkToFriend", data: { friendName: friendName, friendEmail: friendEmail, ownName: ownName, ownEmail: ownEmail, message: message, securitycode: securitycode, cultureName: culture, pageTitle: pageTitle, pageUrl: pageUrl} }, arguments, successCallback, true) }; return ctor })(); function doIframe() { o = document.getElementsByTagName("iframe"); for (i = 0; i < o.length; i++) { if (/\bautoHeight\b/.test(o[i].className)) { setHeight(o[i]); addEvent(o[i], "load", doIframe) } } } function setHeight(e) { var h1 = 0; var h2 = 0; var h3 = 0; var h4 = 0; try { if (e.Document && e.Document.body.scrollHeight) { h1 = e.Document.body.scrollHeight + 20 } } catch (err) { } try { if (e.contentDocument && e.contentDocument.body.scrollHeight) { h2 = e.contentDocument.body.scrollHeight + 35 } } catch (err) { } try { if (e.contentDocument && e.contentDocument.body.offsetHeight) { h3 = e.contentDocument.body.offsetHeight + 35 } } catch (err) { } try { if (e.contentDocument) { h4 = e.contentDocument.body.offsetHeight } } catch (err) { } var largestHeight = h1; if (h2 > largestHeight) { largestHeight = h2 } if (h3 > largestHeight) { largestHeight = h3 } if (h4 > largestHeight) { largestHeight = h4 } if (largestHeight <= 35) { largestHeight = 400 } e.style.display = "block"; e.height = largestHeight } function addEvent(obj, evType, fn) { if (obj.addEventListener) { obj.addEventListener(evType, fn, false); return true } else { if (obj.attachEvent) { return obj.attachEvent("on" + evType, fn) } } return false } if (document.getElementById && document.createTextNode) { addEvent(window, "load", doIframe) }; function FormAgreementValidate(source, arguments) { if ((source == null) || (source.checkboxID == undefined) || (source.checkboxID == "")) return; var cb = $("#" + source.checkboxID); if (cb.length > 0) { arguments.IsValid = cb[0].checked; } }

