
var month;
var year;
var month_names = new Array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");
  
  
function initNews(monat,jahr) {    
    
      month = monat;      
      year = jahr; 
     
       
    if (!year && !month)  // die funktion wird zum 1. mal aufgerufen
    { 
       dt      = new Date();
       year    = dt.getFullYear();
       month   = dt.getMonth()-1;                                        
    }
    else
    {      
      if (month > 11)
      {
         month = 0;
         year++;
      }
      if (month < 0)
      {
         month = 11;
         year--;
      }
      
      if (year > 2015)
      {
         year = 2006;         
      }
      if (year < 2006)
      {
         year = 2015;         
      }
      
    }
    
    
    if (document.getElementById)
    {
        cnt = document.getElementById("news_navi");        
    }
    else
    {
     if (document.all)
     {
        cnt = document.all["news_navi"];        
     }
    }
    
    
    str = "";
    str += '<form method="post" action="index.php?page=2">';
    str += '<table style="margin-left:75px;text-align:center;width:400px;"><tr><td>';
    
    // Monat        
    str += '<a style="color:#ffffff" href="javascript:month--; initNews(month,year);">&laquo;</a> ';
    str += '<select id="select_month" name="monthsel" onchange="month = parseInt(document.getElementById(\'select_month\').value);">';
    for (i =0; i < 12; i++)
    {
        if (i == month)
           selected = ' selected="selected"';
        else
           selected = '';
        str += '<option value="' + i + '" ' + selected + '>' + month_names[i] + '</option>';
    }
    str += '</select>';
    str += ' <a style="color:#ffffff" href="javascript:month++; initNews(month,year);">&raquo;</a>';    
      
    
    str += '</td><td>';
    
    
    // Jahr
    startyear = 2006;
    endyear   = 2015;
    

    str += '<a style="color:#ffffff" href="javascript:year--; initNews(month,year);">&laquo;</a> ';
    str += '<select id="select_year" name="yearsel" onchange="year = parseInt(document.getElementById(\'select_year\').value);">';
    for (i = startyear; i <= endyear ; i++)
    {
        if (i == year) 
            selected = ' selected="selected"';
        else
            selected = '';
        str += '<option value="' + i + '" ' + selected + '>' + i + '</option>';
    }
    str += '</select>';
    str += ' <a style="color:#ffffff" href="javascript:year++; initNews(month,year);">&raquo;</a>';


    str += '</td><td>';
    str += '<input type="submit" style="width:80px;" value=" filtern ">';
            
    
    str += '</td></td><table>';
    str += '</form>';
    
       
    cnt.innerHTML = str;
    
    
    
}

