function question_request(name, email, desc, captcha_comment) { var url = "/ajax/question_request.php"; var params = { name : name, email : email, desc : desc, agree : ($('#agree').is(':checked'))? 1 : 0, captcha_comment : captcha_comment }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ $("#question_request_msg").html(data); $("#question_request_msg").css({'color' : 'red'}); $("#question_request_msg").show(); } else { $("#question_request_msg").css({'color' : 'green'}); $("#question_request_msg").html("Коментарът Ви е записан успешно."); setTimeout(function(){ $('input[name=name]').val(''); $('input[name=email]').val(''); $('#description').val(''); $('#captcha_comment').val(''); $("#question_request_msg").hide(); }, 4000); } }); } function partner_request(company, name, city, offices, phone, email, desc, captcha_comment) { var url = "/ajax/partner_request.php"; var params = { company : company, name : name, city : city, offices : offices, phone : phone, email : email, desc : desc, agree : ($('#agree').is(':checked'))? 1 : 0, captcha_comment : captcha_comment }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ $("#partner_request_msg").html(data); $("#partner_request_msg").css({'color' : 'red'}); $("#partner_request_msg").show(); } else { $("#partner_request_msg").css({'color' : 'green'}); $("#partner_request_msg").html("Благодарим Ви. Вашето запитване беше изпратено успешно."); setTimeout(function(){ $('input[name=company]').val(''); $('input[name=name]').val(''); $('input[name=city]').val(''); $('input[name=offices]').val(''); $('input[name=phone]').val(''); $('input[name=email]').val(''); $('#description').val(''); $('#captcha_comment').val(''); $("#partner_request_msg").hide(); }, 4000); } }); } function career_request(career_id, name, email, cv, desc, captcha_comment) { var url = "/ajax/careers_requests.php"; var params = { career_id : career_id, name : name, email : email, cv : cv, desc : desc, agree : ($('#agree').is(':checked'))? 1 : 0, captcha_comment : captcha_comment }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ $("#career_request_msg").html(data); $("#career_request_msg").css({'color' : 'red'}); $("#career_request_msg").show(); } else { $("#career_request_msg").css({'color' : 'green'}); $("#career_request_msg").html("Благодарим Ви. Вашата кандидатура беше изпратена успешно."); setTimeout(function(){ $('input[name=name]').val(''); $('input[name=email]').val(''); $('input[name=cv]').val(''); $('#description').val(''); $('#captcha_comment').val(''); $("#career_request_msg").hide(); }, 4000); } }); } function consultant_request(name, email, cv, desc, captcha_comment) { var url = "/ajax/consultant_requests.php"; var params = { name : name, email : email, cv : cv, desc : desc, agree : ($('#agree').is(':checked'))? 1 : 0, captcha_comment : captcha_comment }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ $("#consultant_request_msg").html(data); $("#consultant_request_msg").css({'color' : 'red'}); $("#consultant_request_msg").show(); } else { $("#consultant_request_msg").css({'color' : 'green'}); $("#consultant_request_msg").html("Благодарим Ви. Вашата кандидатура беше изпратена успешно."); setTimeout(function(){ $('input[name=name]').val(''); $('input[name=email]').val(''); $('input[name=cv]').val(''); $('#description').val(''); $('#captcha_comment').val(''); $("#consultant_request_msg").hide(); }, 4000); } }); } function save_comment(name, comment, captcha_comment) { var url = "/ajax/save_comment.php"; var params = { name : name, comment : comment, captcha_comment : captcha_comment }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ $("#success").html(data); $("#success").css({'color' : 'red'}); $("#success").show(); } else { $("#success").css({'color' : 'green'}); $("#success").css({'font-weight' : 'bold'}); $("#success").html("Коментарът Ви е записан успешно."); setTimeout(function(){ $('input[name=name]').val(''); $('#comment').val(''); $("#success").html(''); $("#comment_holder").hide(); }, 2500); } }); } function calculator_plan_popup(sum, term, instalments) { var url = "/ajax/calculator_plan_popup.php"; var params = { sum : sum, term : term, instalments : instalments }; $.get(url, params, function(data) { $('#calculator_popup').show(); $('#calculator_popup').html(data); }); } function print_calculator_plan_table(date, sum, term, instalments) { var url = "/ajax/print_calculator_plan_table.php"; var params = { date : date, sum : sum, term : term, instalments : instalments }; $.get(url, params, function(data) { $('#microcredit_step1_popup').hide(); $('#microcredit_plan_table').html(data); }); } function show_all_expences(sum, total_sum, term, instalment, code) { var url = "/ajax/show_all_expences.php"; var params = { sum : sum, total_sum : total_sum, term : term, instalment : instalment, code : code, sms : ($('#sms').is(":checked"))? 1 : 0, payment_type: parseFloat($('#payment_type').val()) }; $.get(url, params, function(data) { $('#expences_popup').show(); $('#expences_popup').html(data); }); } function search_promo_code(code, total_sum, vnoska, sum, term, instalment, payment_type, sms_price, sms_flag) { var url = "/ajax/search_promo_code.php"; var params = { code : code }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ $("#promo_code").parent().find('img').attr('src', $("#promo_code").parent().find('img').attr('src').replace("gray", "blue")); $('input[name=promo_percent]').val(data); if(sms_flag) { $('#total_sum').html(parseFloat(total_sum - (total_sum - sum - parseFloat(payment_type) - parseFloat(sms_price) * instalment ) * data / 100 ).toFixed(2)); $('#instalment').html(parseFloat((total_sum - (total_sum - sum - parseFloat(payment_type)) * data / 100 - parseFloat(payment_type) - parseFloat(sms_price) * instalment ) / instalment).toFixed(2)); } else { $('#total_sum').html(parseFloat(total_sum - (total_sum - sum - parseFloat(payment_type) ) * data / 100 ).toFixed(2)); $('#instalment').html(parseFloat((total_sum - (total_sum - sum - parseFloat(payment_type)) * data / 100 - parseFloat(payment_type) ) / instalment).toFixed(2)); } } else { $("#promo_code").parent().find('img').attr('src', "/img/tick_gray.png"); $('input[name=promo_percent]').val(''); $('#total_sum').html($('input[name=total_sum_old]').val()); $('#instalment').html($('input[name=instalment_old]').val()); } }); } /* microcredit popup functions */ function microcredit_step1() { var url = "/ajax/microcredit_step1.php"; var params = { date : $('#datepicker').val(), request_sum : $('input[name=microcredit_sum]').val(), period : $('input[name=microcredit_term]').val(), instalment_cnt : $('input[name=microcredit_instalment]').val(), partner_code : $('input[name=promo_code]').val(), promo_percent : $('input[name=promo_percent]').val(), sms_notification : ($('#sms').is(":checked"))? 1 : 0, payment_type : $('select[name=payment_type] option:selected').attr('rel'), how_find_us : $('#how_find_us option:selected').val(), how_find_us_specif : $('input[name=how_find_us_specif]').val() }; $.get(url, params, function(data) { $('#microcredit_plan_popup').hide(); $('#microcredit_step1_popup').show(); $('#microcredit_step1_popup').html(data); }); } function microcredit_step1_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/microcredit_step1_request.php"; var params = { firstname_bg_BG : $('input[name=firstname_bg_BG]').val(), sirname_bg_BG : $('input[name=sirname_bg_BG]').val(), lastname_bg_BG : $('input[name=lastname_bg_BG]').val(), egn : $('input[name=egn]').val(), id_card : $('input[name=id_card]').val(), id_card_valid_to : $('input[name=id_card_valid_to]').val(), id_card_from : $('select[name=id_card_from]').val(), city : $('input[name=city]').val(), address_bg_BG : $('input[name=address_bg_BG]').val(), city_corresp : $('input[name=city_corresp]').val(), address_corresp_bg_BG : $('input[name=address_corresp_bg_BG]').val(), phone : $('input[name=phone]').val(), phone_home : $('input[name=phone_home]').val(), phone_extra : $('input[name=phone_extra]').val(), email : $('input[name=email]').val(), living_status : $('select[name=living_status]').val(), family_status : $('select[name=family_status]').val(), household_members_without_income : $('input[name=household_members_without_income]').val(), city_id : $('select[name=city_id]').val(), office_id : $('select[name=office_id]').val(), endless_card : ($('input[name=endless_card]').is(":checked"))? 1 : 0, family_partner : $('input[name=family_partner]').val(), family_partner_egn : $('input[name=family_partner_egn]').val(), available_at : $('input[name=available_at]').val(), phone_operator : $('select[name=phone_operator]').val(), live_here_from : $('input[name=live_here_from]').val(), nationality : $('select[name=nationality]').val(), nationality_specif : $('input[name=nationality_specif]').val() }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step1_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); microcredit_step2(); } }); } function microcredit_step2() { var url = "/ajax/microcredit_step2.php"; var params = { }; $.get(url, params, function(data) { $('#microcredit_step1_popup').show(); $('#microcredit_step1_popup').html(data); }); } function microcredit_step2_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/microcredit_step2_request.php"; var params = { company_bg_BG : $('input[name=company_bg_BG]').val(), company_city : $('input[name=company_city]').val(), work_phone : $('input[name=work_phone]').val(), position_bg_BG : $('input[name=position_bg_BG]').val(), labour_contract : $('select[name=labour_contract]').val(), practice : $('select[name=practice]').val(), education : $('select[name=education]').val(), bulstat : $('input[name=bulstat]').val(), field_of_activity : $('input[name=field_of_activity]').val(), full_practice : $('input[name=full_practice]').val() }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step2_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); microcredit_step3(); } }); } function microcredit_step3() { var url = "/ajax/microcredit_step3.php"; var params = { }; $.get(url, params, function(data) { $('#microcredit_step1_popup').show(); $('#microcredit_step1_popup').html(data); }); } function microcredit_step3_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var bank_names = new Array(); $('input[name=bank_names]').each(function(){ bank_names.push($(this).val()); }); var credit_sums = new Array(); $('input[name=credit_sums]').each(function(){ credit_sums.push($(this).val()); }); var montly_instalments = new Array(); $('input[name=montly_instalments]').each(function(){ montly_instalments.push($(this).val()); }); var date_terms = new Array(); $('input[name=date_terms]').each(function(){ date_terms.push($(this).val()); }); var bank_names_card = new Array(); $('input[name=bank_names_card]').each(function(){ bank_names_card.push($(this).val()); }); var card_date_terms = new Array(); $('input[name=card_date_terms]').each(function(){ card_date_terms.push($(this).val()); }); var card_type = new Array(); $('select[name=card_type]').each(function(){ card_type.push($(this).val()); }); var card_limit = new Array(); $('input[name=card_limit]').each(function(){ card_limit.push($(this).val()); }); var estate = new Array(); $('select[name=estate]').each(function(){ estate.push($(this).val()); }); var estate_owner_percent = new Array(); $('input[name=estate_owner_percent]').each(function(){ estate_owner_percent.push($(this).val()); }); var estate_address = new Array(); $('input[name=estate_address]').each(function(){ estate_address.push($(this).val()); }); var estate_weights = new Array(); $('input[name=estate_weights]').each(function(){ estate_weights.push($(this).val()); }); var url = "/ajax/microcredit_step3_request.php"; var params = { salary : $('input[name=salary]').val(), income_grajdanski : $('input[name=income_grajdanski]').val(), income_eteood : $('input[name=income_eteood]').val(), income_honorari : $('input[name=income_honorari]').val(), income_other : $('input[name=income_other]').val(), income_other_desc : $('input[name=income_other_desc]').val(), has_mps : $('select[name=has_mps]').val(), mps_marka : $('input[name=mps_marka]').val(), mps_year : $('input[name=mps_year]').val(), mps_register_number : $('input[name=mps_register_number]').val(), credits : $('input[name=credits]').val(), credit_expense : $('input[name=credit_expense]').val(), rent_expense : $('input[name=rent_expense]').val(), other_expense : $('input[name=other_expense]').val(), contact_person_relationship : $('select[name=contact_person_relationship]').val(), contact_person_name_bg_BG : $('input[name=contact_person_name_bg_BG]').val(), contact_person_mobile : $('input[name=contact_person_mobile]').val(), contact_person_phone : $('input[name=contact_person_phone]').val(), bank_account_titular : $('input[name=bank_account_titular]').val(), bank_name : $('input[name=bank_name]').val(), bank_account_iban : $('input[name=bank_account_iban]').val(), bank_account_bic : $('input[name=bank_account_bic]').val(), family_partner_income : $('input[name=family_partner_income]').val(), income_rent : $('input[name=income_rent]').val(), support_expense : $('input[name=support_expense]').val(), food_expense : $('input[name=food_expense]').val(), homebills_expense : $('input[name=homebills_expense]').val(), mps_expense : $('input[name=mps_expense]').val(), receive_money_method : $('select[name=receive_money_method]').val(), bank_names : bank_names, credit_sums : credit_sums, montly_instalments : montly_instalments, date_terms : date_terms, bank_names_card : bank_names_card, card_date_terms : card_date_terms, card_type : card_type, card_limit : card_limit, estate : estate, estate_owner_percent : estate_owner_percent, estate_address : estate_address, estate_weights : estate_weights }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") == ""){ $('.popup_container').hide(); microcredit_step4(); } else { $('#micro_credit_step3_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } }); } function microcredit_step4() { var url = "/ajax/microcredit_step4.php"; var params = { }; $.get(url, params, function(data) { $('#microcredit_step1_popup').show(); $('#microcredit_step1_popup').html(data); }); } function microcredit_step4_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/microcredit_step4_request.php"; var number_of_guarantees = $('input[name=number_of_guarantees]').val(); var params = {}; var bank_names = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_' + i; $('input[name=bank_names_'+ i +']').each(function(){ bank_names[k] = new Object(); bank_names[k].name = $(this).attr('name'); bank_names[k].id = $(this).attr('name').substring(11); bank_names[k].value = $(this).val(); k++; }); } var credit_sums = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'credit_sums_' + i; $('input[name=credit_sums_'+ i +']').each(function(){ credit_sums[k] = new Object(); credit_sums[k].name = $(this).attr('name'); credit_sums[k].id = $(this).attr('name').substring(12); credit_sums[k].value = $(this).val(); k++; }); } var montly_instalments = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'montly_instalments_' + i; $('input[name=montly_instalments_'+ i +']').each(function(){ montly_instalments[k] = new Object(); montly_instalments[k].name = $(this).attr('name'); montly_instalments[k].id = $(this).attr('name').substring(19); montly_instalments[k].value = $(this).val(); k++; }); } var date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'date_terms_' + i; $('input[name=date_terms_'+ i +']').each(function(){ date_terms[k] = new Object(); date_terms[k].name = $(this).attr('name'); date_terms[k].id = $(this).attr('name').substring(11); date_terms[k].value = $(this).val(); k++; }); } var bank_names_card = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_card_' + i; $('input[name=bank_names_card_'+ i +']').each(function(){ bank_names_card[k] = new Object(); bank_names_card[k].name = $(this).attr('name'); bank_names_card[k].id = $(this).attr('name').substring(16); bank_names_card[k].value = $(this).val(); k++; }); } var card_date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_date_terms_' + i; $('input[name=card_date_terms_'+ i +']').each(function(){ card_date_terms[k] = new Object(); card_date_terms[k].name = $(this).attr('name'); card_date_terms[k].id = $(this).attr('name').substring(16); card_date_terms[k].value = $(this).val(); k++; }); } var card_type = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_type_' + i; $('select[name=card_type_'+ i +']').each(function(){ card_type[k] = new Object(); card_type[k].name = $(this).attr('name'); card_type[k].id = $(this).attr('name').substring(10); card_type[k].value = $(this).val(); k++; }); } var card_limit = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_limit_' + i; $('input[name=card_limit_'+ i +']').each(function(){ card_limit[k] = new Object(); card_limit[k].name = $(this).attr('name'); card_limit[k].id = $(this).attr('name').substring(11); card_limit[k].value = $(this).val(); k++; }); } var estate = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_' + i; $('select[name=estate_'+ i +']').each(function(){ estate[k] = new Object(); estate[k].name = $(this).attr('name'); estate[k].id = $(this).attr('name').substring(7); estate[k].value = $(this).val(); k++; }); } var estate_owner_percent = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_owner_percent_' + i; $('input[name=estate_owner_percent_'+ i +']').each(function(){ estate_owner_percent[k] = new Object(); estate_owner_percent[k].name = $(this).attr('name'); estate_owner_percent[k].id = $(this).attr('name').substring(21); estate_owner_percent[k].value = $(this).val(); k++; }); } var estate_address = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_address_' + i; $('input[name=estate_address_'+ i +']').each(function(){ estate_address[k] = new Object(); estate_address[k].name = $(this).attr('name'); estate_address[k].id = $(this).attr('name').substring(15); estate_address[k].value = $(this).val(); k++; }); } var estate_weights = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_weights_' + i; $('input[name=estate_weights_'+ i +']').each(function(){ estate_weights[k] = new Object(); estate_weights[k].name = $(this).attr('name'); estate_weights[k].id = $(this).attr('name').substring(15); estate_weights[k].value = $(this).val(); k++; }); } for(var i = 1; i <= number_of_guarantees; i++){ params['firstname_bg_BG_' + i] = $('#firstname_bg_BG_' + i).val(); params['sirname_bg_BG_' + i] = $('#sirname_bg_BG_' + i).val(); params['lastname_bg_BG_' + i] = $('#lastname_bg_BG_' + i).val(); params['egn_' + i] = $('#egn_' + i).val(); params['id_card_' + i] = $('#id_card_' + i).val(); params['id_card_valid_to_' + i] = $('#id_card_valid_to_' + i).val(); params['id_card_from_' + i] = $('#id_card_from_' + i).val(); params['endless_card_' + i] = ($('#endless_card_' + i).is(':checked'))? 1 : 0; params['has_mps_' + i] = $('#has_mps_' + i).val(); params['mps_marka_' + i] = $('#mps_marka_' + i).val(); params['mps_year_' + i] = $('#mps_year_' + i).val(); params['mps_register_number_' + i] = $('#mps_register_number_' + i).val(); params['city_' + i] = $('#city_' + i).val(); params['address_bg_BG_' + i] = $('#address_bg_BG_' + i).val(); params['city_corresp_' + i] = $('#city_corresp_' + i).val(); params['address_corresp_bg_BG_' + i] = $('#address_corresp_bg_BG_' + i).val(); params['phone_' + i] = $('#phone_' + i).val(); params['phone_extra_' + i] = $('#phone_extra_' + i).val(); params['labour_contract_' + i] = $('#labour_contract_' + i).val(); params['company_bg_BG_' + i] = $('#company_bg_BG_' + i).val(); params['company_city_' + i] = $('#company_city_' + i).val(); params['position_bg_BG_' + i] = $('#position_bg_BG_' + i).val(); params['field_of_activity_' + i] = $('#field_of_activity_' + i).val(); params['practice_' + i] = $('#practice_' + i).val(); params['education_' + i] = $('#education_' + i).val(); params['living_status_' + i] = $('#living_status_' + i).val(); params['family_status_' + i] = $('#family_status_' + i).val(); params['family_partner_' + i] = $('#family_partner_' + i).val(); params['family_partner_egn_' + i] = $('#family_partner_egn_' + i).val(); params['income_other_' + i] = $('#income_other_' + i).val(); params['other_expense_' + i] = $('#other_expense_' + i).val(); params['support_expense_' + i] = $('#support_expense_' + i).val(); params['has_bank_' + i] = ($('#has_bank_' + i).is(':checked'))? 1 : 0; } params['number_of_guarantees'] = number_of_guarantees; params['bank_names'] = bank_names; params['credit_sums'] = credit_sums; params['montly_instalments'] = montly_instalments; params['date_terms'] = date_terms; params['bank_names_card'] = bank_names_card; params['card_date_terms'] = card_date_terms; params['card_type'] = card_type; params['card_limit'] = card_limit; params['estate'] = estate; params['estate_owner_percent'] = estate_owner_percent; params['estate_address'] = estate_address; params['estate_weights'] = estate_weights; $.post(url, params, function(data) { if(data != ''){ data = JSON.parse(data); if(data[1] != ''){ $('#micro_credit_step4_msg').html(data[1]); $("ul.tabs li").removeClass("active"); $('#tab_link_'+(data[0])).parent().addClass("active"); $(".tab_content").hide(); $('#tab' + data[0]).show(); $('html, body').animate({ scrollTop: $("#micro_credit_step4_msg").offset().top }, 500); if (jQuery.browser.msie) { activatePlaceholders(); } } } else { $('.popup_container').hide(); microcredit_end(); } }); } function microcredit_step4_save_values() { var url = "/ajax/microcredit_step4_save_values.php"; var number_of_guarantees = $('input[name=number_of_guarantees]').val(); var params = {}; var bank_names = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_' + i; $('input[name=bank_names_'+ i +']').each(function(){ bank_names[k] = new Object(); bank_names[k].name = $(this).attr('name'); bank_names[k].id = $(this).attr('name').substring(11); bank_names[k].value = $(this).val(); k++; }); } var credit_sums = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'credit_sums_' + i; $('input[name=credit_sums_'+ i +']').each(function(){ credit_sums[k] = new Object(); credit_sums[k].name = $(this).attr('name'); credit_sums[k].id = $(this).attr('name').substring(12); credit_sums[k].value = $(this).val(); k++; }); } var montly_instalments = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'montly_instalments_' + i; $('input[name=montly_instalments_'+ i +']').each(function(){ montly_instalments[k] = new Object(); montly_instalments[k].name = $(this).attr('name'); montly_instalments[k].id = $(this).attr('name').substring(19); montly_instalments[k].value = $(this).val(); k++; }); } var date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'date_terms_' + i; $('input[name=date_terms_'+ i +']').each(function(){ date_terms[k] = new Object(); date_terms[k].name = $(this).attr('name'); date_terms[k].id = $(this).attr('name').substring(11); date_terms[k].value = $(this).val(); k++; }); } var bank_names_card = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_card_' + i; $('input[name=bank_names_card_'+ i +']').each(function(){ bank_names_card[k] = new Object(); bank_names_card[k].name = $(this).attr('name'); bank_names_card[k].id = $(this).attr('name').substring(16); bank_names_card[k].value = $(this).val(); k++; }); } var card_date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_date_terms_' + i; $('input[name=card_date_terms_'+ i +']').each(function(){ card_date_terms[k] = new Object(); card_date_terms[k].name = $(this).attr('name'); card_date_terms[k].id = $(this).attr('name').substring(16); card_date_terms[k].value = $(this).val(); k++; }); } var card_type = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_type_' + i; $('select[name=card_type_'+ i +']').each(function(){ card_type[k] = new Object(); card_type[k].name = $(this).attr('name'); card_type[k].id = $(this).attr('name').substring(10); card_type[k].value = $(this).val(); k++; }); } var card_limit = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_limit_' + i; $('input[name=card_limit_'+ i +']').each(function(){ card_limit[k] = new Object(); card_limit[k].name = $(this).attr('name'); card_limit[k].id = $(this).attr('name').substring(11); card_limit[k].value = $(this).val(); k++; }); } var estate = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_' + i; $('select[name=estate_'+ i +']').each(function(){ estate[k] = new Object(); estate[k].name = $(this).attr('name'); estate[k].id = $(this).attr('name').substring(7); estate[k].value = $(this).val(); k++; }); } var estate_owner_percent = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_owner_percent_' + i; $('input[name=estate_owner_percent_'+ i +']').each(function(){ estate_owner_percent[k] = new Object(); estate_owner_percent[k].name = $(this).attr('name'); estate_owner_percent[k].id = $(this).attr('name').substring(21); estate_owner_percent[k].value = $(this).val(); k++; }); } var estate_address = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_address_' + i; $('input[name=estate_address_'+ i +']').each(function(){ estate_address[k] = new Object(); estate_address[k].name = $(this).attr('name'); estate_address[k].id = $(this).attr('name').substring(15); estate_address[k].value = $(this).val(); k++; }); } var estate_weights = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_weights_' + i; $('input[name=estate_weights_'+ i +']').each(function(){ estate_weights[k] = new Object(); estate_weights[k].name = $(this).attr('name'); estate_weights[k].id = $(this).attr('name').substring(15); estate_weights[k].value = $(this).val(); k++; }); } for(var i = 1; i <= number_of_guarantees; i++){ params['firstname_bg_BG_' + i] = $('#firstname_bg_BG_' + i).val(); params['sirname_bg_BG_' + i] = $('#sirname_bg_BG_' + i).val(); params['lastname_bg_BG_' + i] = $('#lastname_bg_BG_' + i).val(); params['egn_' + i] = $('#egn_' + i).val(); params['id_card_' + i] = $('#id_card_' + i).val(); params['id_card_valid_to_' + i] = $('#id_card_valid_to_' + i).val(); params['id_card_from_' + i] = $('#id_card_from_' + i).val(); params['endless_card_' + i] = ($('#endless_card_' + i).is(':checked'))? 1 : 0; params['has_mps_' + i] = $('#has_mps_' + i).val(); params['mps_marka_' + i] = $('#mps_marka_' + i).val(); params['mps_year_' + i] = $('#mps_year_' + i).val(); params['mps_register_number_' + i] = $('#mps_register_number_' + i).val(); params['city_' + i] = $('#city_' + i).val(); params['address_bg_BG_' + i] = $('#address_bg_BG_' + i).val(); params['city_corresp_' + i] = $('#city_corresp_' + i).val(); params['address_corresp_bg_BG_' + i] = $('#address_corresp_bg_BG_' + i).val(); params['phone_' + i] = $('#phone_' + i).val(); params['phone_extra_' + i] = $('#phone_extra_' + i).val(); params['labour_contract_' + i] = $('#labour_contract_' + i).val(); params['company_bg_BG_' + i] = $('#company_bg_BG_' + i).val(); params['company_city_' + i] = $('#company_city_' + i).val(); params['position_bg_BG_' + i] = $('#position_bg_BG_' + i).val(); params['field_of_activity_' + i] = $('#field_of_activity_' + i).val(); params['practice_' + i] = $('#practice_' + i).val(); params['education_' + i] = $('#education_' + i).val(); params['living_status_' + i] = $('#living_status_' + i).val(); params['family_status_' + i] = $('#family_status_' + i).val(); params['family_partner_' + i] = $('#family_partner_' + i).val(); params['family_partner_egn_' + i] = $('#family_partner_egn_' + i).val(); params['income_other_' + i] = $('#income_other_' + i).val(); params['other_expense_' + i] = $('#other_expense_' + i).val(); params['support_expense_' + i] = $('#support_expense_' + i).val(); params['has_bank_' + i] = ($('#has_bank_' + i).is(':checked'))? 1 : 0; } params['number_of_guarantees'] = number_of_guarantees; params['bank_names'] = bank_names; params['credit_sums'] = credit_sums; params['montly_instalments'] = montly_instalments; params['date_terms'] = date_terms; params['bank_names_card'] = bank_names_card; params['card_date_terms'] = card_date_terms; params['card_type'] = card_type; params['card_limit'] = card_limit; params['estate'] = estate; params['estate_owner_percent'] = estate_owner_percent; params['estate_address'] = estate_address; params['estate_weights'] = estate_weights; $.post(url, params, function(data) { }); } function get_offices(city_id) { var url = "/ajax/get_offices.php"; var params = { city_id : city_id }; $.get(url, params, function(data) { $('#cities_offices').html(data); }); } function get_office_image(office_id) { var url = "/ajax/get_office_image.php"; var params = { office_id : office_id }; $.get(url, params, function(data) { $('#office_image').html(data); }); } function get_offices_address(office_id) { var url = "/ajax/get_offices_address.php"; var params = { office_id : office_id }; $.get(url, params, function(data) { $('#offices_address').html(data); }); } function microcredit_end() { var url = "/ajax/microcredit_end.php"; var params = { }; $.get(url, params, function(data) { $('#microcredit_step1_popup').show(); $('#microcredit_step1_popup').html(data); }); } function consumerlongcredit_step1() { var url = "/ajax/consumercredit_step1.php"; var params = { request_sum : $('input[name=ipoteccredit_sum]').val(), period : $('input[name=ipoteccredit_term]').val(), instalment_cnt : $('input[name=ipoteccredit_term]').val(), sms_notification : ($('#sms').is(":checked"))? 1 : 0, payment_type : $('select[name=consumelongrcredit_payment_type] option:selected').attr('rel'), how_find_us : $('#how_find_us option:selected').val(), how_find_us_specif : $('input[name=how_find_us_specif]').val(), consumer_long_credit: 1, rate_of_interest : $('input[name=ipoteccredit_rate_of_interest]').val(), gratis_term : $('input[name=ipoteccredit_gratis_term]').val() }; $.get(url, params, function(data) { $('#consumercredit_plan_popup').hide(); $('#consumercredit_expences_popup').hide(); $('#consumerlongcredit_step1_popup').show(); $('#consumerlongcredit_step1_popup').html(data); }); } /* consumercredit functions */ function consumercredit_activate_calculator() { var url = "/ajax/consumercredit_activate_calculator.php"; var params = { }; $.get(url, params, function(data) { $('#consumercredit_calculator_popup').show(); $('#consumercredit_calculator_popup').html(data); }); } function consumerlongcredit_activate_calculator() { var url = "/ajax/consumercredit_activate_calculator.php"; var params = { }; $.get(url, params, function(data) { $('#consumerlongcredit_calculator_popup').show(); $('#consumerlongcredit_calculator_popup').html(data); }); } function consumercredit_activate_calculator_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/consumercredit_activate_calculator_request.php"; var params = { firstname : $('input[name=firstname]').val(), middlename : $('input[name=middlename]').val(), lastname : $('input[name=lastname]').val(), egn : $('input[name=egn]').val(), phone : $('input[name=phone]').val(), email : $('input[name=email]').val(), agree : ($('#agree').is(':checked'))? 1 : 0 }; $.get(url, params, function(data) { if(data != ''){ $('#error_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); $( ".make_disable" ).removeAttr('disabled'); $( ".additional_btns" ).show(); $( "#consumercredit_order_credit" ).show(); $( "#consumercredit_sum_slider" ).slider("enable"); $( "#consumercredit_term_slider" ).slider("enable"); $( "#consumerlongcredit_order_credit" ).show(); $( "#ipoteccredit_sum_slider" ).slider("enable"); $( "#ipoteccredit_term_slider" ).slider("enable"); $( "#ipoteccredit_rate_of_interest_slider" ).slider("enable"); $( "#ipoteccredit_gratis_term_slider" ).slider("enable"); $( "#activate_calculator1" ).hide(); $( "#familycredit_order_credit" ).show(); $( "#familycredit_sum_slider" ).slider("enable"); $( "#familycredit_term_slider" ).slider("enable"); $( "#familycredit_instalments_slider" ).slider("enable"); $( "#order_credit" ).show(); $( "#sum_slider" ).slider("enable"); $( "#term_slider" ).slider("enable"); $( "#instalment_slider" ).slider("enable"); $( "#activate_calculator" ).hide(); } }); } function consumercredit_plan_popup(total, total_sum, term, sum, instalment) { var url = "/ajax/consumercredit_plan_popup.php"; var params = { total : total, total_sum : total_sum, term : term, sum : sum, instalment : instalment }; $.get(url, params, function(data) { $('#consumercredit_calculator_popup').show(); $('#consumercredit_calculator_popup').html(data); }); } function print_consumercredit_calculator_plan_table(date, sum, term, instalment, total, total_sum) { var url = "/ajax/print_consumercredit_calculator_plan_table.php"; var params = { date : date, sum : sum, term : term, instalment : instalment, total : total, total_sum : total_sum }; $.get(url, params, function(data) { //$('#consumercredit_step1_popup').hide(); $('#consumercredit_plan_table').html(data); }); } function consumercredit_show_all_expences(sum, total_sum, term, instalment, code, credit_type) { var url = "/ajax/consumercredit_show_all_expences.php"; var params = { sum : sum, total_sum : total_sum, term : term, instalment : instalment, code : code, sms : ($('#sms').is(":checked"))? 1 : 0, payment_type: parseFloat($('#consumercredit_payment_type').val()), credit_type : credit_type }; $.get(url, params, function(data) { $('#consumercredit_expences_popup').show(); $('#consumercredit_expences_popup').html(data); }); } function search_consumercredit_promo_code(code, total_sum, vnoska, sum, term, instalment, payment_type, sms_price, sms_flag, credit_type) { var url = "/ajax/search_consumercredit_promo_code.php"; var params = { code : code, credit_type : credit_type }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ $("#consumercredit_promo_code").parent().find('img').attr('src', $("#consumercredit_promo_code").parent().find('img').attr('src').replace("gray", "blue")); $('input[name=promo_percent]').val(data); if(sms_flag) { $('#consumercredit_total_sum').html(parseFloat(total_sum - (total_sum - sum - parseFloat(payment_type) - parseFloat(sms_price) * instalment ) * data / 100 ).toFixed(2)); $('#consumercredit_instalment').html(parseFloat((total_sum - (total_sum - sum - parseFloat(payment_type) - parseFloat(sms_price) * instalment) * data / 100 - parseFloat(payment_type) - parseFloat(sms_price) * instalment ) / instalment).toFixed(2)); } else { $('#consumercredit_total_sum').html(parseFloat(total_sum - (total_sum - sum - parseFloat(payment_type) ) * data / 100 ).toFixed(2)); $('#consumercredit_instalment').html(parseFloat((total_sum - (total_sum - sum - parseFloat(payment_type)) * data / 100 - parseFloat(payment_type) ) / instalment).toFixed(2)); } } else { $("#consumercredit_promo_code").parent().find('img').attr('src', "/img/tick_gray.png"); $('input[name=promo_percent]').val(''); $('#consumercredit_total_sum').html($('input[name=consumercredit_total_sum_old]').val()); $('#consumercredit_instalment').html($('input[name=consumercredit_instalment_old]').val()); } }); } function consumercredit_step1() { var url = "/ajax/consumercredit_step1.php"; var params = { request_sum : $('input[name=consumercredit_sum]').val(), period : $('input[name=consumercredit_term]').val(), instalment_cnt : $('input[name=consumercredit_term]').val(), partner_code : $('input[name=consumercredit_promo_code]').val(), promo_percent : $('input[name=promo_percent]').val(), sms_notification : ($('#sms').is(":checked"))? 1 : 0, payment_type : $('select[name=consumercredit_payment_type] option:selected').attr('rel'), how_find_us : $('#how_find_us option:selected').val(), how_find_us_specif : $('input[name=how_find_us_specif]').val(), ctedit_type_id : $('select[name=credit_type]').val(), numberofcredits : $('select[name=numberofcredits]').val() }; $.get(url, params, function(data) { $('#consumercredit_plan_popup').hide(); $('#consumercredit_expences_popup').hide(); $('#consumercredit_step1_popup').show(); $('#consumercredit_step1_popup').html(data); }); } function consumercredit_step1_request(is_long) { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/consumercredit_step1_request.php"; var params = { firstname_bg_BG : $('input[name=firstname_bg_BG]').val(), sirname_bg_BG : $('input[name=sirname_bg_BG]').val(), lastname_bg_BG : $('input[name=lastname_bg_BG]').val(), egn : $('input[name=egn]').val(), id_card : $('input[name=id_card]').val(), id_card_valid_to : $('input[name=id_card_valid_to]').val(), id_card_from : $('select[name=id_card_from]').val(), city : $('input[name=city]').val(), address_bg_BG : $('input[name=address_bg_BG]').val(), city_corresp : $('input[name=city_corresp]').val(), address_corresp_bg_BG : $('input[name=address_corresp_bg_BG]').val(), phone : $('input[name=phone]').val(), phone_home : $('input[name=phone_home]').val(), phone_extra : $('input[name=phone_extra]').val(), email : $('input[name=email]').val(), living_status : $('select[name=living_status]').val(), family_status : $('select[name=family_status]').val(), household_members_without_income : $('input[name=household_members_without_income]').val(), city_id : $('select[name=city_id]').val(), office_id : $('select[name=office_id]').val(), endless_card : ($('input[name=endless_card]').is(":checked"))? 1 : 0, family_partner : $('input[name=family_partner]').val(), family_partner_egn : $('input[name=family_partner_egn]').val(), available_at : $('input[name=available_at]').val(), phone_operator : $('select[name=phone_operator]').val(), live_here_from : $('input[name=live_here_from]').val(), nationality : $('select[name=nationality]').val(), nationality_specif : $('input[name=nationality_specif]').val() }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step1_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); consumercredit_step2(is_long); } }); } function consumercredit_step2(is_long) { var url = "/ajax/consumercredit_step2.php"; var params = { }; $.get(url, params, function(data) { if(is_long){ $('#consumerlongcredit_step1_popup').show(); $('#consumerlongcredit_step1_popup').html(data); } else { $('#consumercredit_step1_popup').show(); $('#consumercredit_step1_popup').html(data); } }); } function consumercredit_step2_request(is_long) { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/consumercredit_step2_request.php"; var params = { company_bg_BG : $('input[name=company_bg_BG]').val(), company_city : $('input[name=company_city]').val(), work_phone : $('input[name=work_phone]').val(), position_bg_BG : $('input[name=position_bg_BG]').val(), labour_contract : $('select[name=labour_contract]').val(), practice : $('select[name=practice]').val(), education : $('select[name=education]').val(), bulstat : $('input[name=bulstat]').val(), field_of_activity : $('input[name=field_of_activity]').val(), full_practice : $('input[name=full_practice]').val() }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step2_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); consumercredit_step3(is_long); } }); } function consumercredit_step3(is_long) { var url = "/ajax/consumercredit_step3.php"; var params = { }; $.get(url, params, function(data) { if(is_long){ $('#consumerlongcredit_step1_popup').show(); $('#consumerlongcredit_step1_popup').html(data); } else { $('#consumercredit_step1_popup').show(); $('#consumercredit_step1_popup').html(data); } }); } function consumercredit_step3_request(is_long) { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var bank_names = new Array(); $('input[name=bank_names]').each(function(){ bank_names.push($(this).val()); }); var credit_sums = new Array(); $('input[name=credit_sums]').each(function(){ credit_sums.push($(this).val()); }); var montly_instalments = new Array(); $('input[name=montly_instalments]').each(function(){ montly_instalments.push($(this).val()); }); var date_terms = new Array(); $('input[name=date_terms]').each(function(){ date_terms.push($(this).val()); }); var bank_names_card = new Array(); $('input[name=bank_names_card]').each(function(){ bank_names_card.push($(this).val()); }); var card_date_terms = new Array(); $('input[name=card_date_terms]').each(function(){ card_date_terms.push($(this).val()); }); var card_type = new Array(); $('select[name=card_type]').each(function(){ card_type.push($(this).val()); }); var card_limit = new Array(); $('input[name=card_limit]').each(function(){ card_limit.push($(this).val()); }); var estate = new Array(); $('select[name=estate]').each(function(){ estate.push($(this).val()); }); var estate_owner_percent = new Array(); $('input[name=estate_owner_percent]').each(function(){ estate_owner_percent.push($(this).val()); }); var estate_address = new Array(); $('input[name=estate_address]').each(function(){ estate_address.push($(this).val()); }); var estate_weights = new Array(); $('input[name=estate_weights]').each(function(){ estate_weights.push($(this).val()); }); var url = "/ajax/consumercredit_step3_request.php"; var params = { salary : $('input[name=salary]').val(), income_grajdanski : $('input[name=income_grajdanski]').val(), income_eteood : $('input[name=income_eteood]').val(), income_honorari : $('input[name=income_honorari]').val(), income_other : $('input[name=income_other]').val(), income_other_desc : $('input[name=income_other_desc]').val(), has_mps : $('select[name=has_mps]').val(), mps_marka : $('input[name=mps_marka]').val(), mps_year : $('input[name=mps_year]').val(), mps_register_number : $('input[name=mps_register_number]').val(), credits : $('input[name=credits]').val(), credit_expense : $('input[name=credit_expense]').val(), rent_expense : $('input[name=rent_expense]').val(), other_expense : $('input[name=other_expense]').val(), contact_person_relationship : $('select[name=contact_person_relationship]').val(), contact_person_name_bg_BG : $('input[name=contact_person_name_bg_BG]').val(), contact_person_mobile : $('input[name=contact_person_mobile]').val(), contact_person_phone : $('input[name=contact_person_phone]').val(), bank_account_titular : $('input[name=bank_account_titular]').val(), bank_name : $('input[name=bank_name]').val(), bank_account_iban : $('input[name=bank_account_iban]').val(), bank_account_bic : $('input[name=bank_account_bic]').val(), family_partner_income : $('input[name=family_partner_income]').val(), income_rent : $('input[name=income_rent]').val(), support_expense : $('input[name=support_expense]').val(), food_expense : $('input[name=food_expense]').val(), homebills_expense : $('input[name=homebills_expense]').val(), mps_expense : $('input[name=mps_expense]').val(), receive_money_method : $('select[name=receive_money_method]').val(), bank_names : bank_names, credit_sums : credit_sums, montly_instalments : montly_instalments, date_terms : date_terms, bank_names_card : bank_names_card, card_date_terms : card_date_terms, card_type : card_type, card_limit : card_limit, estate : estate, estate_owner_percent : estate_owner_percent, estate_address : estate_address, estate_weights : estate_weights }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") == ""){ $('.popup_container').hide(); consumercredit_step4(is_long); } else { $('#micro_credit_step3_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } }); } function consumercredit_step4(is_long) { var url = "/ajax/consumercredit_step4.php"; var params = { }; $.get(url, params, function(data) { if(is_long){ $('#consumerlongcredit_step1_popup').show(); $('#consumerlongcredit_step1_popup').html(data); } else { $('#consumercredit_step1_popup').show(); $('#consumercredit_step1_popup').html(data); } }); } function consumercredit_step4_request(is_long) { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/consumercredit_step4_request.php"; var number_of_guarantees = $('input[name=number_of_guarantees]').val(); var params = {}; var bank_names = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_' + i; $('input[name=bank_names_'+ i +']').each(function(){ bank_names[k] = new Object(); bank_names[k].name = $(this).attr('name'); bank_names[k].id = $(this).attr('name').substring(11); bank_names[k].value = $(this).val(); k++; }); } var credit_sums = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'credit_sums_' + i; $('input[name=credit_sums_'+ i +']').each(function(){ credit_sums[k] = new Object(); credit_sums[k].name = $(this).attr('name'); credit_sums[k].id = $(this).attr('name').substring(12); credit_sums[k].value = $(this).val(); k++; }); } var montly_instalments = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'montly_instalments_' + i; $('input[name=montly_instalments_'+ i +']').each(function(){ montly_instalments[k] = new Object(); montly_instalments[k].name = $(this).attr('name'); montly_instalments[k].id = $(this).attr('name').substring(19); montly_instalments[k].value = $(this).val(); k++; }); } var date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'date_terms_' + i; $('input[name=date_terms_'+ i +']').each(function(){ date_terms[k] = new Object(); date_terms[k].name = $(this).attr('name'); date_terms[k].id = $(this).attr('name').substring(11); date_terms[k].value = $(this).val(); k++; }); } var bank_names_card = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_card_' + i; $('input[name=bank_names_card_'+ i +']').each(function(){ bank_names_card[k] = new Object(); bank_names_card[k].name = $(this).attr('name'); bank_names_card[k].id = $(this).attr('name').substring(16); bank_names_card[k].value = $(this).val(); k++; }); } var card_date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_date_terms_' + i; $('input[name=card_date_terms_'+ i +']').each(function(){ card_date_terms[k] = new Object(); card_date_terms[k].name = $(this).attr('name'); card_date_terms[k].id = $(this).attr('name').substring(16); card_date_terms[k].value = $(this).val(); k++; }); } var card_type = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_type_' + i; $('select[name=card_type_'+ i +']').each(function(){ card_type[k] = new Object(); card_type[k].name = $(this).attr('name'); card_type[k].id = $(this).attr('name').substring(10); card_type[k].value = $(this).val(); k++; }); } var card_limit = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_limit_' + i; $('input[name=card_limit_'+ i +']').each(function(){ card_limit[k] = new Object(); card_limit[k].name = $(this).attr('name'); card_limit[k].id = $(this).attr('name').substring(11); card_limit[k].value = $(this).val(); k++; }); } var estate = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_' + i; $('select[name=estate_'+ i +']').each(function(){ estate[k] = new Object(); estate[k].name = $(this).attr('name'); estate[k].id = $(this).attr('name').substring(7); estate[k].value = $(this).val(); k++; }); } var estate_owner_percent = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_owner_percent_' + i; $('input[name=estate_owner_percent_'+ i +']').each(function(){ estate_owner_percent[k] = new Object(); estate_owner_percent[k].name = $(this).attr('name'); estate_owner_percent[k].id = $(this).attr('name').substring(21); estate_owner_percent[k].value = $(this).val(); k++; }); } var estate_address = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_address_' + i; $('input[name=estate_address_'+ i +']').each(function(){ estate_address[k] = new Object(); estate_address[k].name = $(this).attr('name'); estate_address[k].id = $(this).attr('name').substring(15); estate_address[k].value = $(this).val(); k++; }); } var estate_weights = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_weights_' + i; $('input[name=estate_weights_'+ i +']').each(function(){ estate_weights[k] = new Object(); estate_weights[k].name = $(this).attr('name'); estate_weights[k].id = $(this).attr('name').substring(15); estate_weights[k].value = $(this).val(); k++; }); } for(var i = 1; i <= number_of_guarantees; i++){ params['firstname_bg_BG_' + i] = $('#firstname_bg_BG_' + i).val(); params['sirname_bg_BG_' + i] = $('#sirname_bg_BG_' + i).val(); params['lastname_bg_BG_' + i] = $('#lastname_bg_BG_' + i).val(); params['egn_' + i] = $('#egn_' + i).val(); params['id_card_' + i] = $('#id_card_' + i).val(); params['id_card_valid_to_' + i] = $('#id_card_valid_to_' + i).val(); params['id_card_from_' + i] = $('#id_card_from_' + i).val(); params['endless_card_' + i] = ($('#endless_card_' + i).is(':checked'))? 1 : 0; params['has_mps_' + i] = $('#has_mps_' + i).val(); params['mps_marka_' + i] = $('#mps_marka_' + i).val(); params['mps_year_' + i] = $('#mps_year_' + i).val(); params['mps_register_number_' + i] = $('#mps_register_number_' + i).val(); params['city_' + i] = $('#city_' + i).val(); params['address_bg_BG_' + i] = $('#address_bg_BG_' + i).val(); params['city_corresp_' + i] = $('#city_corresp_' + i).val(); params['address_corresp_bg_BG_' + i] = $('#address_corresp_bg_BG_' + i).val(); params['phone_' + i] = $('#phone_' + i).val(); params['phone_extra_' + i] = $('#phone_extra_' + i).val(); params['labour_contract_' + i] = $('#labour_contract_' + i).val(); params['company_bg_BG_' + i] = $('#company_bg_BG_' + i).val(); params['company_city_' + i] = $('#company_city_' + i).val(); params['position_bg_BG_' + i] = $('#position_bg_BG_' + i).val(); params['field_of_activity_' + i] = $('#field_of_activity_' + i).val(); params['practice_' + i] = $('#practice_' + i).val(); params['education_' + i] = $('#education_' + i).val(); params['living_status_' + i] = $('#living_status_' + i).val(); params['family_status_' + i] = $('#family_status_' + i).val(); params['family_partner_' + i] = $('#family_partner_' + i).val(); params['family_partner_egn_' + i] = $('#family_partner_egn_' + i).val(); params['income_other_' + i] = $('#income_other_' + i).val(); params['other_expense_' + i] = $('#other_expense_' + i).val(); params['support_expense_' + i] = $('#support_expense_' + i).val(); params['has_bank_' + i] = ($('#has_bank_' + i).is(':checked'))? 1 : 0; } params['number_of_guarantees'] = number_of_guarantees; params['bank_names'] = bank_names; params['credit_sums'] = credit_sums; params['montly_instalments'] = montly_instalments; params['date_terms'] = date_terms; params['bank_names_card'] = bank_names_card; params['card_date_terms'] = card_date_terms; params['card_type'] = card_type; params['card_limit'] = card_limit; params['estate'] = estate; params['estate_owner_percent'] = estate_owner_percent; params['estate_address'] = estate_address; params['estate_weights'] = estate_weights; $.post(url, params, function(data) { if(data != ''){ data = JSON.parse(data); if(data[1] != ''){ $('#micro_credit_step4_msg').html(data[1]); $("ul.tabs li").removeClass("active"); $('#tab_link_'+(data[0])).parent().addClass("active"); $(".tab_content").hide(); $('#tab' + data[0]).show(); $('html, body').animate({ scrollTop: $("#micro_credit_step4_msg").offset().top }, 500); if (jQuery.browser.msie) { activatePlaceholders(); } } } else { $('.popup_container').hide(); consumercredit_end(is_long); } }); } function consumercredit_step4_save_values(is_long) { var url = "/ajax/consumercredit_step4_save_values.php"; var number_of_guarantees = $('input[name=number_of_guarantees]').val(); var params = {}; var bank_names = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_' + i; $('input[name=bank_names_'+ i +']').each(function(){ bank_names[k] = new Object(); bank_names[k].name = $(this).attr('name'); bank_names[k].id = $(this).attr('name').substring(11); bank_names[k].value = $(this).val(); k++; }); } var credit_sums = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'credit_sums_' + i; $('input[name=credit_sums_'+ i +']').each(function(){ credit_sums[k] = new Object(); credit_sums[k].name = $(this).attr('name'); credit_sums[k].id = $(this).attr('name').substring(12); credit_sums[k].value = $(this).val(); k++; }); } var montly_instalments = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'montly_instalments_' + i; $('input[name=montly_instalments_'+ i +']').each(function(){ montly_instalments[k] = new Object(); montly_instalments[k].name = $(this).attr('name'); montly_instalments[k].id = $(this).attr('name').substring(19); montly_instalments[k].value = $(this).val(); k++; }); } var date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'date_terms_' + i; $('input[name=date_terms_'+ i +']').each(function(){ date_terms[k] = new Object(); date_terms[k].name = $(this).attr('name'); date_terms[k].id = $(this).attr('name').substring(11); date_terms[k].value = $(this).val(); k++; }); } var bank_names_card = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_card_' + i; $('input[name=bank_names_card_'+ i +']').each(function(){ bank_names_card[k] = new Object(); bank_names_card[k].name = $(this).attr('name'); bank_names_card[k].id = $(this).attr('name').substring(16); bank_names_card[k].value = $(this).val(); k++; }); } var card_date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_date_terms_' + i; $('input[name=card_date_terms_'+ i +']').each(function(){ card_date_terms[k] = new Object(); card_date_terms[k].name = $(this).attr('name'); card_date_terms[k].id = $(this).attr('name').substring(16); card_date_terms[k].value = $(this).val(); k++; }); } var card_type = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_type_' + i; $('select[name=card_type_'+ i +']').each(function(){ card_type[k] = new Object(); card_type[k].name = $(this).attr('name'); card_type[k].id = $(this).attr('name').substring(10); card_type[k].value = $(this).val(); k++; }); } var card_limit = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_limit_' + i; $('input[name=card_limit_'+ i +']').each(function(){ card_limit[k] = new Object(); card_limit[k].name = $(this).attr('name'); card_limit[k].id = $(this).attr('name').substring(11); card_limit[k].value = $(this).val(); k++; }); } var estate = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_' + i; $('select[name=estate_'+ i +']').each(function(){ estate[k] = new Object(); estate[k].name = $(this).attr('name'); estate[k].id = $(this).attr('name').substring(7); estate[k].value = $(this).val(); k++; }); } var estate_owner_percent = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_owner_percent_' + i; $('input[name=estate_owner_percent_'+ i +']').each(function(){ estate_owner_percent[k] = new Object(); estate_owner_percent[k].name = $(this).attr('name'); estate_owner_percent[k].id = $(this).attr('name').substring(21); estate_owner_percent[k].value = $(this).val(); k++; }); } var estate_address = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_address_' + i; $('input[name=estate_address_'+ i +']').each(function(){ estate_address[k] = new Object(); estate_address[k].name = $(this).attr('name'); estate_address[k].id = $(this).attr('name').substring(15); estate_address[k].value = $(this).val(); k++; }); } var estate_weights = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_weights_' + i; $('input[name=estate_weights_'+ i +']').each(function(){ estate_weights[k] = new Object(); estate_weights[k].name = $(this).attr('name'); estate_weights[k].id = $(this).attr('name').substring(15); estate_weights[k].value = $(this).val(); k++; }); } for(var i = 1; i <= number_of_guarantees; i++){ params['firstname_bg_BG_' + i] = $('#firstname_bg_BG_' + i).val(); params['sirname_bg_BG_' + i] = $('#sirname_bg_BG_' + i).val(); params['lastname_bg_BG_' + i] = $('#lastname_bg_BG_' + i).val(); params['egn_' + i] = $('#egn_' + i).val(); params['id_card_' + i] = $('#id_card_' + i).val(); params['id_card_valid_to_' + i] = $('#id_card_valid_to_' + i).val(); params['id_card_from_' + i] = $('#id_card_from_' + i).val(); params['endless_card_' + i] = ($('#endless_card_' + i).is(':checked'))? 1 : 0; params['has_mps_' + i] = $('#has_mps_' + i).val(); params['mps_marka_' + i] = $('#mps_marka_' + i).val(); params['mps_year_' + i] = $('#mps_year_' + i).val(); params['mps_register_number_' + i] = $('#mps_register_number_' + i).val(); params['city_' + i] = $('#city_' + i).val(); params['address_bg_BG_' + i] = $('#address_bg_BG_' + i).val(); params['city_corresp_' + i] = $('#city_corresp_' + i).val(); params['address_corresp_bg_BG_' + i] = $('#address_corresp_bg_BG_' + i).val(); params['phone_' + i] = $('#phone_' + i).val(); params['phone_extra_' + i] = $('#phone_extra_' + i).val(); params['labour_contract_' + i] = $('#labour_contract_' + i).val(); params['company_bg_BG_' + i] = $('#company_bg_BG_' + i).val(); params['company_city_' + i] = $('#company_city_' + i).val(); params['position_bg_BG_' + i] = $('#position_bg_BG_' + i).val(); params['field_of_activity_' + i] = $('#field_of_activity_' + i).val(); params['practice_' + i] = $('#practice_' + i).val(); params['education_' + i] = $('#education_' + i).val(); params['living_status_' + i] = $('#living_status_' + i).val(); params['family_status_' + i] = $('#family_status_' + i).val(); params['family_partner_' + i] = $('#family_partner_' + i).val(); params['family_partner_egn_' + i] = $('#family_partner_egn_' + i).val(); params['income_other_' + i] = $('#income_other_' + i).val(); params['other_expense_' + i] = $('#other_expense_' + i).val(); params['support_expense_' + i] = $('#support_expense_' + i).val(); params['has_bank_' + i] = ($('#has_bank_' + i).is(':checked'))? 1 : 0; } params['number_of_guarantees'] = number_of_guarantees; params['bank_names'] = bank_names; params['credit_sums'] = credit_sums; params['montly_instalments'] = montly_instalments; params['date_terms'] = date_terms; params['bank_names_card'] = bank_names_card; params['card_date_terms'] = card_date_terms; params['card_type'] = card_type; params['card_limit'] = card_limit; params['estate'] = estate; params['estate_owner_percent'] = estate_owner_percent; params['estate_address'] = estate_address; params['estate_weights'] = estate_weights; $.post(url, params, function(data) { }); } function consumercredit_end(is_long) { var url = "/ajax/consumercredit_end.php"; var params = { }; $.get(url, params, function(data) { if(is_long){ $('#consumerlongcredit_step1_popup').show(); $('#consumerlongcredit_step1_popup').html(data); } else { $('#consumercredit_step1_popup').show(); $('#consumercredit_step1_popup').html(data); } }); } /* end consumercredit functions */ /* familycredit functions */ function familycredit_show_all_expences(sum, total_sum, term, instalment, instalments, code) { var url = "/ajax/familycredit_show_all_expences.php"; var params = { sum : sum, total_sum : total_sum, term : term, instalment : instalment, instalments : instalments, code : code, sms : ($('#sms').is(":checked"))? 1 : 0, payment_type: parseFloat($('#familycredit_payment_type').val()) }; $.get(url, params, function(data) { $('#familycredit_expences_popup').show(); $('#familycredit_expences_popup').html(data); }); } function search_familycredit_promo_code(code, total_sum, vnoska, sum, term, instalment, payment_type, sms_price, sms_flag) { var url = "/ajax/search_familycredit_promo_code.php"; var params = { code : code }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ term = instalment = ($( "#credit_type" ).val() == 5)? $( "#familycredit_instalments" ).val() : $( "#familycredit_term" ).val(); $("#familycredit_promo_code").parent().find('img').attr('src', $("#familycredit_promo_code").parent().find('img').attr('src').replace("gray", "blue")); $('input[name=promo_percent]').val(data); if(sms_flag) { $('#familycredit_total_sum').html(parseFloat(total_sum - (total_sum - sum - parseFloat(payment_type) - parseFloat(sms_price) * instalment ) * data / 100 ).toFixed(2)); $('#familycredit_instalment').html(parseFloat((total_sum - (total_sum - sum - parseFloat(payment_type)) * data / 100 - parseFloat(payment_type) - parseFloat(sms_price) * instalment ) / instalment).toFixed(2)); } else { $('#familycredit_total_sum').html(parseFloat(total_sum - (total_sum - sum - parseFloat(payment_type) ) * data / 100 ).toFixed(2)); $('#familycredit_instalment').html(parseFloat((total_sum - (total_sum - sum - parseFloat(payment_type)) * data / 100 - parseFloat(payment_type) ) / instalment).toFixed(2)); } } else { $("#familycredit_promo_code").parent().find('img').attr('src', "/img/tick_gray.png"); $('input[name=promo_percent]').val(''); $('#familycredit_total_sum').html($('input[name=familycredit_total_sum_old]').val()); $('#familycredit_instalment').html($('input[name=familycredit_instalment_old]').val()); } }); } function familycredit_step1() { var url = "/ajax/familycredit_step1.php"; var params = { request_sum : $('input[name=familycredit_sum]').val(), period : $('input[name=familycredit_term]').val(), instalment_cnt : ($("#credit_type").val() == 5)? $('input[name=familycredit_instalments]').val() : $('input[name=familycredit_term]').val(), partner_code : $('input[name=familycredit_promo_code]').val(), promo_percent : $('input[name=promo_percent]').val(), sms_notification : ($('#sms').is(":checked"))? 1 : 0, payment_type : $('select[name=familycredit_payment_type] option:selected').attr('rel'), how_find_us : $('#how_find_us option:selected').val(), how_find_us_specif : $('input[name=how_find_us_specif]').val(), ctedit_type_id : $('input[name=credit_type]').val(), numberofcredits : $('select[name=numberofcredits]').val(), familycredit_type_of_credit : $('input[name=familycredit_type_of_credit]').val() }; $.get(url, params, function(data) { //$('#consumercredit_plan_popup').hide(); $('#familycredit_expences_popup').hide(); $('#familycredit_step1_popup').show(); $('#familycredit_step1_popup').html(data); }); } function familycredit_step1_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/familycredit_step1_request.php"; var params = { firstname_bg_BG : $('input[name=firstname_bg_BG]').val(), sirname_bg_BG : $('input[name=sirname_bg_BG]').val(), lastname_bg_BG : $('input[name=lastname_bg_BG]').val(), egn : $('input[name=egn]').val(), id_card : $('input[name=id_card]').val(), id_card_valid_to : $('input[name=id_card_valid_to]').val(), id_card_from : $('select[name=id_card_from]').val(), city : $('input[name=city]').val(), address_bg_BG : $('input[name=address_bg_BG]').val(), city_corresp : $('input[name=city_corresp]').val(), address_corresp_bg_BG : $('input[name=address_corresp_bg_BG]').val(), phone : $('input[name=phone]').val(), phone_home : $('input[name=phone_home]').val(), phone_extra : $('input[name=phone_extra]').val(), email : $('input[name=email]').val(), living_status : $('select[name=living_status]').val(), family_status : $('select[name=family_status]').val(), household_members_without_income : $('input[name=household_members_without_income]').val(), city_id : $('select[name=city_id]').val(), office_id : $('select[name=office_id]').val(), endless_card : ($('input[name=endless_card]').is(":checked"))? 1 : 0, family_partner : $('input[name=family_partner]').val(), family_partner_egn : $('input[name=family_partner_egn]').val(), available_at : $('input[name=available_at]').val(), phone_operator : $('select[name=phone_operator]').val(), live_here_from : $('input[name=live_here_from]').val(), nationality : $('select[name=nationality]').val(), nationality_specif : $('input[name=nationality_specif]').val() }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step1_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); familycredit_step2(); } }); } function familycredit_step2() { var url = "/ajax/familycredit_step2.php"; var params = { }; $.get(url, params, function(data) { $('#familycredit_step1_popup').show(); $('#familycredit_step1_popup').html(data); }); } function familycredit_step2_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/familycredit_step2_request.php"; var params = { company_bg_BG : $('input[name=company_bg_BG]').val(), company_city : $('input[name=company_city]').val(), work_phone : $('input[name=work_phone]').val(), position_bg_BG : $('input[name=position_bg_BG]').val(), labour_contract : $('select[name=labour_contract]').val(), practice : $('select[name=practice]').val(), education : $('select[name=education]').val(), bulstat : $('input[name=bulstat]').val(), field_of_activity : $('input[name=field_of_activity]').val(), full_practice : $('input[name=full_practice]').val() }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step2_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); familycredit_step3(); } }); } function familycredit_step3() { var url = "/ajax/familycredit_step3.php"; var params = { }; $.get(url, params, function(data) { $('#familycredit_step1_popup').show(); $('#familycredit_step1_popup').html(data); }); } function familycredit_step3_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var bank_names = new Array(); $('input[name=bank_names]').each(function(){ bank_names.push($(this).val()); }); var credit_sums = new Array(); $('input[name=credit_sums]').each(function(){ credit_sums.push($(this).val()); }); var montly_instalments = new Array(); $('input[name=montly_instalments]').each(function(){ montly_instalments.push($(this).val()); }); var date_terms = new Array(); $('input[name=date_terms]').each(function(){ date_terms.push($(this).val()); }); var bank_names_card = new Array(); $('input[name=bank_names_card]').each(function(){ bank_names_card.push($(this).val()); }); var card_date_terms = new Array(); $('input[name=card_date_terms]').each(function(){ card_date_terms.push($(this).val()); }); var card_type = new Array(); $('select[name=card_type]').each(function(){ card_type.push($(this).val()); }); var card_limit = new Array(); $('input[name=card_limit]').each(function(){ card_limit.push($(this).val()); }); var estate = new Array(); $('select[name=estate]').each(function(){ estate.push($(this).val()); }); var estate_owner_percent = new Array(); $('input[name=estate_owner_percent]').each(function(){ estate_owner_percent.push($(this).val()); }); var estate_address = new Array(); $('input[name=estate_address]').each(function(){ estate_address.push($(this).val()); }); var estate_weights = new Array(); $('input[name=estate_weights]').each(function(){ estate_weights.push($(this).val()); }); var url = "/ajax/familycredit_step3_request.php"; var params = { salary : $('input[name=salary]').val(), income_grajdanski : $('input[name=income_grajdanski]').val(), income_eteood : $('input[name=income_eteood]').val(), income_honorari : $('input[name=income_honorari]').val(), income_other : $('input[name=income_other]').val(), income_other_desc : $('input[name=income_other_desc]').val(), has_mps : $('select[name=has_mps]').val(), mps_marka : $('input[name=mps_marka]').val(), mps_year : $('input[name=mps_year]').val(), mps_register_number : $('input[name=mps_register_number]').val(), credits : $('input[name=credits]').val(), credit_expense : $('input[name=credit_expense]').val(), rent_expense : $('input[name=rent_expense]').val(), other_expense : $('input[name=other_expense]').val(), contact_person_relationship : $('select[name=contact_person_relationship]').val(), contact_person_name_bg_BG : $('input[name=contact_person_name_bg_BG]').val(), contact_person_mobile : $('input[name=contact_person_mobile]').val(), contact_person_phone : $('input[name=contact_person_phone]').val(), bank_account_titular : $('input[name=bank_account_titular]').val(), bank_name : $('input[name=bank_name]').val(), bank_account_iban : $('input[name=bank_account_iban]').val(), bank_account_bic : $('input[name=bank_account_bic]').val(), family_partner_income : $('input[name=family_partner_income]').val(), income_rent : $('input[name=income_rent]').val(), support_expense : $('input[name=support_expense]').val(), food_expense : $('input[name=food_expense]').val(), homebills_expense : $('input[name=homebills_expense]').val(), mps_expense : $('input[name=mps_expense]').val(), receive_money_method : $('select[name=receive_money_method]').val(), bank_names : bank_names, credit_sums : credit_sums, montly_instalments : montly_instalments, date_terms : date_terms, bank_names_card : bank_names_card, card_date_terms : card_date_terms, card_type : card_type, card_limit : card_limit, estate : estate, estate_owner_percent : estate_owner_percent, estate_address : estate_address, estate_weights : estate_weights }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") == ""){ $('.popup_container').hide(); familycredit_step4(); } else { $('#micro_credit_step3_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } }); } function familycredit_step4() { var url = "/ajax/familycredit_step4.php"; var params = { }; $.get(url, params, function(data) { $('#familycredit_step1_popup').show(); $('#familycredit_step1_popup').html(data); }); } function familycredit_step4_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/familycredit_step4_request.php"; var number_of_guarantees = $('input[name=number_of_guarantees]').val(); var params = {}; var bank_names = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_' + i; $('input[name=bank_names_'+ i +']').each(function(){ bank_names[k] = new Object(); bank_names[k].name = $(this).attr('name'); bank_names[k].id = $(this).attr('name').substring(11); bank_names[k].value = $(this).val(); k++; }); } var credit_sums = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'credit_sums_' + i; $('input[name=credit_sums_'+ i +']').each(function(){ credit_sums[k] = new Object(); credit_sums[k].name = $(this).attr('name'); credit_sums[k].id = $(this).attr('name').substring(12); credit_sums[k].value = $(this).val(); k++; }); } var montly_instalments = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'montly_instalments_' + i; $('input[name=montly_instalments_'+ i +']').each(function(){ montly_instalments[k] = new Object(); montly_instalments[k].name = $(this).attr('name'); montly_instalments[k].id = $(this).attr('name').substring(19); montly_instalments[k].value = $(this).val(); k++; }); } var date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'date_terms_' + i; $('input[name=date_terms_'+ i +']').each(function(){ date_terms[k] = new Object(); date_terms[k].name = $(this).attr('name'); date_terms[k].id = $(this).attr('name').substring(11); date_terms[k].value = $(this).val(); k++; }); } var bank_names_card = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_card_' + i; $('input[name=bank_names_card_'+ i +']').each(function(){ bank_names_card[k] = new Object(); bank_names_card[k].name = $(this).attr('name'); bank_names_card[k].id = $(this).attr('name').substring(16); bank_names_card[k].value = $(this).val(); k++; }); } var card_date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_date_terms_' + i; $('input[name=card_date_terms_'+ i +']').each(function(){ card_date_terms[k] = new Object(); card_date_terms[k].name = $(this).attr('name'); card_date_terms[k].id = $(this).attr('name').substring(16); card_date_terms[k].value = $(this).val(); k++; }); } var card_type = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_type_' + i; $('select[name=card_type_'+ i +']').each(function(){ card_type[k] = new Object(); card_type[k].name = $(this).attr('name'); card_type[k].id = $(this).attr('name').substring(10); card_type[k].value = $(this).val(); k++; }); } var card_limit = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_limit_' + i; $('input[name=card_limit_'+ i +']').each(function(){ card_limit[k] = new Object(); card_limit[k].name = $(this).attr('name'); card_limit[k].id = $(this).attr('name').substring(11); card_limit[k].value = $(this).val(); k++; }); } var estate = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_' + i; $('select[name=estate_'+ i +']').each(function(){ estate[k] = new Object(); estate[k].name = $(this).attr('name'); estate[k].id = $(this).attr('name').substring(7); estate[k].value = $(this).val(); k++; }); } var estate_owner_percent = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_owner_percent_' + i; $('input[name=estate_owner_percent_'+ i +']').each(function(){ estate_owner_percent[k] = new Object(); estate_owner_percent[k].name = $(this).attr('name'); estate_owner_percent[k].id = $(this).attr('name').substring(21); estate_owner_percent[k].value = $(this).val(); k++; }); } var estate_address = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_address_' + i; $('input[name=estate_address_'+ i +']').each(function(){ estate_address[k] = new Object(); estate_address[k].name = $(this).attr('name'); estate_address[k].id = $(this).attr('name').substring(15); estate_address[k].value = $(this).val(); k++; }); } var estate_weights = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_weights_' + i; $('input[name=estate_weights_'+ i +']').each(function(){ estate_weights[k] = new Object(); estate_weights[k].name = $(this).attr('name'); estate_weights[k].id = $(this).attr('name').substring(15); estate_weights[k].value = $(this).val(); k++; }); } for(var i = 1; i <= number_of_guarantees; i++){ params['firstname_bg_BG_' + i] = $('#firstname_bg_BG_' + i).val(); params['sirname_bg_BG_' + i] = $('#sirname_bg_BG_' + i).val(); params['lastname_bg_BG_' + i] = $('#lastname_bg_BG_' + i).val(); params['egn_' + i] = $('#egn_' + i).val(); params['id_card_' + i] = $('#id_card_' + i).val(); params['id_card_valid_to_' + i] = $('#id_card_valid_to_' + i).val(); params['id_card_from_' + i] = $('#id_card_from_' + i).val(); params['endless_card_' + i] = ($('#endless_card_' + i).is(':checked'))? 1 : 0; params['has_mps_' + i] = $('#has_mps_' + i).val(); params['mps_marka_' + i] = $('#mps_marka_' + i).val(); params['mps_year_' + i] = $('#mps_year_' + i).val(); params['mps_register_number_' + i] = $('#mps_register_number_' + i).val(); params['city_' + i] = $('#city_' + i).val(); params['address_bg_BG_' + i] = $('#address_bg_BG_' + i).val(); params['city_corresp_' + i] = $('#city_corresp_' + i).val(); params['address_corresp_bg_BG_' + i] = $('#address_corresp_bg_BG_' + i).val(); params['phone_' + i] = $('#phone_' + i).val(); params['phone_extra_' + i] = $('#phone_extra_' + i).val(); params['labour_contract_' + i] = $('#labour_contract_' + i).val(); params['company_bg_BG_' + i] = $('#company_bg_BG_' + i).val(); params['company_city_' + i] = $('#company_city_' + i).val(); params['position_bg_BG_' + i] = $('#position_bg_BG_' + i).val(); params['field_of_activity_' + i] = $('#field_of_activity_' + i).val(); params['practice_' + i] = $('#practice_' + i).val(); params['education_' + i] = $('#education_' + i).val(); params['living_status_' + i] = $('#living_status_' + i).val(); params['family_status_' + i] = $('#family_status_' + i).val(); params['family_partner_' + i] = $('#family_partner_' + i).val(); params['family_partner_egn_' + i] = $('#family_partner_egn_' + i).val(); params['income_other_' + i] = $('#income_other_' + i).val(); params['other_expense_' + i] = $('#other_expense_' + i).val(); params['support_expense_' + i] = $('#support_expense_' + i).val(); params['has_bank_' + i] = ($('#has_bank_' + i).is(':checked'))? 1 : 0; } params['number_of_guarantees'] = number_of_guarantees; params['bank_names'] = bank_names; params['credit_sums'] = credit_sums; params['montly_instalments'] = montly_instalments; params['date_terms'] = date_terms; params['bank_names_card'] = bank_names_card; params['card_date_terms'] = card_date_terms; params['card_type'] = card_type; params['card_limit'] = card_limit; params['estate'] = estate; params['estate_owner_percent'] = estate_owner_percent; params['estate_address'] = estate_address; params['estate_weights'] = estate_weights; $.post(url, params, function(data) { if(data != ''){ data = JSON.parse(data); if(data[1] != ''){ $('#micro_credit_step4_msg').html(data[1]); $("ul.tabs li").removeClass("active"); $('#tab_link_'+(data[0])).parent().addClass("active"); $(".tab_content").hide(); $('#tab' + data[0]).show(); $('html, body').animate({ scrollTop: $("#micro_credit_step4_msg").offset().top }, 500); if (jQuery.browser.msie) { activatePlaceholders(); } } } else { $('.popup_container').hide(); familycredit_end(); } }); } function familycredit_step4_save_values() { var url = "/ajax/familycredit_step4_save_values.php"; var number_of_guarantees = $('input[name=number_of_guarantees]').val(); var params = {}; var bank_names = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_' + i; $('input[name=bank_names_'+ i +']').each(function(){ bank_names[k] = new Object(); bank_names[k].name = $(this).attr('name'); bank_names[k].id = $(this).attr('name').substring(11); bank_names[k].value = $(this).val(); k++; }); } var credit_sums = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'credit_sums_' + i; $('input[name=credit_sums_'+ i +']').each(function(){ credit_sums[k] = new Object(); credit_sums[k].name = $(this).attr('name'); credit_sums[k].id = $(this).attr('name').substring(12); credit_sums[k].value = $(this).val(); k++; }); } var montly_instalments = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'montly_instalments_' + i; $('input[name=montly_instalments_'+ i +']').each(function(){ montly_instalments[k] = new Object(); montly_instalments[k].name = $(this).attr('name'); montly_instalments[k].id = $(this).attr('name').substring(19); montly_instalments[k].value = $(this).val(); k++; }); } var date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'date_terms_' + i; $('input[name=date_terms_'+ i +']').each(function(){ date_terms[k] = new Object(); date_terms[k].name = $(this).attr('name'); date_terms[k].id = $(this).attr('name').substring(11); date_terms[k].value = $(this).val(); k++; }); } var bank_names_card = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_card_' + i; $('input[name=bank_names_card_'+ i +']').each(function(){ bank_names_card[k] = new Object(); bank_names_card[k].name = $(this).attr('name'); bank_names_card[k].id = $(this).attr('name').substring(16); bank_names_card[k].value = $(this).val(); k++; }); } var card_date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_date_terms_' + i; $('input[name=card_date_terms_'+ i +']').each(function(){ card_date_terms[k] = new Object(); card_date_terms[k].name = $(this).attr('name'); card_date_terms[k].id = $(this).attr('name').substring(16); card_date_terms[k].value = $(this).val(); k++; }); } var card_type = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_type_' + i; $('select[name=card_type_'+ i +']').each(function(){ card_type[k] = new Object(); card_type[k].name = $(this).attr('name'); card_type[k].id = $(this).attr('name').substring(10); card_type[k].value = $(this).val(); k++; }); } var card_limit = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_limit_' + i; $('input[name=card_limit_'+ i +']').each(function(){ card_limit[k] = new Object(); card_limit[k].name = $(this).attr('name'); card_limit[k].id = $(this).attr('name').substring(11); card_limit[k].value = $(this).val(); k++; }); } var estate = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_' + i; $('select[name=estate_'+ i +']').each(function(){ estate[k] = new Object(); estate[k].name = $(this).attr('name'); estate[k].id = $(this).attr('name').substring(7); estate[k].value = $(this).val(); k++; }); } var estate_owner_percent = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_owner_percent_' + i; $('input[name=estate_owner_percent_'+ i +']').each(function(){ estate_owner_percent[k] = new Object(); estate_owner_percent[k].name = $(this).attr('name'); estate_owner_percent[k].id = $(this).attr('name').substring(21); estate_owner_percent[k].value = $(this).val(); k++; }); } var estate_address = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_address_' + i; $('input[name=estate_address_'+ i +']').each(function(){ estate_address[k] = new Object(); estate_address[k].name = $(this).attr('name'); estate_address[k].id = $(this).attr('name').substring(15); estate_address[k].value = $(this).val(); k++; }); } var estate_weights = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_weights_' + i; $('input[name=estate_weights_'+ i +']').each(function(){ estate_weights[k] = new Object(); estate_weights[k].name = $(this).attr('name'); estate_weights[k].id = $(this).attr('name').substring(15); estate_weights[k].value = $(this).val(); k++; }); } for(var i = 1; i <= number_of_guarantees; i++){ params['firstname_bg_BG_' + i] = $('#firstname_bg_BG_' + i).val(); params['sirname_bg_BG_' + i] = $('#sirname_bg_BG_' + i).val(); params['lastname_bg_BG_' + i] = $('#lastname_bg_BG_' + i).val(); params['egn_' + i] = $('#egn_' + i).val(); params['id_card_' + i] = $('#id_card_' + i).val(); params['id_card_valid_to_' + i] = $('#id_card_valid_to_' + i).val(); params['id_card_from_' + i] = $('#id_card_from_' + i).val(); params['endless_card_' + i] = ($('#endless_card_' + i).is(':checked'))? 1 : 0; params['has_mps_' + i] = $('#has_mps_' + i).val(); params['mps_marka_' + i] = $('#mps_marka_' + i).val(); params['mps_year_' + i] = $('#mps_year_' + i).val(); params['mps_register_number_' + i] = $('#mps_register_number_' + i).val(); params['city_' + i] = $('#city_' + i).val(); params['address_bg_BG_' + i] = $('#address_bg_BG_' + i).val(); params['city_corresp_' + i] = $('#city_corresp_' + i).val(); params['address_corresp_bg_BG_' + i] = $('#address_corresp_bg_BG_' + i).val(); params['phone_' + i] = $('#phone_' + i).val(); params['phone_extra_' + i] = $('#phone_extra_' + i).val(); params['labour_contract_' + i] = $('#labour_contract_' + i).val(); params['company_bg_BG_' + i] = $('#company_bg_BG_' + i).val(); params['company_city_' + i] = $('#company_city_' + i).val(); params['position_bg_BG_' + i] = $('#position_bg_BG_' + i).val(); params['field_of_activity_' + i] = $('#field_of_activity_' + i).val(); params['practice_' + i] = $('#practice_' + i).val(); params['education_' + i] = $('#education_' + i).val(); params['living_status_' + i] = $('#living_status_' + i).val(); params['family_status_' + i] = $('#family_status_' + i).val(); params['family_partner_' + i] = $('#family_partner_' + i).val(); params['family_partner_egn_' + i] = $('#family_partner_egn_' + i).val(); params['income_other_' + i] = $('#income_other_' + i).val(); params['other_expense_' + i] = $('#other_expense_' + i).val(); params['support_expense_' + i] = $('#support_expense_' + i).val(); params['has_bank_' + i] = ($('#has_bank_' + i).is(':checked'))? 1 : 0; } params['number_of_guarantees'] = number_of_guarantees; params['bank_names'] = bank_names; params['credit_sums'] = credit_sums; params['montly_instalments'] = montly_instalments; params['date_terms'] = date_terms; params['bank_names_card'] = bank_names_card; params['card_date_terms'] = card_date_terms; params['card_type'] = card_type; params['card_limit'] = card_limit; params['estate'] = estate; params['estate_owner_percent'] = estate_owner_percent; params['estate_address'] = estate_address; params['estate_weights'] = estate_weights; $.post(url, params, function(data) { }); } function familycredit_end() { var url = "/ajax/familycredit_end.php"; var params = { }; $.get(url, params, function(data) { $('#familycredit_step1_popup').show(); $('#familycredit_step1_popup').html(data); }); } /* end of familycredit functions */ /* start of ipoteccredit functions */ function ipoteccredit_step1() { var url = "/ajax/ipoteccredit_step1.php"; var params = { }; $.get(url, params, function(data) { $('#ipoteccredit_step1_popup').show(); $('#ipoteccredit_step1_popup').html(data); }); } function ipoteccredit_step1_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var representative_firstnames = new Array(); $('input[name=representative_firstname]').each(function(){ representative_firstnames.push($(this).val()); }); var representative_middlenames = new Array(); $('input[name=representative_middlename]').each(function(){ representative_middlenames.push($(this).val()); }); var representative_lastnames = new Array(); $('input[name=representative_lastname]').each(function(){ representative_lastnames.push($(this).val()); }); var representative_id_cards = new Array(); $('input[name=representative_id_card]').each(function(){ representative_id_cards.push($(this).val()); }); var representative_id_cards_valid_to = new Array(); $('input[name=representative_id_card_valid_to]').each(function(){ representative_id_cards_valid_to.push($(this).val()); }); var representative_endless_cards = new Array(); $('input[name=representative_endless_card]').each(function(){ representative_endless_cards.push(($(this).is(':checked'))? 1 : 0); }); var representative_id_cards_from = new Array(); $('select[name=representative_id_card_from]').each(function(){ representative_id_cards_from.push($(this).val()); }); var representative_egns = new Array(); $('input[name=representative_egn]').each(function(){ representative_egns.push($(this).val()); }); var representative_positions = new Array(); $('input[name=representative_position]').each(function(){ representative_positions.push($(this).val()); }); var representative_assignees = new Array(); $('select[name=representative_assignee]').each(function(){ representative_assignees.push($(this).val()); }); var representative_proxys = new Array(); $('input[name=representative_proxy]').each(function(){ representative_proxys.push($(this).val()); }); var representative_proxys_date = new Array(); $('input[name=representative_proxy_date]').each(function(){ representative_proxys_date.push($(this).val()); }); var representative_addresses = new Array(); $('input[name=representative_address_bg]').each(function(){ representative_addresses.push($(this).val()); }); var url = "/ajax/ipoteccredit_step1_request.php"; var params = { person_type : $( "input[name=person_type]:checked" ).val(), firstname_bg_BG : $('input[name=firstname_bg_BG]').val(), sirname_bg_BG : $('input[name=sirname_bg_BG]').val(), lastname_bg_BG : $('input[name=lastname_bg_BG]').val(), egn : $('input[name=egn]').val(), id_card : $('input[name=id_card]').val(), id_card_valid_to : $('input[name=id_card_valid_to]').val(), id_card_from : $('select[name=id_card_from]').val(), city : $('input[name=city]').val(), address_bg_BG : $('input[name=address_bg_BG]').val(), city_corresp : $('input[name=city_corresp]').val(), address_corresp_bg_BG : $('input[name=address_corresp_bg_BG]').val(), phone : $('input[name=phone]').val(), phone_home : $('input[name=phone_home]').val(), phone_extra : $('input[name=phone_extra]').val(), email : $('input[name=email]').val(), living_status : $('select[name=living_status]').val(), family_status : $('select[name=family_status]').val(), household_members_without_income : $('input[name=household_members_without_income]').val(), city_id : $('select[name=city_id]').val(), office_id : $('select[name=office_id]').val(), endless_card : ($('input[name=endless_card]').is(":checked"))? 1 : 0, family_partner : $('input[name=family_partner]').val(), family_partner_egn : $('input[name=family_partner_egn]').val(), available_at : $('input[name=available_at]').val(), phone_operator : $('select[name=phone_operator]').val(), live_here_from : $('input[name=live_here_from]').val(), nationality : $('select[name=nationality]').val(), nationality_specif : $('input[name=nationality_specif]').val(), legal_status : $('input[name=legal_status]').val(), management : $('select[name=management]').val(), management_other : $('input[name=management_other]').val(), bulstat : $('input[name=bulstat]').val(), vat_number : $('input[name=vat_number]').val(), city_legal : $('input[name=city_legal]').val(), address_bg_BG_legal : $('input[name=address_bg_BG_legal]').val(), city_corresp_legal : $('input[name=city_corresp_legal]').val(), address_corresp_bg_BG_legal : $('input[name=address_corresp_bg_BG_legal]').val(), field_of_activity : $('input[name=field_of_activity]').val(), employee_number : $('input[name=employee_number]').val(), phone_legal : $('input[name=phone_legal]').val(), phone_operator_legal : $('select[name=phone_operator_legal]').val(), phone_home_legal : $('input[name=phone_home_legal]').val(), fax : $('input[name=fax]').val(), email_legal : $('input[name=email_legal]').val(), public_property_percent : $('input[name=public_property_percent]').val(), person_property_percent : $('input[name=person_property_percent]').val(), cooperative_property_percent : $('input[name=cooperative_property_percent]').val(), foreign_property_percent : $('input[name=foreign_property_percent]').val(), representative_firstnames : representative_firstnames, representative_middlenames : representative_middlenames, representative_lastnames : representative_lastnames, representative_id_cards : representative_id_cards, representative_id_cards_valid_to : representative_id_cards_valid_to, representative_endless_cards : representative_endless_cards, representative_id_cards_from : representative_id_cards_from, representative_egns : representative_egns, representative_positions : representative_positions, representative_assignees : representative_assignees, representative_proxys : representative_proxys, representative_proxys_date : representative_proxys_date, representative_addresses : representative_addresses }; $.post(url, params, function(data) { if(data != ''){ $('#micro_credit_step1_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } $('html, body').animate({ scrollTop: $("#micro_credit_step1_msg").offset().top }, 500); } else { $('.popup_container').hide(); ipoteccredit_step2(); } }); } function ipoteccredit_step2() { var url = "/ajax/ipoteccredit_step2.php"; var params = { }; $.get(url, params, function(data) { $('#ipoteccredit_step1_popup').show(); $('#ipoteccredit_step1_popup').html(data); }); } function ipoteccredit_step2_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var sum_phases = new Array(); $('input[name=sum_phase]').each(function(){ sum_phases.push($(this).val()); }); var phase_periods = new Array(); $('input[name=phase_period]').each(function(){ phase_periods.push($(this).val()); }); var repayment_dates = new Array(); $('input[name=repayment_date]').each(function(){ repayment_dates.push($(this).val()); }); var gratis_dates = new Array(); $('input[name=gratis_date]').each(function(){ gratis_dates.push($(this).val()); }); var url = "/ajax/ipoteccredit_step2_request.php"; var params = { collateral : $( "select[name=collateral]" ).val(), credit_type : $( "select[name=credit_type]" ).val(), credit_goal : $( "input[name=credit_goal]" ).val(), request_sum : $( "input[name=request_sum]" ).val(), credit_term : $( "input[name=credit_term]" ).val(), currency : $( "select[name=currency]" ).val(), repayment_type : $( "select[name=repayment_type]" ).val(), credit_description : $( "#credit_description" ).val(), sum_phases : sum_phases, phase_periods : phase_periods, repayment_dates : repayment_dates, gratis_dates : gratis_dates }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step2_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); if( $( "input[name=person_type]" ).val() == 1){ ipoteccredit_step3(); } else { ipoteccredit_step4(); } } }); } function ipoteccredit_step3() { var url = "/ajax/ipoteccredit_step3.php"; var params = { }; $.get(url, params, function(data) { $('#ipoteccredit_step1_popup').show(); $('#ipoteccredit_step1_popup').html(data); }); } function ipoteccredit_step3_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/ipoteccredit_step3_request.php"; var params = { company_bg_BG : $('input[name=company_bg_BG]').val(), company_city : $('input[name=company_city]').val(), work_phone : $('input[name=work_phone]').val(), position_bg_BG : $('input[name=position_bg_BG]').val(), labour_contract : $('select[name=labour_contract]').val(), practice : $('select[name=practice]').val(), education : $('select[name=education]').val(), bulstat : $('input[name=bulstat]').val(), field_of_activity : $('input[name=field_of_activity]').val(), full_practice : $('input[name=full_practice]').val() }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step3_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } } else { $('.popup_container').hide(); ipoteccredit_step4(); } }); } function ipoteccredit_step4() { var url = "/ajax/ipoteccredit_step4.php"; var params = { }; $.get(url, params, function(data) { $('#ipoteccredit_step1_popup').show(); $('#ipoteccredit_step1_popup').html(data); }); } function ipoteccredit_step4_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var mps_marks = new Array(); $('input[name=mps_marka]').each(function(){ mps_marks.push($(this).val()); }); var mps_years = new Array(); $('input[name=mps_year]').each(function(){ mps_years.push($(this).val()); }); var mps_register_numbers = new Array(); $('input[name=mps_register_number]').each(function(){ mps_register_numbers.push($(this).val()); }); var obligation_bank_names = new Array(); $('input[name=obligation_bank_name]').each(function(){ obligation_bank_names.push($(this).val()); }); var obligation_types = new Array(); $('select[name=obligation_type]').each(function(){ obligation_types.push($(this).val()); }); var obligation_sums= new Array(); $('input[name=obligation_sum]').each(function(){ obligation_sums.push($(this).val()); }); var obligation_currencies= new Array(); $('select[name=obligation_currency]').each(function(){ obligation_currencies.push($(this).val()); }); var residues= new Array(); $('input[name=residue]').each(function(){ residues.push($(this).val()); }); var obligation_starts= new Array(); $('input[name=obligation_start]').each(function(){ obligation_starts.push($(this).val()); }); var obligation_ends= new Array(); $('input[name=obligation_end]').each(function(){ obligation_ends.push($(this).val()); }); var guarantee_bank_names= new Array(); $('input[name=guarantee_bank_name]').each(function(){ guarantee_bank_names.push($(this).val()); }); var guarantee_types= new Array(); $('select[name=guarantee_type]').each(function(){ guarantee_types.push($(this).val()); }); var estate_names= new Array(); $('input[name=estate_name]').each(function(){ estate_names.push($(this).val()); }); var guarantee_sums= new Array(); $('input[name=guarantee_sum]').each(function(){ guarantee_sums.push($(this).val()); }); var guarantee_currencies= new Array(); $('select[name=guarantee_currency]').each(function(){ guarantee_currencies.push($(this).val()); }); var accounts_bank_names= new Array(); $('input[name=accounts_bank_name]').each(function(){ accounts_bank_names.push($(this).val()); }); var bank_branches= new Array(); $('input[name=bank_branch]').each(function(){ bank_branches.push($(this).val()); }); var accounts_types= new Array(); $('select[name=accounts_type]').each(function(){ accounts_types.push($(this).val()); }); var accounts_currencies= new Array(); $('select[name=accounts_currency]').each(function(){ accounts_currencies.push($(this).val()); }); var accounts_numbers= new Array(); $('input[name=accounts_number]').each(function(){ accounts_numbers.push($(this).val()); }); var estate_types= new Array(); $('select[name=estate]').each(function(){ estate_types.push($(this).val()); }); var estate_owner_percents= new Array(); $('input[name=estate_owner_percent]').each(function(){ estate_owner_percents.push($(this).val()); }); var estate_addresses= new Array(); $('input[name=estate_address]').each(function(){ estate_addresses.push($(this).val()); }); var estates_weights= new Array(); $('input[name=estate_weights]').each(function(){ estates_weights.push($(this).val()); }); var representative_descriptions= new Array(); $('input[name=representative_description]').each(function(){ representative_descriptions.push($(this).val()); }); var donations_descriptions= new Array(); $('input[name=donations_description]').each(function(){ donations_descriptions.push($(this).val()); }); var convicted_descriptions= new Array(); $('input[name=convicted_description]').each(function(){ convicted_descriptions.push($(this).val()); }); var partners= new Array(); $('input[name=partner]').each(function(){ partners.push($(this).val()); }); var partners= new Array(); $('input[name=partner]').each(function(){ partners.push($(this).val()); }); var firm_partners= new Array(); $('input[name=firm_partner]').each(function(){ firm_partners.push($(this).val()); }); var stock_partners= new Array(); $('input[name=stock_partner]').each(function(){ stock_partners.push($(this).val()); }); var controls_by= new Array(); $('input[name=control_by]').each(function(){ controls_by.push($(this).val()); }); votes_by_arr = new Array(); $("input:radio[id^=votes_by1]").each(function(){ votes_by_arr.push($(this).attr('name').substring(9)); }); var votes_by = new Array(); for(var i = 0; i < votes_by_arr.length; i++){ votes_by.push(($("input:radio[name='votes_by_" + votes_by_arr[i] +"']:checked").val() == undefined)? '' : $("input:radio[name='votes_by_" + votes_by_arr[i] +"']:checked").val()); } member_by_arr = new Array(); $("input:radio[id^=member_by1]").each(function(){ member_by_arr.push($(this).attr('name').substring(10)); }); var member_by = new Array(); for(var i = 0; i < member_by_arr.length; i++){ member_by.push(($("input:radio[name='member_by_" + member_by_arr[i] +"']:checked").val() == undefined)? '' : $("input:radio[name='member_by_" + member_by_arr[i] +"']:checked").val()); } lead_by_arr = new Array(); $("input:radio[id^=lead_by1]").each(function(){ lead_by_arr.push($(this).attr('name').substring(8)); }); var lead_by = new Array(); for(var i = 0; i < lead_by_arr.length; i++){ lead_by.push(($("input:radio[name='lead_by_" + lead_by_arr[i] +"']:checked").val() == undefined)? '' : $("input:radio[name='lead_by_" + lead_by_arr[i] +"']:checked").val()); } var controls= new Array(); $('input[name=control]').each(function(){ controls.push($(this).val()); }); votes_arr = new Array(); $("input:radio[id^=votes1]").each(function(){ votes_arr.push($(this).attr('name').substring(6)); }); var votes = new Array(); for(var i = 0; i < votes_arr.length; i++){ votes.push(($("input:radio[name='votes_" + votes_arr[i] +"']:checked").val() == undefined)? '' : $("input:radio[name='votes_" + votes_arr[i] +"']:checked").val()); } member_arr = new Array(); $("input:radio[id^=member1]").each(function(){ member_arr.push($(this).attr('name').substring(7)); }); var member = new Array(); for(var i = 0; i < member_arr.length; i++){ member.push(($("input:radio[name='member_" + member_arr[i] +"']:checked").val() == undefined)? '' : $("input:radio[name='member_" + member_arr[i] +"']:checked").val()); } lead_arr = new Array(); $("input:radio[id^=lead1]").each(function(){ lead_arr.push($(this).attr('name').substring(5)); }); var lead = new Array(); for(var i = 0; i < lead_arr.length; i++){ lead.push(($("input:radio[name='lead_" + lead_arr[i] +"']:checked").val() == undefined)? '' : $("input:radio[name='lead_" + lead_arr[i] +"']:checked").val()); } var url = "/ajax/ipoteccredit_step4_request.php"; var params = { salary : $('input[name=salary]').val(), income_grajdanski : $('input[name=income_grajdanski]').val(), income_eteood : $('input[name=income_eteood]').val(), income_honorari : $('input[name=income_honorari]').val(), family_partner_income : $('input[name=family_partner_income]').val(), income_rent : $('input[name=income_rent]').val(), income_other : $('input[name=income_other]').val(), income_other_desc : $('input[name=income_other_desc]').val(), rent_expense : $('input[name=rent_expense]').val(), other_expense : $('input[name=other_expense]').val(), support_expense : $('input[name=support_expense]').val(), food_expense : $('input[name=food_expense]').val(), homebills_expense : $('input[name=homebills_expense]').val(), mps_expense : $('input[name=mps_expense]').val(), contact_person_relationship : $('select[name=contact_person_relationship]').val(), contact_person_name_bg_BG : $('input[name=contact_person_name_bg_BG]').val(), contact_person_mobile : $('input[name=contact_person_mobile]').val(), contact_person_phone : $('input[name=contact_person_phone]').val(), receive_money_method : $('select[name=receive_money_method]').val(), bank_account_titular : $('input[name=bank_account_titular]').val(), bank_name : $('input[name=bank_name]').val(), bank_account_iban : $('input[name=bank_account_iban]').val(), bank_account_bic : $('input[name=bank_account_bic]').val(), has_mps : $('input[name=mps]:checked').val(), mps_marks : mps_marks, mps_years : mps_years, mps_register_numbers : mps_register_numbers, has_obligation : $('input[name=obligation]:checked').val(), obligation_bank_names : obligation_bank_names, obligation_types : obligation_types, obligation_sums : obligation_sums, obligation_currencies : obligation_currencies, residues : residues, obligation_starts : obligation_starts, obligation_ends : obligation_ends, has_guarantee : $('input[name=guarantee]:checked').val(), guarantee_bank_names : guarantee_bank_names, guarantee_types : guarantee_types, estate_names : estate_names, guarantee_sums : guarantee_sums, guarantee_currencies : guarantee_currencies, has_accounts : $('input[name=accounts]:checked').val(), accounts_bank_names : accounts_bank_names, bank_branches : bank_branches, accounts_types : accounts_types, accounts_currencies : accounts_currencies, accounts_numbers : accounts_numbers, has_estates : $('input[name=estates]:checked').val(), estate_types : estate_types, estate_owner_percents : estate_owner_percents, estate_addresses : estate_addresses, estates_weights : estates_weights, has_public_obligation : $('input[name=public_obligation]:checked').val(), has_representative : $('input[name=representative]:checked').val(), representative_descriptions : representative_descriptions, has_donations : $('input[name=donations]:checked').val(), donations_descriptions : donations_descriptions, has_donations : $('input[name=donations]:checked').val(), has_defendant : $('input[name=defendant]:checked').val(), has_convicted : $('input[name=convicted]:checked').val(), convicted_descriptions : convicted_descriptions, has_connectivity : $('input[name=connectivity]:checked').val(), partners : partners, firm_partners : firm_partners, stock_partners : stock_partners, controls_by : controls_by, votes_by : votes_by, member_by : member_by, lead_by : lead_by, controls : controls, votes : votes, member : member, lead : lead, personal_documents : $( "#personal_documents" ).is(":checked")? 1 : 0, personal_documents_partner : $( "#personal_documents_partner" ).is(":checked")? 1 : 0, dopk : $( "#dopk" ).is(":checked")? 1 : 0, collateral_documents : $( "#collateral_documents" ).is(":checked")? 1 : 0, copy_of_documents : $( "#copy_of_documents" ).is(":checked")? 1 : 0, other_documents : $( "#other_documents" ).is(":checked")? 1 : 0, other_documents_desc : $( "input[name=other_documents_desc]" ).val(), legal_documents : $( "#legal_documents" ).is(":checked")? 1 : 0, constitutive_act_documents : $( "#constitutive_act_documents" ).is(":checked")? 1 : 0, decision_act_documents : $( "#decision_act_documents" ).is(":checked")? 1 : 0, copy_of_personal_documents : $( "#copy_of_personal_documents" ).is(":checked")? 1 : 0, ddc_documents : $( "#ddc_documents" ).is(":checked")? 1 : 0, bulstat_documents : $( "#bulstat_documents" ).is(":checked")? 1 : 0, dopk_documents : $( "#dopk_documents" ).is(":checked")? 1 : 0, report_documents : $( "#report_documents" ).is(":checked")? 1 : 0, copy_of_declaration_documents : $( "#copy_of_declaration_documents" ).is(":checked")? 1 : 0, information_collateral_documents: $( "#information_collateral_documents" ).is(":checked")? 1 : 0, copy_of_contracts_documents : $( "#copy_of_contracts_documents" ).is(":checked")? 1 : 0 }; $.get(url, params, function(data) { if(data != ''){ $('#micro_credit_step4_msg').html(data); if (jQuery.browser.msie) { activatePlaceholders(); } $('html, body').animate({ scrollTop: $("#micro_credit_step4_msg").offset().top }, 500); } else { $('.popup_container').hide(); ipoteccredit_step5(); } }); } function ipoteccredit_step5() { var url = "/ajax/ipoteccredit_step5.php"; var params = { }; $.get(url, params, function(data) { $('#ipoteccredit_step1_popup').show(); $('#ipoteccredit_step1_popup').html(data); }); } function ipoteccredit_step5_request() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/ipoteccredit_step5_request.php"; var number_of_guarantees = $('input[name=number_of_guarantees]').val(); var params = {}; var bank_names = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_' + i; $('input[name=bank_names_'+ i +']').each(function(){ bank_names[k] = new Object(); bank_names[k].name = $(this).attr('name'); bank_names[k].id = $(this).attr('name').substring(11); bank_names[k].value = $(this).val(); k++; }); } var credit_sums = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'credit_sums_' + i; $('input[name=credit_sums_'+ i +']').each(function(){ credit_sums[k] = new Object(); credit_sums[k].name = $(this).attr('name'); credit_sums[k].id = $(this).attr('name').substring(12); credit_sums[k].value = $(this).val(); k++; }); } var montly_instalments = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'montly_instalments_' + i; $('input[name=montly_instalments_'+ i +']').each(function(){ montly_instalments[k] = new Object(); montly_instalments[k].name = $(this).attr('name'); montly_instalments[k].id = $(this).attr('name').substring(19); montly_instalments[k].value = $(this).val(); k++; }); } var date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'date_terms_' + i; $('input[name=date_terms_'+ i +']').each(function(){ date_terms[k] = new Object(); date_terms[k].name = $(this).attr('name'); date_terms[k].id = $(this).attr('name').substring(11); date_terms[k].value = $(this).val(); k++; }); } var bank_names_card = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_card_' + i; $('input[name=bank_names_card_'+ i +']').each(function(){ bank_names_card[k] = new Object(); bank_names_card[k].name = $(this).attr('name'); bank_names_card[k].id = $(this).attr('name').substring(16); bank_names_card[k].value = $(this).val(); k++; }); } var card_date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_date_terms_' + i; $('input[name=card_date_terms_'+ i +']').each(function(){ card_date_terms[k] = new Object(); card_date_terms[k].name = $(this).attr('name'); card_date_terms[k].id = $(this).attr('name').substring(16); card_date_terms[k].value = $(this).val(); k++; }); } var card_type = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_type_' + i; $('select[name=card_type_'+ i +']').each(function(){ card_type[k] = new Object(); card_type[k].name = $(this).attr('name'); card_type[k].id = $(this).attr('name').substring(10); card_type[k].value = $(this).val(); k++; }); } var card_limit = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_limit_' + i; $('input[name=card_limit_'+ i +']').each(function(){ card_limit[k] = new Object(); card_limit[k].name = $(this).attr('name'); card_limit[k].id = $(this).attr('name').substring(11); card_limit[k].value = $(this).val(); k++; }); } var estate = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_' + i; $('select[name=estate_'+ i +']').each(function(){ estate[k] = new Object(); estate[k].name = $(this).attr('name'); estate[k].id = $(this).attr('name').substring(7); estate[k].value = $(this).val(); k++; }); } var estate_owner_percent = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_owner_percent_' + i; $('input[name=estate_owner_percent_'+ i +']').each(function(){ estate_owner_percent[k] = new Object(); estate_owner_percent[k].name = $(this).attr('name'); estate_owner_percent[k].id = $(this).attr('name').substring(21); estate_owner_percent[k].value = $(this).val(); k++; }); } var estate_address = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_address_' + i; $('input[name=estate_address_'+ i +']').each(function(){ estate_address[k] = new Object(); estate_address[k].name = $(this).attr('name'); estate_address[k].id = $(this).attr('name').substring(15); estate_address[k].value = $(this).val(); k++; }); } var estate_weights = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_weights_' + i; $('input[name=estate_weights_'+ i +']').each(function(){ estate_weights[k] = new Object(); estate_weights[k].name = $(this).attr('name'); estate_weights[k].id = $(this).attr('name').substring(15); estate_weights[k].value = $(this).val(); k++; }); } var pledge_types= new Array(); $('select[name^=pledge_type]').each(function(){ pledge_types.push($(this).val()); }); var pledge_values= new Array(); $('input[name^=pledge_value]').each(function(){ pledge_values.push($(this).val()); }); var pledge_nominal_values= new Array(); $('input[name^=pledge_nominal_value]').each(function(){ pledge_nominal_values.push($(this).val()); }); var pledge_totals= new Array(); $('input[name^=pledge_total]').each(function(){ pledge_totals.push($(this).val()); }); var pledge_descriptions= new Array(); $('textarea[name^=pledge_description]').each(function(){ pledge_descriptions.push($(this).val()); }); var ipotec_types= new Array(); $('select[name^=ipotec_type]').each(function(){ ipotec_types.push($(this).val()); }); var ipotec_descriptions= new Array(); $('textarea[name^=ipotec_description]').each(function(){ ipotec_descriptions.push($(this).val()); }); var mps_marks = new Array(); $('input[name=firm_mps_marka]').each(function(){ mps_marks.push($(this).val()); }); var mps_years = new Array(); $('input[name=firm_mps_year]').each(function(){ mps_years.push($(this).val()); }); var mps_register_numbers = new Array(); $('input[name=firm_mps_register_number]').each(function(){ mps_register_numbers.push($(this).val()); }); var obligation_bank_names = new Array(); $('input[name=firm_obligation_bank_name]').each(function(){ obligation_bank_names.push($(this).val()); }); var obligation_types = new Array(); $('select[name=firm_obligation_type]').each(function(){ obligation_types.push($(this).val()); }); var obligation_sums= new Array(); $('input[name=firm_obligation_sum]').each(function(){ obligation_sums.push($(this).val()); }); var obligation_currencies= new Array(); $('select[name=firm_obligation_currency]').each(function(){ obligation_currencies.push($(this).val()); }); var residues= new Array(); $('input[name="firm_residue"]').each(function(){ residues.push($(this).val()); }); var obligation_starts= new Array(); $('input[name=firm_obligation_start]').each(function(){ obligation_starts.push($(this).val()); }); var obligation_ends= new Array(); $('input[name=firm_obligation_end]').each(function(){ obligation_ends.push($(this).val()); }); var guarantee_bank_names= new Array(); $('input[name=firm_guarantee_bank_name]').each(function(){ guarantee_bank_names.push($(this).val()); }); var guarantee_types= new Array(); $('select[name=firm_guarantee_type]').each(function(){ guarantee_types.push($(this).val()); }); var estate_names= new Array(); $('input[name=firm_estate_name]').each(function(){ estate_names.push($(this).val()); }); var guarantee_sums= new Array(); $('input[name=firm_guarantee_sum]').each(function(){ guarantee_sums.push($(this).val()); }); var guarantee_currencies= new Array(); $('select[name=firm_guarantee_currency]').each(function(){ guarantee_currencies.push($(this).val()); }); var accounts_bank_names= new Array(); $('input[name=firm_accounts_bank_name]').each(function(){ accounts_bank_names.push($(this).val()); }); var bank_branches= new Array(); $('input[name=firm_bank_branch]').each(function(){ bank_branches.push($(this).val()); }); var accounts_types= new Array(); $('select[name=firm_accounts_type]').each(function(){ accounts_types.push($(this).val()); }); var accounts_currencies= new Array(); $('select[name=firm_accounts_currency]').each(function(){ accounts_currencies.push($(this).val()); }); var accounts_numbers= new Array(); $('input[name=firm_accounts_number]').each(function(){ accounts_numbers.push($(this).val()); }); var firm_estate_types= new Array(); $('select[name=firm_estate]').each(function(){ firm_estate_types.push($(this).val()); }); var firm_estate_owner_percents= new Array(); $('input[name=firm_estate_owner_percent]').each(function(){ firm_estate_owner_percents.push($(this).val()); }); var firm_estate_addresses= new Array(); $('input[name=firm_estate_address]').each(function(){ firm_estate_addresses.push($(this).val()); }); var firm_estates_weights= new Array(); $('input[name=firm_estate_weights]').each(function(){ firm_estates_weights.push($(this).val()); }); var representative_firstnames = new Array(); $('input[name=representative_firstname]').each(function(){ representative_firstnames.push($(this).val()); }); var representative_middlenames = new Array(); $('input[name=representative_middlename]').each(function(){ representative_middlenames.push($(this).val()); }); var representative_lastnames = new Array(); $('input[name=representative_lastname]').each(function(){ representative_lastnames.push($(this).val()); }); var representative_id_cards = new Array(); $('input[name=representative_id_card]').each(function(){ representative_id_cards.push($(this).val()); }); var representative_id_cards_valid_to = new Array(); $('input[name=representative_id_card_valid_to]').each(function(){ representative_id_cards_valid_to.push($(this).val()); }); var representative_endless_cards = new Array(); $('input[name=representative_endless_card]').each(function(){ representative_endless_cards.push(($(this).is(':checked'))? 1 : 0); }); var representative_id_cards_from = new Array(); $('select[name=representative_id_card_from]').each(function(){ representative_id_cards_from.push($(this).val()); }); var representative_egns = new Array(); $('input[name=representative_egn]').each(function(){ representative_egns.push($(this).val()); }); var representative_positions = new Array(); $('input[name=representative_position]').each(function(){ representative_positions.push($(this).val()); }); var representative_assignees = new Array(); $('select[name=representative_assignee]').each(function(){ representative_assignees.push($(this).val()); }); var representative_proxys = new Array(); $('input[name=representative_proxy]').each(function(){ representative_proxys.push($(this).val()); }); var representative_proxys_date = new Array(); $('input[name=representative_proxy_date]').each(function(){ representative_proxys_date.push($(this).val()); }); var representative_addresses = new Array(); $('input[name=representative_address_bg]').each(function(){ representative_addresses.push($(this).val()); }); for(var i = 1; i <= number_of_guarantees; i++){ params['firstname_bg_BG_' + i] = $('#firstname_bg_BG_' + i).val(); params['sirname_bg_BG_' + i] = $('#sirname_bg_BG_' + i).val(); params['lastname_bg_BG_' + i] = $('#lastname_bg_BG_' + i).val(); params['egn_' + i] = $('#egn_' + i).val(); params['id_card_' + i] = $('#id_card_' + i).val(); params['id_card_valid_to_' + i] = $('#id_card_valid_to_' + i).val(); params['id_card_from_' + i] = $('#id_card_from_' + i).val(); params['endless_card_' + i] = ($('#endless_card_' + i).is(':checked'))? 1 : 0; params['has_mps_' + i] = $('#has_mps_' + i).val(); params['mps_marka_' + i] = $('#mps_marka_' + i).val(); params['mps_year_' + i] = $('#mps_year_' + i).val(); params['mps_register_number_' + i] = $('#mps_register_number_' + i).val(); params['city_' + i] = $('#city_' + i).val(); params['address_bg_BG_' + i] = $('#address_bg_BG_' + i).val(); params['city_corresp_' + i] = $('#city_corresp_' + i).val(); params['address_corresp_bg_BG_' + i] = $('#address_corresp_bg_BG_' + i).val(); params['phone_' + i] = $('#phone_' + i).val(); params['phone_extra_' + i] = $('#phone_extra_' + i).val(); params['labour_contract_' + i] = $('#labour_contract_' + i).val(); params['company_bg_BG_' + i] = $('#company_bg_BG_' + i).val(); params['company_city_' + i] = $('#company_city_' + i).val(); params['position_bg_BG_' + i] = $('#position_bg_BG_' + i).val(); params['field_of_activity_' + i] = $('#field_of_activity_' + i).val(); params['practice_' + i] = $('#practice_' + i).val(); params['education_' + i] = $('#education_' + i).val(); params['living_status_' + i] = $('#living_status_' + i).val(); params['family_status_' + i] = $('#family_status_' + i).val(); params['family_partner_' + i] = $('#family_partner_' + i).val(); params['family_partner_egn_' + i] = $('#family_partner_egn_' + i).val(); params['income_other_' + i] = $('#income_other_' + i).val(); params['other_expense_' + i] = $('#other_expense_' + i).val(); params['support_expense_' + i] = $('#support_expense_' + i).val(); params['has_bank_' + i] = ($('#has_bank_' + i).is(':checked'))? 1 : 0; } params['guarantor_type'] = $('input[name=guarantor_type]:checked').val(); params['number_of_guarantees'] = number_of_guarantees; params['bank_names'] = bank_names; params['credit_sums'] = credit_sums; params['montly_instalments'] = montly_instalments; params['date_terms'] = date_terms; params['bank_names_card'] = bank_names_card; params['card_date_terms'] = card_date_terms; params['card_type'] = card_type; params['card_limit'] = card_limit; params['estate'] = estate; params['estate_owner_percent'] = estate_owner_percent; params['estate_address'] = estate_address; params['estate_weights'] = estate_weights; params['firm_legal_status'] = $( "input[name=firm_legal_status]" ).val(); params['firm_management'] = $( "select[name=firm_management]" ).val(); params['firm_management_other'] = $( "input[name=firm_management_other]" ).val(); params['firm_bulstat'] = $( "input[name=firm_bulstat]" ).val(); params['firm_is_vat_number'] = ($( "input[name=firm_is_vat_number]" ).is(":checked"))? 1 : 0; params['firm_vat_number'] = $( "input[name=firm_vat_number]" ).val(); params['firm_city_legal'] = $( "input[name=firm_city_legal]" ).val(); params['firm_address_bg_BG_legal'] = $( "input[name=firm_address_bg_BG_legal]" ).val(); params['firm_city_corresp_legal'] = $( "input[name=firm_city_corresp_legal]" ).val(); params['firm_address_corresp_bg_BG_legal']= $( "input[name=firm_address_corresp_bg_BG_legal]" ).val(); params['firm_field_of_activity'] = $( "input[name=firm_field_of_activity]" ).val(); params['firm_employee_number'] = $( "input[name=firm_employee_number]" ).val(); params['firm_phone_legal'] = $( "input[name=firm_phone_legal]" ).val(); params['firm_phone_home_legal'] = $( "input[name=firm_phone_home_legal]" ).val(); params['firm_phone_operator_legal'] = $( "select[name=firm_phone_operator_legal]" ).val(); params['firm_fax'] = $( "input[name=firm_fax]" ).val(); params['firm_email'] = $( "input[name=firm_email_legal]" ).val(); params['has_mps'] = $('input[name=mps]:checked').val(); params['mps_marks'] = mps_marks; params['mps_years'] = mps_years; params['mps_register_numbers'] = mps_register_numbers; params['has_obligation'] = $('input[name=obligation]:checked').val(); params['obligation_bank_names'] = obligation_bank_names; params['obligation_types'] = obligation_types; params['obligation_sums'] = obligation_sums; params['obligation_currencies'] = obligation_currencies; params['residues'] = residues; params['obligation_starts'] = obligation_starts; params['obligation_ends'] = obligation_ends; params['has_guarantee'] = $('input[name=guarantee]:checked').val(); params['guarantee_bank_names'] = guarantee_bank_names; params['guarantee_types'] = guarantee_types; params['estate_names'] = estate_names; params['guarantee_sums'] = guarantee_sums; params['guarantee_currencies'] = guarantee_currencies; params['has_accounts'] = $('input[name=accounts]:checked').val(); params['accounts_bank_names'] = accounts_bank_names; params['bank_branches'] = bank_branches; params['accounts_types'] = accounts_types; params['accounts_currencies'] = accounts_currencies; params['accounts_numbers'] = accounts_numbers; params['has_estates'] = $('input[name=estates]:checked').val(); params['firm_estate_types'] = firm_estate_types; params['firm_estate_owner_percents'] = firm_estate_owner_percents; params['firm_estate_addresses'] = firm_estate_addresses; params['firm_estates_weights'] = firm_estates_weights; params['has_public_obligation'] = $('input[name=public_obligation]:checked').val(); params['public_property_percent'] = $('input[name=public_property_percent]').val(); params['person_property_percent'] = $('input[name=person_property_percent]').val(); params['cooperative_property_percent'] = $('input[name=cooperative_property_percent]').val(); params['foreign_property_percent'] = $('input[name=foreign_property_percent]').val(); params['representative_firstnames'] = representative_firstnames; params['representative_middlenames'] = representative_middlenames; params['representative_lastnames'] = representative_lastnames; params['representative_id_cards'] = representative_id_cards; params['representative_id_cards_valid_to']= representative_id_cards_valid_to; params['representative_endless_cards'] = representative_endless_cards; params['representative_id_cards_from'] = representative_id_cards_from; params['representative_egns'] = representative_egns; params['representative_positions'] = representative_positions; params['representative_assignees'] = representative_assignees; params['representative_proxys'] = representative_proxys; params['representative_proxys_date'] = representative_proxys_date; params['representative_addresses'] = representative_addresses; params['pledge_types'] = pledge_types; params['pledge_values'] = pledge_values; params['pledge_nominal_values'] = pledge_nominal_values; params['pledge_totals'] = pledge_totals; params['pledge_descriptions'] = pledge_descriptions; params['ipotec_types'] = ipotec_types; params['ipotec_descriptions'] = ipotec_descriptions; $.post(url, params, function(data) { if(data != ''){ data = JSON.parse(data); if(data[1] != ''){ $('#micro_credit_step4_msg').html(data[1]); $("ul.tabs li").removeClass("active"); $('#tab_link_'+(data[0])).parent().addClass("active"); $(".tab_content").hide(); $('#tab' + data[0]).show(); $('html, body').animate({ scrollTop: $("#micro_credit_step4_msg").offset().top }, 500); if (jQuery.browser.msie) { activatePlaceholders(); } } } else { $('.popup_container').hide(); ipoteccredit_end(); } }); } function ipoteccredit_step5_prev() { $('[placeholder]').each(function(){ if($(this).val() == $(this).attr('placeholder')){ $(this).val(''); } }); var url = "/ajax/ipoteccredit_step5_prev.php"; var number_of_guarantees = $('input[name=number_of_guarantees]').val(); var params = {}; var bank_names = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_' + i; $('input[name=bank_names_'+ i +']').each(function(){ bank_names[k] = new Object(); bank_names[k].name = $(this).attr('name'); bank_names[k].id = $(this).attr('name').substring(11); bank_names[k].value = $(this).val(); k++; }); } var credit_sums = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'credit_sums_' + i; $('input[name=credit_sums_'+ i +']').each(function(){ credit_sums[k] = new Object(); credit_sums[k].name = $(this).attr('name'); credit_sums[k].id = $(this).attr('name').substring(12); credit_sums[k].value = $(this).val(); k++; }); } var montly_instalments = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'montly_instalments_' + i; $('input[name=montly_instalments_'+ i +']').each(function(){ montly_instalments[k] = new Object(); montly_instalments[k].name = $(this).attr('name'); montly_instalments[k].id = $(this).attr('name').substring(19); montly_instalments[k].value = $(this).val(); k++; }); } var date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'date_terms_' + i; $('input[name=date_terms_'+ i +']').each(function(){ date_terms[k] = new Object(); date_terms[k].name = $(this).attr('name'); date_terms[k].id = $(this).attr('name').substring(11); date_terms[k].value = $(this).val(); k++; }); } var bank_names_card = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'bank_names_card_' + i; $('input[name=bank_names_card_'+ i +']').each(function(){ bank_names_card[k] = new Object(); bank_names_card[k].name = $(this).attr('name'); bank_names_card[k].id = $(this).attr('name').substring(16); bank_names_card[k].value = $(this).val(); k++; }); } var card_date_terms = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_date_terms_' + i; $('input[name=card_date_terms_'+ i +']').each(function(){ card_date_terms[k] = new Object(); card_date_terms[k].name = $(this).attr('name'); card_date_terms[k].id = $(this).attr('name').substring(16); card_date_terms[k].value = $(this).val(); k++; }); } var card_type = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_type_' + i; $('select[name=card_type_'+ i +']').each(function(){ card_type[k] = new Object(); card_type[k].name = $(this).attr('name'); card_type[k].id = $(this).attr('name').substring(10); card_type[k].value = $(this).val(); k++; }); } var card_limit = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'card_limit_' + i; $('input[name=card_limit_'+ i +']').each(function(){ card_limit[k] = new Object(); card_limit[k].name = $(this).attr('name'); card_limit[k].id = $(this).attr('name').substring(11); card_limit[k].value = $(this).val(); k++; }); } var estate = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_' + i; $('select[name=estate_'+ i +']').each(function(){ estate[k] = new Object(); estate[k].name = $(this).attr('name'); estate[k].id = $(this).attr('name').substring(7); estate[k].value = $(this).val(); k++; }); } var estate_owner_percent = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_owner_percent_' + i; $('input[name=estate_owner_percent_'+ i +']').each(function(){ estate_owner_percent[k] = new Object(); estate_owner_percent[k].name = $(this).attr('name'); estate_owner_percent[k].id = $(this).attr('name').substring(21); estate_owner_percent[k].value = $(this).val(); k++; }); } var estate_address = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_address_' + i; $('input[name=estate_address_'+ i +']').each(function(){ estate_address[k] = new Object(); estate_address[k].name = $(this).attr('name'); estate_address[k].id = $(this).attr('name').substring(15); estate_address[k].value = $(this).val(); k++; }); } var estate_weights = new Array(); var k = 0; for(var i = 1; i <= number_of_guarantees; i++){ var name = 'estate_weights_' + i; $('input[name=estate_weights_'+ i +']').each(function(){ estate_weights[k] = new Object(); estate_weights[k].name = $(this).attr('name'); estate_weights[k].id = $(this).attr('name').substring(15); estate_weights[k].value = $(this).val(); k++; }); } var pledge_types= new Array(); $('select[name^=pledge_type]').each(function(){ pledge_types.push($(this).val()); }); var pledge_values= new Array(); $('input[name^=pledge_value]').each(function(){ pledge_values.push($(this).val()); }); var pledge_nominal_values= new Array(); $('input[name^=pledge_nominal_value]').each(function(){ pledge_nominal_values.push($(this).val()); }); var pledge_totals= new Array(); $('input[name^=pledge_total]').each(function(){ pledge_totals.push($(this).val()); }); var pledge_descriptions= new Array(); $('textarea[name^=pledge_description]').each(function(){ pledge_descriptions.push($(this).val()); }); var ipotec_types= new Array(); $('select[name^=ipotec_type]').each(function(){ ipotec_types.push($(this).val()); }); var ipotec_descriptions= new Array(); $('textarea[name^=ipotec_description]').each(function(){ ipotec_descriptions.push($(this).val()); }); var mps_marks = new Array(); $('input[name=firm_mps_marka]').each(function(){ mps_marks.push($(this).val()); }); var mps_years = new Array(); $('input[name=firm_mps_year]').each(function(){ mps_years.push($(this).val()); }); var mps_register_numbers = new Array(); $('input[name=firm_mps_register_number]').each(function(){ mps_register_numbers.push($(this).val()); }); var obligation_bank_names = new Array(); $('input[name=firm_obligation_bank_name]').each(function(){ obligation_bank_names.push($(this).val()); }); var obligation_types = new Array(); $('select[name=firm_obligation_type]').each(function(){ obligation_types.push($(this).val()); }); var obligation_sums= new Array(); $('input[name=firm_obligation_sum]').each(function(){ obligation_sums.push($(this).val()); }); var obligation_currencies= new Array(); $('select[name=firm_obligation_currency]').each(function(){ obligation_currencies.push($(this).val()); }); var residues= new Array(); $('input[name=firm_residue]').each(function(){ residues.push($(this).val()); }); var obligation_starts= new Array(); $('input[name=firm_obligation_start]').each(function(){ obligation_starts.push($(this).val()); }); var obligation_ends= new Array(); $('input[name=firm_obligation_end]').each(function(){ obligation_ends.push($(this).val()); }); var guarantee_bank_names= new Array(); $('input[name=firm_guarantee_bank_name]').each(function(){ guarantee_bank_names.push($(this).val()); }); var guarantee_types= new Array(); $('select[name=firm_guarantee_type]').each(function(){ guarantee_types.push($(this).val()); }); var estate_names= new Array(); $('input[name=firm_estate_name]').each(function(){ estate_names.push($(this).val()); }); var guarantee_sums= new Array(); $('input[name=firm_guarantee_sum]').each(function(){ guarantee_sums.push($(this).val()); }); var guarantee_currencies= new Array(); $('select[name=firm_guarantee_currency]').each(function(){ guarantee_currencies.push($(this).val()); }); var accounts_bank_names= new Array(); $('input[name=firm_accounts_bank_name]').each(function(){ accounts_bank_names.push($(this).val()); }); var bank_branches= new Array(); $('input[name=firm_bank_branch]').each(function(){ bank_branches.push($(this).val()); }); var accounts_types= new Array(); $('select[name=firm_accounts_type]').each(function(){ accounts_types.push($(this).val()); }); var accounts_currencies= new Array(); $('select[name=firm_accounts_currency]').each(function(){ accounts_currencies.push($(this).val()); }); var accounts_numbers= new Array(); $('input[name=firm_accounts_number]').each(function(){ accounts_numbers.push($(this).val()); }); var firm_estate_types= new Array(); $('select[name=firm_estate]').each(function(){ firm_estate_types.push($(this).val()); }); var firm_estate_owner_percents= new Array(); $('input[name=firm_estate_owner_percent]').each(function(){ firm_estate_owner_percents.push($(this).val()); }); var firm_estate_addresses= new Array(); $('input[name=firm_estate_address]').each(function(){ firm_estate_addresses.push($(this).val()); }); var firm_estates_weights= new Array(); $('input[name=firm_estate_weights]').each(function(){ firm_estates_weights.push($(this).val()); }); var representative_firstnames = new Array(); $('input[name=representative_firstname]').each(function(){ representative_firstnames.push($(this).val()); }); var representative_middlenames = new Array(); $('input[name=representative_middlename]').each(function(){ representative_middlenames.push($(this).val()); }); var representative_lastnames = new Array(); $('input[name=representative_lastname]').each(function(){ representative_lastnames.push($(this).val()); }); var representative_id_cards = new Array(); $('input[name=representative_id_card]').each(function(){ representative_id_cards.push($(this).val()); }); var representative_id_cards_valid_to = new Array(); $('input[name=representative_id_card_valid_to]').each(function(){ representative_id_cards_valid_to.push($(this).val()); }); var representative_id_cards_from = new Array(); $('select[name=representative_id_card_from]').each(function(){ representative_id_cards_from.push($(this).val()); }); var representative_egns = new Array(); $('input[name=representative_egn]').each(function(){ representative_egns.push($(this).val()); }); var representative_positions = new Array(); $('input[name=representative_position]').each(function(){ representative_positions.push($(this).val()); }); var representative_assignees = new Array(); $('select[name=representative_assignee]').each(function(){ representative_assignees.push($(this).val()); }); var representative_proxys = new Array(); $('input[name=representative_proxy]').each(function(){ representative_proxys.push($(this).val()); }); var representative_proxys_date = new Array(); $('input[name=representative_proxy_date]').each(function(){ representative_proxys_date.push($(this).val()); }); var representative_addresses = new Array(); $('input[name=representative_address_bg]').each(function(){ representative_addresses.push($(this).val()); }); for(var i = 1; i <= number_of_guarantees; i++){ params['firstname_bg_BG_' + i] = $('#firstname_bg_BG_' + i).val(); params['sirname_bg_BG_' + i] = $('#sirname_bg_BG_' + i).val(); params['lastname_bg_BG_' + i] = $('#lastname_bg_BG_' + i).val(); params['egn_' + i] = $('#egn_' + i).val(); params['id_card_' + i] = $('#id_card_' + i).val(); params['id_card_valid_to_' + i] = $('#id_card_valid_to_' + i).val(); params['id_card_from_' + i] = $('#id_card_from_' + i).val(); params['endless_card_' + i] = ($('#endless_card_' + i).is(':checked'))? 1 : 0; params['has_mps_' + i] = $('#has_mps_' + i).val(); params['mps_marka_' + i] = $('#mps_marka_' + i).val(); params['mps_year_' + i] = $('#mps_year_' + i).val(); params['mps_register_number_' + i] = $('#mps_register_number_' + i).val(); params['city_' + i] = $('#city_' + i).val(); params['address_bg_BG_' + i] = $('#address_bg_BG_' + i).val(); params['city_corresp_' + i] = $('#city_corresp_' + i).val(); params['address_corresp_bg_BG_' + i] = $('#address_corresp_bg_BG_' + i).val(); params['phone_' + i] = $('#phone_' + i).val(); params['phone_extra_' + i] = $('#phone_extra_' + i).val(); params['labour_contract_' + i] = $('#labour_contract_' + i).val(); params['company_bg_BG_' + i] = $('#company_bg_BG_' + i).val(); params['company_city_' + i] = $('#company_city_' + i).val(); params['position_bg_BG_' + i] = $('#position_bg_BG_' + i).val(); params['field_of_activity_' + i] = $('#field_of_activity_' + i).val(); params['practice_' + i] = $('#practice_' + i).val(); params['education_' + i] = $('#education_' + i).val(); params['living_status_' + i] = $('#living_status_' + i).val(); params['family_status_' + i] = $('#family_status_' + i).val(); params['family_partner_' + i] = $('#family_partner_' + i).val(); params['family_partner_egn_' + i] = $('#family_partner_egn_' + i).val(); params['income_other_' + i] = $('#income_other_' + i).val(); params['other_expense_' + i] = $('#other_expense_' + i).val(); params['support_expense_' + i] = $('#support_expense_' + i).val(); params['has_bank_' + i] = ($('#has_bank_' + i).is(':checked'))? 1 : 0; } params['guarantor_type'] = $('input[name=guarantor_type]:checked').val(); params['number_of_guarantees'] = number_of_guarantees; params['bank_names'] = bank_names; params['credit_sums'] = credit_sums; params['montly_instalments'] = montly_instalments; params['date_terms'] = date_terms; params['bank_names_card'] = bank_names_card; params['card_date_terms'] = card_date_terms; params['card_type'] = card_type; params['card_limit'] = card_limit; params['estate'] = estate; params['estate_owner_percent'] = estate_owner_percent; params['estate_address'] = estate_address; params['estate_weights'] = estate_weights; params['firm_legal_status'] = $( "input[name=firm_legal_status]" ).val(); params['firm_management'] = $( "select[name=firm_management]" ).val(); params['firm_management_other'] = $( "input[name=firm_management_other]" ).val(); params['firm_bulstat'] = $( "input[name=firm_bulstat]" ).val(); params['firm_is_vat_number'] = ($( "input[name=firm_is_vat_number]" ).is(":checked"))? 1 : 0; params['firm_vat_number'] = $( "input[name=firm_vat_number]" ).val(); params['firm_city_legal'] = $( "input[name=firm_city_legal]" ).val(); params['firm_address_bg_BG_legal'] = $( "input[name=firm_address_bg_BG_legal]" ).val(); params['firm_city_corresp_legal'] = $( "input[name=firm_city_corresp_legal]" ).val(); params['firm_address_corresp_bg_BG_legal']= $( "input[name=firm_address_corresp_bg_BG_legal]" ).val(); params['firm_field_of_activity'] = $( "input[name=firm_field_of_activity]" ).val(); params['firm_employee_number'] = $( "input[name=firm_employee_number]" ).val(); params['firm_phone_legal'] = $( "input[name=firm_phone_legal]" ).val(); params['firm_phone_home_legal'] = $( "input[name=firm_phone_home_legal]" ).val(); params['firm_phone_operator_legal'] = $( "select[name=firm_phone_operator_legal]" ).val(); params['firm_fax'] = $( "input[name=firm_fax]" ).val(); params['firm_email'] = $( "input[name=firm_email_legal]" ).val(); params['has_mps'] = $('input[name=mps]:checked').val(); params['mps_marks'] = mps_marks; params['mps_years'] = mps_years; params['mps_register_numbers'] = mps_register_numbers; params['has_obligation'] = $('input[name=obligation]:checked').val(); params['obligation_bank_names'] = obligation_bank_names; params['obligation_types'] = obligation_types; params['obligation_sums'] = obligation_sums; params['obligation_currencies'] = obligation_currencies; params['residues'] = residues; params['obligation_starts'] = obligation_starts; params['obligation_ends'] = obligation_ends; params['has_guarantee'] = $('input[name=guarantee]:checked').val(); params['guarantee_bank_names'] = guarantee_bank_names; params['guarantee_types'] = guarantee_types; params['estate_names'] = estate_names; params['guarantee_sums'] = guarantee_sums; params['accounts_numbers'] = accounts_numbers; params['has_accounts'] = $('input[name=accounts]:checked').val(); params['accounts_bank_names'] = accounts_bank_names; params['bank_branches'] = bank_branches; params['accounts_types'] = accounts_types; params['accounts_currencies'] = accounts_currencies; params['accounts_numbers'] = accounts_numbers; params['has_estates'] = $('input[name=estates]:checked').val(); params['firm_estate_types'] = firm_estate_types; params['firm_estate_owner_percents'] = firm_estate_owner_percents; params['firm_estate_addresses'] = firm_estate_addresses; params['firm_estates_weights'] = firm_estates_weights; params['has_public_obligation'] = $('input[name=public_obligation]:checked').val(); params['public_property_percent'] = $('input[name=public_property_percent]').val(); params['person_property_percent'] = $('input[name=person_property_percent]').val(); params['cooperative_property_percent'] = $('input[name=cooperative_property_percent]').val(); params['foreign_property_percent'] = $('input[name=foreign_property_percent]').val(); params['representative_firstnames'] = representative_firstnames; params['representative_middlenames'] = representative_middlenames; params['representative_lastnames'] = representative_lastnames; params['representative_id_cards'] = representative_id_cards; params['representative_id_cards_valid_to']= representative_id_cards_valid_to; params['representative_id_cards_from'] = representative_id_cards_from; params['representative_egns'] = representative_egns; params['representative_positions'] = representative_positions; params['representative_assignees'] = representative_assignees; params['representative_proxys'] = representative_proxys; params['representative_proxys_date'] = representative_proxys_date; params['representative_addresses'] = representative_addresses; params['pledge_types'] = pledge_types; params['pledge_values'] = pledge_values; params['pledge_nominal_values'] = pledge_nominal_values; params['pledge_totals'] = pledge_totals; params['pledge_descriptions'] = pledge_descriptions; params['ipotec_types'] = ipotec_types; params['ipotec_descriptions'] = ipotec_descriptions; $.post(url, params, function(data) { }); } function ipoteccredit_end() { var url = "/ajax/ipoteccredit_end.php"; var params = { }; $.get(url, params, function(data) { //console.log(data); $('#ipoteccredit_step1_popup').show(); $('#ipoteccredit_step1_popup').html(data); }); } function ipoteccredit_show_all_expences(sum, term, rate, instalment, ipoteccreditAdministrativeFee, ipoteccreditYearMenageFee, ipoteccreditAssessmentFee, ipoteccreditInsuranceFee, ipoteccreditSMSSum, currency, gratis) { var url = "/ajax/ipoteccredit_show_all_expences.php"; var params = { sum : sum, term : term, rate : rate, instalment : instalment, ipoteccreditAdministrativeFee : ipoteccreditAdministrativeFee, ipoteccreditYearMenageFee : ipoteccreditYearMenageFee, ipoteccreditAssessmentFee : ipoteccreditAssessmentFee, ipoteccreditInsuranceFee : ipoteccreditInsuranceFee, ipoteccreditSMSSum : ipoteccreditSMSSum, currency : currency, gratis : gratis }; $.get(url, params, function(data) { $('#ipoteccredit_show_all_expences_popup').html(''); $('#ipoteccredit_show_all_expences_popup').show(); $('#ipoteccredit_show_all_expences_popup').html(data); }); } function ipoteccredit_plan_popup(sum, term, rate, instalment, ipoteccreditAdministrativeFee, ipoteccreditYearMenageFee, ipoteccreditAssessmentFee, ipoteccreditInsuranceFee, ipoteccreditSMSSum, currency, gratis,credit_id) { var url = "/ajax/ipoteccredit_plan_popup.php"; var params = { sum : sum, term : term, rate : rate, instalment : instalment, ipoteccreditAdministrativeFee : ipoteccreditAdministrativeFee, ipoteccreditYearMenageFee : ipoteccreditYearMenageFee, ipoteccreditAssessmentFee : ipoteccreditAssessmentFee, ipoteccreditInsuranceFee : ipoteccreditInsuranceFee, ipoteccreditSMSSum : ipoteccreditSMSSum, currency : currency, gratis : gratis, credit_id : credit_id }; $.get(url, params, function(data) { $('#ipoteccredit_show_all_expences_popup').html(''); $('#ipoteccredit_show_all_expences_popup').show(); $('#ipoteccredit_show_all_expences_popup').html(data); }); } function print_ipoteccredit_calculator_plan_table(date, sum, term, rate, instalment, ipoteccreditAdministrativeFee, ipoteccreditYearMenageFee, ipoteccreditAssessmentFee, ipoteccreditInsuranceFee, ipoteccreditSMSSum, currency, gratis) { var url = "/ajax/print_ipoteccredit_calculator_plan_table.php"; var params = { date : date, sum : sum, term : term, rate : rate, instalment : instalment, ipoteccreditAdministrativeFee : ipoteccreditAdministrativeFee, ipoteccreditYearMenageFee : ipoteccreditYearMenageFee, ipoteccreditAssessmentFee : ipoteccreditAssessmentFee, ipoteccreditInsuranceFee : ipoteccreditInsuranceFee, ipoteccreditSMSSum : ipoteccreditSMSSum, currency : currency, gratis : gratis }; $.get(url, params, function(data) { $('#ipoteccredit_plan_table').html(data); }); } function save_ipoteccredit_data(id,date){ var url = "/admin/ajax/submit_calc.php"; var params = { date : date, id : id }; $.get(url, params, function(data) { $('#date_'+id).html(data); }); } function save_individualcredit_data(id,date){ var url = "/admin/ajax/submit_calc_individual.php"; var params = { date : date, id : id }; $.get(url, params, function(data) { $('#date_'+id).html(data); }); } function search_ipoteccredit_promo_code(code, total_sum, sum, fees, term) { var url = "/ajax/search_ipoteccredit_promo_code.php"; var params = { code : code }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") != ""){ $("#ipoteccredit_promo_code").parent().find('img').attr('src', $("#ipoteccredit_promo_code").parent().find('img').attr('src').replace("gray", "blue")); $('input[name=promo_percent]').val(data); $('#ipoteccredit_total_sum').html(parseFloat(total_sum - (total_sum - sum - fees) * data / 100 ).toFixed(2)); $('#ipoteccredit_instalment').html(parseFloat((total_sum - (total_sum - sum - fees) * data / 100 - fees ) / term).toFixed(2)); } else { $("#ipoteccredit_promo_code").parent().find('img').attr('src', "/img/tick_gray.png"); $('input[name=promo_percent]').val(''); $('#ipoteccredit_total_sum').html($('input[name=ipoteccredit_total_sum_old]').val()); $('#ipoteccredit_instalment').html($('input[name=ipoteccredit_instalment_old]').val()); } }); } /* end of ipoteccredit functions */ function registration() { var url = "/ajax/registration.php"; var params = { name : $('input[name=reg_name]').val(), email : $('input[name=reg_email]').val(), password : $('input[name=reg_password]').val(), retype_password : $('input[name=reg_retype_password]').val(), captcha_reg : $('input[name=captcha_reg]').val() }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") == ""){ $('#error_message3').html('Регистрацията премина успешно. Проверете пощата си, за да активирате своя акаунт.'); setTimeout(function(){ $(".reg").removeClass("opened_login"); $('#registration_popup').hide(); }, 4000); } else { $('#error_message3').html(data); } }); } function login() { var url = "/ajax/login.php"; var params = { email : $('input[name=log_email]').val(), password : $('input[name=log_password]').val() }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") == ""){ window.location.reload(); } else { $('#error_message1').html(data); } }); } function admin_login() { var url = "/ajax/admin_login.php"; var params = { username : $('input[name=admin_log_email]').val(), password : $('input[name=admin_log_password]').val() }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") == ""){ window.location.href = '/admin/index.php' } else { $('#error_message4').html(data); } }); } function forgotten_password() { var url = "/ajax/forgotten_password.php"; var params = { email : $('input[name=forgot_email]').val() }; $.get(url, params, function(data) { if(data.replace(/\s/g,"") == ""){ $('#error_message2').html('Нова парола беше изпратена на вашия Email'); setTimeout(function(){ $(".login").removeClass("opened_login"); $('#forgotten_password_popup').hide(); }, 4000); } else { $('#error_message2').html(data); } }); } function edit_profile(user_id) { var url = "/ajax/edit_profile.php"; var params = { user_id : user_id, name : $('input[name=name]').val(), current_password : $('input[name=current_password]').val(), new_password : $('input[name=new_password]').val(), retype_password : $('input[name=retype_password]').val(), city : $('input[name=city]').val(), phone : $('input[name=phone]').val(), egn : $('input[name=egn]').val() }; $.get(url, params, function(data) { $('#error_msg').html(data); }); } function get_position_info(position_id) { var url = "/ajax/get_position_info.php"; var params = { position_id : position_id }; $.get(url, params, function(data) { $('#career_position_info').html(data); }); } //admin functions function change_visibility(id, table, action, lang) { show_ajax_loading(); var url = "/admin/ajax/change_visibility.php"; var params = { id : id, table : table, action : action, lang : lang }; $.get(url, params, function(data) { hide_ajax_loading(); }); } function delete_element(id, table){ show_ajax_loading(); var url = "/admin/ajax/delete_element.php"; var params = { id : id, table : table }; $.get(url, params, function(data) { window.location.reload(); hide_ajax_loading(); }); } function delete_element_gallery(id, target){ show_ajax_loading(); var url = "/admin/ajax/delete_element_gallery.php"; var params = { id : id, target : target }; $.get(url, params, function(data) { window.location.reload(); hide_ajax_loading(); }); } function subscribe_news(email){ var url = "/ajax/subscribe_news.php"; var params = { email : email }; $.get(url, params, function(data) { if(data){ $('#subscribe_div').html(data); } }); } function savePoll(fb_id){ var questions = new Array(); $( ".question" ).each(function(){ if($(this).attr('rel') != undefined){ questions.push($(this).attr('rel')); } }); var err = ''; var ok = true; var answers = new Array(); for(var i = 0; i < questions.length; i++){ var elem = $( "input[name^=question_" + questions[i] + "]" ); var type = elem.attr('type'); var rel = elem.attr('rel'); if((type == 'checkbox' || type == 'radio') && rel == ''){ var length = $( "input[name=question_" + questions[i] + "]:checked" ).length; if(length == 0){ err += (i+1) + ','; ok = false; } else { $( "input[name=question_" + questions[i] + "]:checked" ).each(function(){ answers.push({ type : 1, questionId : questions[i] , answerId : parseInt($(this).val()) }); }); } } else if(type == 'text'){ if($( "input[name=question_" + questions[i] + "]" ).val() == ''){ err += (i+1) + ','; ok = false; } else { answers.push({ type : 2, questionId : questions[i] , answerId : $( "input[name=question_" + questions[i] + "]" ).val() }); } } else { for (var j = 1; j <= parseInt(rel); j++){ var length = $( "input[name=question_" + questions[i] + "_" + j + "]:checked" ).length; var arr = $( "input[name=question_" + questions[i] + "_" + j + "]" ).attr('id').split('_'); var answer_id = arr[2]; if(length == 0){ err += (i+1) + ','; ok = false; } else { $( "input[name=question_" + questions[i] + "_" + j + "]:checked" ).each(function(){ answers.push({ type : 3, questionId : questions[i] , answerId : parseInt($(this).val()), answer_id : answer_id }); }); } } } } var url = "/ajax/savePoll.php"; var params = { fb_id : fb_id, poll_id : $("input[name=poll_id]").val(), answers : answers, err : err, user_name : $("input[name=user_name]").val(), user_email: $("input[name=user_email]").val(), user_phone: $("input[name=user_phone]").val() }; $.get(url, params, function(data) { data = JSON.parse(data); $("#error").html(data.msg); if(fb_id != '' && data.error == 0){ window.location.href = 'index.php'; } }); }