//first, checks if it isn't implemented yet if (!String.prototype.format) { String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match ; }); }; } if (!Date.prototype.toISOString) { (function () { function pad(number) { var r = String(number); if (r.length === 1) { r = '0' + r; } return r; } Date.prototype.toISOString = function () { return this.getUTCFullYear() + '-' + pad(this.getUTCMonth() + 1) + '-' + pad(this.getUTCDate()) + 'T' + pad(this.getUTCHours()) + ':' + pad(this.getUTCMinutes()) + ':' + pad(this.getUTCSeconds()) + '.' + String((this.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5) + 'Z'; }; } ()); } function hasFocus(jqueryObject) { return jqueryObject.hasClass('has-focus'); } function isNullOrEmpty(item) { return (typeof item === 'undefiend' || item == 'undefined' || item == null || item == ''); } function fillDropDown(id, JSONdata, postUpdateFn) { if(id!=null){ var jddl = jQuery('#' + id); if(!jddl){ return; } var ddl = jddl.first().get(0); if(!ddl) { return; } var url = jddl.attr('data-url'); var ie7 = (jQuery.browser.msie && parseInt(jQuery.browser.version) == 7) ? true : false; ddl.options.length=0; ddl.options.add(new Option('Henter data...', '-1')); ddl.selectedIndex=0; //alert(JSONdata); jQuery.ajax({ type: 'GET' , url: url + (ie7 == true ? '&ie7=true' : '') , data: jQuery.parseJSON(JSONdata) , dataType: 'html' , async: true , success: function (html) { var requestData = jQuery.parseJSON(JSONdata); eval(html); if (typeof (JSONres) != "undefined") { if (JSONres != null && typeof (JSONres.element) !== 'undefined') { var jObj = jQuery('#' + JSONres.element); var ddl = jObj[0]; var dataDefault = jObj.attr('data-default'); ddl.options.length = 0; if (typeof (JSONres.items) != 'undefined' && JSONres.items.length > 0) { var l = JSONres.items.length; var selectedIndex = 0; for (var i = 0; i < l; i++) { var opt; if (JSONres.items[i].text == '-' && JSONres.items[i].value == '-') { opt = new Option('------', '-'); opt.disabled = true; } else { opt = new Option(JSONres.items[i].text, JSONres.items[i].value); if (eval(JSONres.items[i].selected)) { selectedIndex = i; } else if (eval(new String(requestData.selected)) == JSONres.items[i].value) { selectedIndex = i; } } ddl.options.add(opt); } ddl.selectedIndex = selectedIndex; if (typeof (JSONres.disabled) !== 'undefined' && JSONres.disabled == true) { ddl.disabled = true; } else { ddl.disabled = false; } jObj.removeAttr('data-sv'); if (hasFocus(jObj)) { ddl.focus(); } } else { ddl.disabled = true; ddl.options.add(new Option('Ingen data...', "-1")); } jddl.trigger("optionschanged"); if (eval(postUpdateFn) == null) { jQuery(ddl).change(); } else { postUpdateFn(ddl); } } } } }); } } function cancelEvent(e) { if (!e) var e = window.event; try { e.returnValue = false; e.cancelBubble = true; } catch (err) { } try { //e.cancelBubble is supported by IE - this will kill the bubbling process. if (e.returnValue) { e.returnValue = false; } if (e.cancelBubble) { e.cancelBubble = true; } } catch (err) { } try { //e.stopPropagation works only in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } } catch (err) { } } //Extending jQuery with a better trigger function (function ($) { //Attach to jQuery $.fn.extend({ triggerLink: function (e, url) { if (typeof (global_default_js_is_loaded) != "undefined" && global_default_js_is_loaded) { return; //it works in the default.js } if (e.target.tagName.toLowerCase() != 'a') { var linkElement = null; if (url === undefined || url == '') { url = ''; var links = $(e.target).find('a.primary').first(); if (links.length == 0) { links = $(e.target).find('a'); } var l = links.length; var i = 0; for (i; i < l; i++) { var testLinkElement = $(links[i]); var testUrl = testLinkElement.attr('href'); if (true || isValidUrl(testUrl)) { linkElement = testLinkElement; url = testUrl; break; } } } if (url != '') { cancelEvent(e); //unselect all text selected (if any) if (document.selection) { document.selection.empty(); } else { window.getSelection().removeAllRanges(); } var doActivateLink = true; if (url.substring(0, 1) == '#' && linkElement !== null) { doActivateLink = false; url = window.location.href.split('#')[0] + url; var clickResult = linkElement.click(); if(clickResult !== undefined && (clickResult == true || clickResult == false)) { doActivateLink = clickResult; } } if(doActivateLink) { if (e.ctrlKey) { window.open(url, 'a' + Math.random()); } else if (e.shiftKey) { window.open(url, '_blank', 'location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1'); } else { window.location = url; } } return false; } } return true; } }); //pass jQuery to the function, //So that we will able to use any valid Javascript variable name //to replace "$" SIGN. But, we'll stick to $ (I like dollar sign: ) ) })(jQuery); //Extending jQuery with a trace/logging function (function ($) { //Attach to jQuery jQuery.fn.extend({ log: function (msg) { if (window.console // check for window.console not console && window.console.log) { window.console.log(e); } // Other logging here } }); //pass jQuery to the function, //So that we will able to use any valid Javascript variable name //to replace "$" SIGN. But, we'll stick to $ (I like dollar sign: ) ) })(jQuery); function equalHeightStart() { var i = 1; var l = 10; for (i; i <= l; i++) { equalHeight(jQuery('.ehg_' + i)); } // group.each(function(){ // equalHeight(jQuery(".equalHeight:not([rel])")); // equalHeight(jQuery(".equalHeight([rel='"+jQuery(this).attr('rel')+"'])")); // }); } function equalHeight(group) { tallest = 0; group.each(function () { thisHeight = jQuery(this).height(); if (thisHeight > tallest) { tallest = thisHeight; } }); group.height(tallest); //[rel='gallerybox'] } jQuery(document).ready(function () { jQuery('hr').each(function () { var obj = jQuery(this); var cssStyle = obj.attr('style'); cssStyle = (cssStyle ? ' style="' + cssStyle + '"' : ''); var cssClass = obj.attr('class'); cssClass = ' class="hr ' + (cssClass ? cssClass : '') + '"'; obj.wrap('
'); obj.removeAttr('class'); obj.removeAttr('style'); }); //add .first and .last css class names to ul>li elements jQuery('ul').each(function () { var jObj = jQuery(this); if (jObj.find('li.first').length <= 0) { jObj.find('li:first').addClass('first'); } if (jObj.find('li.last').length <= 0) { jObj.find('li:last').addClass('last'); } }); jQuery(document).on('click', '.onclick.primary', function (e) { if (e.target.tagName.toLowerCase() != 'a') { var touch = typeof(seek4) != "undefined" && seek4 && seek4.IsBrowserHasTouch(); if (touch) { var hovered = $(this).hasClass("hover"); $(".onclick.primary").removeClass("hover"); $(this).addClass("hover"); if (hovered) { e.target = this; $(this).triggerLink(e); } else { e.preventDefault(); e.stopPropagation(); } } else { $(this).closest('.onclick.primary').first().each(function () { e.target = this; $(this).triggerLink(e); }); } } }); /*update equal height columns*/ setTimeout("equalHeightStart()", 100); });