//array push/pop - IE5Mac

//array push/pop - IE5Mac

//$gd_i = $Rate/12;   Rate=Zinssatz NPer=Anzahl Monate Pv=Anschaffungswert Fv=Restwert Type= 1(vorschüssig) 0(nachschüssig
//$gd_i100 = $gd_i/100;
//$gd_i1 = $gd_i100+1;
//$gd_ipow = 1/pow( $gd_i1, $Nper );
//$gd_p0 = -$Pv-$Fv*$gd_ipow;
//$gd_p100 = $gd_p0*$gd_i100;

//$nachschuss = $gd_p100/(1-$gd_ipow);
//return $nachschuss/(1+$gd_i100*$myType);

var allesok=0;
var $sperren="FAIL";



function sperren(){
	
	$sperren="OK";
	document.getElementById("anfragenbutton").disabled=true;

}

function seiteAufrufen($page){
	
	window.location.href=$page;

}

function checkform()
{
	allesok=0;
	
	if(document.getElementById("nachnameedit").value=="") allesok++;
	if(document.getElementById("ortedit").value=="") allesok++;
	if(document.getElementById("mailedit").value=="") allesok++;
	
	if(document.getElementById("id104passwortedit").value=="") allesok++;
	if(document.getElementById("passwortwiededit").value=="") allesok++;
	if(document.getElementById("id104passwortedit").value!=document.getElementById("passwortwiededit").value) allesok++;
	
	if(document.getElementById("id104passwortedit").value!=document.getElementById("passwortwiededit").value)
	{
		document.getElementById("statusb").innerHTML="<p>keine &Uuml;bereinstimmung der Passw&ouml;rter</p>";	
	}else{
		document.getElementById("statusb").innerHTML="<p> </p>";	
	}

	if(allesok!=0)
	{
		document.getElementById("statusa").innerHTML="<p>*Pflichtfelder m&uuml;ssen noch ausgef&uuml;llt werden.</p>";	
	}else{
		document.getElementById("statusa").innerHTML="<p> </p>";	
	}

	if(allesok>0){
		document.getElementById("senden").disabled=true;
	}else{
		document.getElementById("senden").disabled=false;
	}

}

function checkformb()
{
	var allesokb=0;
	allesok=0;
	
	var feldertext="*Pflichtfelder ausf&uuml;llen. Bitte eine Ratenvariante w&auml;hlen.";
	
	if(document.getElementById("lieferedit").value=="") allesok++;
	if(document.getElementById("inedit").value=="") allesok++;
	if(document.getElementById("kundeedit").value=="") allesok++;
	if(document.getElementById("ansppartedit").value=="") allesok++;
	if(document.getElementById("strhausedit").value=="") allesok++;
	if(document.getElementById("id54plzedit").value=="") allesok++;
	if(document.getElementById("id55ortedit").value=="") allesok++;
	if(document.getElementById("teledit").value=="") allesok++;
	if(document.getElementById("id60faxedit").value=="") allesok++;
	
	if(document.getElementById("CheckboxGroup1_1").checked==true) allesokb++;
	if(document.getElementById("CheckboxGroup1_2").checked==true) allesokb++;
	if(document.getElementById("CheckboxGroup1_3").checked==true) allesokb++;
	if(document.getElementById("CheckboxGroup1_4").checked==true) allesokb++;
	
	if(document.getElementById("CheckboxGroup2_1").checked==true) allesokb++;
	if(document.getElementById("CheckboxGroup2_2").checked==true) allesokb++;
	if(document.getElementById("CheckboxGroup2_3").checked==true) allesokb++;
	if(document.getElementById("CheckboxGroup2_4").checked==true) allesokb++;
	
	//if(document.getElementById("CheckboxGroup3_1").checked==true) allesokb++;
	//if(document.getElementById("CheckboxGroup3_2").checked==true) allesokb++;
	//if(document.getElementById("CheckboxGroup3_3").checked==true) allesokb++;
	if(document.getElementById("CheckboxGroup3_4").checked==true) allesokb++;
	

	
	if(allesok==0 && allesokb==1){
		document.getElementById("button1").disabled=false;
		document.getElementById("button2").disabled=false;
		document.getElementById("button3").disabled=false;
		document.getElementById("button4").disabled=false;
		$('#id96').hide();
	}else{
		if(allesok==0 && allesokb!=1) feldertext="Bitte <strong><em>eine</em></strong> Ratenvariante w&auml;hlen.";
		if(allesok>0 && allesokb==1) feldertext="*Pflichtfelder ausf&uuml;llen.";
		document.getElementById("button1").disabled=true;
		document.getElementById("button2").disabled=true;
		document.getElementById("button3").disabled=true;
		document.getElementById("button4").disabled=true;
		$('#id96').fadeTo(400, 1.0);
	}
	document.getElementById("id96").innerHTML="<p> "+feldertext+"</p>";
}

