function Triplelink0(Dir)
{
 parent.frames[1].location.href=Dir+"menu.htm"
 parent.frames[2].location.href=Dir+"title.htm"
 parent.frames[3].location.href=Dir+"index.htm"
}

function Triplelink(Link1,Link2,Link3)
{
 parent.frames[1].location.href=Link1
 parent.frames[2].location.href=Link2
 parent.frames[3].location.href=Link3
}
//---------------------------------------------------------------------------------
//
// Produces one row of day links in table
// Each cell contains hyperlink to file: <filename>_<n>.png
// First cell contains hyperlink to file:<filename>.htm 
//
// Revisions
//
// 14-apr-2007 Creation
//
// Fred Bosveld (KNMI)
//
//---------------------------------------------------------------------------------
//
function day_row(tekst,filename,n,ltoday)
{
  var i
  document.write('<TR>')
  document.write('<TD><A HREF="../graphs/'+filename+'.htm">'+tekst+'</A></TD>')

  if (ltoday) 
    {
     document.write('<TD><A HREF="../graphs/'+filename+'_0.htm"  target="_blank"><CENTER>go</CENTER></A></TD>')
     document.write('<TD><A HREF="../graphs/'+filename+'_0.png"><CENTER>go</CENTER></A></TD>')
    }
  else 
   {document.write('<TD>&nbsp;</TD>'+'<TD>&nbsp;</TD>')}

  for(i=1;i<=n;i++)
    {document.write('<TD><A HREF="../graphs/'+filename+'_'+i+'.png"><CENTER>go</CENTER></A></TD>')}

  document.write('</TR>')
}
//---------------------------------------------------------------------------------
//
// Produces one row of day links in table
// Each cell contains hyperlink to file: <filename>_<n>.png
// First cell contains hyperlink to file:<filename>.htm 
//
// Revisions
//
// 14-apr-2007 Creation
//
// Fred Bosveld (KNMI)
//
//---------------------------------------------------------------------------------
//
function day_row_doc(tekst,filename,n,ltoday,ldoc)
{
  var i
  document.write('<TR>')
  document.write('<TD><A HREF="../graphs/'+filename+'.htm">'+tekst+'</A></TD>')
  if (ldoc)
    {document.write('<TD><A HREF="../graphs/'+filename+'_doc.htm">doc</A></TD>')}
  else 
   {document.write('<TD>&nbsp;</TD>')}
   
  if (ltoday) 
    {
     document.write('<TD><A HREF="../graphs/'+filename+'_0.htm"  target="_blank"><CENTER>go</CENTER></A></TD>')
     document.write('<TD><A HREF="../graphs/'+filename+'_0.png"><CENTER>go</CENTER></A></TD>')
    }
  else 
   {document.write('<TD>&nbsp;</TD>'+'<TD>&nbsp;</TD>')}

  for(i=1;i<=n;i++)
    {document.write('<TD><A HREF="../graphs/'+filename+'_'+i+'.png"><CENTER>go</CENTER></A></TD>')}

  document.write('</TR>')
}
//---------------------------------------------------------------------------------
//
//
// Produces one row of year links in table
// Each cell contains hyperlink to file: <filename>_<yyyy>.png
// First cell contains hyperlink to file:<filename>.htm 
//
// Revisions
//
// 14-apr-2007 Creation
//
// Fred Bosveld (KNMI)
//
//---------------------------------------------------------------------------------
//
function year_row(dir,firstyear,beginyear,endyear,text,file)
{
  document.write('<tr><td><a href="'+dir+file+'.htm">'+text+'</a></td>')
  for(i=endyear;i>=beginyear;i--) {document.write('<td><a href="'+dir+file+'_'+i+'.png"><center>*</center></a></td>')}
  for(i=beginyear-1;i>=firstyear;i--) {document.write('<td>&nbsp;</td>')}
  document.write('</tr>')
}
//---------------------------------------------------------------------------------
//
// Produces table with month-columns and year-rows
// Each cell contains hyperlink to file: <filename>_<yyyy><mm>.<ext>
//
// Revisions
//
// 14-apr-2007 Creation
//
// Fred Bosveld (KNMI)
//
//---------------------------------------------------------------------------------
//
function table_year_month(dir,startyear,startmonth,endyear,endmonth,filename,ext)
{
var i
var j
document.write('<p></p><table border>')
document.write('<tr><td>&nbsp;</td>')

for (j=1;j<=12;j++)
{mnd = new String(100+j);document.write('<td><small>'+mnd.substring(1)+'</small></td>')}

document.write('</tr>')

i=startyear
document.write('<tr><td><small>'+i+'</small></td>')
for (j=1;j<startmonth;j++){document.write('<td>&nbsp;</td>')}
for (j=startmonth;j<=12;j++)
  {k=100*i+j;document.write('<td><a href="'+dir+filename+'_'+k+'.'+ext+'" target="home"><center>*</center></a></td>')};

document.write('</tr>')

for (i=startyear+1;i<endyear;i++)
{
  document.write('<tr><td><small>'+i+'</small></td>')
  for (j=1;j<=12;j++)
    {k=100*i+j;document.write('<td><a href="'+dir+filename+'_'+k+'.'+ext+'" target="home"><center>*</center></a></td>')}
  document.write('</tr>')
}

i=endyear
document.write('<tr><td><small>'+i+'</small></td>')
for (j=1;j<=endmonth;j++)
{k=100*i+j;document.write('<td><a href="'+dir+filename+'_'+k+'.'+ext+'" target="home"><center>*</center></a></td>')}

for (j=endmonth+1;j<=12;j++)
{document.write('<td>&nbsp;</td>')}

document.write('</tr></table>')
}
//---------------------------------------------------------------------------------
//
// Produces table with row and column headers given in arrays.
// Each cell contains hyperlink to file: <preface>_<row name>_<column name>.<ext>
//
// Revisions
//
// 20-apr-2007 Creation
//
// Fred Bosveld (KNMI)
//
//---------------------------------------------------------------------------------
//
function table_row_col(title,preface,row_name,col_name,ext)
{
  var i
  var j
  var nrow=row_name.length
  var ncol=col_name.length

  document.write('<p></p>'+title+'<br>')
  document.write('<table border>')

  document.write('<tr><td>&nbsp;</td>')
  for (j=1;j<=ncol;j++)
    {document.write('<td>'+col_name[j-1]+'</td>')}
  document.write('</tr>')

  for (i=1;i<=nrow;i++)
  { document.write('<tr><td>'+row_name[i-1]+'</td>')
    for (j=1;j<=ncol;j++)
    { document.write('<td><a href="'+preface+'_'+row_name[i-1]+'_'+col_name[j-1]+'.'+ext+'" target="home"><center>*</center></a></td>')}
    document.write('</tr>')
  }

  document.write('</tr></table>')
}
//---------------------------------------------------------------------------------
//
// Produces table with row and column headers given in arrays.
// Each cell contains hyperlink to file: <dir(col)>_<preface>_<row name(row)>_<postface>
//
// Revisions
//
// 28-oct-2010 Creation
//
// Fred Bosveld (KNMI)
//
//---------------------------------------------------------------------------------
//
function table_row_col_dir(title,dir,preface,row_name,col_name,postface)
{
  var i
  var j
  var nrow=row_name.length
  var ncol=col_name.length

  document.write('<p></p>'+title+'<br>')
  document.write('<table border>')

  document.write('<tr><td>&nbsp;</td>')
  for (j=1;j<=ncol;j++)
    {document.write('<td>'+col_name[j-1]+'</td>')}
  document.write('</tr>')

  for (i=1;i<=nrow;i++)
  { document.write('<tr><td>'+row_name[i-1]+'</td>')
    for (j=1;j<=ncol;j++)
    { document.write('<td><a href="'+dir[j-1]+preface+'_'+row_name[i-1]+'_'+postface+'" target="home"><center>*</center></a></td>')}
    document.write('</tr>')
  }

  document.write('</tr></table>')
}
//---------------------------------------------------------------------------------
//
// Adds number of months to yyyymm and output yyyymm format
//
// Revisions
//
// Fred Bosveld (KNMI)
//
//---------------------------------------------------------------------------------
//
function roundmonth(i,month)
{
  var j;
  j=month+i;
  if (i>=0)
    {while (j-100*Math.floor(j/100)>12)
    {j=j+88;}}
  else
    {while ( (j-100*Math.floor(j/100)>12)||(j-100*Math.floor(j/100)==0))
    {j=j-88;}}
  return j;
}
 


