if (typeof jQuery !== 'function') { var jqs = document.createElement('script'); jqs.setAttribute('type','text/javascript'); jqs.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'); document.getElementsByTagName('head')[0].appendChild(jqs); } function ttbk_PlaceholderFix () { if (typeof jQuery == 'function') { clearInterval(ttbk_Interval); jQuery(function() { test = document.createElement('input'); if('placeholder' in test) ttbk_support_placeholder = true; }); jQuery(function(){ if(!ttbk_support_placeholder) { var active = document.activeElement; jQuery('#ttbk_input').focus(function () { if (jQuery(this).attr('placeholder') != '' && jQuery(this).val() == jQuery(this).attr('placeholder')) { jQuery(this).val('').removeClass('hasPlaceholder'); } }).blur(function () { if (jQuery(this).attr('placeholder') != '' && (jQuery(this).val() == '' || jQuery(this).val() == jQuery(this).attr('placeholder'))) { jQuery(this).val(jQuery(this).attr('placeholder')).addClass('hasPlaceholder'); } }); jQuery('#ttbk_input').blur(); jQuery(active).focus(); } jQuery(".hasPlaceholder").css("color", "#777777"); }); jQuery(document).keydown(function(event) { if (jQuery('#ttbk_resorts:visible').length > 0 && (event.which == '38' || event.which == '40')) { event.preventDefault(); if (event.which == '38') { ttbk_selected = ttbk_selected - 1; if (ttbk_selected < 0) ttbk_selected = ttbk_resorts.length-1; } else if (event.which == '40') { ttbk_selected = ttbk_selected + 1; if (ttbk_selected >= ttbk_resorts.length) ttbk_selected = 0; } jQuery('#ttbk_parent a.ttbk_focus').removeClass('ttbk_focus'); jQuery(ttbk_resorts).eq(ttbk_selected).addClass('ttbk_focus').get(0).focus(); } }); } } var ttbk_support_placeholder = false; var ttbk_Interval = setInterval('ttbk_PlaceholderFix()', 500); var ttbk_val = ''; var ttbk_resorts = ''; var ttbk_selected = -1; function ttbk_Reset(s) { jQuery('#ttbk_resorts').empty().hide(); jQuery('#ttbk_input').val(''); } function ttbk_GetResorts(s) { if (s.length > 0) { if (ttbk_val != s) { jQuery.getJSON('http://tonkosti.ru//service/get_resorts.php?n=&s='+encodeURI(s)+'&callback=?', function(json) { jQuery('#ttbk_resorts').empty().show(); for (var n=0; n
'+json.NAME[n]+'
'); } if (json.F == 1) jQuery('#ttbk_resorts').append('
Есть еще: уточните поиск
'); else if (json.CNT == 0) jQuery('#ttbk_resorts').append('
Курорты не найдены
'); jQuery('#ttbk_resorts').css('margin-bottom', -(jQuery('#ttbk_resorts').outerHeight())); ttbk_resorts = jQuery('#ttbk_resorts > a'); ttbk_selected = -1; }); } ttbk_val = s; } else jQuery('#ttbk_resorts').empty().hide(); } document.write('
ОчиститьСтраны и курорты на «Тонкостях туризма»
');