function openNewsletter() {
  window.open('http://su.pbl.nu/s/21/2','newsletterPrenWin','height=480,width=640,scrollbars=no');
}

function setMenu(main, sub) {
  P7_swapClass(1,'p'+main,'open','closed','li')
  setMenu2(sub);
}
function setMenu2(sm) {
  obj = MM_findObj('p7swapmenu');
  if (typeof(isgroup) == 'undefined') { var isgroup = 0; }
  arr = obj.getElementsByTagName("A");
  var isset = 0;
  for (i=0; i<arr.length; i++) {
//    if (arr[i].href == document.location.href && (document.location.href.indexOf("&sp=") != -1 || document.location.href.indexOf("?sp=") != -1)) { 
//      arr[i].className = 'meck';
//      isset = 1;
//    }
  rexp = /\&sp\=(\d+)\&?$/;
  rexpb = /\?sp\=(\d+)\&?$/;
  if ((arr[i].href.match(rexp) && RegExp.$1 == sm) || (arr[i].href.match(rexpb) && RegExp.$1 == sm)) { arr[i].className = 'meck'; }

  //if (ara[0] != '' || arb[0] != '') {
  //   arr[i].className = 'meck';
  //  }
//    if (arr[i].href.indexOf("&sp="+sm) != -1 || arr[i].href.indexOf("?sp="+sm) != -1) { 
//     arr[i].className = 'meck';
//    }
  }
}

function saveMenu() {
  obj = MM_findObj('p7swapmenu');
  arr = obj.getElementsByTagName("LI");
  for (i=0; 0<arr.length; i++) {
    if (arr[i].id == 'p1') { 
//      alert('p1 har '+arr[i].className);
    }
  }
}

function P7_swapClass(){ //v1.4 by PVII
 var i,x,tB,j=0,tA=new Array(),arg=P7_swapClass.arguments;
 if(document.getElementsByTagName){for(i=4;i<arg.length;i++){tB=document.getElementsByTagName(arg[i]);
  for(x=0;x<tB.length;x++){tA[j]=tB[x];j++;}}for(i=0;i<tA.length;i++){
  if(tA[i].className){if(tA[i].id==arg[1]){if(arg[0]==1){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}else{tA[i].className=arg[2];}
  }else if(arg[0]==1 && arg[1]=='none'){if(tA[i].className==arg[2] || tA[i].className==arg[3]){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}
  }else if(tA[i].className==arg[2]){tA[i].className=arg[3];}}}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function P7_getLDims(el) { //v2.5 by PVII
 var x,ll=0,tl=0,hh=0,ww=0,wx,g,gg;
 if((g=MM_findObj(el))!=null){gg=(document.layers)?g:g.style;ll=parseInt(gg.left);
 tt=parseInt(gg.top);if(isNaN(ll)){if(g.currentStyle){ll=parseInt(g.currentStyle.left);
 }else if(document.defaultView&&document.defaultView.getComputedStyle){
 ll=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("left"));
 }if(isNaN(ll)){ll=0;}}if(isNaN(tt)){if(g.currentStyle){tt=parseInt(g.currentStyle.top);
 }else if(document.defaultView&&document.defaultView.getComputedStyle){
 tt=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("top"));}if(isNaN(ll)){tt=0;}}
 if(document.all||document.getElementById){ww=parseInt(g.offsetWidth);hh=parseInt(g.offsetHeight);
 if(!ww){ww=parseInt(g.style.pixelWidth);if(!ww){ww=parseInt(g.style.width);}}if(!hh){
 hh=parseInt(g.style.pixelHeight);}if(g.hasChildNodes&&g.childNodes){for(x=0;x<g.childNodes.length;x++){
 wx=parseInt(g.childNodes[x].offsetWidth);if(wx>ww){ww=wx;}}}}else if(document.layers){
 ww=parseInt(g.clip.width);hh=parseInt(g.clip.height);}}var aR=[ll,tt,hh,ww];return aR;
}

function P7_alignRR() { //v2.5 by PVII
 var i;if(!document.p7alignRR) {return;}if(document.layers){
 if(innerWidth!=document.p7RRiw || innerHeight!=document.p7RRih){location.reload();}
 }else{document.p7RR=1;for(i=0;i<p7aRR.length;i++){eval(p7aRR[i]);}document.p7RR=0;}
}

function P7_alignLL2(){ //v2.5 by PVII
 var g,gg,lp,tp,tW,tH,oV,oH,aL,aT,pa='px',args=P7_alignLL2.arguments;if(document.layers||window.opera){pa='';}
 for(var i=0;i<args.length;i+=5){if((g=MM_findObj(args[i]))!=null){gg=(document.layers)?g:g.style;
 oV=parseInt(args[i+3]);oH=parseInt(args[i+4]);aL = P7_getLDims(args[i]);aT = P7_getLDims(args[i+1]);
 lp=aL[0];tp=aL[1];switch (args[i+2]){case 'A':lp=aT[0]-aL[3]+oH;tp=aT[1]-aL[2]+oV;break;
 case 'B':lp=aT[0]+oH;tp=aT[1]-aL[2]+oV;break;case 'C':lp=aT[0]+aT[3]+oH;tp=aT[1]-aL[2]+oV;break;
 case 'D':lp=aT[0]-aL[3]+oH;tp=aT[1]+oV;break;case 'E':lp=aT[0]+aT[3]+oH;tp=aT[1]+oV;break;
 case 'F':lp=aT[0]-aL[3]+oH;tp=aT[1]+aT[2]+oV;break;case 'G':lp=aT[0]+oH;tp=aT[1]+aT[2]+oV;break;
 case 'H':lp=aT[0]+aT[3]+oH;tp=aT[1]+aT[2]+oV;break;}gg.left=lp+pa;gg.top=tp+pa;
 if(!document.p7alignRR){p7aRR=new Array();document.p7alignRR=true;document.p7RR=0;onresize=P7_alignRR;
 if(document.layers){document.p7RR=0;document.p7RRiw=innerWidth;document.p7RRih=innerHeight;}}if(document.p7RR==0){
 p7aRR[p7aRR.length]="P7_alignLL2('"+args[i]+"','"+args[i+1]+"','"+args[i+2]+"',"+oV+","+oH+")";}}}
}
