var matiere = new Array; //nouveau tableau matiere[0] = new Array("1", "0"); matiere[1] = new Array("2", "1"); matiere[2] = new Array("3", "2"); matiere[3] = new Array("4", "3"); matiere[4] = new Array("5", "4"); matiere[5] = new Array("6", "5"); // period1.1 var period=new Array; period["1"] = new Array; period["1"][0] = new Array("7", "7 дни"); period["1"][1] = new Array("10", "10 дни"); period["1"][2] = new Array("1", "1 месец"); period["1"][3] = new Array("3", "3 месеца"); period["1"][4] = new Array("6", "6 месеца"); period["1"][5] = new Array("12", "12 месеца"); period["1"][6] = new Array("18", "18 месеца"); period["1"][7] = new Array("24", "24 месеца"); period["1"][8] = new Array("30", "30 месеца"); period["1"][9] = new Array("36", "36 месеца"); //period2 period["2"]=new Array; period["2"][0] = new Array("12", "12 месеца"); period["2"][1] = new Array("18", "18 месеца"); period["2"][2] = new Array("24", "24 месеца"); period["2"][3] = new Array("30", "30 месеца"); period["2"][4] = new Array("36", "36 месеца"); //period3 period["3"]=new Array; period["3"][0] = new Array("1", "1 месец"); period["3"][1] = new Array("3", "3 месеца"); period["3"][2] = new Array("6", "6 месеца"); period["3"][3] = new Array("12", "12 месеца"); //period4 period["4"] = new Array; period["4"][0] = new Array("6", "6 месеца"); period["4"][1] = new Array("12", "12 месеца"); //period5 period["5"] = new Array; period["5"][0] = new Array("6", "6 месеца"); period["5"][1] = new Array("12", "12 месеца"); //period6 period["6"] = new Array; period["6"][0] = new Array("6", "6 месеца"); period["6"][1] = new Array("12", "12 месеца"); //initialize fields "interest", "benefit", "f_account" and "currency_txt" function met_blanc() { document.forms.Form1.elements.interest.value=""; document.forms.Form1.elements.benefit.value= ""; document.forms.Form1.elements.f_account.value=""; document.forms.Form1.elements.currency_txt.value=""; } function filltheselect(liste, choix) { choice_currency=document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value; choice_matiere=document.forms.Form1.elements.list_matiere.options[document.forms.Form1.elements.list_matiere.selectedIndex].value; switch (liste) { case "list_matiere": raz("listeville"); //si la monnaie est en pound et matiere 1 alors deb = 0; deb_2 = period[choix].length; if ((choice_currency=="GBP")&&(choice_matiere=="1")){ deb=2; } if ((choice_currency=="CHF")&&(choice_matiere=="1")){ deb=2; } if ((choice_currency=="USD")&&(choice_matiere=="1")){ deb_2=6; } if ((choice_currency=="GBP")&&(choice_matiere=="1")){ deb_2=6; } if ((choice_currency=="CHF")&&(choice_matiere=="1")){ deb_2=6; } if ((choice_currency=="GBP")&&(choice_matiere=="2")){ deb_2=0; } if ((choice_currency=="CHF")&&(choice_matiere=="2")){ deb_2=0; } if ((choice_currency=="GBP")&&(choice_matiere=="3")){ deb_2=0; } if ((choice_currency=="CHF")&&(choice_matiere=="3")){ deb_2=0; } if ((choice_currency=="USD")&&(choice_matiere=="4")){ deb_2=0; } if ((choice_currency=="GBP")&&(choice_matiere=="4")){ deb_2=0; } if ((choice_currency=="CHF")&&(choice_matiere=="4")){ deb_2=0; } if ((choice_currency=="USD")&&(choice_matiere=="5")){ deb_2=0; } if ((choice_currency=="GBP")&&(choice_matiere=="5")){ deb_2=0; } if ((choice_currency=="CHF")&&(choice_matiere=="5")){ deb_2=0; } if ((choice_currency=="USD")&&(choice_matiere=="6")){ deb_2=0; } if ((choice_currency=="GBP")&&(choice_matiere=="6")){ deb_2=0; } if ((choice_currency=="CHF")&&(choice_matiere=="6")){ deb_2=0; } for (i=deb; i" +period['1'][i][1]+""; chaine+="

