var TI = { xhttp : {}, lang : 'ro', base_uri : {"ro":"","hu":"","en":"","de":"","fr":"","it":"","ru":""}, ajax : function(url, success){ jQuery.ajax({ url : url, success : success, }); }, ajaxOld : function(url, success){ TI.xhttp = new XMLHttpRequest(); TI.xhttp.cFunc = success; TI.xhttp.onreadystatechange = function() { if (TI.xhttp.readyState == 4 && TI.xhttp.status == 200) { TI.xhttp.cFunc(TI.xhttp.responseText); } } TI.xhttp.open("GET", url, true); TI.xhttp.send(); }, defineLang : function(){ langFounded = false; if(document.getElementsByTagName('html')[0].lang != ''){ TI.lang = document.getElementsByTagName('html')[0].lang.split('-')[0].split('_')[0].toLowerCase(); langFounded = true; }else if(document.getElementsByTagName('body')[0].lang != ''){ TI.lang = document.getElementsByTagName('body')[0].lang.split('-')[0].split('_')[0].toLowerCase(); langFounded = true; }else{ var metas = document.getElementsByTagName('meta'); for(mi in metas){ if(typeof metas[mi].getAttribute == 'function' && metas[mi].getAttribute('http-equiv') && metas[mi].getAttribute('http-equiv').toLowerCase() == 'content-language'){ TI.lang = metas[mi].getAttribute('content').split('-')[0].split('_')[0].toLowerCase(); langFounded = true; } } if(langFounded == false){ var TI_Elements = document.querySelectorAll('[lang]'); if(TI_Elements.length > 0){ TI.lang = TI_Elements[0].getAttribute('lang').toLowerCase(); langFounded = true; } } } if((langFounded == false) && (! typeof DEFAULT_LANG == 'undefined')){ console.warn('Lang definition not found'); } if((langFounded = true) && (TI.lang != 'ro') && (TI.lang != 'hu') && (TI.lang != 'en') && (TI.lang != 'de') && (TI.lang != 'fr')){ console.warn("Defined lang is incorrect, usung tourist-informator.info's default (ro)"); TI.lang = 'ro'; } }, build : function(){ TI.defineLang(); var nodeDoctype = document.implementation.createDocumentType( 'html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd' ); if(document.doctype) { // document.replaceChild(nodeDoctype, document.doctype); } else { document.insertBefore(nodeDoctype, document.childNodes[0]); } document.getElementsByTagName('head')[0].appendChild(TI.createElement('script', { src : 'https://www.tourist-informator.info/js/moment.min.js', })); document.getElementsByTagName('head')[0].appendChild(TI.createElement('script', { src : 'https://www.tourist-informator.info/js/pikaday.js', })); document.getElementsByTagName('head')[0].appendChild(TI.createElement('link', { href : 'https://www.tourist-informator.info/css/pikaday.css', media : 'all', rel : 'stylesheet', })); document.getElementsByTagName('head')[0].appendChild(TI.createElement('link', { href : 'https://www.tourist-informator.info/css/affiliate-script.css', media : 'all', rel : 'stylesheet', })); // if(true){ // ; // }else{ TI.ajax('https://www.tourist-informator.info/ajax/' + TI.lang + '/affiliate-get-script-content.html?id=10', function(xData){ jQuery('#TI-Affiliate-Instant-Container').html(xData); jQuery('.TI-Affiliate-DatePicker').datepicker({ dateFormat : "yy-mm-dd", firstDay : 1, }); }); // } }, changeTabs : function(tID, tCount){ for(tii = 0; tii < tCount; tii++){ TI.removeClass(TI.e('#TI-tTab-' + tii), 'TI-tTabs-selected'); TI.removeClass(TI.e('#TI-tTab-' + tii), 'TI-tTabs-unselected'); TI.addClass(TI.e('#TI-tTab-' + tii), 'TI-tTabs-' + ((tID == tii) ? '' : 'un') + 'selected'); TI.removeClass(TI.e('#TI-Affiliate-Tab-' + tii), 'TI-Affiliate-CTab-selected'); TI.removeClass(TI.e('#TI-Affiliate-Tab-' + tii), 'TI-Affiliate-CTab-unselected'); TI.addClass(TI.e('#TI-Affiliate-Tab-' + tii), 'TI-Affiliate-CTab-' + ((tID == tii) ? '' : 'un') + 'selected'); } }, gotoPage : function(form){ jQuery('#TI-Affiliate-Frame-Container').fadeIn(); jQuery('#TI-Affiliate-Frame-Container iframe').attr('src', 'https://www.tourist-informator.info/affiliate/10/?/tia/' + TI.lang + '/search.html?' + jQuery(form).serialize()); }, closeAffiliate : function(){ jQuery('#TI-Affiliate-Frame-Container').fadeOut(); }, arrayForm : function(form){ ret = {}; var f = form.getElementsByTagName('input'); for(fi = 0; fi < f.length; fi++){ if(f[fi].name != '') ret[f[fi].name] = f[fi].value; } return ret; }, objectToUri : function(obj, joinStrng){ var js = joinStrng || "&"; var str = ""; for (var key in obj) { if (str != "") { str += js; } str += key + "=" + encodeURIComponent(obj[key]); } return str; }, createElement : function(nodeType, options){ tmpElm = document.createElement(nodeType); if(typeof options == 'object'){ for(oi in options) tmpElm[oi] = options[oi]; } return tmpElm; }, hasClass : function(object, className){ // console.log(object); return ((object != null) && (typeof object != 'undefined') && (typeof object.className != 'undefined') && (object.className.indexOf(className) >= 0)); }, addClass : function(object, className){ if((typeof object != 'undefined') && (typeof object != 'null') && (this.hasClass(object, className) == false)){ object.className = ((object.className) && (typeof object.className != 'undefined')) ? object.className + ' ' + className : className; } }, removeClass : function(object, className){ if((typeof object != 'undefined') && (typeof object != 'null')){ object.className = (typeof object.className != 'undefined') ? object.className.replace(className, '') : ''; } }, e : function(obString){ if(obString.substring(0, 1) == '.'){ return document.getElementsByClassName(obString.substring(1)); }else if(obString.substring(0, 1) == '#'){ return document.getElementById(obString.substring(1)); }else{ return document.getElementsByTagName(obString); } }, }; if(typeof jQuery == 'undefined'){ // document.write("") // document.write("") var _TI_jQuery_script = document.createElement('script'); _TI_jQuery_script.src = 'https://www.tourist-informator.info/js/jquery-1.12.3.noConflict.js'; document.head.appendChild(_TI_jQuery_script); } document.write("") // document.write("") var _TI_jQuery_ui_script = document.createElement('script'); _TI_jQuery_ui_script.src = 'https://www.tourist-informator.info/js/jquery-ui.1.10.3.js'; document.head.appendChild(_TI_jQuery_ui_script); document.write('
'); document.addEventListener("DOMContentLoaded", function(event) { _TI_META_CHECK(); var TI_Affiliate_Target = (jQuery("#main-content-region .region p").length == 0) ? jQuery('#TI-Affiliate-Original-Location') : jQuery(jQuery("#main-content-region .region p")[(jQuery("#main-content-region .region p").length - 1)]); TI_Affiliate_Target.append("
"); TI.build(); jQuery('body').append(""); var frameContainer = ''; if(/ip(hone|od)|ipad/i.test(navigator.userAgent)){ frameContainer = "
"; jQuery('html, body').css({ 'overflow-x' : 'hidden' }); }else{ frameContainer = ""; } jQuery('#TI-Affiliate-Frame-Container').html("
" + frameContainer + "
"); jQuery('.TI_Affiliate_Tab_All').on('click', function(){ jQuery('.TI_Affiliate_Tab_All').removeClass('TI_Affiliate_Tab_Selected'); jQuery(this).addClass('TI_Affiliate_Tab_Selected'); }); }); var _TI_META_CHECK = function() { if(jQuery('meta[name="viewport"]').length > 0){ var viewportContent = {}, viewportContentFinal = [], viewportContentRaw = jQuery('meta[name="viewport"]')[0].content.split(','); for(var mvi = 0; mvi < viewportContentRaw.length; mvi++){ if(jQuery.trim(viewportContentRaw[mvi]) != ''){ viewportContent[jQuery.trim(viewportContentRaw[mvi]).split('=')[0]] = jQuery.trim(viewportContentRaw[mvi]).split('=')[1]; } } if((viewportContent['initial-scale']) && (! viewportContent['minimum-scale']) && (! viewportContent['maximum-scale'])){ viewportContent["minimum-scale"] = viewportContent["initial-scale"]; viewportContent["maximum-scale"] = viewportContent["initial-scale"]; } if(! viewportContent["user-scalable"]){ viewportContent["user-scalable"] = "no"; } for(mvi in viewportContent){ viewportContentFinal.push(mvi + '=' + viewportContent[mvi]); } jQuery('meta[name="viewport"]')[0].content = viewportContentFinal.join(','); } };