<!-- FOOTER SECTION -->
<section class="footer-section">
	<div class="container">
		<div class="row">
			<div class="col-lg-8 copyrights">
				<a data-i18n data-intgrtn-link-agreements="1" href="" class="">Website Agreement</a> |
				<a data-i18n data-intgrtn-link-agreements="2" href="" class="">Risk Disclaimer</a> |
				<a data-i18n data-intgrtn-link-agreements="3" href="" class="">Privacy Policy</a> |
				<a data-i18n data-intgrtn-link-report-abuse="" href="" class="">Report Abuse</a> |
				<a data-i18n data-intgrtn-link-contact-us="" href="" class="">Contact Us</a>
			</div>
		</div>
		<div class="footer-text">
			<p>
				<div data-intgrtn-agreements="" data-intgrtn-type="4" style="font-size: 12px; padding-top: 20px"></div>
			</p>
		</div>
	</div>
</section>

<!-- JS Core -->
<script src="config.js"></script>
<script src="js/build.min.js"></script>
<!-- #JS Core -->
<script src="uislider/wNumb.js"></script>
<script src="uislider/nouislider.min.js"></script>
<script src="js/index.js"></script>
<script src="js/bootstrap.min.js"></script>

<script>
	$(function () {
		var waitIntgrtn = setInterval(function () {
			if (!window.intgrtn) {
				return false;
			}
			clearInterval(waitIntgrtn);

            window.intgrtn.events.on("get.project.details.success", function (response) {
				if (response.data && response.data.client.location.countryIsoCode && response.data.client.location.country) {
					var countryIsoCode = window.intgrtn.lookup("language", true, response.data.client.location.countryIsoCode.toLowerCase());
					document.dispatchEvent(new CustomEvent("visitorsLocated", {
						detail: response.data
					}));
					switch (countryIsoCode) {
						case "de":
						case "at":
						case "ch":
							countryIsoCode = "de";
							break;
					}
					translateToCurrentLanguage(countryIsoCode);
					blinkSelectedCountry(response.data.client.location.country);
				}
			}, function () {
				translateToCurrentLanguage();
			});

			function blinkSelectedCountry(country) {
			    var hotSpots = $('.hotspots');
                switch (country) {
                    case "Italy":
                        hotSpots.append('<div class="hotspot-wrapper active-country" style="top: 30%; left: 48%;;">\n' +
                            '                    <div class="circle animated zoomIn"></div>\n' +
                            '                    <div class="hotspot">\n' +
                            '                    </div>\n' +
                            '                </div>');
                        break;
                    case "Germany":
                        hotSpots.append('<div class="hotspot-wrapper active-country" style="top: 25%; left: 46.6%;;">\n' +
                            '                    <div class="circle animated zoomIn"></div>\n' +
                            '                    <div class="hotspot">\n' +
                            '                    </div>\n' +
                            '                </div>');
                        break;
                    case "Spain":
                        hotSpots.append('<div class="hotspot-wrapper active-country" style="top: 31%; left: 43%;">\n' +
                            '                    <div class="circle animated zoomIn"></div>\n' +
                            '                    <div class="hotspot">\n' +
                            '                    </div>\n' +
                            '                </div>');
                        break;
                    case "United Kingdom":
                        hotSpots.append('<div class="hotspot-wrapper active-country" style="top: 23%; left: 44%;;">\n' +
                            '                    <div class="circle animated zoomIn"></div>\n' +
                            '                    <div class="hotspot">\n' +
                            '                    </div>\n' +
                            '                </div>');
                        break;
                }
            }

			function translateToCurrentLanguage(langIso) {
				langIso = typeof langIso !== 'undefined' ? langIso : 'default';

				$.ajax({
					url: 'i18n/' + langIso + '.json',
					method: 'GET'
				}).done(function (response) {
					document.dispatchEvent(new CustomEvent("translationsLoaded", {
						detail: response
					}));
					applyTranslations(response);
				}).fail(function () {
                    $.ajax({
                        url: 'i18n/default.json',
                        method: 'GET'
                    }).done(function (response) {
                        document.dispatchEvent(new CustomEvent("translationsLoaded", {
                            detail: response
                        }));
                        applyTranslations(response);
                    })
                });
			}

			function applyTranslations(translations) {
				$("[data-i18n]").each(function () {
					var t = $(this).attr("data-i18n");
					switch ($(this).prop("tagName")) {
						case "INPUT":
							t || (t = $(this).attr("placeholder"));
							$(this).attr("placeholder", translations[t]);
							break;
						default:
							t || (t = $(this).text()), $(this).text(translations[t])
					}
				})
			}

            window.intgrtn.events.on('parse.data.tags.form.signup.success', function (element) {
                $(element).find($('.intgrtn-input-holder')).append('<img class="input-checkmark" src="img/checkmark.png" alt="">')
                $(element).find($('.intgrtn-input-holder')).append('<img class="input-exclamationmark" src="img/exclamationmark.png" alt="">')
                $(element).find($('.intgrtn-input-holder.intgrtn-input-holder-first-name .intgrtn-input, .intgrtn-input-holder.intgrtn-input-holder-last-name .intgrtn-input')).on('keyup change', function () {
                    if (this.value.length >= 2 && window.intgrtn.checkContainsOnlyLetters(this.value)) {
                        $(this).addClass('intgrtn-not-empty');
                        $(this).siblings('.input-checkmark').css('display', 'block');
                        $(this).siblings('.input-exclamationmark').css('display', 'none');
                        inputValid = true;
                    } else if (this.value.length < 1 || window.intgrtn.checkContainsOnlyLetters(this.value)) {
                        $(this).removeClass('intgrtn-not-empty');
                        $(this).addClass('intgrtn-invalid');
                        $(this).siblings('.input-checkmark').css('display', 'none');
                        $(this).siblings('.input-exclamationmark').css('display', 'block');
                    }
                });
                $(element).find($('.intgrtn-input-holder.intgrtn-input-holder-email .intgrtn-input')).on('keyup change', function () {
                    if (window.intgrtn.validate.email(this.value)) {
                        $(this).addClass('intgrtn-not-empty');
                        $(this).siblings('.input-checkmark').css('display', 'block');
                        $(this).siblings('.input-exclamationmark').css('display', 'none');
                        inputValid = true;
                    } else if (!window.intgrtn.validate.email(this.value)) {
                        $(this).removeClass('intgrtn-not-empty');
                        $(this).siblings('.input-checkmark').css('display', 'none');
                        $(this).siblings('.input-exclamationmark').css('display', 'block');
                    }
                });
            });

		}, 10);
	});