"; chaine+=""; //document.write(chaine); break; } } function raz(liste) {l=document.forms.Form1.elements[liste].length; for (i=l; i>=0; i--) document.forms.Form1.elements[liste].options[i]=null; } //check the field "account" is not empty function validate(){ // si la valeur du champ account est non vide if(document.forms.Form1.elements.account.value != "") { return true; } else { //if the field is empty --> messagebox alert("Попълнете полето 'Сума'!"); met_blanc(); return false; } } //check the minimum asked for the account function comparison_min(nb, mini, choice_matiere, t_account){ if(choice_matiere==nb){ if (t_account "+mini+" !"); met_blanc(); evaluation=false; } } } //check the bracket asked for the account function comparison_fourchette(nb, mini, maxi, choice_matiere, t_account){ if(choice_matiere==nb){ if ((t_accountmaxi)){ alert ( " Сумата трябва да бъде > "+mini+" < "+maxi+" !"); met_blanc(); evaluation=false; } } } //check the maximum asked for the account function comparison_max(nb, maxi, choice_matiere, t_account){ if(choice_matiere==nb){ if (t_account>maxi){ alert ( "Сумата трябва да бъде < "+maxi+" !"); met_blanc(); evaluation=false; } } } //check the account function evaluate(t_account, choice_matiere, choice_currency) { evaluation=true; if(choice_matiere=="1"){ if(choice_currency=="BGN"){ if (t_account<30){ alert ( "Сумата трябва да бъде >30 !"); met_blanc(); evaluation=false; } } else{ if (t_account<100) { alert ( "Сумата трябва да бъде >100 !"); met_blanc(); evaluation=false; } } } comparison_min(2, 5000, choice_matiere, t_account); comparison_min(3, 100, choice_matiere, t_account); comparison_fourchette(4, 10000, 19999, choice_matiere, t_account); comparison_fourchette(5, 20000, 49999, choice_matiere, t_account); comparison_min(6, 50000, choice_matiere, t_account); return evaluation; } function calculate() { var evaluation; //tables with the interest rate and the period ////////////////////////////////BGN/////////////////////// var tablebg1 = new Array; for(var i=0; i<=36; i++){ tablebg1[i]=0; } var tablebg2 = new Array; for(var i=0; i<=36; i++){ tablebg2[i]=0; } var tablebg3 = new Array; for(var i=0; i<=36; i++){ tablebg3[i]=0; } var tablebg4 = new Array; for(var i=0; i<=36; i++){ tablebg4[i]=0; } var tablebg5 = new Array; for(var i=0; i<=36; i++){ tablebg5[i]=0; } var tablebg6 = new Array; for(var i=0; i<=36; i++){ tablebg6[i]=0; } var list_interestbg=new Array; list_interestbg[1]=tablebg1; list_interestbg[2]=tablebg2; list_interestbg[3]=tablebg3; list_interestbg[4]=tablebg4; list_interestbg[5]=tablebg5; list_interestbg[6]=tablebg6; ////////////////////////////euros/////////////////////// var tableeuros1 = new Array; for(var i=0; i<=36; i++){ tableeuros1[i]=0; } var tableeuros2 = new Array; for(var i=0; i<=36; i++){ tableeuros2[i]=0; } var tableeuros3 = new Array; for(var i=0; i<=36; i++){ tableeuros3[i]=0; } var tableeuros4 = new Array; for(var i=0; i<=36; i++){ tableeuros4[i]=0; } var tableeuros5 = new Array; for(var i=0; i<=36; i++){ tableeuros5[i]=0; } var tableeuros6 = new Array; for(var i=0; i<=36; i++){ tableeuros6[i]=0; } var list_interesteuros=new Array; list_interesteuros[1]=tableeuros1; list_interesteuros[2]=tableeuros2; list_interesteuros[3]=tableeuros3; list_interesteuros[4]=tableeuros4; list_interesteuros[5]=tableeuros5; list_interesteuros[6]=tableeuros6; ////////////////////////////usd//////////////////////////////////// var tableusd1 = new Array; for(var i=0; i<=36; i++){ tableusd1[i]=0; } var tableusd2 = new Array; for(var i=0; i<=36; i++){ tableusd2[i]=0; } var tableusd3 = new Array; for(var i=0; i<=36; i++){ tableusd3[i]=0; } var tableusd4 = new Array; for(var i=0; i<=36; i++){ tableusd4[i]=0; } var tableusd5 = new Array; for(var i=0; i<=36; i++){ tableusd5[i]=0; } var tableusd6 = new Array; for(var i=0; i<=36; i++){ tableusd6[i]=0; } var list_interestusd=new Array; list_interestusd[1]=tableusd1; list_interestusd[2]=tableusd2; list_interestusd[3]=tableusd3; list_interestusd[4]=tableusd4; list_interestusd[5]=tableusd5; list_interestusd[6]=tableusd6; ////////////////////////////GBP//////////////////////////////////// var tablegbp1 = new Array; for(var i=0; i<=36; i++){ tablegbp1[i]=0; } var list_interestgbp=new Array; list_interestgbp[1]=tablegbp1; ////////////////////////////CHF//////////////////////////////////// var tablechf1 = new Array; for(var i=0; i<=36; i++){ tablechf1[i]=0; } var list_interestchf=new Array; list_interestchf[1]=tablechf1; tablebg1[7]=0; tablebg1[10]=0; tablebg1[1]=0.01; tablebg1[3]=0.015; tablebg1[6]=0.02; tablebg1[12]=0.025; tablebg1[18]=0; tablebg1[24]=0.03; tablebg1[30]=0; tablebg1[36]=0.035; tablebg2[7]=0; tablebg2[10]=0; tablebg2[1]=0; tablebg2[3]=0; tablebg2[6]=0; tablebg2[12]=0; tablebg2[18]=0; tablebg2[24]=0; tablebg2[30]=0; tablebg2[36]=0; tablebg3[7]=0; tablebg3[10]=0; tablebg3[1]=0.015; tablebg3[3]=0.02; tablebg3[6]=0.025; tablebg3[12]=0.03; tablebg3[18]=0; tablebg3[24]=0; tablebg3[30]=0; tablebg3[36]=0; tablebg4[7]=0; tablebg4[10]=0; tablebg4[1]=0; tablebg4[3]=0; tablebg4[6]=0; tablebg4[12]=0; tablebg4[18]=0; tablebg4[24]=0; tablebg4[30]=0; tablebg4[36]=0; tablebg5[7]=0; tablebg5[10]=0; tablebg5[1]=0; tablebg5[3]=0; tablebg5[6]=0.2; tablebg5[12]=0.35; tablebg5[18]=0; tablebg5[24]=0; tablebg5[30]=0; tablebg5[36]=0; tablebg6[7]=0; tablebg6[10]=0; tablebg6[1]=0; tablebg6[3]=0; tablebg6[6]=0.3; tablebg6[12]=0.4; tablebg6[18]=0; tablebg6[24]=0; tablebg6[30]=0; tablebg6[36]=0; tablechf1[7]=0; tablechf1[10]=0; tablechf1[1]=0.01; tablechf1[3]=0.01; tablechf1[6]=0.01; tablechf1[12]=0.01; tablechf1[18]=0; tablechf1[24]=0; tablechf1[30]=0; tablechf1[36]=0; tableeuros1[7]=0; tableeuros1[10]=0; tableeuros1[1]=0.01; tableeuros1[3]=0.015; tableeuros1[6]=0.02; tableeuros1[12]=0.025; tableeuros1[18]=0; tableeuros1[24]=0.03; tableeuros1[30]=0; tableeuros1[36]=0.035; tableeuros2[7]=0; tableeuros2[10]=0; tableeuros2[1]=0; tableeuros2[3]=0; tableeuros2[6]=0; tableeuros2[12]=0; tableeuros2[18]=0; tableeuros2[24]=0; tableeuros2[30]=0; tableeuros2[36]=0; tableeuros3[7]=0; tableeuros3[10]=0; tableeuros3[1]=0.015; tableeuros3[3]=0.02; tableeuros3[6]=0.025; tableeuros3[12]=0.03; tableeuros3[18]=0; tableeuros3[24]=0; tableeuros3[30]=0; tableeuros3[36]=0; tableeuros4[7]=0; tableeuros4[10]=0; tableeuros4[1]=0; tableeuros4[3]=0; tableeuros4[6]=0; tableeuros4[12]=0; tableeuros4[18]=0; tableeuros4[24]=0; tableeuros4[30]=0; tableeuros4[36]=0; tableeuros5[7]=0; tableeuros5[10]=0; tableeuros5[1]=0; tableeuros5[3]=0; tableeuros5[6]=0.2; tableeuros5[12]=0.35; tableeuros5[18]=0; tableeuros5[24]=0; tableeuros5[30]=0; tableeuros5[36]=0; tableeuros6[7]=0; tableeuros6[10]=0; tableeuros6[1]=0; tableeuros6[3]=0; tableeuros6[6]=0.3; tableeuros6[12]=0.4; tableeuros6[18]=0; tableeuros6[24]=0; tableeuros6[30]=0; tableeuros6[36]=0; tablegbp1[7]=0; tablegbp1[10]=0; tablegbp1[1]=0.01; tablegbp1[3]=0.01; tablegbp1[6]=0.01; tablegbp1[12]=0.01; tablegbp1[18]=0; tablegbp1[24]=0; tablegbp1[30]=0; tablegbp1[36]=0; tableusd1[7]=0; tableusd1[10]=0; tableusd1[1]=0.015; tableusd1[3]=0.015; tableusd1[6]=0.02; tableusd1[12]=0.03; tableusd1[18]=0; tableusd1[24]=0.035; tableusd1[30]=0; tableusd1[36]=0.04; tableusd2[7]=0; tableusd2[10]=0; tableusd2[1]=0; tableusd2[3]=0; tableusd2[6]=0; tableusd2[12]=0; tableusd2[18]=0; tableusd2[24]=0; tableusd2[30]=0; tableusd2[36]=0; tableusd3[7]=0; tableusd3[10]=0; tableusd3[1]=0.02; tableusd3[3]=0.02; tableusd3[6]=0.025; tableusd3[12]=0.035; tableusd3[18]=0; tableusd3[24]=0; tableusd3[30]=0; tableusd3[36]=0; var test= validate(); if (test){ t_account=document.forms.Form1.elements.account.value; choice_matiere=document.forms.Form1.elements.list_matiere.options[document.forms.Form1.elements.list_matiere.selectedIndex].value; choice_currency=document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value; evaluation=evaluate(t_account, choice_matiere, choice_currency); if (evaluation){ choice_per=document.forms.Form1.elements.listeville.options[document.forms.Form1.elements.listeville.selectedIndex].value; // alert("choix mat "+ choice_matiere+" choix periode "+choice_per+" choix devise "+choice_currency); switch (choice_currency){ case "BGN" : document.forms.Form1.elements.interest.value=list_interestbg[choice_matiere][choice_per]; if ((choice_per==10)||(choice_per==7)){ final_account=Math.round((((list_interestbg[choice_matiere][choice_per])/(100*365))*t_account*choice_per+eval(t_account))*100)/100; }else{ final_account=Math.round(((((list_interestbg[choice_matiere][choice_per])/(100*360))*t_account*30*choice_per)+eval(t_account))*100)/100; } break; case "EUR" : document.forms.Form1.elements.interest.value=list_interesteuros[choice_matiere][choice_per]; if ((choice_per==10)||(choice_per==7)){ final_account=Math.round((((list_interesteuros[choice_matiere][choice_per])/(100*365))*t_account*choice_per+eval(t_account))*100)/100; }else{ final_account=Math.round(((((list_interesteuros[choice_matiere][choice_per])/(100*360))*t_account*30*choice_per)+eval(t_account))*100)/100; } break; case "USD" : document.forms.Form1.elements.interest.value=list_interestusd[choice_matiere][choice_per]; if ((choice_per==10)||(choice_per==7)){ final_account=Math.round((((list_interestusd[choice_matiere][choice_per])/(100*365))*t_account*choice_per+eval(t_account))*100)/100; }else{ final_account=Math.round(((((list_interestusd[choice_matiere][choice_per])/(100*360))*t_account*30*choice_per)+eval(t_account))*100)/100; } break; case "GBP" : document.forms.Form1.elements.interest.value=list_interestgbp[choice_matiere][choice_per]; if ((choice_per==10)||(choice_per==7)){ final_account=Math.round((((list_interestgbp[choice_matiere][choice_per])/(100*365))*t_account*choice_per+eval(t_account))*100)/100; }else{ final_account=Math.round(((((list_interestgbp[choice_matiere][choice_per])/(100*360))*t_account*30*choice_per)+eval(t_account))*100)/100; } break; case "CHF" : document.forms.Form1.elements.interest.value=list_interestchf[choice_matiere][choice_per]; if ((choice_per==10)||(choice_per==7)){ final_account=Math.round((((list_interestchf[choice_matiere][choice_per])/(100*365))*t_account*choice_per+eval(t_account))*100)/100; }else{ final_account=Math.round(((((list_interestchf[choice_matiere][choice_per])/(100*360))*t_account*30*choice_per)+eval(t_account))*100)/100; } break; } document.forms.Form1.elements.f_account.value=final_account; document.forms.Form1.elements.benefit.value= Math.round((eval(final_account)-eval(t_account))*100)/100; document.forms.Form1.elements.currency_txt.value=choice_currency; } } } var Today = new Date(); var TodaysYear = Today.getFullYear(); var TodaysMonth = 1+Today.getMonth() ; var TodaysDate = Today.getDate(); var TodaysDay = Today.getDay() ; var MonthLength = new Array("Mois_longueur_vide",31,29,31,30,31,30,31,31,30,31,30,31); // values from database var lastDay="30"; var lastMonth="04"; var lastYear="2000"; var tauxBuy; var tauxSell; /*var tauxBuy=1.96; var tauxSell=4; var tauxBuy_opt1=1.96; var tauxBuy_opt2=2; var tauxSell_opt1=4; var tauxSell_opt2=5;*/ ///////************************* show or hide warning messages **************************///////////// function cache(object){ if (document.layers && document.layers[object]) { document.layers[object].visibility = 'hidden'; } else if (document.all) { document.all[object].style.visibility = 'hidden'; } else if (document.getElementById) { document.getElementById(object).style.visibility = 'hidden'; } } function montre(object){ if (document.layers && document.layers[object]) { document.layers[object].visibility = 'visible'; } else if (document.all) { document.all[object].style.visibility = 'visible'; document.all[object].style.zIndex = 100; } else if (document.getElementById) { document.getElementById(object).style.visibility = 'visible'; document.getElementById(object).style.zIndex = 100; } } function change_text(object, text){ if (document.layers && document.layers[object]) { document.layers[object].innerHTML = text; } else if (document.all) { document.all[object].innerHTML = text; } else if (document.getElementById) { document.getElementById(object).innerHTML = text; } } ////////****************** DATE ************************////////////// // automatic date format dd.mm.yyyy function masqueSaisieDate(obj) { var ch; var ch_gauche, ch_droite; ch = obj.value; ch.toString(); if ( ( (ch.slice(2,3)) != (".") ) && (ch.length >= 3) ){ ch_gauche = ch.slice(0,2); ch_droite = ch.slice(2); obj.value = ch_gauche + "." + ch_droite; } if ( ( (ch.slice(5,6)) != (".") ) && (ch.length >= 6) ){ ch_gauche = ch.slice(0,5); ch_droite = ch.slice(5); obj.value = ch_gauche + "." + ch_droite; } return; } //load the current date in the form function load_date(){ if (TodaysMonth<10){ TodaysMonth="0"+(1+Today.getMonth()) ; } if (TodaysDate<10){ TodaysDate="0"+Today.getDate(); } chaineDate=TodaysDate+"."+TodaysMonth+"."+TodaysYear; document.forms.Form1.elements.dateSB.value = chaineDate; } /* Teste une annee pour determiner si elle est bissextile ou pas*/ function CheckLeap(yy) { if ((yy % 100 == 0 && yy % 400 == 0) || (yy % 4 == 0)) { //alert("bi"); return 29; } else { //alert("pas bi"); return 28; } } /*build error message for dates */ function msgDate(){ if ((lastMonth<10)){ if((lastMonth.substr(0,1)!="0")){ lastMonth="0"+lastMonth; } } if ((lastDay<10)){ if ((lastDay.substr(0,1)!="0")){ lastDay="0"+lastDay; } } HTMLCode=""; DateMessage.innerHTML = HTMLCode; } /* check the date */ function checkDate(){ //chaine.substr(nb_debut,taille) msgDate(); cache("msgDate1"); dateSaisie=document.forms.Form1.elements.dateSB.value; if((dateSaisie.substr(1,1)==".")||(dateSaisie.substr(3,1)==".")||(dateSaisie.substr(4,1)==".")||(dateSaisie.substr(6,1)==".")){ alert("date format"); }else{ jourSaisi=dateSaisie.substr(0,2); moisSaisi=dateSaisie.substr(3,2); anneeSaisie=dateSaisie.substr(6,4); nb_currentdate=((TodaysYear*10000) + (TodaysMonth*100) + TodaysDate); nb_written=((anneeSaisie *10000) + (moisSaisi *100)+ eval(jourSaisi)); anteDate(nb_written); postDate(nb_written); MonthLength[2]=CheckLeap(anneeSaisie); if (moisSaisi.substr(0,1)==0){ moisSaisi_temp=moisSaisi.substr(1,1); } //test la coherence des dates //alert(MonthLength[moisSaisi_temp]); if (MonthLength[moisSaisi_temp] < jourSaisi) /* on verifie si la date est coherente*/ { alert("Няма" + jourSaisi + " дни и месец "+moisSaisi + " но " + MonthLength[moisSaisi_temp] + ". \nБихте ли избрали друга дата!"); //load_date(); } } } // test si la date est anterieure a la date du jour function postDate(nb_saisi){ //alert((anneeSaisie *10000)+" "+(moisSaisi *100) ); //alert(nb_currentdate +" c "+nb); if ((nb_saisi) > nb_currentdate){ montre("msgDate1"); // load_date(); document.forms.Form1.elements.dateSB.focus(); } } //verifie si les dates sont coherentes function anteDate(nb_saisi){ //the last date in database if (((lastYear * 10000) + (lastMonth * 100) + eval(lastDay)) > nb_saisi){ montre("msgDate1"); // load_date(); document.forms.Form1.elements.dateSB.focus(); } } //verifie que la date saisie est superieure a la derniere reference dans la base de donnees //check the date is more older the last date in database function lastDate(){ } /////////////**************** EVENTS *********************///////////// /* */ function change_opt2(){ val_buy=document.forms.Form1.elements.option2.options[document.forms.Form1.elements.option1.selectedIndex].value; /* if (val_buy=="1"){ tauxBuy=tauxBuy_opt1; }else{ tauxBuy=tauxBuy_opt2; }*/ } function change_opt1(){ val_sell=document.forms.Form1.elements.option1.options[document.forms.Form1.elements.option2.selectedIndex].value; /* if (val_sell=="1"){ tauxSell=tauxSell_opt1; }else{ tauxSell=tauxSell_opt2; }*/ } function change_interest(){ } ////////////////////////********************** Currency ***********************//////////////// function check_currency(){ val1_currency=document.forms.Form1.elements.list_title1.options[document.forms.Form1.elements.list_title1.selectedIndex].value; val2_currency=document.forms.Form1.elements.list_title3.options[document.forms.Form1.elements.list_title3.selectedIndex].value; val3_currency=document.forms.Form1.elements.list_title2_1.options[document.forms.Form1.elements.list_title2_1.selectedIndex].value; val4_currency=document.forms.Form1.elements.list_title2_3.options[document.forms.Form1.elements.list_title2_3.selectedIndex].value; if(val1_currency==val2_currency){ alert("Не може да се преобразува "+val1_currency+" --> "+val2_currency+"!"); } else if(val3_currency==val4_currency){ alert("Не може да се преобразува "+val3_currency+" --> "+val4_currency+"!"); } } function fixe_interest(currency_1, currency_2){ switch(currency_1){ case "BGN": if(currency_2=="EUR"){ taux=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); } if(currency_2=="USD"){ taux=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); } if(currency_2=="CHF"){ taux=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); } if(currency_2=="GBP"){ taux=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); } break; case "EUR": if(currency_2=="BGN"){ taux=parseFloat(document.forms.Form1.elements.EUR_bnb.value); } if(currency_2=="USD"){ taux=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); taux=taux*tauxtemp; } if(currency_2=="CHF"){ taux=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); taux=taux*tauxtemp; } if(currency_2=="GBP"){ taux=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); taux=taux*tauxtemp; } break; case "USD": if(currency_2=="EUR"){ taux=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); taux=taux*tauxtemp; } if(currency_2=="BGN"){ taux=parseFloat(document.forms.Form1.elements.USD_bnb.value); } if(currency_2=="CHF"){ taux=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); taux=taux*tauxtemp; } if(currency_2=="GBP"){ taux=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); taux=taux*tauxtemp; } break; case "CHF": if(currency_2=="EUR"){ taux=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); taux=taux*tauxtemp; } if(currency_2=="USD"){ taux=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); taux=taux*tauxtemp; } if(currency_2=="BGN"){ taux=parseFloat(document.forms.Form1.elements.CHF_bnb.value); } if(currency_2=="GBP"){ taux=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); taux=taux*tauxtemp; } break; case "GBP": if(currency_2=="EUR"){ taux=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); taux=taux*tauxtemp; } if(currency_2=="USD"){ taux=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); taux=taux*tauxtemp; } if(currency_2=="CHF"){ taux=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxtemp=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); taux=taux*tauxtemp; } if(currency_2=="BGN"){ taux=parseFloat(document.forms.Form1.elements.GBP_bnb.value); } break; } } function Calculate_2(){ check_currency(); //Calculs //accounts written by the user accountBuy= document.forms.Form1.elements.c_title3.value ; accountSell=document.forms.Form1.elements.c_title1.value; val_buy=document.forms.Form1.elements.option2.options[document.forms.Form1.elements.option2.selectedIndex].value; val_sell=document.forms.Form1.elements.option1.options[document.forms.Form1.elements.option1.selectedIndex].value; //currency sold currency_sell_1=document.forms.Form1.elements.list_title1.options[document.forms.Form1.elements.list_title1.selectedIndex].value; currency_sell_2=document.forms.Form1.elements.list_title3.options[document.forms.Form1.elements.list_title3.selectedIndex].value; //curency bought currency_buy_1=document.forms.Form1.elements.list_title2_1.options[document.forms.Form1.elements.list_title2_1.selectedIndex].value; currency_buy_2=document.forms.Form1.elements.list_title2_3.options[document.forms.Form1.elements.list_title2_3.selectedIndex].value; switch (val_buy){ case "1": switch(currency_buy_1){ case "BGN": if(currency_buy_2=="EUR"){ tauxBuy=1/parseFloat(document.forms.Form1.elements.EUR_buy.value); } if(currency_buy_2=="USD"){ tauxBuy=1/parseFloat(document.forms.Form1.elements.USD_buy.value); } if(currency_buy_2=="CHF"){ tauxBuy=1/parseFloat(document.forms.Form1.elements.CHF_buy.value); } if(currency_buy_2=="GBP"){ tauxBuy=1/parseFloat(document.forms.Form1.elements.GBP_buy.value); } break; case "EUR": if(currency_buy_2=="BGN"){ tauxBuy=parseFloat(document.forms.Form1.elements.EUR_buy.value); } if(currency_buy_2=="USD"){ tauxBuy=parseFloat(document.forms.Form1.elements.EUR_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="CHF"){ tauxBuy=parseFloat(document.forms.Form1.elements.EUR_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.CHF_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="GBP"){ tauxBuy=parseFloat(document.forms.Form1.elements.EUR_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.GBP_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } break; case "USD": if(currency_buy_2=="EUR"){ tauxBuy=parseFloat(document.forms.Form1.elements.USD_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.EUR_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="BGN"){ tauxBuy=parseFloat(document.forms.Form1.elements.USD_buy.value); } if(currency_buy_2=="CHF"){ tauxBuy=parseFloat(document.forms.Form1.elements.USD_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.CHF_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="GBP"){ tauxBuy=parseFloat(document.forms.Form1.elements.USD_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.GBP_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } break; case "CHF": if(currency_buy_2=="EUR"){ tauxBuy=parseFloat(document.forms.Form1.elements.CHF_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.EUR_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="USD"){ tauxBuy=parseFloat(document.forms.Form1.elements.CHF_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="BGN"){ tauxBuy=parseFloat(document.forms.Form1.elements.CHF_buy.value); } if(currency_buy_2=="GBP"){ tauxBuy=parseFloat(document.forms.Form1.elements.CHF_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } break; case "GBP": if(currency_buy_2=="EUR"){ tauxBuy=parseFloat(document.forms.Form1.elements.GBP_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.EUR_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="USD"){ tauxBuy=parseFloat(document.forms.Form1.elements.GBP_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="CHF"){ tauxBuy=parseFloat(document.forms.Form1.elements.GBP_buy.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_buy.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="BGN"){ tauxBuy=parseFloat(document.forms.Form1.elements.GBP_buy.value); } break; } break; case "2": switch(currency_buy_1){ case "BGN": if(currency_buy_2=="EUR"){ tauxBuy=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); } if(currency_buy_2=="USD"){ tauxBuy=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); } if(currency_buy_2=="CHF"){ tauxBuy=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); } if(currency_buy_2=="GBP"){ tauxBuy=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); } break; case "EUR": if(currency_buy_2=="BGN"){ tauxBuy=parseFloat(document.forms.Form1.elements.EUR_bnb.value); } if(currency_buy_2=="USD"){ tauxBuy=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="CHF"){ tauxBuy=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="GBP"){ tauxBuy=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } break; case "USD": if(currency_buy_2=="EUR"){ tauxBuy=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="BGN"){ tauxBuy=parseFloat(document.forms.Form1.elements.USD_bnb.value); } if(currency_buy_2=="CHF"){ tauxBuy=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="GBP"){ tauxBuy=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } break; case "CHF": if(currency_buy_2=="EUR"){ tauxBuy=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="USD"){ tauxBuy=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="BGN"){ tauxBuy=parseFloat(document.forms.Form1.elements.CHF_bnb.value); } if(currency_buy_2=="GBP"){ tauxBuy=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } break; case "GBP": if(currency_buy_2=="EUR"){ tauxBuy=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="USD"){ tauxBuy=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="CHF"){ tauxBuy=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxBuytemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxBuy=tauxBuy*tauxBuytemp; } if(currency_buy_2=="BGN"){ tauxBuy=parseFloat(document.forms.Form1.elements.GBP_bnb.value); } break; } break; } switch (val_sell){ case "1": switch(currency_sell_1){ case "BGN": if(currency_sell_2=="EUR"){ tauxSell=1/parseFloat(document.forms.Form1.elements.EUR_sell.value); } if(currency_sell_2=="USD"){ tauxSell=1/parseFloat(document.forms.Form1.elements.USD_sell.value); } if(currency_sell_2=="CHF"){ tauxSell=1/parseFloat(document.forms.Form1.elements.CHF_sell.value); } if(currency_sell_2=="GBP"){ tauxSell=1/parseFloat(document.forms.Form1.elements.GBP_sell.value); } break; case "EUR": if(currency_sell_2=="GBP"){ tauxSell=parseFloat(document.forms.Form1.elements.EUR_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.GBP_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="USD"){ tauxSell=parseFloat(document.forms.Form1.elements.EUR_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.USD_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="CHF"){ tauxSell=parseFloat(document.forms.Form1.elements.EUR_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.CHF_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="BGN"){ tauxSell=parseFloat(document.forms.Form1.elements.EUR_sell.value); } break; case "USD": if(currency_sell_2=="EUR"){ tauxSell=parseFloat(document.forms.Form1.elements.USD_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.EUR_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="GBP"){ tauxSell=parseFloat(document.forms.Form1.elements.USD_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.GBP_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="CHF"){ tauxSell=parseFloat(document.forms.Form1.elements.USD_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.CHF_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="BGN"){ tauxSell=parseFloat(document.forms.Form1.elements.USD_sell.value); } break; case "CHF": if(currency_sell_2=="EUR"){ tauxSell=parseFloat(document.forms.Form1.elements.CHF_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.EUR_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="USD"){ tauxSell=parseFloat(document.forms.Form1.elements.CHF_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.USD_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="GBP"){ tauxSell=parseFloat(document.forms.Form1.elements.CHF_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.GBP_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="BGN"){ tauxSell=parseFloat(document.forms.Form1.elements.CHF_sell.value); } break; case "GBP": if(currency_sell_2=="EUR"){ tauxSell=parseFloat(document.forms.Form1.elements.GBP_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.EUR_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="USD"){ tauxSell=parseFloat(document.forms.Form1.elements.GBP_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.USD_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="CHF"){ tauxSell=parseFloat(document.forms.Form1.elements.GBP_sell.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.CHF_sell.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="BGN"){ tauxSell=parseFloat(document.forms.Form1.elements.GBP_sell.value); } break; } break; case "2": switch(currency_sell_1){ case "BGN": if(currency_sell_2=="EUR"){ tauxSell=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); } if(currency_sell_2=="USD"){ tauxSell=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); } if(currency_sell_2=="CHF"){ tauxSell=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); } if(currency_sell_2=="GBP"){ tauxSell=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); } break; case "EUR": if(currency_sell_2=="GBP"){ tauxSell=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="USD"){ tauxSell=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="CHF"){ tauxSell=parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="BGN"){ tauxSell=parseFloat(document.forms.Form1.elements.EUR_bnb.value); } break; case "USD": if(currency_sell_2=="EUR"){ tauxSell=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="GBP"){ tauxSell=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="CHF"){ tauxSell=parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="BGN"){ tauxSell=parseFloat(document.forms.Form1.elements.USD_bnb.value); } break; case "CHF": if(currency_sell_2=="EUR"){ tauxSell=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="USD"){ tauxSell=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="GBP"){ tauxSell=parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="BGN"){ tauxSell=parseFloat(document.forms.Form1.elements.CHF_bnb.value); } break; case "GBP": if(currency_sell_2=="EUR"){ tauxSell=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.EUR_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="USD"){ tauxSell=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.USD_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="CHF"){ tauxSell=parseFloat(document.forms.Form1.elements.GBP_bnb.value); tauxSelltemp=1/parseFloat(document.forms.Form1.elements.CHF_bnb.value); tauxSell=tauxSell*tauxSelltemp; } if(currency_sell_2=="BGN"){ tauxSell=parseFloat(document.forms.Form1.elements.GBP_bnb.value); } break; } break; } resultBuy=accountBuy*tauxBuy; resultSell=accountSell*tauxSell; if(accountBuy!=""){ document.forms.Form1.elements.c_title4.value=Math.round(resultBuy*100)/100; } if(accountSell!=""){ document.forms.Form1.elements.c_title2.value=Math.round(resultSell*100)/100; } } var matiere = new Array; //new table matiere[0] = new Array("1", "0"); matiere[1] = new Array("2", "1"); matiere[2] = new Array("3", "2"); matiere[3] = new Array("4", "3"); matiere[4] = new Array("5", "4"); // period1 var mat=new Array; mat["1"] = new Array; mat["1"][0] = new Array("BGN", " BGN "); mat["1"][1] = new Array("EUR", " EUR "); //period2 mat["2"]=new Array; mat["2"][0] = new Array("BGN", " BGN "); mat["2"][1] = new Array("EUR", " EUR "); //period3 mat["3"]=new Array; mat["3"][0] = new Array("EUR", " EUR "); //period4 mat["4"] = new Array; mat["4"][0] = new Array("BGN", " BGN "); mat["4"][1] = new Array("EUR", " EUR "); //period5 mat["5"] = new Array; mat["5"][0] = new Array("EUR", " EUR "); //period6 mat["6"] = new Array; mat["6"][0] = new Array("BGN", " BGN "); //period4 mat["7"] = new Array; mat["7"][0] = new Array("BGN", " BGN "); mat["7"][1] = new Array("EUR", " EUR "); var gar=new Array; gar["1"] = new Array; gar["1"][0] = new Array("0", "Поръчителство при месечен превод по сметка в банката"); gar["1"][1] = new Array("1", "Поръчителство при вноска на каса"); gar["1"][2] = new Array("2", "Залог в/у вземане на пар.средства и/или ДЦК"); gar["1"][3] = new Array("3", "Ипотека, с доказване на мин. остатъчен доход"); gar["1"][4] = new Array("4", "Ипотека, без доказване на мин. остататъчен доход"); gar["2"]=new Array; gar["2"][0] = new Array("0", "Ипотека, с док.на мин.остат.доход"); gar["2"][1] = new Array("1", "Ипотека, без док.на мин.остат.доход"); gar["3"]=new Array; gar["3"][0] = new Array("0", "Ипотека, с док.на мин.остат.доход"); gar["3"][1] = new Array("1", "Ипотека, без док.на мин.остат.доход"); gar["4"] = new Array; gar["4"][0] = new Array("0", "Различно "); gar["5"] = new Array; gar["5"][0] = new Array("0", "Ипотека "); gar["5"][1] = new Array("1", "Поръчителство"); gar["5"][2] = new Array("2", "Залог "); gar["6"] = new Array; gar["6"][0] = new Array("0", "Ипотека "); gar["6"][1] = new Array("1", "Поръчителство"); gar["7"] = new Array; gar["7"][0] = new Array("0", "Различно "); //adapts the combobox of currency switch the choice in the first combobox function changeCurrency(liste,choix){ document.forms.Form1.elements.explanation.value=""; switch (liste){ case "list_matiere": raz("currency"); for (i=0; i "+mat['1'][i][1]+" "; chaine+="