function calcValue(rate, nper, pv, fv, type)
{
	var gd_i=rate/12;
	var gd_ia=gd_i/100;
	var gd_ib=gd_ia+1;
	var gd_ipow = 1/Math.pow(gd_ib, nper);
	var gd_pc = -pv+fv*gd_ipow;
	var gd_pa = gd_pc*gd_ia;
	var nachschuss = gd_pa/(1-gd_ipow);
	var ergebnis=nachschuss/(1+gd_ia*type);
	    //ergebnis=Math.round(ergebnis*100)/100;
		ergebnis=formatZahl(ergebnis,2,true);
	return ergebnis;
}
function calcValueX(rate)
{
	ergebnis=formatZahl(rate,2,true);
	return ergebnis;
}
function changeValue()
{
	
	
	var $temp=document.getElementById("eingabe3").value.replace(/,/, ".");
	document.getElementById("eingabe3").value=$temp;
	$temp=document.getElementById("eingabe2").value.replace(/,/, ".");
	document.getElementById("eingabe2").value=$temp;
	
	if($sperren=="OK") document.getElementById("anfragenbutton").disabled=false;
	
	var anzahlung=document.getElementById("eingabe3").value;
	var restwert=document.getElementById("eingabe2").value*0.05;

	var wert=document.getElementById("eingabe2").value;
	var restwertbereinigt=formatZahl(restwert*-1,2,true);
	
	
	document.getElementById("w1").innerHTML="<p> "+calcValue(zleasing,48,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+" &#8364;</p>";
	document.getElementById("w2").innerHTML="<p> "+calcValue(zleasing,60,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+" &#8364;</p>";
	document.getElementById("w3").innerHTML="<p> "+calcValue(zleasing,72,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+" &#8364;</p>";
	document.getElementById("w4").innerHTML="<p> "+calcValue(zleasing,84,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+" &#8364;</p>";
	document.getElementById("w5").innerHTML="<p> "+restwertbereinigt+" &#8364;</p>";
	
	document.getElementById("w1kopie").innerHTML="<p> "+calcValue(zmietkauf,48,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+" &#8364;</p>";
	document.getElementById("w2kopie").innerHTML="<p> "+calcValue(zmietkauf,60,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+" &#8364;</p>";
	document.getElementById("w3kopie").innerHTML="<p> "+calcValue(zmietkauf,72,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+" &#8364;</p>";
	document.getElementById("w4kopie").innerHTML="<p> "+calcValue(zmietkauf,84,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+" &#8364;</p>";
	
	var privatrate=((document.getElementById("eingabe2").value-anzahlung)*.0085)*-1;
	privatrate=calcValueX(privatrate);
	if (document.getElementById("eingabe2").value>4999) document.getElementById("w4kopie2").innerHTML="<p> "+privatrate+" &#8364;</p>";
	if (document.getElementById("eingabe2").value<5000) document.getElementById("w4kopie2").innerHTML="<p>---</p>";
	
	SetVals(wert,anzahlung,document.getElementById("eingabe1").value,"leer");

}


function formatZahl(zahl, k, fix) {
    
	zahl*=-1;
	
	if(!k) k = 0;
    var neu = '';
 
	var dec_point = ',';
	var thousands_sep = '.';
 
    // Runden
    var f = Math.pow(10, k);
    zahl = '' + parseInt(zahl * f + (.5 * (zahl > 0 ? 1 : -1)) ) / f ;
 
    // Komma ermittlen
    var idx = zahl.indexOf('.');
 
    // fehlende Nullen einfügen
    if(fix)    {
         zahl += (idx == -1 ? '.' : '' )
         + f.toString().substring(1);
    }
	var sign = zahl < 0;
	if(sign) zahl = zahl.substring(1);
    idx = zahl.indexOf('.');
 
	// Nachkommastellen ermittlen
    if( idx == -1) idx = zahl.length;
    else neu = dec_point + zahl.substr(idx + 1, k);
 
 
    while(idx > 0)    {
        if(idx - 3 > 0)
        neu = thousands_sep + zahl.substring( idx - 3, idx) + neu;
        else
        neu = zahl.substring(0, idx) + neu;
        idx -= 3;
    }
    return (sign ? '-' : '') + neu;
}






function p2h_push( v )
{
  this[this.length]=v;
}

function p2h_pop()
{
   if(this.length > 0)
   {
  var v = this[this.length -1];
  this.length--;
  return( v );
   }
}

function P2H_ImgSwap(divName, imgPath)
{
  var lyr =document.getElementById(divName);
  if(lyr)
  {
    lyr.style.background = 'url('+imgPath+')';
  }
}

function P2H_GetElementsByClass(className)
{
    var c=0;
    var i=0;
    var tagCollect = new Array();
    var tags = document.getElementsByTagName("*");
if(tags.length == 0){ /*  Safari 1.0 kludge. */ tags=document.getElementsByTagName("div"); }

    for (i=0; i < tags.length; i++)
    {
        if (tags[i].className==className)
        {
        tagCollect[c]=tags[i];
            c++;
        }
    }
    return(tagCollect);
}

function P2H_SetVisibilityByC(className, show)
{
   var arg = 'hidden';
   var i=0;
   if(show){ arg = 'visible';}
   var lyrArray = P2H_GetElementsByClass(className);
   for(i=0; i < lyrArray.length; i++)
   {
     lyrArray[i].style.visibility = arg;
   }
}

function P2H_Menu(menuClassName, delay, level)
{
  P2H_StopClock();
  window.p2h_delay=delay;
  P2H_SetMenu(menuClassName, level);
  P2H_SetVisibilityByC(menuClassName, true);
  P2H_SetVisibilityByC(menuClassName+"hide", false);
  if(level==0){P2H_SetVisibilityByC("hidey", false);}
}

function P2H_MenuItem(level)
{
  P2H_StopClock();
  P2H_ClearMenu(level);
}

function P2H_ClearMenu(level)
{
  if(window.p2h_popmenuarray)
  {
    while(window.p2h_popmenuarray.length > level)
    {
  var cname = p2h_popmenuarray.pop()
      P2H_SetVisibilityByC(cname, false);
  P2H_SetVisibilityByC(cname+"hide", true);
    }
  }
  if(level==0){ P2H_SetVisibilityByC("hidey", true); }
}

function P2H_SetMenu(menuClassName, level)
{
  if(! window.p2h_popmenuarray)
  { 
  window.p2h_popmenuarray = new Array(); 
if(!window.p2h_popmenuarray.push){window.p2h_popmenuarray.push=p2h_push;}
if(!window.p2h_popmenuarray.pop){window.p2h_popmenuarray.pop=p2h_pop;}
  }
  P2H_ClearMenu(level);
  window.p2h_popmenuarray.push(menuClassName);
}

function P2H_StopClock()
{
  if(window.p2h_timeoutid)
  {
    clearTimeout(window.p2h_timeoutid);
    window.p2h_timeoutid = null;
  }
}

function P2H_StartClock()
{
  if(p2h_delay == 0){ P2H_CloseMenu(); return;}
  P2H_StopClock();
  window.p2h_timeoutid = setTimeout('P2H_CloseMenu()', window.p2h_delay);
}

function P2H_CloseMenu()
{
  P2H_StopClock();
  P2H_ClearMenu(0);
}




function PW_GetElementsByTagClass(tagName, className)
{
    var c=0;
    var i=0;
    var tagCollect = new Array();
    var tags = document.getElementsByTagName(tagName);
    for (i=0; i < tags.length; i++)
    {
        if (tags[i].className==className)
        {
    tagCollect[c]=tags[i];
            c++;
        }
    }
    return(tagCollect);
}


function PW_SetDisplay(cName, show)
{
     var arg = 'none';
     var i=0;
     if(show){ arg = 'block';}
     var lyrArray = PW_GetElementsByTagClass('li', cName);
     if(lyrArray != null)
     {  
       for(i=0; i < lyrArray.length; i++)
       {
           lyrArray[i].style.display=arg;
       }
     }
}




  var req_fifo;
  var req_fifox;

  function GetAsyncData(modus) {
    
	$anr=document.getElementById("anredeedit").value;
	$vorn=document.getElementById("vornameedit").value;
	$nach=document.getElementById("nachnameedit").value;
	$stadt=document.getElementById("ortedit").value;
	$mail=document.getElementById("mailedit").value;
	$firm=document.getElementById("firmaedit").value;
	$str=document.getElementById("strasseedit").value;
	$pass=document.getElementById("id104passwortedit").value;
	$plz=document.getElementById("plzedit").value;
	$tel=document.getElementById("telefonedit").value;
	$fax=document.getElementById("faxedit").value;
	
	if(modus==1) user=document.getElementById("loginedit").value;
	if(modus==1) userpass=document.getElementById("id78passwortedit").value;
	
	if(modus==0) url = "anmeld_beantragen.php?mode="+modus+"&anr="+$anr+"&vorn="+$vorn+"&nach="+$nach+"&ort="+$stadt+"&mail="+$mail+"&firm="+$firm+"&str="+$str+"&pass="+$pass+"&plz="+$plz+"&tel="+$tel+"&fax="+$fax+"&";
	if(modus==1) url = "anmeld_beantragen.php?mode="+modus+"&userid="+user+"&passid="+userpass+"&auslog=x";
	if(modus==2) url = "anmeld_beantragen.php?mode=1&auslog=raus&";
	
    if (window.XMLHttpRequest) {

      req_fifo = new XMLHttpRequest();
      req_fifo.abort();
      req_fifo.onreadystatechange = GotAsyncData;
      req_fifo.open("GET", url, true);
      req_fifo.send(null);

    } else if (window.ActiveXObject) {
      req_fifo = new ActiveXObject("Microsoft.XMLHTTP");
      if (req_fifo) {
        req_fifo.abort();
        req_fifo.onreadystatechange = GotAsyncData;
        req_fifo.open("GET", url, true);
        req_fifo.send();
      }
    }
  }

  function GotAsyncData() {

    if (req_fifo.readyState != 4 || req_fifo.status != 200) {
      return;
    }

	var temtext=req_fifo.responseText;

	if(temtext=="Ihre Partnernummer wird Ihnen\nper Mail zugestellt."){

	document.getElementById('statusa').innerHTML="<p>"+req_fifo.responseText+"</p>";
	
	document.getElementById("senden").disabled=true;
	
	document.getElementById("anredeedit").value="";
	document.getElementById("vornameedit").value="";
	document.getElementById("nachnameedit").value="";
	document.getElementById("ortedit").value="";
	document.getElementById("mailedit").value="";
	document.getElementById("firmaedit").value="";
	document.getElementById("strasseedit").value="";
	document.getElementById("id104passwortedit").value="";
	document.getElementById("passwortwiededit").value="";
	document.getElementById("plzedit").value="";
	document.getElementById("telefonedit").value="";
	document.getElementById("faxedit").value="";
	}
		
		if(temtext=="OK"){
			window.location.href = "index.php";
		}
		if(temtext=="ausgeloggt"){
			window.location.href = "login.php";
		}
		if(temtext=="fehler"){
			alert("Benutzerdaten falsch!");
			window.location.href = "login.php";
		}

	req_fifo=0;
    //setTimeout("GetAsyncData()", 100000);
    return;
  }



  function SetVals(vala,valb,valc,vald) {
    
	//anr=document.getElementById("anredeedit").value;

	url = "werte_eintragen.php?vala="+vala+"&valb="+valb+"&valc="+valc+"&vald="+vald+"&";
	
    if (window.XMLHttpRequest) {

      req_fifox = new XMLHttpRequest();
      req_fifox.abort();
      req_fifox.onreadystatechange = GotVals;
      req_fifox.open("GET", url, true);
      req_fifox.send(null);

    } else if (window.ActiveXObject) {
      req_fifox = new ActiveXObject("Microsoft.XMLHTTP");
      if (req_fifox) {
        req_fifox.abort();
        req_fifox.onreadystatechange = GotVals;
        req_fifox.open("GET", url, true);
        req_fifox.send();
      }
    }
  }

  function GotVals() {

    if (req_fifox.readyState != 4 || req_fifox.status != 200) {
      return;
    }

	var temtext=req_fifox.responseText;

	//alert(temtext);;

	req_fifox=0;
    //setTimeout("SetVals()", 100000);
    return;
  }

var fifoy;

  function SendeAnfrage(artderanf) {

	genVals();

	//anr=document.getElementById("anredeedit").value;

	$a=document.getElementById("partnredit").value;
	$b=document.getElementById("lieferedit").value;
	$c=document.getElementById("inedit").value;
	$d=document.getElementById("kundeedit").value;
	$e=document.getElementById("ansppartedit").value;
	$f=document.getElementById("strhausedit").value;
	$g=document.getElementById("vorstcheck").checked;
	$h=document.getElementById("id54plzedit").value+" "+document.getElementById("id55ortedit").value;
	$i=document.getElementById("teledit").value;
	$j=document.getElementById("id60faxedit").value;
	$k=document.getElementById("id61mailedit").value;
	$l=document.getElementById("rufamedit").value;
	$m=document.getElementById("rufumedit").value;
	$n=document.getElementById("ihrteledit").value;
	$o=document.getElementById("ihrnameedit").value;
	$p=document.getElementById("eingabe1").value;
	$q=document.getElementById("eingabe2").value;
	$r=document.getElementById("eingabe3").value;
	$s="datum der anfrage";
	$t=$anfvals;
	$u=document.getElementById("CheckboxGroup1_1").checked+"A"+
	   document.getElementById("CheckboxGroup1_2").checked+"A"+
	   document.getElementById("CheckboxGroup1_3").checked+"A"+
	   document.getElementById("CheckboxGroup1_4").checked+"A"+
	   document.getElementById("CheckboxGroup2_1").checked+"A"+
	   document.getElementById("CheckboxGroup2_2").checked+"A"+
	   document.getElementById("CheckboxGroup2_3").checked+"A"+
	   document.getElementById("CheckboxGroup2_4").checked+"A"+
	   "true".checked+"A"+
	   "true".checked+"A"+
	   "true".checked+"A"+
	   document.getElementById("CheckboxGroup3_4").checked;

	$art=artderanf;


	url = "ins_anfrage.php?a="+$a+"&b="+$b+"&c="+$c+"&d="+$d+"&e="+$e+"&f="+$f+"&g="+$g+"&h="+$h+"&i="+$i+"&j="+$j+"&k="+$k+"&l="+$l+"&m="+$m+"&n="+$n+"&o="+$o+"&p="+$p+"&q="+$q+"&r="+$r+"&s="+$s+"&t="+$t+"&u="+$u+"&art="+$art+"&";

    if (window.XMLHttpRequest) {

      req_fifoy = new XMLHttpRequest();
      req_fifoy.abort();
      req_fifoy.onreadystatechange = AnfrageGesendet;
      req_fifoy.open("GET", url, true);
      req_fifoy.send(null);

    } else if (window.ActiveXObject) {
      req_fifoy = new ActiveXObject("Microsoft.XMLHTTP");
      if (req_fifoy) {
        req_fifoy.abort();
        req_fifoy.onreadystatechange = AnfrageGesendet;
        req_fifoy.open("GET", url, true);
        req_fifoy.send();
      }
    }
  }

  function AnfrageGesendet() {

    if (req_fifoy.readyState != 4 || req_fifoy.status != 200) {
      return;
    }

	var temtext=req_fifoy.responseText;

	alert("Ihren Daten wurden erfolgreich gespeichert/gesendet.");

	req_fifoy=0;

    return;
  }

var $anfvals=" ";


function genVals(){

		
	var anzahlung=document.getElementById("eingabe3").value;
	var restwert=document.getElementById("eingabe2").value*0.05;
	var wert=document.getElementById("eingabe2").value;

	//restwert=(formatZahl(restwert,2,true))*-1;

	$anfvals=encodeURIComponent(document.getElementById("partnredit").value+"X"+
	document.getElementById("lieferedit").value+"X"+
	document.getElementById("inedit").value+"X"+
	document.getElementById("kundeedit").value+"X"+
	document.getElementById("ansppartedit").value+"X"+
	document.getElementById("strhausedit").value+"X"+
	document.getElementById("vorstcheck").checked+"X"+
	document.getElementById("id54plzedit").value+" "+document.getElementById("id55ortedit").value+"X"+
	document.getElementById("teledit").value+"X"+
	document.getElementById("id60faxedit").value+"X"+
	document.getElementById("id61mailedit").value+"X"+
	document.getElementById("rufamedit").value+"X"+
	document.getElementById("rufumedit").value+"X"+
	document.getElementById("ihrteledit").value+"X"+
	document.getElementById("ihrnameedit").value+"X"+
	document.getElementById("eingabe1").value+"X"+
	document.getElementById("eingabe2").value+"X"+
	document.getElementById("eingabe3").value+"X"+
	document.getElementById("CheckboxGroup1_1").checked+"X"+
	document.getElementById("CheckboxGroup1_2").checked+"X"+
	document.getElementById("CheckboxGroup1_3").checked+"X"+
	document.getElementById("CheckboxGroup1_4").checked+"X"+
	document.getElementById("CheckboxGroup2_1").checked+"X"+
	document.getElementById("CheckboxGroup2_2").checked+"X"+
	document.getElementById("CheckboxGroup2_3").checked+"X"+
	document.getElementById("CheckboxGroup2_4").checked+"X"+
	document.getElementById("CheckboxGroup3_4").checked+"X"+
	document.getElementById("CheckboxGroup3_4").checked+"X"+
	document.getElementById("CheckboxGroup3_4").checked+"X"+
	document.getElementById("CheckboxGroup3_4").checked+"X"+
	calcValue(zleasing,48,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+"X"+
	calcValue(zleasing,60,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+"X"+
	calcValue(zleasing,72,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+"X"+
	calcValue(zleasing,84,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+"X"+
	restwert+"X"+
	calcValue(zmietkauf,48,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+"X"+
	calcValue(zmietkauf,60,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+"X"+
	calcValue(zmietkauf,72,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+"X"+
	calcValue(zmietkauf,84,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+"X"+
	"ohne"+"X"+
	calcValue(zkredit,97,document.getElementById("eingabe2").value*(zkreditpv/100)-anzahlung,0,1)+"X"+
	calcValue(zkredit,120,document.getElementById("eingabe2").value*(zkreditpv/100)-anzahlung,0,1)+"X"+
	calcValue(zkredit,144,document.getElementById("eingabe2").value*(zkreditpv/100)-anzahlung,0,1)+"X"+
	calcValue(zkredit,180,document.getElementById("eingabe2").value*(zkreditpv/100)-anzahlung,0,1)+"X"+
	"ohne");

}

function genValsShort(){

		
	var anzahlung=document.getElementById("eingabe3").value;
	var restwert=document.getElementById("eingabe2").value*0.05;
	var wert=document.getElementById("eingabe2").value;

	//restwert=(formatZahl(restwert,2,true))*-1;

	$anfvals=encodeURIComponent(" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+" "+" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	document.getElementById("eingabe1").value+"X"+
	document.getElementById("eingabe2").value+"X"+
	document.getElementById("eingabe3").value+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	" "+"X"+
	calcValue(zleasing,48,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+"X"+
	calcValue(zleasing,60,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+"X"+
	calcValue(zleasing,72,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+"X"+
	calcValue(zleasing,84,document.getElementById("eingabe2").value*(zleapv/100)-anzahlung,restwert,1)+"X"+
	restwert+"X"+
	calcValue(zmietkauf,48,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+"X"+
	calcValue(zmietkauf,60,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+"X"+
	calcValue(zmietkauf,72,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+"X"+
	calcValue(zmietkauf,84,document.getElementById("eingabe2").value*(zmietpv/100)-anzahlung,0,1)+"X"+
	"ohne"+"X"+
	calcValue(zkredit,97,document.getElementById("eingabe2").value*(zkreditpv/100)-anzahlung,0,1)+"X"+
	calcValue(zkredit,120,document.getElementById("eingabe2").value*(zkreditpv/100)-anzahlung,0,1)+"X"+
	calcValue(zkredit,144,document.getElementById("eingabe2").value*(zkreditpv/100)-anzahlung,0,1)+"X"+
	calcValue(zkredit,180,document.getElementById("eingabe2").value*(zkreditpv/100)-anzahlung,0,1)+"X"+
	"ohne");

}

var fifoz;

  function SpeicherSession() {
    
	//anr=document.getElementById("anredeedit").value;
	
	
	genVals();

	url = "save_anfrage.php?avals="+$anfvals+"&";

    if (window.XMLHttpRequest) {

      req_fifoz = new XMLHttpRequest();
      req_fifoz.abort();
      req_fifoz.onreadystatechange = SessionGespeichert;
      req_fifoz.open("GET", url, true);
      req_fifoz.send(null);

    } else if (window.ActiveXObject) {
      req_fifoz = new ActiveXObject("Microsoft.XMLHTTP");
      if (req_fifoz) {
        req_fifoz.abort();
        req_fifoz.onreadystatechange = SessionGespeichert;
        req_fifoz.open("GET", url, true);
        req_fifoz.send();
      }
    }
  }

  function SpeicherSessionShort() {
    
	//anr=document.getElementById("anredeedit").value;
	
	
	genValsShort();

	url = "save_anfrage.php?avals="+$anfvals+"&";

    if (window.XMLHttpRequest) {

      req_fifoz = new XMLHttpRequest();
      req_fifoz.abort();
      req_fifoz.onreadystatechange = SessionGespeichertShort;
      req_fifoz.open("GET", url, true);
      req_fifoz.send(null);

    } else if (window.ActiveXObject) {
      req_fifoz = new ActiveXObject("Microsoft.XMLHTTP");
      if (req_fifoz) {
        req_fifoz.abort();
        req_fifoz.onreadystatechange = SessionGespeichertShort;
        req_fifoz.open("GET", url, true);
        req_fifoz.send();
      }
    }
  }

  function SpeicherSessionAng() {
    
	//anr=document.getElementById("anredeedit").value;
	
	
	genVals();

	url = "save_anfrage.php?avals="+$anfvals+"&";

    if (window.XMLHttpRequest) {

      req_fifoz = new XMLHttpRequest();
      req_fifoz.abort();
      req_fifoz.onreadystatechange = SessionGespeichertAng;
      req_fifoz.open("GET", url, true);
      req_fifoz.send(null);

    } else if (window.ActiveXObject) {
      req_fifoz = new ActiveXObject("Microsoft.XMLHTTP");
      if (req_fifoz) {
        req_fifoz.abort();
        req_fifoz.onreadystatechange = SessionGespeichertAng;
        req_fifoz.open("GET", url, true);
        req_fifoz.send();
      }
    }
  }

  function SpeicherSessionOld() {
    
	//anr=document.getElementById("anredeedit").value;
	
	$anfvals=encodeURIComponent(document.getElementById("anfragen").value);


	url = "save_anfrage.php?avals="+$anfvals+"&";

    if (window.XMLHttpRequest) {

      req_fifoz = new XMLHttpRequest();
      req_fifoz.abort();
      req_fifoz.onreadystatechange = SessionGespeichert;
      req_fifoz.open("GET", url, true);
      req_fifoz.send(null);

    } else if (window.ActiveXObject) {
      req_fifoz = new ActiveXObject("Microsoft.XMLHTTP");
      if (req_fifoz) {
        req_fifoz.abort();
        req_fifoz.onreadystatechange = SessionGespeichert;
        req_fifoz.open("GET", url, true);
        req_fifoz.send();
      }
    }
  }
  function SessionGespeichertShort() {

    if (req_fifoz.readyState != 4 || req_fifoz.status != 200) {
      return;
    }

	var temtext=req_fifoz.responseText;

	$force=Math.random();
	Win = window.open("finanfragesh.php?force="+$force,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');

	//window.location.href = "finanfragepdf.php";


	req_fifoz=0;

    return;
  }  function SessionGespeichert() {

    if (req_fifoz.readyState != 4 || req_fifoz.status != 200) {
      return;
    }

	var temtext=req_fifoz.responseText;

	$force=Math.random();
	Win = window.open("finanfragepdf.php?force="+$force,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');

	//window.location.href = "finanfragepdf.php";


	req_fifoz=0;

    return;
  }

  function SessionGespeichertAng() {

    if (req_fifoz.readyState != 4 || req_fifoz.status != 200) {
      return;
    }

	var temtext=req_fifoz.responseText;

	$force=Math.random();
	Win = window.open("anganfragepdf.php?force="+$force,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');

	//window.location.href = "finanfragepdf.php";


	req_fifoz=0;

    return;
  }


  function AnfAnzeigen() {
    
	$anfid=document.getElementById("anfragen").value;
	window.location.href = "onlineanfrage.php?idval="+$anfid;

  }
  function setstate() {
    
	$status=document.getElementById("sachstatus").value;
	$bearbeiter=document.getElementById("sachbearb").value;
	$setid=document.getElementById("anfragen").value;
	window.location.href = "index.php?statusset=1&status="+$status+"&bearbeiter="+$bearbeiter+"&setid="+$setid+"&";
	
  }
  
	$('#startseitepopup').fadeTo(6, 0.0);
	$('#firmenvideopopup').fadeTo(6, 0.0);
	$('#ratenrechnerpopup').fadeTo(6, 0.0);
	$('#onlineanfragepopup').fadeTo(6, 0.0);
	$('#finanzierungsformenpopup').fadeTo(6, 0.0);
	$('#kontaktpopup').fadeTo(6, 0.0);
	$('#loginpopup').fadeTo(6, 0.0);
$('#infolayer').hide();
$(document).ready(function () {
							

	$('#startseitepopup').fadeTo(6, 0.0);
	$('#firmenvideopopup').fadeTo(6, 0.0);
	$('#ratenrechnerpopup').fadeTo(6, 0.0);
	$('#onlineanfragepopup').fadeTo(6, 0.0);
	$('#finanzierungsformenpopup').fadeTo(6, 0.0);
	$('#kontaktpopup').fadeTo(6, 0.0);
	$('#loginpopup').fadeTo(6, 0.0);



	$('#startseitemenu').hover(function () {
				$('#startseitepopup').fadeTo(400, 1.0);
			},function(){
				$('#startseitepopup').fadeTo(400, 0.0);
	});
	$('#firmenvideomenu').hover(function () {
				$('#firmenvideopopup').fadeTo(400, 1.0);
			},function(){
				$('#firmenvideopopup').fadeTo(400, 0.0);
	});
	$('#ratenrechnermenu').hover(function () {
				$('#ratenrechnerpopup').fadeTo(400, 1.0);
			},function(){
				$('#ratenrechnerpopup').fadeTo(400, 0.0);
	});
	$('#onlineanfragemenu').hover(function () {
				$('#onlineanfragepopup').fadeTo(400, 1.0);
			},function(){
				$('#onlineanfragepopup').fadeTo(400, 0.0);
	});
	$('#finanzierungsformenmenu').hover(function () {
				$('#finanzierungsformenpopup').fadeTo(400, 1.0);
			},function(){
				$('#finanzierungsformenpopup').fadeTo(400, 0.0);
	});
	$('#kontaktmenu').hover(function () {
				$('#kontaktpopup').fadeTo(400, 1.0);
			},function(){
				$('#kontaktpopup').fadeTo(400, 0.0);
	});
	$('#loginmenu').hover(function () {
				$('#loginpopup').fadeTo(400, 1.0);
			},function(){
				$('#loginpopup').fadeTo(400, 0.0);
	});
	$('#newstext').hover(function () {
				$('#infolayer').fadeTo(800, 1.0);
			},function(){
				$('#infolayer').fadeTo(800, 0.0);
	});	
});



