//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Vorladen von Images
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function preloadImg()
{
  var d=document;
  if(d.images)
  {
   if(!d.macu_p)
    d.macu_p=new Array();
    var i,j=d.macu_p.length,a=preloadImg.arguments;
    for(i=0; i<a.length; i++)
     if (a[i].indexOf("#")!=0)
     {
      d.macu_p[j]=new Image;
      d.macu_p[j++].src=a[i];
     }
  }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function swapImage()
{
  var i,j=0,x,a=swapImage.arguments;
  document.macu_sr=new Array;
  for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null)
   {
    document.macu_sr[j++]=x;
    if(!x.oSrc)
     x.oSrc=x.src;
     x.src=a[i+2];
   }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function findObj(n, d)
{
  var p,i,x;
  if(!d)
   d=document;
   if((p=n.indexOf("?"))>0&&parent.frames.length)
   {
    d=parent.frames[n.substring(p+1)].document;
    n=n.substring(0,p);
   }
   if(!(x=d[n])&&d.all) x=d.all[n];
   for (i=0;!x&&i<d.forms.length;i++)
    x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    x=findObj(n,d.layers[i].document);
    return x;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function swapImgRestore()
{
  var i,x,a=document.macu_sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
  x.src=x.oSrc;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function displayStatusMsg(msgStr)
{
  status=msgStr;
  document.returnValue = true;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function Go()
{
 window.location.href = document.bc.schemata.value;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function openPrint()
{
 var calc = document.bc.calc.value;
 
 var risk_l = document.bc.risk_l.value;
 var risk_i = document.bc.risk_i.value;
 var risk_h = document.bc.risk_h.value;
 
 if (calc == "syl")
 {
  var anzahl  = document.bc.anzahl.value;
  var size    = document.bc.size.value;
  var rez     = document.bc.rez.value;
  var tklasse = document.bc.tklasse.value;
  var cis     = document.bc.cis.value;
  var dif     = document.bc.dif.value;
  
  var rp1y = document.bc.rp1y.value;
  var rp5y = document.bc.rp5y.value;
  var pp1y = document.bc.pp1y.value;
  var pp5y = document.bc.pp5y.value;

  window.open('../php/print_result.php?calc=syl&risk_l='+risk_l+'&risk_i='+risk_i+'&risk_h='+risk_h+'&anzahl='+anzahl+'&size='+size+'&rez='+rez+'&tklasse='+tklasse+'&cis='+cis+'&dif='+dif+'&rp1y='+rp1y+'&rp5y='+rp5y+'&pp1y='+pp1y+'&pp5y='+pp5y, '','width=670,height=750,scrollbars=yes,resizeable=yes,left=100,top=100,status=yes,menubar=yes,hotkeys=yes,toolbar=yes');
 }
 else
 {
  var rate = document.bc.rate.value;
  var size = document.bc.size.value;
  var grad = document.bc.grad.value;
  var late = document.bc.late.value;
  var post = document.bc.post.value;
  var dome = document.bc.dome.value;
  
  window.open('../php/print_result.php?calc=kurth&risk_l='+risk_l+'&risk_i='+risk_i+'&risk_h='+risk_h+'&rate='+rate+'&size='+size+'&grad='+grad+'&late='+late+'&post='+post+'&dome='+dome, '','width=670,height=700,scrollbars=yes,resizeable=yes,left=100,top=100,status=yes,menubar=yes,hotkeys=yes,toolbar=yes');
 }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function chgColor(nr)
{
 document.getElementById("r" + nr).bgColor= "#F9B29F";
 document.getElementById("l" + nr).bgColor= "#FDD7C9";
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function chgColorBack(nr)
{
 document.getElementById("r" + nr).bgColor= "#FFF2EE";
 document.getElementById("l" + nr).bgColor= "#FEE9E1";
}

