/* Spezielle Funktionen zum Ausdrucken mit Druckvorschau 
 Hier erfolgt das Ausdrucken mit Hilfe eines switches von media = print auf media= all  */

function wechsleBackground()
{
  this.style.backgroundColor = "#FFF";
}

function getMouseoverBackground()
{
  this.style.backgroundColor = "#4A5D97";
}

function getMouseoutBackground()
{
  this.style.backgroundColor = "#6572A6";
}


/* Schaltet VON  Media=Print Media = all um */
function printPreview()
{ 
	var currCSS = document.getElementById('printCSS');
	var druckLiElem = document.getElementById("druckli");
	var previewLink = document.getElementById("druck");
	
	//alert(' media : ' + currCSS.media + ' 1 // ');
  if(currCSS.media == 'all') {
	  currCSS.media = 'print';
	  // speziell hier:  Farbe des Listenelements für Druck muß beim Switch ebenfalls angepaßt werden
	  druckLiElem.style.backgroundColor = "#6572A6";
	  druckLiElem.style.width = "34px";
	  // Verwendet Funktionsreferenzen
	  druckLiElem.onmouseover = getMouseoverBackground;
    druckLiElem.onmouseout = getMouseoutBackground;
    previewLink.firstChild.src = "uploads/media/btn_drucken.gif";
    previewLink.firstChild.height = "20";
    previewLink.firstChild.width = "20";
    if ((druckLink2=document.getElementById("druck2")) != "")
      document.getElementById("druckli").removeChild(druckLink2); 
  }
	else { 
    currCSS.media = 'all';
	  druckLiElem.style.backgroundColor = "#FFF";
	  druckLiElem.style.width = "105px";
	   // Verwendet Funktionsreferenzen
	  druckLiElem.onmouseover = wechsleBackground;
    druckLiElem.onmouseout = wechsleBackground;
   
    druckLink2 = document.getElementById("druck").cloneNode(true);
    druckLink2.id = "druck2";
    previewLink.firstChild.src = "uploads/media/btn_back.gif";
    previewLink.firstChild.height = "15";
    previewLink.firstChild.width = "65"; 
    
    document.getElementById("druckli").appendChild(druckLink2);
    //  wichtig: setzt auf den Druckbutton auf Window.print()
    druckLink2.setAttribute("href","javascript:window.print()");
  }
}