</script>

<script type="text/javascript">
	document.addEventListener('visitorsLocated', function (e) {
		console.log('Visitor located', e.detail.client.location.countryIsoCode.toLowerCase(), e.detail.client.location.country);
	});
	document.addEventListener('translationsLoaded', function (e) {
		console.log('Translations loaded.', e);
		var currentTranslation = e.detail;

		window.intgrtn.setOptions({
			forms: {
				signup: {
					placeholders: {
						firstName: currentTranslation.hasOwnProperty('First Name') ? currentTranslation['First Name'] : "First Name",
						lastName: currentTranslation.hasOwnProperty('Last Name') ? currentTranslation['Last Name'] : "Last Name",
						email: currentTranslation.hasOwnProperty('Email') ? currentTranslation['Email'] : "Email",
						password: currentTranslation.hasOwnProperty('Password') ? currentTranslation['Password'] : "Password",
					},
					fields: {
						password: {
							tooltip: currentTranslation.hasOwnProperty('password-validation-error') ? currentTranslation['password-validation-error'] : "Password should contain at least 1 lowercase, 1 uppercase and 1 number without special characters. <strong>Example: 123Abc</strong>",
						}
					},
					buttons: {
						submit: {
							text: currentTranslation.hasOwnProperty('Register') ? currentTranslation['Register'] : "Try now for free ›"
						}
					},
				},
			}
		});
	});
	document.addEventListener('validationPassed', function (e) {
		console.log('Validation passed', e);
	});
</script>
