	function enlargenote()
	{
		var a = document.getElementById("note");
		var b = a.value.match(/\n/gi);
		var r = parseInt((a.value.length + 10) / a.cols, 10);
		if (r>0) a.rows = r; else a.rows = 1;
		if(b) a.rows += b.length;
		a.rows++;
	}
	
	
	//expand
	
	function expandcollapse(contentid, buttonid)
{
     if (document.getElementById(contentid).style.display == 'none') <!-- Wenn momentan der Content ausgeblendet ist ... -->
     {
          document.getElementById(contentid).style.display = ''; <!-- ... den Content einblenden ... -->
          document.getElementById(buttonid).src = 'img/attachment.png'; <!-- ... und das das Collapse Symbol anzeigen. -->
     }
     else if(document.getElementById(contentid).style.display == '') <!-- Wenn der Content momentan eingeblendet ist ... -->
     {
          document.getElementById(contentid).style.display = 'none'; <!-- den Content ausblenden ... -->
          document.getElementById(buttonid).src = 'img/add_attachment.png'; <!-- ... und das Expand Symbol anzeigen. -->
     }
}
	
	
	
	
//upload Start

function validate(){
 var theForm = document.form;
 var isError = true;
 for(i=0;i<theForm.elements.length;i++) {
  if( (theForm.elements[i].type).toLowerCase()=="file" && trim(theForm.elements[i].value)!="") {
      isError=false;
     }
 }
 if(isError) alert("Bitte mindestens eine Datei auswählen!");
 return !isError;
}

function trim(str) {
 return str.replace( /^\s*/, '').replace( /\s*$/, '' );
}

function AddRowsToTable() {
 var tbl = document.getElementById('dateiupload');
 var lastRow = tbl.rows.length;
 var iteration = lastRow;   
 if (iteration < 10) {   
   var row = tbl.insertRow(lastRow);
 
   var cellRight = row.insertCell(0);
   var el = document.createElement('input');
   el.setAttribute('type', 'file');
   el.setAttribute('name', 'uploadfile[]');

   el.setAttribute('size', '40');
   cellRight.setAttribute('id',iteration)
   cellRight.appendChild(el);
   var aa = document.createElement("a");
   aa.setAttribute('href', '#');
   var clickName = new Function("DeleteRow(this)");
   aa.onclick = clickName;
   aa.innerHTML = "&nbsp;&nbsp;remove";
   cellRight.appendChild(aa);
 } else {
   alert('Maximal 10 Dateien gleichzeitig zugelassen.');
 }
}
function DeleteRow(x)
{
     while (x.tagName.toLowerCase() !='tr')
     {
          if(x.parentElement)
             x=x.parentElement;
        else if(x.parentNode)
             x=x.parentNode;
        else
             return;
     }
     var rowNum=x.rowIndex;
     while (x.tagName.toLowerCase() !='table')
     {
          if(x.parentElement)
             x=x.parentElement;
        else if(x.parentNode)
             x=x.parentNode;
        else
             return;
     }
     x.deleteRow(rowNum); 
}

function RemoveRowFromTable(rowid) {
 var tbl = document.getElementById(iteration);
 //var lastRow = tbl.rows.length;
 //if (lastRow > 1)
 tbl.deleteRow(rowid);
}



