function setSize() {


    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }

    if((myWidth - 240)>500)
        document.getElementById("img_banner").style.width = (myWidth - 240) + "px";
    else
        document.getElementById("img_banner").style.width = "500px";
        
    var h = myHeight - document.getElementById("img_banner").style.height - 375;

    var w = (myWidth - 450);

   // document.getElementById("debug").value = myHeight;
    
    if (h < 250)
        h = 250;
    
    if (w < 600)
        w = 600;
        
   
    document.getElementById("div_inhalt").style.height = h + "px";

    if(document.getElementById("div_rechts") != null)
    	{
    		if_w = w-120;
    		document.getElementById("div_inhalt").style.width = (w-120) + "px" ;
    	}
    else
      {
		if_w = w+125;
      	document.getElementById("div_inhalt").style.width = (w+125) + "px";
      }
    
     if(document.getElementById("div_rezept") != null)
      {
        document.getElementById("div_submenue").style.height = (h-100) + "px";
      }
     else
      {
     	 	document.getElementById("div_submenue").style.height = "100%";
      }
      
    if(document.getElementById("if_sortimentsliste") != null)
    	{
    		document.getElementById("if_sortimentsliste").style.height = (h-5) + "px" ;
    		document.getElementById("if_sortimentsliste").style.width = (if_w-5) + "px";    		
    	}
}

function myWindowOpen(url,name,width,height,scrollbars)
{
  
  var ScreenX = screen.width;
  var ScreenY = screen.height;
  
  var CenterX = ScreenX/2;
  var CenterY = ScreenY/2;

  var left = CenterX - width/2;
  var top  = CenterY - height/2;
  
  var mywindow=window.open(url,name,'width='+width+',top='+top+',left='+left+',height='+height+',scrollbars='+scrollbars);
  
  return false;
}


function setImage(id, mode)
{
	try
	{
		var obj = document.getElementById(id);

		if (obj.className!='mode2')
		{
			if (mode==0) 
			{
				obj.innerHTML='';
			}
			else if (mode==1) 
			{
				obj.innerHTML="<img id='mode1' src='../../../images/rechteck_rot.gif' border='0'>";
				obj.className='mode1';
			}
			else if (mode==2) 
			{
				obj.innerHTML="<img id='mode2' src='../../../images/rechteck_blau.gif' border='0'>";
				obj.className='mode2';
			}
		}
	}
	catch (e)
	{
	}
}

function formatFirstLetter(id)
{
	try
	{
		var obj = document.getElementById(id);
		var mychar = obj.innerHTML.charAt(0);

		if ((mychar!="<") && (mychar!="")  && (mychar!=" ")&& (mychar!="\n") && (obj.innerHTML.charCodeAt()!=13))
	  	obj.innerHTML = "<span style='background-image:url(../../../images/herz.gif); width:22px; background-repeat:no-repeat;' class='first'>&nbsp;&nbsp;"+mychar+"</span>"+obj.innerHTML.substring(1,obj.innerHTML.length)
	 }
	 catch (e)
	 {
	 }
}




function drucken (id)
{
	try
	{
  	var text = document.getElementById(id).innerHTML;
				
		ParaString = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,WIDTH=700,HEIGHT=600';
    druck = window.open ('', 'fenster',ParaString);
    druck.document.clear();
    druck.document.open();
    druck.document.write ("<html><head><!-- PageID 4 - published by RedDot 7.5 - 7.5.1.75 - 25078 -->\n");
		druck.document.write ("<link href='../../../styles/styles.css' type='text/css' rel='stylesheet'>\n");
    druck.document.write ("<title>Druckansicht</title></head><body onload='self.print()'>");
    druck.document.write ("<center>"+text+"</center>");
    druck.document.write ("</body></html>");
    druck.document.close();
   }
   catch(e)
   {
   	window.print();
   }  
 }
 
 function preloadImages() 
 {
	  var d=document; 
	  if(d.images)
	  { 
	  	if(!d.MM_p) 
	  		d.MM_p=new Array();
	    
	    var i,j=d.MM_p.length,a=preloadImages.arguments; 
	    
	    for(i=0; i<a.length; i++)
	    {
	    	if (a[i].indexOf("#")!=0)
	    	{ 
	    		d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
	    	}
	    }
	  }
	}
	
	
	function getElementHeight(e)
	{
	  try
	  {
	    var obj = document.getElementById(e);
	    if (obj!=null)
	    {
	      if (!isNaN(obj.offsetHeight))
	        return obj.offsetHeight;
	      else return 0;
	     }
	     else return 0;
	  }
	  catch (e)
	  {
	    return 0;
	  }
	}
	
	
	function setFormHeight()
	{
	  try
	  {
			var obenheight = 165;
			var untenheight = 0;
			var documentheight = document.body.offsetHeight;
			var formheight = documentheight-obenheight-untenheight;
			document.getElementById('content').style.height = formheight;
	  }
	  catch (e)
	  {
	  }
	}