function show(Id) {
var upload = document.getElementById('Lay'+Id);
var text = document.getElementById('text');
if (upload.style.display == 'none') {
upload.style.display = '';
text.style.display = 'none';
} else {
upload.style.display = 'none';
}}


//@autor Slava, www.php-resource.de
//tipparbeit sparen
var $=function(id){return document.getElementById(id);}

/* function Kalender
@parameter jahr: gewünschte Jahr
@parameter monat: gewünschte Monat
wenn jahr und monat auf 0 gesetzt sind, wird aktuele Jahr und monat angezeigt.
@parameter dok_id: id von einem div oder span, in dem Kalender angezeigt wird
@parameter textfeld_id: id von einem textfeld oder verstecktem feld, in der angeklikte Datum
 übertragen wird
**/

function Kalender(jahr,monat,dok_id,textfeld_id)
{
   var date ;
   
   if(jahr==0&&monat==0)  date=new Date();
   else
   date=new Date(jahr,monat-1,1);
   
   var datakt=new Date();
   var aktjahr=date.getYear();
   //opera problem
   if (aktjahr < 999)
   aktjahr += 1900;

   var ausgabe="";
   var mm=date.getMonth();
   var dd=0;
   if(datakt.getMonth()==mm)
   var dd=datakt.getDate();

   var tageszahl;
   if(mm==1)
   {//anzal von tagen im februar ermiteln
      if((jahr % 4 == 0 && jahr % 100 != 0) || jahr % 400 == 0){  tageszahl=29;  }
      else  {tageszahl=28;}
   }
   else
      {
         if(mm == 3 || mm == 5 || mm == 8 || mm == 10)tageszahl=30;
         else tageszahl=31;
      }
   var fmm=mm<9?("0"+(mm+1)):mm+1;
   var yy=date.getYear();
   if(yy < 1900)yy+=1900;
   format=date.toLocaleString(mm);
   erg=format.slice(format.indexOf(".")+1,format.lastIndexOf(" "));
   
   //Wochentag des 1. des Monats ermitteln
   date.setDate(1);
   var kk=date.getDay();
   if(kk == 0)kk=7;
   ausgabe+='<table style="border-color:#5b5b5b;width:250px; border-style:solid" bgcolor="#F1F1F1">';
   ausgabe+='<tr><td colspan="6"><font size=+1>'+erg+'</font></td>';
   ausgabe+='<td><span style="text-align:left;color:red;font-weight:bold;cursor:pointer;" id="schliss">';
   ausgabe+='X</span><br></td></tr>';
   ausgabe+='<tr><td colspan="7">Jahr:&nbsp;&nbsp;<select id="jahr">&nbsp;';

   for(a=1920;a<=2400;a++)
   {
      ausgabe+='<option value="'+a+'" ';
      if(a==aktjahr)    ausgabe+='selected="selected"  ';
      ausgabe+='>'+a+'</option>';
   }

   ausgabe+='</select>';
   ausgabe+='&nbsp;Monat:&nbsp;&nbsp;<select id="monatl">';
   for(a=1;a<=12;a++)
   {
      ausgabe+='<option value="'+a+'" ';
      if(a==mm+1)ausgabe+='selected="selected" ';
      ausgabe+='>'+a+'</option>';
   }
   ausgabe+='</select></td></tr>';

   ausgabe+="<tr><th width='25'>Mo</th><th width='25'>Di</th><th width='25'>Mi</th>";
   ausgabe+="<th width='25'>Do</th><th width='25'>Fr</th><th width='25'>Sa</th><th width='25'>So</th></tr>";
   ausgabe+="<tr>";
   //erste Zeile auffuellen

   if(1<kk)  ausgabe+='<td colspan="'+(kk-1)+'">&nbsp;</td>';

   for(ii=1; ii<=tageszahl; ii++)
   {
      tagi=(ii<10)?("0"+ii):ii;
      if(ii == dd)
      {
      ausgabe+='<td ><b><u><span name="kalendertag" style="color:red;cursor:pointer" onclick="$(\''+textfeld_id+'\').value=\''+yy+'-'+(fmm)+'-'+tagi+'\';$(\''+dok_id+'\').innerHTML=\'\';">'+ii+'</span></u></b ></td>';
      } else{
      ausgabe+='<td><span name="kalendertag" style="color:#636363;cursor:pointer" onclick="$(\''+textfeld_id+'\').value=\''+yy+'-'+(fmm)+'-'+tagi+'\';$(\''+dok_id+'\').innerHTML=\'\';">'+ii+'</span></td>';
      }
      
      kk++;
      
      if(kk > 7)
      {
         ausgabe+="</tr>\n<tr>";
         kk=1;
      }
   }
   ausgabe+='<td colspan="'+(7-(kk-1))+'">&nbsp;</td>';
   ausgabe+="</tr></table>";


   $(dok_id).innerHTML = ausgabe;
   
   
   
   
   $("schliss").onclick= function(){$(dok_id).innerHTML="";}
   $("jahr").onchange= $("monatl").onchange= function ()
   {
      j=$("jahr").options[$("jahr").selectedIndex].text;
      m=$("monatl").options[$("monatl").selectedIndex].text;
      Kalender(j,m,dok_id,textfeld_id);
   };

}


