function transformLinksUlToSelect($ul, $select) { var $links = $('li a', $ul); if ($links.length > 0) { $links.each(function(){ $select.append(''); }); } $select.change(function(){ var link = $select.val(); if (link != '') { var target = $select.find(':selected').attr('target'); if (target == '' || target.match(/top/i)) { top.location.href = link; } else { window.open(link, target); } } }); } function addBAMButton(button, id) { $('#' + id).html(button); } //Override global window.open method to hide context for popups by default var originalWindowOpenMethod = window.open; function globalWindowOpenMethod() { var url = arguments[0]; if (url.indexOf("_context=") == -1 && url.indexOf("portalen") != -1) url = url.concat((url.indexOf("?") == -1 ? "?" : "&") + "_context=none"); if (arguments[2]) originalWindowOpenMethod(url, arguments[1], arguments[2]); else if (arguments[1]) originalWindowOpenMethod(url, arguments[1]); else originalWindowOpenMethod(url); } window.open = globalWindowOpenMethod; document.open = globalWindowOpenMethod; //IE7 base href behaviour $(function(){if($.browser.msie&&$.browser.version>=7)$('body base[href]').eq(0).appendTo($('head'));}); //File links should open a new window $(function(){$('a[href$=.pdf],a[href$=.ppt],a[href$=.doc]').attr('target','_blank');}); //Remove target="content" from a's for backward compatibility $(function(){$('a[target=content]').removeAttr('target');}); //Target "modal" opens modal dialog $(function(){$('a[target=modal]').live('click',function(){top.$.detaildialog({url: $(this).attr('href'), key: '', forcedOpen: true});return false;})}); //Execute onLoad function if exists $(function(){if (typeof(onLoad)=="function") onLoad();}); //Ajax Loader $(function(){$(".ajaxLoader").each(function(){$(this).load($(">a",this).attr('href')); $(this).removeClass("ajaxLoader");});});