// Gebraucht in:Listenansicht bei eigentümerabrechung: checkboxen werden abgefragt und die ids als array zurückgegeben
function check_checkboxes(checkboxname){
	var j=0;
	var idarray = new Array();
	d=document.all[checkboxname];
	for(i=0;i<d.length;i++){
		if(d[i].checked){
			j++;
			idarray.push(d[i].value);
			//alert (d[i].value);
		}
	}
	//alert('Aktivierte Checkboxen: '+j+' '+idarray);
	document.all["eab_id"].value=idarray;
	return idarray;
}


function setPointeron(theRow)
{
    if (typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = "#FFFFFF";
    }

    return true;
}

function setPointeroff(theRow)
{
    if (typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = "#F9F5EF";
    }

    return true;
}

function loadwindow(fname)
	{
	delwindow = window.open(fname,'message', 'menubar=no,resizeable=no,scrollbars=no,titlebar=no,width=250,height=140');
	delwindow.moveTo((screen.availWidth-300)/2,(screen.availHeight-100)/2);
	}
	
function dateiload(headline)
	{
	parent.headline.location.href = headline;
	}



/**********************************
	* Kann dazu benutzt werden, beim nächsten Seitenaufruf an die Position y zu springen (Pixel Offset
	* Der Sprung erfolgt am Ende der Seitenausgabe in der Datei adminstart.php 
	* Der Name des Formulars mit dem Hiddenfeld muss angegeben werden 
	************************************/
function set_position(myButtonName)
{
  var scroll_pos = window.pageYOffset;
  //document.edit_to_save["scroll_pos"].value=scroll_pos;
  formularname = document.getElementsByName(myButtonName.name)[0].form.name;
 // alert(document.getElementsByTagName("form")[0].name);
  //formularname = document.getElementsByName(updobj.name)[0].form.name
  if(document.forms[formularname].elements['scroll_pos']) 
  {
  	document[formularname]["scroll_pos"].value=scroll_pos;
  }
 // alert(scroll_pos);
}

function jumpto_position(y)
{
 window.scrollTo(0,y);
 //alert(y);
}


function fensteropen(pfile,weit,hoch,sbar)
		{
		attr = "scrollbars=" + sbar +",width=" + weit + ",height=" + hoch;
	  	window.open(pfile,"eingabe",attr);
		}
	
	function dateiload(headline)
		{
		parent.headline.location.href = headline;
		}
		
	function check(text)
	{
			Check = confirm(text);
			return Check;
	}
	

		function goto(marker)
		{
			var wert = document.all.part3.offsetTop;
			window.scrollTo(0,document.all.marker.offsetTop);
			
		}
		
  
  window.onload = function() 
	{
		//optionale automatische markersprünge//
		//if (document.all.part1) window.scrollTo(0,document.all.part1.offsetTop);
		//if (document.all.part2) window.scrollTo(0,document.all.part2.offsetTop);
		//if (document.all.part3) window.scrollTo(0,document.all.part3.offsetTop);
		//if (document.all.part4) window.scrollTo(0,document.all.part4.offsetTop);
		//if (document.all.part5) window.scrollTo(0,document.all.part5.offsetTop);
		//if (document.all.part6) window.scrollTo(0,document.all.part6.offsetTop); 
		//if (document.all.part7) window.scrollTo(0,document.all.part7.offsetTop);
		
		for (var i = 0; i <= document.getElementsByTagName("textarea").length-1; i++)
		{
      var t = document.getElementsByTagName("textarea")[i];
      var nls = t.value.split("\n");
     	var count = nls.length;
      t.rows = count;
      //t.style.overflow = "hidden";
          
      t.onkeyup = function() 
      {
        var nls = this.value.split("\n");
        var count = nls.length;
        for (var i = 0; i < nls.length; ++i) 
        {
          if (nls[i].length > this.cols) 
          {
            //++count;
            count += Math.floor(nls[i].length / this.cols);
          }
        }
        this.rows = count;
      }
    } 
  }

	function winopen(width,height,url) {
			// Here resize the PopUp
			var popUpSizeX=width;
			var popUpSizeY=height;
			
			// Here move it to any poiny on screen	
			var popUpLocationX=25;
			var popUpLocationY=02;
			
			// URL of the popUp
			var popUpURL = url;
			
			
			splashWin = window.open("",'_popup','fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=0');
			
			splashWin.blur();
			window.focus();
			
			splashWin.resizeTo(popUpSizeX,popUpSizeY);
			splashWin.moveTo(popUpLocationX,popUpLocationY);
			splashWin.location=popUpURL;
			splashWin.focus();
	}
