//kalkulator motor
function credigenKalkulatorObject(name, penznem, kamatlab, halasztas, futamido_min, futamido_max, hitelosszeg_min, hitelosszeg_max, torleszto_min, torleszto_max, kezelesiktsg_type, kezelesiktsg_value, biztositas, onero_min, onero_max, default_futamido, default_onero, text1, urltext, url, thm_min, thm_max){

    this.name = name;
    this.penznem = penznem;
    this.kamatlab = kamatlab;
    this.halasztas = halasztas;
    this.futamido_min = futamido_min;
    this.futamido_max = futamido_max;
    this.hitelosszeg_min = hitelosszeg_min;
    this.hitelosszeg_max = hitelosszeg_max;
    this.torleszto_min = torleszto_min;
    this.torleszto_max = torleszto_max;
    this.kezelesiktsg_type = kezelesiktsg_type;
    this.kezelesiktsg_value = kezelesiktsg_value;
    this.biztositas = biztositas;
    this.onero_min = onero_min;
    this.onero_max = onero_max;
    this.default_futamido = default_futamido;
    this.default_onero = default_onero;
    this.thm_min = thm_min;
    this.thm_max = thm_max;

    this.ar = 0;
    this.hitelosszeg = 0;
    this.onero = 0;
    this.futamido = 0;
    this.irvaluea = 0;
    this.irvalueb = 0;
    this.havibiztositas = 0;
    this.torlesztoalap = 0;
    this.torleszto = 0;
    this.torlesztoelso = 0;
    this.torlesztobiztositassalelso = 0;
    this.torlesztopostponed = 0;
    this.thmmensu = 0;
    this.thm = 0;
    this.postpone = 0;
    this.postponeinterest = 0;
    this.kezelesikoltseghavi = 0;
    this.kezelesikoltsega = 0;
    this.kezelesikoltsegb = 0;
    
    this.ampRemainingCapital = new Array();
    this.ampCapital = new Array();
    this.ampInstalments = new Array();
    this.ampInterest = new Array();
    this.ampHandlingFee = new Array();

    this.ampRemainingCapitalBEA = new Array();
    this.ampInstalmentBEA = new Array();
    this.ampInterestBEA = new Array();
    this.ampHandlingFeeBEA = new Array();
    this.ampCapitalBEA = new Array();

    this.MAX_IRR_ITERATIONS=32000;

    this.boxWidth=150;
    this.error='';

    //THM-et szamol
    this.calculateTHM = function(){
        this.ampRemainingCapital = new Array();
        this.ampCapital = new Array();
        for(i=0;i<=this.futamido_max;i++){
            this.ampRemainingCapital[i]=0;
            this.ampCapital[i]=0;
            this.ampInstalments[i]=0;
            this.ampInterest[i]=0;
            this.ampHandlingFee[i]=0;
            
            this.ampRemainingCapitalBEA[i]=0;
            this.ampInstalmentBEA[i]=0;
            this.ampInterestBEA[i]=0;
            this.ampHandlingFeeBEA[i]=0;
            this.ampCapitalBEA[i]=0;
        }
		
//BEA --------------------------------------------------------------------------
        for(i=1;i<=this.futamido;i++){
	
			//ampRemainingCapitalBEA
        	if(i==1)this.ampRemainingCapitalBEA[i]=this.hitelosszeg;
        	else this.ampRemainingCapitalBEA[i]=this.ampRemainingCapitalBEA[i-1]-this.ampCapitalBEA[i-1];

			//ampInstalmentBEA
        	if(i==1)this.ampInstalmentBEA[i]=this.torlesztoelso;
        	else {
        		if(i==this.futamido){
        			this.ampInstalmentBEA[i]=this.torlesztoelso; 				// +H16
        		} else {
        			this.ampInstalmentBEA[i]=this.torlesztoelso;
        		}
			}
			
			//ampInterestBEA
			if(i==1)this.ampInterestBEA[i]=(this.ampRemainingCapitalBEA[i]+this.postponeinterest)*this.irvaluea+this.postponeinterest;
			else this.ampInterestBEA[i]=this.ampRemainingCapitalBEA[i]*this.irvaluea;
			
			//ampHandlingFeeBEA
			if(i==1){
				if(this.kezelesiktsg_type==3){
					this.ampHandlingFeeBEA[i]=this.kezelesikoltseghavi;
				} else if(this.kezelesiktsg_type==2){
					this.ampHandlingFeeBEA[i]=this.kezelesikoltsega;
				} else {
					this.ampHandlingFeeBEA[i]=this.kezelesikoltsega;			// SHOP
				}
			} else {
				if(this.kezelesiktsg_type==3) this.ampHandlingFeeBEA[i]=this.kezelesikoltseghavi;
			}

			//ampCapitalBEA
			if(i==this.futamido)this.ampCapitalBEA[i]=this.ampRemainingCapitalBEA[i];
			else this.ampCapitalBEA[i]=this.ampInstalmentBEA[i]-this.ampInterestBEA[i]-this.ampHandlingFeeBEA[i];
		}
		
		//init
        this.ampRemainingCapital[0]=this.hitelosszeg;

        if(this.kezelesiktsg_type==1){
	        this.ampInstalments[0]=-(this.hitelosszeg-this.kezelesikoltsega);
	    } else {
	        this.ampInstalments[0]=-this.hitelosszeg;
	    }
        
        for(i=1;i<=this.futamido+this.postpone;i++){
        //ampRemainingCapital
            this.ampRemainingCapital[i]=this.ampRemainingCapital[i-1]-this.ampCapital[i-1];
            
        //ampInstalments
            if(i>this.futamido+this.postpone){
                //
            } else if(i>this.postpone+1){
                this.ampInstalments[i]=this.torleszto;
            } else if(i==this.postpone+1){
                this.ampInstalments[i]=this.torlesztoelso;
            }

        //ampInterest
            if(i<this.postpone+1){
                //
            } else if(i==this.postpone+1){
                this.ampInterest[i]=Math.round(((this.ampRemainingCapital[i]+this.postponeinterest)*this.irvaluea+this.postponeinterest)*100000000000)/100000000000;
            } else {
                this.ampInterest[i]=Math.round((this.ampRemainingCapital[i]*this.irvaluea)*100000000000)/100000000000;
            }

        //ampHandlingFee
            if(this.kezelesiktsg_type==3){
                //kezelesi koltseg havonta
                this.ampHandlingFee[i]=this.kezelesikoltseghavi;
            } else if(this.kezelesiktsg_type==2){
                //kezelesi koltseg az elso torlesztovel
                if(i==1)this.ampHandlingFee[i]=this.kezelesikoltsega;
            } else {
                //kezelesi koltseg a shopban
            }

        //ampCapital
            if(i==this.futamido+this.postpone){
                this.ampCapital[i]=this.ampRemainingCapital[i];
                //this.ampCapital[i]=Math.round((this.ampRemainingCapital[i])*100000000000)/100000000000;
            } else {
                this.ampCapital[i]=Math.round((this.ampInstalments[i]-this.ampInterest[i]-this.ampHandlingFee[i])*100000000000)/100000000000;
            }
        }
       
        this.thmmensu=this.IRR(this.ampInstalments,0.001);
        this.thm=Math.round((Math.pow((this.thmmensu + 1), 12)-1)*10000)/100;
      
        return this.thm;
                               
        return this.ampInterest;               
                                
        return this.thmmensu+'<br>'+this.thm;
    }      

    this.IRR = function(cashFlow, guess){
        var npv = 0;
        var cnt = 0;
        do {
            npv = this.NPV(guess,cashFlow);
            guess += 0.000001;
            
            if(cnt > this.MAX_IRR_ITERATIONS) return NaN;
            else cnt++;
        } while (npv > 0);
        
        return guess;
    }

    this.NPV = function(discountRate,cashFlow){
        var npv=0;
        for(t=0;t<cashFlow.length;t++){
            npv += cashFlow[t]  / Math.pow((1 + discountRate), t);
        }
        return npv;
    }

    //torlesztoreszletet szamol biztositassal
    this.calculateTorlesztoBiztositassal = function(){
        if(this.kezelesiktsg_type==3){
	    	//ha havi kezelesi koltseg
	        this.torlesztobiztositassal=this.torlesztoalap+this.havibiztositas+this.torlesztopostponed+this.kezelesikoltseghavi;
	        this.torlesztobiztositassalelso=this.torlesztobiztositassal+this.kezelesikoltsegb;
        } else if(this.kezelesiktsg_type==2){
	    	//ha az elso reszlettel fizeti a kezelesi koltseget
	        this.torlesztobiztositassal=this.torlesztoalap+this.havibiztositas+this.torlesztopostponed;
	        this.torlesztobiztositassalelso=this.torlesztobiztositassal+this.kezelesikoltsegb;
        } else {
	    	//ha a boltban fizeti a kezelesi koltseget
	        this.torlesztobiztositassal=this.torlesztoalap+this.havibiztositas+this.torlesztopostponed;
	        this.torlesztobiztositassalelso=this.torlesztobiztositassal;
        }

        return this.torlesztobiztositassalelso;
    }      
    
    //torlesztoreszletet szamol biztositas nelkul
    this.calculateTorlesztoBiztositasnelkul = function(){
        if(this.kezelesiktsg_type==3){
	    	//ha havi kezelesi koltseg
	        this.torleszto=this.torlesztoalap+this.torlesztopostponed+this.kezelesikoltseghavi;
	        this.torlesztoelso=this.torleszto+this.kezelesikoltsega;
        } else if(this.kezelesiktsg_type==2){
	    	//ha az elso reszlettel fizeti a kezelesi koltseget
	        this.torleszto=this.torlesztoalap+this.torlesztopostponed;
	        this.torlesztoelso=this.torleszto+this.kezelesikoltsega;
        } else {
	    	//ha a boltban fizeti a kezelesi koltseget
	        this.torleszto=this.torlesztoalap+this.torlesztopostponed;
	        this.torlesztoelso=this.torleszto;
        }

        return this.torlesztoelso;
    }

    //kiszamol mindent es megjeleniti
    this.reCalculate = function(){
        this.hitelosszeg = parseInt(document.getElementById('credigenFormAr').value.replace(/[^0-9]/g,''),10) - parseInt(document.getElementById('credigenFormOnero').value.replace(/[^0-9]/g,''),10);
        this.futamido = parseInt(document.getElementById('credigenFormFutamido').value,10);
        this.ar = parseInt(document.getElementById('credigenFormAr').value.replace(/[^0-9]/g,''),10);
        this.onero = parseInt(document.getElementById('credigenFormOnero').value.replace(/[^0-9]/g,''),10);
        this.irvaluea = this.kamatlab/100/12;
        this.irvalueb = Math.pow(1+this.irvaluea,this.futamido);
        this.havibiztositas = this.hitelosszeg*(this.biztositas/100);
        if(this.kezelesiktsg_type<3){
            this.kezelesikoltsega = Math.round(this.hitelosszeg*(this.kezelesiktsg_value/100));
            this.kezelesikoltsegb = this.kezelesikoltsega;
        } else {
            this.kezelesikoltseghavi=Math.round(this.hitelosszeg*(this.kezelesiktsg_value/100));                    
        }
        if(this.halasztas-3>0){
			this.postpone = this.halasztas-3;
			if(this.kamatlab>0){
				this.postponeinterest=Math.round(this.hitelosszeg*this.irvaluea*this.postpone);  
				this.torlesztopostponed=Math.round(this.postponeinterest*this.irvalueb*this.irvaluea*(1/(this.irvalueb-1)));  
			} else {
				this.postponeinterest=0;
				this.torlesztopostponed=0;
			}
		} else {
			this.postpone=0
		}
    	if(this.kamatlab>0)this.torlesztoalap=Math.round((this.hitelosszeg-(0/this.irvalueb))*this.irvalueb*this.irvaluea*(1/(this.irvalueb-1)));
    	else this.torlesztoalap=Math.floor(this.hitelosszeg/this.futamido);
        
        this.error='';
        if(this.error=='' && this.ar<=this.onero)this.error='Az önerő nem lehet nagyobb az árnál!';
        if(this.error=='' && this.hitelosszeg<this.hitelosszeg_min)this.error='A hitelösszegnek legalább '+this.hitelosszeg_min+' forintnak kell lennie!';
        if(this.error=='' && this.hitelosszeg>this.hitelosszeg_max)this.error='A hitelösszeg legfeljebb '+this.hitelosszeg_max+' forint lehet!';
        if(this.error=='' && this.onero<Math.round(this.ar*(this.onero_min/100)))this.error='A önerőnek minimum '+this.onero_min+'%-nak kell lennie!';
        if(this.error=='' && this.onero>Math.round(this.ar*(this.onero_max/100)))this.error='A önerő legfeljebb '+this.onero_max+'% lehet!';
        
        if(this.error==''){
        	this.calculateTorlesztoBiztositassal();
        	this.calculateTorlesztoBiztositasnelkul();
        	if(this.kezelesiktsg_type==2){
	            document.getElementById('credigenResultTorlesztoB').innerHTML='<div><b>'+this.formatNumber(this.torleszto,0,'.',' ')+'</b> HUF/hó</div><div style="font-size:9px;">(első részlet: '+this.formatNumber(this.torlesztoelso,0,'.',' ')+')</div>';
	            document.getElementById('credigenResultTorlesztoA').innerHTML='<div><b>'+this.formatNumber(this.torlesztobiztositassal,0,'.',' ')+'</b> HUF/hó</div><div style="font-size:9px;">(első részlet: '+this.formatNumber(this.torlesztobiztositassalelso,0,'.',' ')+')</div>';
	        } else {
	            document.getElementById('credigenResultTorlesztoB').innerHTML='<b>'+this.formatNumber(this.torleszto,0,'.',' ')+'</b> HUF/hó';
	            document.getElementById('credigenResultTorlesztoA').innerHTML='<b>'+this.formatNumber(this.torlesztobiztositassal,0,'.',' ')+'</b> HUF/hó';
	        }
            this.thm=this.calculateTHM();
        	if(this.thm<this.thm_min)this.thm=this.thm_min;
        	if(this.thm>this.thm_max)this.thm=this.thm_max;
            document.getElementById('credigenResultTHM').innerHTML='<b>'+this.thm+'</b> %';
        } else alert(this.error);
    }

    //feltolti a kalkulatort az alapadatokkal
    this.initForm = function(){
        this.onero = Math.round(this.ar*(this.default_onero/100));
        this.hitelosszeg = this.ar - this.onero;
        if(this.hitelosszeg < this.hitelosszeg_min){
            this.onero = Math.round(this.ar*(this.onero_min/100));
            this.hitelosszeg = this.ar - this.onero;
            if(this.hitelosszeg < this.hitelosszeg_min){
                this.ar=500000;
                this.onero = Math.round(this.ar*(this.default_onero/100));
            }
        }
        
        document.getElementById('credigenFormAr').value=this.formatNumber(this.ar,0,'.',' ');
        document.getElementById('credigenFormOnero').value=this.formatNumber(this.onero,0,'.',' ');
        document.getElementById('credigenFormFutamido').value=this.default_futamido;
    }
    
    this.resetResult = function (){
        document.getElementById('credigenResultTorlesztoA').innerHTML='<b>?</b>';
        document.getElementById('credigenResultTorlesztoB').innerHTML='<b>?</b>';
        document.getElementById('credigenResultTHM').innerHTML='<b>?</b>';
    }

    this.formatNumber = function(a, b, c, d) {
    	// formatNumber(number, decimals, comma, formatSeparator)
    	a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
    	e = a + '';
    	f = e.split('.');
    	if(!f[0]) f[0] = '0';
    	if(!f[1]) f[1] = '';
    	if(f[1].length < b){
    		g = f[1];
    		for(i = f[1].length + 1; i <= b; i++) {
    			g += '0';
    		}
    		f[1] = g;
    	}
    	if(d != '' && f[0].length > 3) {
    		h = f[0];
    		f[0] = '';
    		for(j = 3; j < h.length; j += 3) {
    			i = h.slice(h.length - j, h.length - j + 3);
    			f[0] = d + i +  f[0] + '';
    		}
    		j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
    		f[0] = j + f[0];
    	}
    	c = (b <= 0) ? '': c;
    	return f[0] + c + f[1];
    }

    this.formMoneyFormat = function (ev){
        ev || (ev=window.event);  
        var source;  
        if(typeof ev.target != 'undefined') {  
            source=ev.target;  
        } else if (typeof ev.srcElement != 'undefined') {  
            source=ev.srcElement;  
        } else { return(true); }  
    	
        source.value=this.formatNumber(source.value.replace(/[^0-9]/ig,""),0,'.',' ');
    }

    this.generateID = function(splitter) {
        var sp=(splitter) ? splitter : 'A';
        var now=new Date();
        return Date.parse(now.toGMTString()) + sp + Math.floor(Math.random()*1000000000);
    }
    
    this.writeForm = function(){
        //document.write('<div id="credigenKalkulatorDiv"></div>');

        var htmlFutamidoSelect='<select name="credigenFormFutamido" id="credigenFormFutamido" class="credigenInput" style="width:60px; font-family:arial; font-size:12px; color:#000000; font-weight:bold; background-color:#ffffff;" onchange="credigen.resetResult();">';
        for(i=this.futamido_min;i<=this.futamido_max;i++)htmlFutamidoSelect+='<option value="'+i+'"'+(i==this.default_futamido?' selected':'')+'>'+i+'</option>';
        htmlFutamidoSelect+='</select>';        
    
        var k = '';
        var boxWidth='228';
        var boxHeight='228';
        
        k+='<style type="text/css">';
        k+='.credigenTABLE {background-color:#FFFFFF;}';
        k+='.credigenLabel {font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left;}';
        k+='.credigenInput {font-family:arial; font-size:12px; color:#000000; font-weight:bold; background-color:#ffffff;}';
        k+='.credigenPadding1 {padding-top:8px;}';
        k+='.credigenPadding2 {padding-right:8px;}';
        k+='.credigenButton {font-family:arial; font-size:11px; color:#ffffff; font-weight:bold; background-color:#000000;}';
        k+='.credigenSeparator {height:1px; border-bottom:1px solid #F47B20; padding-top:6px;  font-size:0px;}';
        k+='.credigenResult {font-family:arial; font-size:14px; color:#000000; font-weight:normal; text-align:left;}';
        k+='.credigenLink {font-family:arial; font-size:9px; color:#F47B20; font-weight:normal; text-align:left; text-decoration:none;}';
        k+='.credigenLink:HOVER {color:#F47B20; text-decoration:underline;}';
        k+='.credigenNote {font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; background-color:#ECECEC;}';
        k+='</style>';        
        
        k+='<div style="border:0px solid #ECECEC; background-color:#FFFFFF; padding:5px;">';
        
        k+='<div class="credigenTABLE">';
        k+='<div class="credigenNote" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; background-color:#ECECEC; padding-top:5px; margin-bottom:10px; min-height:35px;"><img src="http://www.credigen.hu/pictures/k1/credigen2.gif" height="46" width="137" align="left" style="padding-right:8px;" />'+text1+' <a href="'+url+'" target="_blank" class="credigenLink" style="font-family:arial; font-size:9px; color:#F47B20; font-weight:normal; text-align:left; text-decoration:none;">'+urltext+'</a></div>';
        k+='<div class="credigenSeparator" style="height:1px; border-bottom:1px solid #F47B20; padding-top:6px;  font-size:0px; margin-bottom:4px;"></div>';
        k+='<div style="height:30px;">';
        k+='<div style="float:left;"><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;">Vételár (HUF):</div><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;"><input type="text" id="credigenFormAr" class="credigenInput" style="width:60px; font-family:arial; font-size:12px; color:#000000; font-weight:bold; background-color:#ffffff;" onkeypress="credigen.formMoneyFormat();credigen.resetResult();" onkeyup="credigen.formMoneyFormat();credigen.resetResult();" onfocus="credigen.formMoneyFormat();" onblur="credigen.formMoneyFormat();"></div></div>';
        k+='<div style="float:left;"><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;">Önerő (HUF):</div><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;"><input type="text" id="credigenFormOnero" class="credigenInput" style="width:60px; font-family:arial; font-size:12px; color:#000000; font-weight:bold; background-color:#ffffff;" onkeypress="credigen.formMoneyFormat();credigen.resetResult();" onkeyup="credigen.formMoneyFormat();credigen.resetResult();" onfocus="credigen.formMoneyFormat();" onblur="credigen.formMoneyFormat();"></div></div>';
        k+='<div style="float:left;"><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;">Futamidő (HÓ):</div><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;">'+htmlFutamidoSelect+'</div></div>';
        k+='<div style="float:left;"><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;">&nbsp;</div><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;"><input type="button" class="credigenButton" value="Számol" onclick="javascript:credigen.reCalculate();" style="margin-left:10px; font-family:arial; font-size:11px; color:#ffffff; font-weight:bold; background-color:#000000;"></div></div>';
        k+='<div style="float:left;"><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;">Törlesztőrészlet biztosítással:</div><div id="credigenResultTorlesztoA" class="credigenResult credigenPadding2" style="font-family:arial; font-size:14px; color:#000000; font-weight:normal; text-align:left; padding-right:8px;"></div></div>';
        k+='<div style="float:left;"><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;">Törlesztőrészlet biztosítás nélkül:</div><div id="credigenResultTorlesztoB" class="credigenResult credigenPadding2" style="font-family:arial; font-size:14px; color:#000000; font-weight:normal; text-align:left; padding-right:8px;"></div></div>';
        k+='<div style="float:left;"><div class="credigenLabel credigenPadding2" style="font-family:arial; font-size:9px; color:#797979; font-weight:normal; text-align:left; padding-right:8px;">THM:</div><div id="credigenResultTHM" class="credigenResult credigenPadding2" style="font-family:arial; font-size:14px; color:#000000; font-weight:normal; text-align:left; padding-right:8px;"></div>';
        k+='</div>';
        
        k+='</div>';

        k+='</div>';
        k+='<div><img src="http://www.credigen.hu/stat.php?id=92&t='+credigen.generateID()+'" width="1" height="1" border="0"></div>';
        
        document.getElementById('credigenKalkulatorDiv').innerHTML=k;
    }
}

