 if( top.window != this.window ) {
   top.document.location.replace( this.document.location );
 }

 updDate = new Date(2005,10,14); // 14 Okt 2005
 updDates = new Array(
              new Array(2005, 9,14), // 14 Okt 2005, site update
              new Array(2005, 2, 4), // 3 Mars 2005, football general
              new Array(2005, 2, 4), // 3 Mars 2005, hockey genereal
              new Array(2005, 2, 4), // 3 Mars 2005, sw genereal
              new Array(2004, 8, 3), // 3 Sep 2004, news update
              new Array(2004,10,21), // 21 Nov 2004, news update
              new Array(2005,10,16), // 21 Nov 2004, news update
              new Array(2005, 2, 4), // 3 Mars 2005, news update
              new Array(2005,10,10)  // 3 Mars 2005, news update
            );

 monthArr = new Array(
   new Array("januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december" ),
   new Array("january","febuary","mars","april","may","june","july","august","september","october","november","december" )
 );

 transArr = new Array(
   new Array("Säsong", "Serie", "Lag", "Cup", "Plats", "Spelare", "Matcher", "Mål", "Assist", "Poäng", "Utvisningar", new Array("M","V","O","F","+","-","=","P"), "All-Time", "Interna", "Tabell", "Skytteligan" ),
   new Array("Season", "League", "Team", "Cup", "Place", "Player", "Games", "Goals", "Assists", "Points", "Penalties", new Array("G","W","D","L","+","-","=","P"), "All-Time", "Internal", "Table", "Scoringtable" )
 );

 function showLastUpd(l) {
   updDate = new Date(updDates[0][0],updDates[0][1],updDates[0][2]);
   if ( l == 0 )
     document.writeln( "Siten senast uppdaterad "+ updDate.getDate().toString() +" "+ monthArr[l][updDate.getMonth()] +" "+ updDate.getFullYear().toString() +".<P>Testad med NS7, FF & IE5. Gjord för 800x600." );
   else
     document.writeln( "Site last updated "+ monthArr[l][updDate.getMonth()] +" "+ updDate.getDate().toString() +", "+ updDate.getFullYear().toString() +".<P>Tested with NS7, FF & IE5. Made for 800x600." );
 }

 function showUpdate(idx) {
   updDate = new Date(updDates[idx][0],updDates[idx][1],updDates[idx][2]);
   yy = (""+updDate.getFullYear()).substring( updDate.getFullYear().toString().length - 2 );
   mm = ("00"+(updDate.getMonth()+1)).substring( (updDate.getMonth()+1).toString().length );
   dd = ("00"+updDate.getDate()).substring( updDate.getDate().toString().length );
//   document.writeln( "<I>("+ dd +"/"+ mm +"-"+ yy +")</I>" );
   return "<I>("+ dd +"/"+ mm +"-"+ yy +")</I>";
 }

 function showBanner(l) {
   if (l == 0) {
     document.writeln( "<NOBR><FONT CLASS=clsH2>Stöd <B><U>Demerzel</U></B> i förbundskaptensvalet i MZ-Hockey</FONT></NOBR>" );
   } else {
     document.writeln( "<NOBR><FONT CLASS=clsH2>&nbsp;</FONT></NOBR>" );
   }
 }

 function showLogo(lr) {
   alignArr = new Array("","ALIGN=LEFT","ALIGN=RIGHT");
//   document.writeln( "<IMG "+ alignArr[lr] +" SRC='img/DZBlogo.gif' WIDTH=114 HEIGHT=125 BORDER=0 ALT='DZ Blue'>" );
   return "<IMG "+ alignArr[lr] +" SRC='img/DZBlogo4.gif' WIDTH=114 HEIGHT=125 BORDER=0 ALT='DZ Blue'>";
 }

 function getLink(page,txt,cls) {
   clsArr = new Array("","CLASS=headBUT");
   if (txt.length >= 1)
     return "<A "+ clsArr[cls] +" onClick='location.replace(this.href);return false;' HREF='"+ page +"?'>"+ txt +"</A>";
   else
     return "&nbsp;";
 }

 function showTopLinks(l) {
   pageArr = new Array("index","hockey","football","tools","","landslag","contact");
   langArr = new Array(
     new Array("STARTSIDA","Hockey","Fotboll","Program","","Kaptensvalet","Kontakta","<IMG SRC='img/eng.gif' ALT='English' WIDTH=19 HEIGHT=12 BORDER=1>"),
     new Array("FRONTPAGE","Hockey","Football","Tools","","","Contact","<IMG SRC='img/swe.gif' ALT='Svenska' WIDTH=19 HEIGHT=12 BORDER=1>"),
     new Array(".php","_e.php")
   );

   htmlStr  = "<TABLE ALIGN=CENTER BORDER=1 BORDERCOLOR=black CELLSPACING=1 CELLPADDING=0>";
   htmlStr += "<TR ALIGN=CENTER>";
   for (i=0 ; i<pageArr.length ; i++) {
     htmlStr += " <TD WIDTH=95 HEIGHT=25>"+ getLink(pageArr[i]+""+langArr[2][l],langArr[l][i],1) +"</TD>";
   }
   htmlStr += " <TD WIDTH=25 HEIGHT=25>"+ getLink(pageArr[0]+""+langArr[2][l],langArr[Math.abs(l-1)][i],1) +"</TD>";
   htmlStr += " <TD WIDTH=25 HEIGHT=25>"+ getLink(pageArr[0]+""+langArr[2][Math.abs(l-1)],langArr[l][i],1) +"</TD>";
   htmlStr += "</TR>";
   htmlStr += "</TABLE>";

   document.writeln( htmlStr );
 }

 function showNoAd() {
//   alert(navigator.userAgent+"\n"+navigator.appName+"\n"+navigator.appVersion+"\n"+navigator.appCodeName);
   htmlStr  = "<IFRAME ALIGN=LEFT NAME=noadf ID=noadf WIDTH=1 HEIGHT=1 BORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 SCROLLING=NO>";
   htmlStr += "<OBJECT WIDTH=5 HEIGHT=1><EMBED WIDTH=10 HEIGHT=1>";

   if ( navigator.appName.indexOf("Microsoft") >= 0 )
     htmlStr += "";
   else
     htmlStr += "<APPLET WIDTH=1 HEIGHT=1>";

   document.writeln( htmlStr );
 }


 function showContent(inArr) {
   htmlStr  = "<TABLE WIDTH=100% BORDER=0 BORDERCOLOR=black CELLSPACING=0 CELLPADDING=0>";
   if ( inArr.length >= 1 ) {
     if ( inArr[0].length >= 1 )
       htmlStr += "<TR CLASS=tabRUB><TD>&nbsp; <B CLASS=clsH2w>"+ inArr[0][0] +"</B></TD></TR>";
     if ( inArr[0].length == 2 )
       htmlStr += "<TR><TD ALIGN=CENTER><B CLASS=clsH2><I>"+ inArr[0][1] +"</I></B></TD></TR>";
     htmlStr += "<TR><TD VALIGN=TOP>";
     for (i=1 ; i<inArr.length ; i++) {
       if ( inArr[i].length >= 2 && inArr[i][0].length > 0 ) {
         if ( i > 1 && i < inArr.length )
           htmlStr += "";                     //// POSSIBLE DIVIDER BETWEEN SUBJECTS
         htmlStr += "<P><B>"+ inArr[i][0] +"</B>";
         if ( inArr[i].length >= 3 )
           htmlStr += " "+ showUpdate(inArr[i][1]);
         htmlStr += "<BR>";
       } else {
         htmlStr += "<P>";
       }
       if ( inArr[i].length >= 3 ) {
         htmlStr += ""+ inArr[i][2];
         for (j=3 ; j<inArr[i].length ; j++) {
           htmlStr += "<P>"+ inArr[i][j];
         }
       } else {
         htmlStr += ""+ inArr[i][inArr[i].length-1];
       }
     }
     htmlStr += "</TD></TR>";
   }
   htmlStr += "</TABLE>";
   document.writeln( htmlStr );
 }


 function showLeagueTable(l,inArr) {
   htmlStr  = "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>";
   if ( inArr.length > 0 ) {
     for ( i=0 ; i<inArr.length ; i++ ) {
       if ( inArr[i].length == 2 ) {
         if ( inArr[i][1].length > 0 ) {
           if ( inArr[i][0] > 0 ) {
             htmlStr += "<TR><TD COLSPAN=9><B>"+ transArr[l][0] +" "+ inArr[i][0] +"</B></TD></TR>";
             htmlStr += "<TR><TD COLSPAN=9>"+ transArr[l][1] +": "+ inArr[i][1] +"</TD></TR>";
           }
           else
             htmlStr += "<TR><TD COLSPAN=9>"+ inArr[i][1] +"</TD></TR>";
         }
         htmlStr += "<TR ALIGN=RIGHT CLASS=tabHEAD><TD ALIGN=LEFT WIDTH=124>"+ transArr[l][2] +"</TD><TD WIDTH=20>"+transArr[l][11][0]+"</TD><TD WIDTH=20>"+transArr[l][11][1]+"</TD><TD WIDTH=20>"+transArr[l][11][2]+"</TD><TD WIDTH=20>"+transArr[l][11][3]+"</TD><TD WIDTH=24>+</TD><TD WIDTH=24>-</TD><TD WIDTH=24>=</TD><TD WIDTH=24>P</TD></TR>";
       }
       else if ( inArr[i].length >= 10 ) {
         if ( inArr[i][1] == "DZ Blue" || inArr[i][0] == 2 )
           htmlStr += "<TR ALIGN=RIGHT CLASS=tabDZB BGCOLOR=#f9f9f9>";
         else
           htmlStr += "<TR ALIGN=RIGHT CLASS=tabLAG BGCOLOR=#f9f9f9>";


         if ( inArr[i][1].length >= 19 )
           if ( inArr[i].length == 11 )
             htmlStr += "<TD ALIGN=LEFT STYLE='font-size:6.5pt;' TITLE='"+ inArr[i][10] +"'><NOBR>"+ inArr[i][1] +"</NOBR></TD>";
           else
             htmlStr += "<TD ALIGN=LEFT STYLE='font-size:6.5pt;'><NOBR>"+ inArr[i][1] +"</NOBR></TD>";
         else
           if ( inArr[i].length == 11 )
             htmlStr += "<TD ALIGN=LEFT TITLE='"+ inArr[i][10] +"'><NOBR>"+ inArr[i][1] +"</NOBR></TD>";
           else
             htmlStr += "<TD ALIGN=LEFT><NOBR>"+ inArr[i][1] +"</NOBR></TD>";

         for ( j=2 ; j<10 ; j++ )
           htmlStr += "<TD>"+ inArr[i][j] +"</TD>";

         htmlStr += "</TR>";
         if ( inArr[i][0] >= 1)
           htmlStr += "<TR><TD COLSPAN=9 BGCOLOR=#696969 HEIGHT=1><IMG SRC=x.gif WIDTH=1 HEIGHT=1></TD></TR>";
       }
     }
   }
   htmlStr += "</TABLE>";
   document.writeln( htmlStr );
 }


 function showScoringTable2(l,s) {
   if ( s < TEAMSCORER.length ) {
    inArr = TEAMSCORER[s];
    htmlStr  = "<P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>";
    if ( inArr.length > 0 ) {
     for ( i=0 ; i<inArr.length ; i++ ) {
       if ( inArr[i].length == 3 ) {
         if ( inArr[i][0] == 0 )
           htmlStr += "<TR><TD COLSPAN=3><B>"+ transArr[l][12] +"-"+ transArr[l][15] +"</B></TD></TR>";
         else
           htmlStr += "<TR><TD COLSPAN=3><B>"+ transArr[l][13] +" "+ transArr[l][15] +"</B></TD></TR>";
         if ( inArr[i][0] == 2 )
           htmlStr += "<TR CLASS=tabHEAD><TD ALIGN=RIGHT WIDTH=34>"+ transArr[l][4] +"</TD><TD WIDTH=8>&nbsp;</TD><TD WIDTH=158>"+ transArr[l][3] +"</TD></TR>";
         else
           htmlStr += "<TR CLASS=tabHEAD><TD ALIGN=RIGHT WIDTH=34>"+ transArr[l][7] +"</TD><TD WIDTH=8>&nbsp;</TD><TD WIDTH=158>"+ transArr[l][5] +"</TD></TR>";
       }
       else if ( inArr[i].length == 5 ) {
         htmlStr += "<TR BGCOLOR=#f9f9f9>";
         htmlStr += "<TD ALIGN=RIGHT>"+ inArr[i][0] +"</TD><TD></TD>";
         htmlStr += "<TD ALIGN=LEFT TITLE='"+ inArr[i][2] +"'><NOBR>"+ inArr[i][4] +" (#"+ inArr[i][3] +")</NOBR></TD>";
         htmlStr += "</TR>";
         if ( i == 1 )
           htmlStr += "<TR><TD COLSPAN=3 BGCOLOR=#696969 HEIGHT=1><IMG SRC=x.gif WIDTH=1 HEIGHT=1></TD></TR>";
       }
     }
    }
    htmlStr += "</TABLE>";
    document.writeln( htmlStr );
   }
 }


 function showScoringTable(l,inArr) {
   htmlStr  = "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>";
   if ( inArr.length > 0 ) {
     for ( i=0 ; i<inArr.length ; i++ ) {
       if ( inArr[i].length == 2 ) {
         htmlStr += "<TR><TD COLSPAN=3><B>"+ inArr[i][1] +"</B></TD></TR>";
         if ( inArr[i][0] == 2 )
           htmlStr += "<TR CLASS=tabHEAD><TD ALIGN=RIGHT WIDTH=34>"+ transArr[l][4] +"</TD><TD WIDTH=8>&nbsp;</TD><TD WIDTH=158>"+ transArr[l][3] +"</TD></TR>";
         else
           htmlStr += "<TR CLASS=tabHEAD><TD ALIGN=RIGHT WIDTH=34>"+ transArr[l][7] +"</TD><TD WIDTH=8>&nbsp;</TD><TD WIDTH=158>"+ transArr[l][5] +"</TD></TR>";
       }
       else if ( inArr[i].length == 3 ) {
         htmlStr += "<TR BGCOLOR=#f9f9f9>";
         htmlStr += "<TD ALIGN=RIGHT>"+ inArr[i][1] +"</TD><TD></TD>";
         htmlStr += "<TD ALIGN=LEFT><NOBR>"+ inArr[i][2] +"</NOBR></TD>";
         htmlStr += "</TR>";
         if ( inArr[i][0] == 1)
           htmlStr += "<TR><TD COLSPAN=9 BGCOLOR=#696969 HEIGHT=1><IMG SRC=x.gif WIDTH=1 HEIGHT=1></TD></TR>";
       }
     }
   }
   htmlStr += "</TABLE>";
   document.writeln( htmlStr );
 }










 function showLeagueTable2(l,t,s) {
   /// Lang, sportType, Season
   showLeagueTable2b(l,TABELLDATA[t][s]);
 }

 function showLeagueTable3(l,s) {
   /// Lang, sportType, Season
   showLeagueTable2b(l,TABELLDATA[s]);
 }

 function showLeagueTable2b(l,inArr,outDiv) {
   /// Lang, tabledata
   htmlStr  = "<BR><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>";
//   alert(inArr);
   if ( inArr.length > 0 ) {
     for ( i=0 ; i<inArr.length ; i++ ) {
       if ( inArr[i].length <= 2 && l == 0 ) {
         for ( j=0 ; j<inArr[i].length ; j++ )
           htmlStr += "<TR><TD COLSPAN=9><BR>"+ inArr[i][j] +"</TD></TR>";
       }
       else if ( inArr[i].length == 3 ) {
         if ( inArr[i][2].length > 0 ) {
           if ( inArr[i][0] > 0 ) {
             htmlStr += "<TR><TD COLSPAN=9><B>"+ transArr[l][0] +" "+ inArr[i][0] +"</B></TD></TR>";
             htmlStr += "<TR><TD COLSPAN=9>"+ transArr[l][1] +": "+ inArr[i][2] +"</TD></TR>";
           }
           else
             htmlStr += "<TR><TD COLSPAN=9>"+ inArr[i][2] +"</TD></TR>";
         }
         htmlStr += "<TR ALIGN=RIGHT CLASS=tabHEAD><TD ALIGN=LEFT WIDTH=124>"+ transArr[l][2] +"</TD><TD WIDTH=20>"+transArr[l][11][0]+"</TD><TD WIDTH=20>"+transArr[l][11][1]+"</TD><TD WIDTH=20>"+transArr[l][11][2]+"</TD><TD WIDTH=20>"+transArr[l][11][3]+"</TD><TD WIDTH=24>+</TD><TD WIDTH=24>-</TD><TD WIDTH=24>=</TD><TD WIDTH=24>P</TD></TR>";
       }
       else if ( inArr[i].length == 11 ) {
         if ( inArr[i][2] == "DZ Blue" || inArr[i][0] == 2 )
           htmlStr += "<TR ALIGN=RIGHT CLASS=tabDZB BGCOLOR=#f3f3f3>";
         else
           htmlStr += "<TR ALIGN=RIGHT CLASS=tabLAG BGCOLOR=#f3f3f3>";


         if ( inArr[i][2].length >= 19 )
           if ( inArr[i].length == 11 )
             htmlStr += "<TD ALIGN=LEFT STYLE='font-size:6.5pt;' TITLE='"+ inArr[i][1] +"'><NOBR>"+ inArr[i][2] +"</NOBR></TD>";
           else
             htmlStr += "<TD ALIGN=LEFT STYLE='font-size:6.5pt;'><NOBR>"+ inArr[i][2] +"</NOBR></TD>";
         else
           if ( inArr[i].length == 11 && inArr[i][1] != "0" )
             htmlStr += "<TD ALIGN=LEFT TITLE='"+ inArr[i][1] +"'><NOBR>"+ inArr[i][2] +"</NOBR></TD>";
           else
             htmlStr += "<TD ALIGN=LEFT><NOBR>"+ inArr[i][2] +"</NOBR></TD>";

         inArr[i][3] = (inArr[i][4]+inArr[i][5]+inArr[i][6]);
         inArr[i][9] = (inArr[i][7]-inArr[i][8]);
         // inArr[i][10] = (inArr[i][4]*3+inArr[i][5]);
         for ( j=3 ; j<11 ; j++ )
           htmlStr += "<TD>"+ inArr[i][j] +"</TD>";

         htmlStr += "</TR>";
         if ( inArr[i][0] >= 1)
           htmlStr += "<TR><TD COLSPAN=9 BGCOLOR=#696969 HEIGHT=1><IMG SRC=x.gif WIDTH=1 HEIGHT=1></TD></TR>";
       }
     }
   }
   htmlStr += "</TABLE>";
   if (outDiv == undefined)
     document.writeln( htmlStr );
   else
     document.getElementById(""+outDiv).innerHTML = htmlStr;
 }


 function calcMarathon(l,s,ma1,ma2) {
   /// Lang, Seasons, maratonskip1, maratonskip2
   for ( j=1 ; j<=s ; j++ ) {
     if ( s == 1)
       inArr = CUPDATA[1];
     else
       inArr = TABELLDATA[j];
     if ( inArr.length > 0 ) {
       for ( i=0 ; i<inArr.length ; i++ ) {
         if ( inArr[i].length == 11 ) {
           if ( inArr[i][2] == "DZ Blue" || inArr[i][0] >= s ) {
             for ( k=3 ; k<11 ; k++ ) {
               if ( s == 1 ) {
                 if ( CUPDATA[1][i][0] == 2 ) {
                   CUPDATA[0][1][k] += CUPDATA[1][i][k];
                   CUPDATA[0][2][k] += CUPDATA[1][i][k];
                 } else
                 if ( CUPDATA[1][i][0] == 1 ) {
                   CUPDATA[0][2][k] -= CUPDATA[1][i][k];
                   CUPDATA[0][3][k] += CUPDATA[1][i][k];
                 }
               } else {
                 TABELLDATA[0][1][k] += TABELLDATA[j][i][k];
                 TABELLDATA[0][5][k] += TABELLDATA[j][i][k];
               }
             }
           }
         } else
         if ( inArr[i].length == 14 && s > 1 ) {
           if ( typeof(inArr[i][0]) == 'object' && (inArr[i][0][1] != 9 || inArr[i][0][2] != 9) ) {
             for ( k=0 ; k<=13 ; k++ ) {
               dg = ag = ha = 0;
               dg = inArr[i][k][0+inArr[i][k][0]];
               ag = inArr[i][k][3-inArr[i][k][0]];
               ha = 1+inArr[i][k][0];

               /// Stora All-time
               if ( ha > 0 && (j > 1 || k >= ma1)) {
                 TABELLDATA[0][ha][3] += 1;
                 if ( dg > ag )
                   TABELLDATA[0][ha][4] += 1;
                 if ( dg == ag )
                   TABELLDATA[0][ha][5] += 1;
                 if ( dg < ag )
                   TABELLDATA[0][ha][6] += 1;
                 TABELLDATA[0][ha][7] += dg;
                 TABELLDATA[0][ha][8] += ag;
                 TABELLDATA[0][ha][9] += (dg-ag);
                 TABELLDATA[0][ha][10] = 3*TABELLDATA[0][ha][4] + TABELLDATA[0][ha][5];
               }
               /// Lilla All-time
               if ( ha > 0 && (j > 1 || k >= ma2) && ma1 != ma2 ) {
                 TABELLDATA[0][ha+4][3] += 1;
                 if ( dg > ag )
                   TABELLDATA[0][ha+4][4] += 1;
                 if ( dg == ag )
                   TABELLDATA[0][ha+4][5] += 1;
                 if ( dg < ag )
                   TABELLDATA[0][ha+4][6] += 1;
                 TABELLDATA[0][ha+4][7] += dg;
                 TABELLDATA[0][ha+4][8] += ag;
                 TABELLDATA[0][ha+4][9] += (dg-ag);
                 TABELLDATA[0][ha+4][10] = 3*TABELLDATA[0][ha+4][4] + TABELLDATA[0][ha+4][5];
               }
             }
           }
           else if ( typeof(inArr[i][0]) == 'string' && (inArr[i][0].toString().indexOf("-") > 0 || inArr[i][0].toString().indexOf(":") > 0) ) {
             for ( k=0 ; k<=13 ; k++ ) {
               dg = ag = ha = 0;
               if ( inArr[i][k].indexOf("-") > 0 ) {
                 dg = parseInt( inArr[i][k].substr(0,inArr[i][k].indexOf("-")) );
                 ag = parseInt( inArr[i][k].substr(1+inArr[i][k].indexOf("-")) );
                 ha = 2;
               } else
               if ( inArr[i][k].indexOf(":") > 0 ) {
                 ag = parseInt( inArr[i][k].substr(0,inArr[i][k].indexOf(":")) );
                 dg = parseInt( inArr[i][k].substr(1+inArr[i][k].indexOf(":")) );
                 ha = 3;
               }
               if ( ha > 0 && (j > 1 || k >= ma1)) {
                 TABELLDATA[0][ha][3] += 1;
                 if ( dg > ag )
                   TABELLDATA[0][ha][4] += 1;
                 if ( dg == ag )
                   TABELLDATA[0][ha][5] += 1;
                 if ( dg < ag )
                   TABELLDATA[0][ha][6] += 1;
                 TABELLDATA[0][ha][7] += dg;
                 TABELLDATA[0][ha][8] += ag;
                 TABELLDATA[0][ha][9] += (dg-ag);
                 TABELLDATA[0][ha][10] = 3*TABELLDATA[0][ha][4] + TABELLDATA[0][ha][5];
               }
               if ( ha > 0 && (j > 1 || k >= ma2) && ma1 != ma2 ) {
                 TABELLDATA[0][ha+4][3] += 1;
                 if ( dg > ag )
                   TABELLDATA[0][ha+4][4] += 1;
                 if ( dg == ag )
                   TABELLDATA[0][ha+4][5] += 1;
                 if ( dg < ag )
                   TABELLDATA[0][ha+4][6] += 1;
                 TABELLDATA[0][ha+4][7] += dg;
                 TABELLDATA[0][ha+4][8] += ag;
                 TABELLDATA[0][ha+4][9] += (dg-ag);
                 TABELLDATA[0][ha+4][10] = 3*TABELLDATA[0][ha+4][4] + TABELLDATA[0][ha+4][5];
               }
             }
           }
         }

       }
       for ( k=3 ; k<11 ; k++ ) {
         TABELLDATA[0][1][k] = TABELLDATA[0][2][k]+TABELLDATA[0][3][k];
         TABELLDATA[0][5][k] = TABELLDATA[0][6][k]+TABELLDATA[0][7][k];
       }

     }
     if ( j < TEAMSCORER.length ) {
       if ( TEAMSCORER[j].length >= 3 ) {
         for ( i=1 ; i<TEAMSCORER[j].length ; i++ ) {
           if ( typeof(TEAMSCORER[j][i]) == 'object' && TEAMSCORER[j][i].length >= 5 ) {
             done = false;
             for ( k=2 ; k<TEAMSCORER[0].length ; k++ ) {
               if ( TEAMSCORER[j][i][2] == TEAMSCORER[0][k][2] ) {
                 TEAMSCORER[0][k][0] += TEAMSCORER[j][i][0];
                 TEAMSCORER[0][k][1] += TEAMSCORER[j][i][1];
                 TEAMSCORER[0][k][3] = TEAMSCORER[j][i][3];
                 done = true;
               }
             }
             if ( !done ) {
               TEAMSCORER[0][k] = TEAMSCORER[j][i];
             }
           }
         }
       }
     }
   }
   sortArr = new Array();
   sortArr[0] = TEAMSCORER[0][0];
   sortArr[1] = TEAMSCORER[0][2];
   for ( i=3 ; i<TEAMSCORER[0].length ; i++ ) {
     for ( j=sortArr.length ; j>1 ; j-- ) {
       if ( TEAMSCORER[0][i][0] > sortArr[j-1][0] ) {
         sortArr[j] = sortArr[j-1];
         sortArr[j-1] = TEAMSCORER[0][i];
       } else {
         sortArr[j] = TEAMSCORER[0][i];
         j = 0;
       }
     }
   }
   TEAMSCORER[0] = sortArr;
 }


 function showLastGame(l,theArr,outDiv) {
   lArr = new Array("Senaste matchen","Last game");
   htmlStr  = "<BR><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>";
   tabArr = theArr[1];
   inArr = theArr[2];
   if ( inArr.length > 0 ) {
     for ( i=(inArr.length-1) ; i>=0 ; i-- ) {
       if ( inArr[i][1] != 9 && inArr[i][2] != 9) {
         htmlStr += "<TR><TD COLSPAN=6>"+ lArr[l] +"</TD></TR>";
         htmlStr += "<TR BGCOLOR=#f3f3f3>";
         resArr = new Array("?","??",inArr[i][1],inArr[i][2],"","");
         resArr[inArr[i][0]-1] = "<B>DZ Blue</B>";
         resArr[6-inArr[i][0]] = inArr[i][3];
         resArr[inArr[i][0]+3] = "DZ Blue";
         for ( j=1 ; j<=8 ; j++ ) {
           if ( tabArr[j].length == 11 ) {
             if ( tabArr[j][1] == inArr[i][3] ) {
               resArr[2-inArr[i][0]] = tabArr[j][2];
             }
             else if ( tabArr[j][2] == "DZ Blue" ) {
               resArr[inArr[i][0]+3] = tabArr[j][1];
             }
           }
         }

         for ( j=0 ; j<=1 ; j++ ) {
           if (resArr[0+j].length >= 19)
             htmlStr += "<TD WIDTH=124 ALIGN=LEFT STYLE='font-size:6.5pt;' TITLE='"+ resArr[4+j] +"'><NOBR>"+ resArr[j] +"</NOBR></TD>";
           else
             htmlStr += "<TD WIDTH=124 ALIGN=LEFT TITLE='"+ resArr[4+j] +"'><NOBR>"+ resArr[j] +"</NOBR></TD>";
           if (j==0)
             htmlStr += "<TD WIDTH=12 ALIGN=LEFT>-</TD>";
         }

         htmlStr += "<TD WIDTH=16 ALIGN=RIGHT>"+ resArr[2] +"</TD><TD WIDTH=8 ALIGN=CENTER>-</TD><TD WIDTH=16 ALIGN=LEFT>"+ resArr[3] +"</TD></TR>";

         htmlStr += "<TR BGCOLOR=#f3f3f3><TD COLSPAN=2><I>P:"+ (inArr[i][6][0]+inArr[i][6][1]+inArr[i][6][2]) +" ("+ inArr[i][6][0] +","+ inArr[i][6][1] +","+ inArr[i][6][2] +")</I></TD>";

         htmlStr += "<TD COLSPAN=4 ALIGN=RIGHT><I>("+ inArr[i][4][0] +"-"+ inArr[i][5][0];
         for (j=1 ; j<inArr[i][4].length ; j++)
           htmlStr += ","+ inArr[i][4][j] +"-"+ inArr[i][5][j];
         htmlStr += ")</I></TD></TR>";

         if (l == 0)
           htmlStr += "<TR><TD COLSPAN=6><BR>"+ inArr[i][7] +"</TD></TR>";

         i = -1;
       }
     }
   }
   htmlStr += "</TABLE>";
   if (outDiv == undefined)
     document.writeln( htmlStr );
   else
     document.getElementById(""+outDiv).innerHTML = htmlStr;
 }


 function writeHRLine() {
   document.writeln("<HR CLASS=line WIDTH=80%>");
 }





 function showTable(l,inArr,outDiv) {
   /// Lang, tabledata
   htmlStr  = "<BR><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>";
   if ( inArr.length > 0 ) {
     for ( i=0 ; i<inArr.length ; i++ ) {
       if ( inArr[i].length == 3 && inArr[i][0].toString().length <= 3 ) {
         if ( inArr[i][2].length > 0 ) {
           if ( inArr[i][0] > 0 ) {
             htmlStr += "<TR><TD COLSPAN=9><B>"+ transArr[l][0] +" "+ inArr[i][0] +"</B></TD></TR>";
             htmlStr += "<TR><TD COLSPAN=9>"+ transArr[l][1] +": "+ inArr[i][2] +"</TD></TR>";
           }
           else
             htmlStr += "<TR><TD COLSPAN=9>"+ inArr[i][2] +"</TD></TR>";
         }
         htmlStr += "<TR ALIGN=RIGHT CLASS=tabHEAD><TD ALIGN=LEFT WIDTH=124>"+ transArr[l][2] +"</TD><TD WIDTH=20>M</TD><TD WIDTH=20>V</TD><TD WIDTH=20>O</TD><TD WIDTH=20>F</TD><TD WIDTH=24>+</TD><TD WIDTH=24>-</TD><TD WIDTH=24>=</TD><TD WIDTH=24>P</TD></TR>";
       }
       else if ( inArr[i].length == 11 ) {
         if ( inArr[i][2] == "DZ Blue" || inArr[i][0] == 2 )
           htmlStr += "<TR ALIGN=RIGHT CLASS=tabDZB BGCOLOR=#f9f9f9>";
         else
           htmlStr += "<TR ALIGN=RIGHT CLASS=tabLAG BGCOLOR=#f9f9f9>";


         if ( inArr[i][2].length >= 19 ) {
           inArr[i][2] = inArr[i][2].substr(0,24);
           if ( inArr[i].length == 11 )
             htmlStr += "<TD ALIGN=LEFT STYLE='font-size:6.5pt;' TITLE='"+ inArr[i][1] +"'><NOBR>"+ inArr[i][2] +"</NOBR></TD>";
           else
             htmlStr += "<TD ALIGN=LEFT STYLE='font-size:6.5pt;'><NOBR>"+ inArr[i][2] +"</NOBR></TD>";
         }
         else
           if ( inArr[i].length == 11 && inArr[i][1] != "0" )
             htmlStr += "<TD ALIGN=LEFT TITLE='"+ inArr[i][1] +"'><NOBR>"+ inArr[i][2] +"</NOBR></TD>";
           else
             htmlStr += "<TD ALIGN=LEFT><NOBR>"+ inArr[i][2] +"</NOBR></TD>";

         inArr[i][3] = (inArr[i][4]+inArr[i][5]+inArr[i][6]);
         inArr[i][9] = (inArr[i][7]-inArr[i][8]);
         // inArr[i][10] = (inArr[i][4]*3+inArr[i][5]);
         for ( j=3 ; j<11 ; j++ )
           htmlStr += "<TD>"+ inArr[i][j] +"</TD>";

         htmlStr += "</TR>";
         if ( inArr[i][0] >= 1)
           htmlStr += "<TR><TD COLSPAN=9 BGCOLOR=#696969 HEIGHT=1><IMG SRC=x.gif WIDTH=1 HEIGHT=1></TD></TR>";
       }
       else if ( inArr[i].length < 11 ) {
         for ( j=0 ; j<inArr[i].length ; j++ )
           htmlStr += "<TR><TD COLSPAN=9><BR>"+ inArr[i][j] +"</TD></TR>";
       }
       else if ( inArr[i].length == 14 || inArr[i][0].length == 8 ) {
         if (i > 0) {
           htmlStr += "</TABLE>";
           htmlStr += "<BR><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>";
         }
         for ( j=(inArr[i].length-1) ; j>=0 ; j-- ) {
           if ( inArr[i][j][1] != 9 && inArr[i][j][2] != 9) {
             htmlStr += "<TR>";
             resArr = new Array("?","Vilbergen Vikings HC",inArr[i][j][1],inArr[i][j][2],"","");
             resArr[inArr[i][j][0]-1] = "<B>DZ Blue</B>";
             resArr[inArr[i][j][0]+3] = "DZ Blue";
             resArr[6-inArr[i][j][0]] = inArr[i][j][3];

             for ( k=0 ; k<=1 ; k++ ) {
               if (resArr[0+k].length >= 19)
                 htmlStr += "<TD WIDTH=124 ALIGN=LEFT STYLE='font-size:6.5pt;' TITLE='"+ resArr[4+k] +"'><NOBR>"+ resArr[k] +"</NOBR></TD>";
               else
                 htmlStr += "<TD WIDTH=124 ALIGN=LEFT TITLE='"+ resArr[4+k] +"'><NOBR>"+ resArr[k] +"</NOBR></TD>";
               if (k==0)
                 htmlStr += "<TD WIDTH=12 ALIGN=LEFT>-</TD>";
             }

             htmlStr += "<TD WIDTH=16 ALIGN=RIGHT>"+ resArr[2] +"</TD><TD WIDTH=8 ALIGN=CENTER>-</TD><TD WIDTH=16 ALIGN=LEFT>"+ resArr[3] +"</TD></TR>";

             htmlStr += "<TR><TD COLSPAN=2><I>P:"+ (inArr[i][j][6][0]+inArr[i][j][6][1]+inArr[i][j][6][2]) +" ("+ inArr[i][j][6][0] +","+ inArr[i][j][6][1] +","+ inArr[i][j][6][2] +")</I></TD>";

             htmlStr += "<TD COLSPAN=4 ALIGN=RIGHT><I>("+ inArr[i][j][4][0] +"-"+ inArr[i][j][5][0];
             for (k=1 ; k<inArr[i][j][4].length ; k++)
               htmlStr += ","+ inArr[i][j][4][k] +"-"+ inArr[i][j][5][k];
             htmlStr += ")</I></TD></TR>";

             htmlStr += "<TR><TD COLSPAN=6>"+ inArr[i][j][7] +"</TD>";

             j = -1;
           }
         }


       }
     }
   }
   htmlStr += "</TABLE>";
   if (outDiv == undefined)
     document.writeln( htmlStr );
   else if (outDiv.length <= 0)
     return htmlStr;
   else
     document.getElementById(""+outDiv).innerHTML = htmlStr;
 }