"; chaine+=""; //document.write(chaine); choix_mat=document.forms.Form1.elements.list_matiere.options[document.forms.Form1.elements.list_matiere.selectedIndex].value; if(choix_mat=="3"){ // document.forms.Form1.elements.degressif.disabled=true; document.forms.Form1.radiobutton [0].disabled = false; document.forms.Form1.radiobutton [0].checked = true; document.forms.Form1.radiobutton [1].disabled = true; } else if ((choix_mat=="4")||(choix_mat=="7")||(choix_mat=="5")){ // document.forms.Form1.elements.degressif.disabled=true; document.forms.Form1.radiobutton [1].disabled = false; document.forms.Form1.radiobutton [1].checked = true; document.forms.Form1.radiobutton [0].disabled = true; } else{ document.forms.Form1.radiobutton [0].disabled = false; document.forms.Form1.radiobutton [1].disabled = false; document.forms.Form1.radiobutton [1].checked = false; document.forms.Form1.radiobutton [0].checked = false; } //adapte les differentes garanties possibles raz("garanties"); for (i=0; i "+gar['1'][i][1]+" "; chaine+="

"; chaine+=""; choixmat=document.forms.Form1.elements.list_matiere.options[document.forms.Form1.elements.list_matiere.selectedIndex].value; if(choixmat!="1"){ cache("zone_expl"); } if(choixmat=="3"){ montre("list_3"); } if(choixmat!="3"){ cache("list_3"); } if (choixmat=="5"){ change_text("title_1", "Лихва по сметка"); // document.forms.Form1.elements.title_interest.value=" LIBOR"; }else { change_text("title_1", "Базов лихвен процент"); // document.forms.Form1.elements.title_interest.value=" fixed"; //} else { // document.forms.Form1.elements.title_interest.value="OLP "; } break; } } function raz(liste) {l=document.forms.Form1.elements[liste].length; for (i=l; i>=0; i--) document.forms.Form1.elements[liste].options[i]=null; } //check the textfield are not empty function validate_field(){ if((document.forms.Form1.elements.account.value != "") && (document.forms.Form1.elements.period.value != "")) { return true; } else { if (document.forms.Form1.elements.account.value == ""){ //if the field is empty --> messagebox alert("Попълнете полето 'Сума' !"); return false; } else{ //if the field is empty --> messagebox alert("Попълнете полето 'Период'!"); return false; } } } //Check the user chose a radiobutton function validate_checkBox(){ if (document.forms.Form1.radiobutton [0].checked == false && document.forms.Form1.radiobutton [1].checked == false){ alert("Изберете вида на вноската"); return false; } else { return true; } } function fonc_garanties(){ var m11=0; var m12=0; var m13=0; var m14=0; var m15=0; m11=6; m12=5; m13=2.5; m14=1; m15=3; garanties=document.forms.Form1.elements.garanties.selectedIndex; var point; switch(garanties){ case 0: point=m12; //ИПОТЕКА 0 return point; break; case 1: point=m11; //ПОРЪЧИТЕЛСТВО 1 return point; break; case 2: point=m13; //ЗАЛОГ 2 return point; break; case 3: point=m14; //ИПОТЕКА 2 return point; break; case 4: point=m15; //ПОРЪЧИТЕЛСТВО 2 return point; break; } } function calcul_lineaire(interet, majo){ somme=document.forms.Form1.elements.account.value; temps=document.forms.Form1.elements.period.value; interet = check_interet(interet, majo); majo = check_majo(majo); percent_aff=interet+majo; document.forms.Form1.elements.percentage.value=Math.round(percent_aff*100)/100; //old :percent=(((interet+majo)/12)/100); //new : percent=Math.round( (((interet+majo)/12)/100)/(360/360) * 1000000000) / 1000000000; //percent=(((interet+majo)/12)/100)/(360/360); tempo=1+percent; annuite=Math.round((somme*percent)/(1-(Math.pow(tempo,(-(temps)))))*100)/100; annuite_temp=(somme*percent)/(1-(Math.pow(tempo,(-(temps))))); //annuite=Math.round(((somme*(1+percent))/temps)*100)/100; document.forms.Form1.elements.payment.value=annuite; //interets pour toute la periode decrease_temp = (somme * percent_aff / 100) / 12; montant_restant = somme - (annuite - decrease_temp); montant_restant = Math.round(montant_restant * 100) / 100; temp_days = 30; for(i=1; iequal switch(list_matiere){ case "1": eval_point=fonc_garanties(); if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { calcul_lineaire(euribor, eval_point); document.forms.Form1.elements.rappel_interest.value=euribor; }else{ calcul_lineaire(interest, eval_point); document.forms.Form1.elements.rappel_interest.value=interest; } document.forms.Form1.elements.rappel_majoration.value=eval_point; //beginning of the calculations - lancement des calculs break; case "2" : if (document.forms.Form1.elements.garanties.selectedIndex == 0) { majoration = m21; }else{ majoration = m22; } if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { calcul_lineaire(euribor, majoration); document.forms.Form1.elements.rappel_interest.value=euribor; }else{ calcul_lineaire(interest, majoration); document.forms.Form1.elements.rappel_interest.value=interest; } document.forms.Form1.elements.rappel_majoration.value=majoration; break; case "3" : if (document.forms.Form1.elements.garanties.selectedIndex == 0) { majoration = m31; }else{ majoration = m32; } calcul_lineaire(majoration, 0); document.forms.Form1.elements.interest_type.value = "" // choix_3=document.forms.Form1.elements.liste_3.options[document.forms.Form1.elements.liste_3.selectedIndex].value; // if(choix_3==1){calcul_lineaire(12, majoration); // interest3=12;} // if(choix_3==0){ // calcul_lineaire(11, majoration); // interest3=11;} document.forms.Form1.elements.rappel_interest.value=majoration; document.forms.Form1.elements.rappel_majoration.value=0; break; case "6" : majoration = m61; if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { calcul_lineaire(euribor, majoration); document.forms.Form1.elements.rappel_interest.value=euribor; }else{ calcul_lineaire(interest, majoration); document.forms.Form1.elements.rappel_interest.value=interest; } document.forms.Form1.elements.rappel_majoration.value=majoration; break; } } if(document.forms.Form1.radiobutton [1].checked == true){ // ->decreasing switch(list_matiere){ case "1": eval_point=fonc_garanties(); if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { calcul_degressif(euribor, eval_point); document.forms.Form1.elements.rappel_interest.value=euribor; }else{ calcul_degressif(interest, eval_point); document.forms.Form1.elements.rappel_interest.value=interest; } document.forms.Form1.elements.rappel_majoration.value=eval_point; break; case "2" : if (document.forms.Form1.elements.garanties.selectedIndex == 0) { majoration = m21; }else{ majoration = m22; } if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { calcul_degressif(euribor, majoration); document.forms.Form1.elements.rappel_interest.value=euribor; }else{ calcul_degressif(interest, majoration); document.forms.Form1.elements.rappel_interest.value=interest; } document.forms.Form1.elements.rappel_majoration.value=majoration; break; case "4" : majoration = m41; if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { calcul_degressif(majoration, 0); document.forms.Form1.elements.rappel_interest.value=majoration; }else{ calcul_degressif(majoration, 0); document.forms.Form1.elements.rappel_interest.value=majoration; } document.forms.Form1.elements.interest_type.value = "" document.forms.Form1.elements.rappel_majoration.value=0; break; case "5" : majoration = m51; if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { //calcul_lineaire(euribor, majoration); calcul_degressif(euribor, majoration); document.forms.Form1.elements.rappel_interest.value=euribor; }else{ //calcul_lineaire(interest, majoration); calcul_degressif(interest, majoration); document.forms.Form1.elements.rappel_interest.value=interest; } document.forms.Form1.elements.rappel_majoration.value=majoration; break; case "6" : majoration = m61; if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { calcul_degressif(euribor, majoration); document.forms.Form1.elements.rappel_interest.value=euribor; }else{ calcul_degressif(interest, majoration); document.forms.Form1.elements.rappel_interest.value=interest; } document.forms.Form1.elements.rappel_majoration.value=majoration; break; case "7" : majoration = m71; if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { calcul_degressif(majoration, 0); document.forms.Form1.elements.rappel_interest.value=majoration; }else{ calcul_degressif(majoration, 0); document.forms.Form1.elements.rappel_interest.value=majoration; } document.forms.Form1.elements.interest_type.value = "" document.forms.Form1.elements.rappel_majoration.value=0; break; } } document.forms.Form1.elements.rappel_majoration.value = check_majo(document.forms.Form1.elements.rappel_majoration.value); } // write in the textearea function txt(zonetxt){ choixmat=document.forms.Form1.elements.list_matiere.options[document.forms.Form1.elements.list_matiere.selectedIndex].value; choixgar=document.forms.Form1.elements.garanties.selectedIndex; choixval=document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value; if(choixmat=="1"){ switch(zonetxt){ case "account": if( (choixgar == 0 || choixgar == 1) && choixval == "BGN"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде >=500 <=15000 BGN"; } else if( (choixgar == 0 || choixgar == 1) && choixval == "EUR"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде >=256 <=7669 ЕUR"; } else if( choixgar == 2 && choixval == "BGN"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде >=500 BGN"; } else if(choixgar == 2 && choixval == "EUR"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде >=256 ЕUR"; } else if( (choixgar == 3 || choixgar == 4) && choixval == "BGN"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде >=5000 BGN"; } else if( (choixgar == 3 || choixgar == 4) && choixval == "EUR"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде >=2556 ЕUR"; } else{ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" невъзможен избор"; } break; case "period": if(choixgar == 0 || choixgar == 1){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >1 <=120"; } else if( (choixgar == 3 || choixgar == 4) && choixval == "BGN"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >1 <=300"; } else if( (choixgar == 3 || choixgar == 4) && choixval == "EUR"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >1 <=360"; } else if(choixgar == 2){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >=6 <=60"; } else{ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" невъзможен избор"; } break; case "user_interest": montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Лихвен процент на влога/сметката с най-висока лихва."; break; } } if(choixmat=="2"){ switch(zonetxt){ case "account": cache("zone_expl"); document.forms.Form1.elements.explanation.value=" "; break; case "period": if(choixval == "BGN"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >=1 <=300"; } else if(choixval == "EUR"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >=1 <=360"; } else{ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" невъзможен избор"; } break; } } if(choixmat=="3"){ switch(zonetxt){ case "account": cache("zone_expl"); document.forms.Form1.elements.explanation.value=" "; break; case "period": if(choixval == "EUR"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >=1 <=84"; } else{ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" невъзможен избор"; } break; } } if(choixmat=="4"){ switch(zonetxt){ case "account": cache("zone_expl"); document.forms.Form1.elements.explanation.value=" "; break; case "period": montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >=12 <=36"; break; } } if(choixmat=="5"){ switch(zonetxt){ case "account": cache("zone_expl"); document.forms.Form1.elements.explanation.value=" "; break; case "period": montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде <=72"; break; case "user_interest": montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Лихвен процент на влога/сметката с най-висока лихва."; break; } } if(choixmat=="6"){ switch(zonetxt){ case "account": if( choixval == "BGN"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде <=5000 BGN"; } else{ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" невъзможен избор"; } break; case "period": montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде <=60"; break; } } if(choixmat=="7"){ switch(zonetxt){ case "account": if( choixval == "BGN"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде <=20000 BGN"; } else if(choixval == "EUR"){ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Сумата трябва да бъде <=10225 ЕUR"; } else{ montre("zone_expl"); document.forms.Form1.elements.explanation.value=" невъзможен избор"; } break; case "period": montre("zone_expl"); document.forms.Form1.elements.explanation.value=" Срокът трябва да бъде >=12 <=36"; break; } } else{ //cache("zone_expl"); } } function checkTextField(){ choixgar=document.forms.Form1.elements.garanties.selectedIndex; val_account= document.forms.Form1.elements.account.value; val_period= document.forms.Form1.elements.period.value; choixmat=document.forms.Form1.elements.list_matiere.options[document.forms.Form1.elements.list_matiere.selectedIndex].value; choixval=document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value; switch (choixmat){ case "1" : if ((choixgar==0 || choixgar==1) && choixval == "BGN"){ if((500>val_account)||(val_account>15000)){ alert("Сумата трябва да бъде >=500 <=15000 BGN"); return false; } else if((val_period>120)||(val_period<2)){ alert("Срокът трябва да бъде >1 <=120"); return false; }else {return true;} } if ((choixgar==0 || choixgar==1) && choixval == "EUR"){ if((256>val_account)||(val_account>7669)){ alert("Сумата трябва да бъде >=256 <=7669 ЕUR"); return false; } else if((val_period>120)||(val_period<2)){ alert("Срокът трябва да бъде >1 <=120"); return false; }else {return true;} } if (choixgar==2 && choixval == "BGN"){ if((500>val_account)){ alert("Сумата трябва да бъде >=500 BGN"); return false; } else if((val_period>60)||(val_period<6)){ alert("Срокът трябва да бъде >=6 <=60"); return false; }else {return true;} } if (choixgar==2 && choixval == "EUR"){ if((256>val_account)){ alert("Сумата трябва да бъде >=256 ЕUR"); return false; } else if((val_period>60)||(val_period<6)){ alert("Срокът трябва да бъде >=6 <=60"); return false; }else {return true;} } if ( (choixgar==3 || choixgar == 4) && choixval == "BGN"){ if((5000>val_account)){ alert("Сумата трябва да бъде >=5000 BGN"); return false; } else if((val_period>300)||(val_period<1)){ alert("Срокът трябва да бъде >=1 <=300"); return false; }else {return true;} } if ( (choixgar==3 || choixgar == 4) && choixval == "EUR"){ if((2556>val_account)){ alert("Сумата трябва да бъде >=2556 ЕUR"); return false; } else if((val_period>360)||(val_period<1)){ alert("Срокът трябва да бъде >=1 <=360"); return false; }else {return true;} } else {return true;} break; case "2" : if (choixval == "BGN"){ if((val_period>300)||(val_period<1)){ alert("Срокът трябва да бъде >=1 <=300"); return false; }else {return true;} } if (choixval == "EUR"){ if((val_period>360)||(val_period<1)){ alert("Срокът трябва да бъде >=1 <=360"); return false; }else {return true;} } else {return true;} break; case "3" : if (choixval == "EUR"){ if((val_period>84)||(val_period<1)){ alert("Срокът трябва да бъде >=1 <=84"); return false; }else {return true;} } else {return true;} break; case "4" : if((val_period>36)||(val_period<12)){ alert("Срокът трябва да бъде >=12 <=36"); return false; }else {return true;} break; case "5" : if((val_period>72)||(val_period<1)){ alert("Срокът трябва да бъде <=72"); return false; }else {return true;} break; case "6" : if (choixval == "BGN"){ if((val_account>5000)){ alert("Сумата трябва да бъде <=5000 BGN"); return false; } else if((val_period>60)||(val_period<1)){ alert("Срокът трябва да бъде <=60"); return false; }else {return true;} } else {return true;} break; case "7" : if (choixval == "BGN"){ if((val_account>20000)){ alert("Сумата трябва да бъде <=20000 BGN"); return false; } else if((val_period>36)||(val_period<12)){ alert("Срокът трябва да бъде >=12 <=36"); return false; }else {return true;} } if (choixval == "EUR"){ if((val_account>10225)){ alert("Сумата трябва да бъде <=10225 EUR"); return false; } else if((val_period>36)||(val_period<12)){ alert("Срокът трябва да бъде >=12 <=36"); return false; }else {return true;} } else {return true;} break; default:if(val_period>84){ alert("Срокът трябва да бъде <84 месеца !"); return false; }else{ return true;} break; } } //////////////////////////////////////////main function/////////////////////////////// function Calculate3(){ var eval_field=true; var eval_checkBox=true; var eval_txtfield=true; //check the textfields are not empty eval_field=validate_field(); if(eval_field){ //check the values in the textfields eval_txtfield=checkTextField(); if(eval_txtfield){ //check a radiobutton was chosen eval_checkBox=validate_checkBox(); if (eval_checkBox){ //disable textfields switch the choice equal/decreasing if (document.forms.Form1.radiobutton [0].checked == true){ document.forms.Form1.elements.percentage.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.payment.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.total_interest.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.txt_pay.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.txt_interest.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.month.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.month_g.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.month_n.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.month_l.style.backgroundColor='#DDDDDD'; //document.forms.Form1.elements.decreasing.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.total_interest_d.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.txt_month.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.txt_decreasing.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.txt_interest_d.style.backgroundColor='#DDDDDD'; }else { document.forms.Form1.elements.percentage.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.payment.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.total_interest.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.txt_pay.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.txt_interest.style.backgroundColor='#DDDDDD'; document.forms.Form1.elements.month.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.month_g.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.month_n.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.month_l.style.backgroundColor='#FFFFFF'; //document.forms.Form1.elements.decreasing.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.total_interest_d.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.txt_month.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.txt_decreasing.style.backgroundColor='#FFFFFF'; document.forms.Form1.elements.txt_interest_d.style.backgroundColor='#FFFFFF'; } if (document.forms.Form1.elements.currency.options[document.forms.Form1.elements.currency.selectedIndex].value == "EUR") { document.forms.Form1.elements.interest_type.value = "EURIBOR"; }else{ document.forms.Form1.elements.interest_type.value = "ОЛП"; } calcul_interest(); } } } } function Clearform(){ document.forms.Form1.elements.explanation.value=""; //cache("explanation"); document.forms.Form1.radiobutton [0].disabled = false; document.forms.Form1.radiobutton [1].disabled = false; document.forms.Form1.radiobutton [1].checked = false; document.forms.Form1.radiobutton [0].checked = false; document.forms.Form1.elements.account.value = ""; document.forms.Form1.elements.period.value = ""; document.forms.Form1.elements.interest_type.value = ""; document.forms.Form1.elements.rappel_interest.value = ""; document.forms.Form1.elements.rappel_majoration.value = ""; changeCurrency('list_matiere', 1); document.forms.Form1.elements.list_matiere.selectedIndex = 0; document.forms.Form1.elements.garanties.selectedIndex = 0; document.forms.Form1.elements.currency.selectedIndex = "BGN"; document.forms.Form1.elements.total_interest_d.value = ""; document.forms.Form1.elements.month.value = ""; document.forms.Form1.elements.month_g.value = ""; document.forms.Form1.elements.month_n.value = ""; document.forms.Form1.elements.month_l.value = ""; document.forms.Form1.elements.txt_month.value = ""; //document.forms.Form1.elements.decreasing.value = ""; document.forms.Form1.elements.txt_decreasing.value = ""; document.forms.Form1.elements.txt_interest_d.value = ""; document.forms.Form1.elements.percentage.value = ""; document.forms.Form1.elements.payment.value = ""; document.forms.Form1.elements.total_interest.value = ""; document.forms.Form1.elements.txt_pay.value = ""; document.forms.Form1.elements.txt_interest.value = ""; }