var credigen = new credigenKalkulatorObject("Standard konstrukció", "HUF", 29.9, 3, 6, 60, 30000, 1000000, 1800, 100000, 2, 2, 0.51, 0, 80, 12, 0, "Az Eladó a Credigen Bank Zrt. megbízásából jár el. A Credigen Bank a hitelbírálat jogát fenntartja. Ez a hirdetés a Bank részéről nem minősül nyilvános tájékoztatónak és ajánlattételnek. A tájékoztatás nem teljes körű, a hitelről részletes tájékoztatást az üzletben elhelyezett hirdetmények adnak. A Credigen Bank kifejezetten fenntartja a jogot, hogy a kölcsön elbírálása során az ügyfél minősítésétől függően, adóstárs és/vagy önerő bevonását/alkalmazását a kölcsön folyósításának feltételeként előírja. A Credigen az ügyfelekkel szembeni tisztességes magatartásról szóló Magatartási Kódexnek alávetette magát.<b>A fenti adatok tájékoztató jellegűek!</b> NGEN0", "www.credigen.hu", "http://www.credigen.hu/termekeink/aruhitel", 35.72, 43.92);

if(document.getElementById('credigenprice') != null)credigen.ar = document.getElementById('credigenprice').innerHTML.replace(/[^0-9]/g,'');
else credigen.ar = 500000;
tmp=credigen.writeForm();
credigen.initForm();
credigen.reCalculate();

