//Cufon.replace('*[cufon=1]');
$('*').click(function() {
$('div.destResults').hide();
})
$(document).ready(function() {
$('div[data-tip=searchDestButton]').click(function() {
var sb=$(this).closest('div.searchBox');
var s=sb.find('input.searchText');
var t = s.val().trim();
if (sb.find('input[name=filename]').val() == '') {
sb.find('div[data-tip=err]').find('td:first').html('Please enter hotel name, country or town');
sb.find('div[data-tip=err]').show();
s.focus();
}
/*else if (sb.find('input[name=arr]').val() == '' || sb.find('input[name=dep]').val() == '') {
sb.find('div[data-tip=err]').find('td:first').html('Please enter the dates of your stay to check availability');
sb.find('div[data-tip=err]').show();
s.focus();
}*/
else {
var a=$('#topBox').find('a[data-tip=submit]');
if (sb.find('input[name=filename]').attr('data-tip') == 'HO') {
//_gaq.push(['_trackEvent', 'search-ho-EN', 'click', sb.find('input[name=filename]').val()]);
_gaq.push(['_trackEvent', 'HotelsCombined', 'EN_clicked_search_', sb.find('input[name=filename]').val()]);
a.attr('target','_blank');
a.attr('href', 'http://www.hotelscombined.com/Hotel.aspx?a_aid=11953&fileName=' + sb.find('input[name=filename]').val() + '&languageCode=EN¤cyCode=EUR' + (sb.find('input[name=arr]').val() != '' ? '&checkin=' + $.datepicker.formatDate('yy-mm-dd', sb.find('input[name=arr]').datepicker('getDate')) : '') + (sb.find('input[name=dep]').val() != '' ? '&checkout=' + $.datepicker.formatDate('yy-mm-dd', sb.find('input[name=dep]').datepicker('getDate')) : ''));
a.click();
}
else if (sb.find('input[name=filename]').attr('data-tip') == 'TW') {
//_gaq.push(['_trackEvent', 'search-tw-EN', 'click', sb.find('input[name=filename]').val()]);
_gaq.push(['_trackEvent', 'HotelsCombined', 'EN_clicked_search_', sb.find('input[name=filename]').val()]);
a.attr('target','_blank');
a.attr('href', 'http://www.hotelscombined.com/SearchResults.aspx?a_aid=11953&fileName=' + sb.find('input[name=filename]').val() + '&languageCode=EN¤cyCode=EUR' + (sb.find('input[name=arr]').val() != '' ? '&checkin=' + $.datepicker.formatDate('yy-mm-dd', sb.find('input[name=arr]').datepicker('getDate')) : '') + (sb.find('input[name=dep]').val() != '' ? '&checkout=' + $.datepicker.formatDate('yy-mm-dd', sb.find('input[name=dep]').datepicker('getDate')) : ''));
a.click();
}
else if (sb.find('input[name=filename]').attr('data-tip') == 'CO') {
//_gaq.push(['_trackEvent', 'search-co-EN', 'click', sb.find('input[name=filename]').val()]);
_gaq.push(['_trackEvent', 'HotelsCombined', 'EN_clicked_search_', sb.find('input[name=filename]').val()]);
a.attr('target','_blank');
a.attr('href', 'http://www.hotelscombined.com/EN/Country/' + sb.find('input[name=filename]').val() + '.htm?a_aid=11953¤cyCode=EUR' + (sb.find('input[name=arr]').val() != '' ? '&checkin=' + $.datepicker.formatDate('yy-mm-dd', sb.find('input[name=arr]').datepicker('getDate')) : '') + (sb.find('input[name=dep]').val() != '' ? '&checkout=' + $.datepicker.formatDate('yy-mm-dd', sb.find('input[name=dep]').datepicker('getDate')) : ''));
a.click();
}
}
});
});
$.fn.waiting = function(b) {
if (b)
$(this).parent().prepend('
');
else
$(this).parent().find('div.my-div-wait').remove();
}
var _sid=null;
$(document).ready(function() {
$('.searchBox input.searchText')
.blur(function() { if ($(this).val() == '') $(this).css({'color':'#cca1a1'}).val('hotel, country or town'); })
.select(function() { if ($(this).closest('div.searchBox').find('input[name=filename]').val() == '') { $(this).val(''); $(this).css({'color':'black'});} $(this).select(); })
.focus(function() { $(this).css({'color':'black'}).val(''); })
.keypress(function(e) {
//if (e.keyCode==13) $('#searchCont .button').click();
})
.keydown(function(e) {
var d = $(this).closest('div.searchBox').find('div.destResults');
var i = parseInt(d.attr('selIdx'),10);
if (e.keyCode == 38) i--;
if (e.keyCode == 40) i++;
if (i < 0)
i = d.find('div').length - 1;
else
i %= d.find('div').length;
d.attr('selIdx', i);
d.find('div').css('background','');
d.find('div:eq(' + i + ')').css('background','#eaeaea');
if (e.keyCode == 13) {
if (d.find('div').length > 0) d.find('div:eq(' + d.attr('selIdx') + ')').click();
}
else if (e.keyCode != 38 && e.keyCode != 40) {
if (_sid != null) clearTimeout(_sid);
_sid = setTimeout("searchDestionations()", 500);
}
})
.change(function() { $(this).attr('sel','0'); })
.blur();
$('div[data-tip=meni] div[data-tip=button]')
.mouseover(function() { $(this).css('background','url(/img/buttonOver.png) no-repeat 0px 7px').find('a').addClass('meniHover'); })
.mouseout(function() { $(this).css('background','none').find('a').removeClass('meniHover'); });
$('div.fb-like').bind('DOMNodeInserted DOMNodeRemoved', function() { if ($(this).find('iframe').length > 0) $(this).find('iframe').css('width','0px').attr('align','right'); });
$('div[data-tip=button]').hover(
function() { $(this).find('div.meni').fadeIn('fast'); },
function() { $(this).find('div.meni').fadeOut('fast'); }
);
$('div.meni td')
.mouseover(function() {$(this).css('background','#12457a'); })
.mouseout(function() {$(this).css('background','none'); });
});
function searchDestionations() {
$('div.destResults').hide();
var s = $('.searchBox input.searchText');
var sb = $('.searchBox');
sb.find('div[data-tip=err]').hide();
var t = s.val().trim();
if (t.length > 2) {
s.waiting(true, '16_search');
$.ajax({
url: '/scripts/searchDestinations.asp',
data: {'lang': 'EN', 'txt': t.replace(new RegExp(' ','g'), ' ').replace(new RegExp(' ','g'),','), 'unique_tid': (new Date()).getTime()},
success: function(data) {
s.waiting(false);
var d = s.parent().find('div.destResults');
d.html('');
d.css({'margin': '0px 4px 0px 4px'}).width(s.width()-4).show();
var i;
var r;
d.attr('selIdx','0');
for (i=0; i| ' + (data.array[i].tip == 'TW' ? 'Town of ' : '') + data.array[i].name + (data.array[i].cnt > 1 ? ' (' + data.array[i].cnt + ')' : '') + ' |
')
.attr('data-txt', data.array[i].name)
.attr('data-tip', data.array[i].tip)
.attr('data-filename', data.array[i].filename);
r.hover(function() { $(this).closest('div.destResults').find('div').css('background',''); $(this).closest('div.destResults').attr('selIdx',$(this).attr('idx')); $(this).css({'background':'#eaeaea', 'cursor': 'pointer'}); }, function() { });
r.click(function() { s.val($(this).attr('data-txt')); s.parent().find('input[name=filename]').attr('data-tip', $(this).attr('data-tip')).val($(this).attr('data-filename')); s.attr('sel','1'); });
d.append(r);
}
d.fadeIn('fast');
},
type: 'POST',
dataType: 'json',
cache: false,
});
}
}
function addTopBoxCity(name, city_id, txt, url) {
var div = $('')
var b = $('').css({'opacity': 0.5});
div.append(b);
b = $('').html(txt);
div.append(b);
b = $('').html('more »');
div.append(b);
b = $('').html(name);
var cityBox= $('');
cityBox.prepend(div).append(b);
cityBox.hover(
function() { $(this).css('cursor','pointer').find('[data-tip=bar]').css({'background-color': 'red'}); },
function() { $(this).find('[data-tip=bar]').css({'background-color': '#000'}); }
);
cityBox.click(function() {
window.location=url;
});
$('#topBoxCities').append(cityBox);
}
function initBoxes() {
$('body').find('div.box').each(function(i,obj) {
if ($(obj).attr('data-preventDefault') != '1') {
//var div = $('').html();
var _scolor = ($(obj).attr('data-backColor') == 'red' ? 'c52828' : '2884c5');
var tbl = $('');
var td = tbl.find('td');
tbl.addClass('back-' + $(obj).attr('data-backColor'));
if ($(obj).attr('data-title-fontSize'))
td.css('font-size', $(obj).attr('data-title-fontSize'));
if ($(obj).attr('data-buttons-min') == '1') {
var _b = $('')
_b.click(function() {
var div = $(this).closest('div.box').find('div.cont');
if (div.is(':visible')) {
div.slideUp();
$(this).removeClass('down').addClass('left');
} else {
div.slideDown();
$(this).removeClass('left').addClass('down');
}
});
td.prepend(_b);
}
td.append($(obj).attr('title'));
$(obj).removeAttr('title')
$(obj).prepend(tbl);
}
});
}
$(document).ready(function() {
$('div.searchBox').each(function(i,obj) {
//alert($(obj).find('input[data-tip=date]').length);
$(obj).find('input[data-tip=arr]').datepicker({
beforeShow: function(input, inst) {
$(this).attr('offsetDays','0');
$(this).datepicker('setDate', new Date());
//setTimeout("$('| Koristite strelice za navigaciju |
').appendTo($('table.ui-datepicker-calendar'))",100);
},
monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj','Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'],
dayNamesMin: ['Pon','Uto','Sri','Čet','Pet','Sub','Ned'],
dateFormat: 'dd.mm.yy',
gotoCurrent: true,
showAnim: ''
});
$(obj).find('input[data-tip=dep]').datepicker({
beforeShow: function(input, inst) {
$(this).attr('offsetDays','0');
$(this).datepicker('setDate', $(this).closest('.searchBox').find('input[data-tip=arr]').datepicker('getDate') );
$(this).datepicker('option','minDate', $(this).closest('.searchBox').find('input[data-tip=arr]').datepicker('getDate') );
//setTimeout("$('| Koristite strelice za navigaciju |
').appendTo($('table.ui-datepicker-calendar'))",100);
},
monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj','Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'],
dayNamesMin: ['Pon','Uto','Sri','Čet','Pet','Sub','Ned'],
dateFormat: 'dd.mm.yy',
gotoCurrent: true,
showAnim: ''
});
});
});
// --------- hotels
var _tid=null;
var _idx=0;
var _slider=null;
var _anid=null;
var _activeHotel=null;
function initResults() {
$('#results div.hotel').each(function(i,obj) {
$(obj).hover(
function() {
$('#results div[class=hotelOverX]').hide();
$('#results div[class=hotel]').show();
var o = $('#results div[class=hotelOverX][hotel_id=' + $(this).attr('hotel_id') + ']');
var a = $('#results div[class=hotel][hotel_id=' + $(this).attr('hotel_id') + ']');
a.css({'background-color': '#fefee0'});
_activeHotel = o;
/*if ($.browser.opera)
o.css({'left': ($(this).position().left-5) + 'px', 'top': ($(this).position().top-5) + 'px', boxShadow: '0 0 8px #333'}).show();
else
o.css({'left': ($(this).position().left-5) + 'px', 'top': ($(this).position().top-5) + 'px'}).show().animate({boxShadow: '0 0 8px #333'}, 'normal');*/
if (_anid != null) clearTimeout(_anid);
_anid = setTimeout("_showHotelOver()", 750);
},
function() {
$(this).css({'background-color': '#fff'});
if (_anid != null) clearTimeout(_anid);
_activeHotel = null;
}
);
});
$('#results div.hotelOverX').hover(
function() {
_idx=0;
if (_tid != null) clearInterval(_tid);
_slider = $(this).find('div.imgslider');
_slider.find('img').hide();
_slider.find('img:first').show();
_tid = setInterval("_dimSlider()",2000);
$(this).find('ul.aviaslider').each(function(i,obj) { });
},
function() {
var a;
if ($('#results').attr('data-home') == '1')
a = $('#results div[class=hotel]');
else
a = $('#results div[class=hotel][hotel_id=' + $(this).attr('hotel_id') + ']');
$(this).hide();
a.show();
//$(this).stop().animate({boxShadow: '0 0 0'}, 'fast');
}
);
// ************ strelica ya boxove
$('#results').find('div.hoteltype div.arr').click(function() {
var div = $('#results div.hotelCont[data-ho-type=' + $(this).attr('data-ho-type') + ']');
if (div.is(':visible')) {
div.slideUp();
$(this).removeClass('down').addClass('left');
} else {
div.slideDown();
$(this).removeClass('left').addClass('down');
}
});
}
function _showHotelOver() {
if (_activeHotel != null) {
var o = _activeHotel;
var a;
if ($('#results').attr('data-home') == '1')
a = $('#results div[class=hotel]');
else
a = $('#results div[class=hotel][hotel_id=' + $(o).attr('hotel_id') + ']');
a.hide();
o.show();
var h = o.find('table.hotel_table').height()+40;
if (a.height() > h) h = a.height();
if ($('#results').attr('data-home') == '1') {
o.height(a.height());
o.animate({height: '100%'}, 'normal');
} else {
o.height(a.height());
o.animate({height: h + 'px'}, 'normal');
}
}
}
function _dimSlider() {
if (_slider != null) {
var c = _slider.find('img').length;
_slider.find('img:eq(' + _idx + ')').fadeOut();
_idx++;
_idx %= c;
_slider.find('img:eq(' + _idx + ')').fadeIn();
}
}
function _fixHotelBox(obj) {
var o = $('').append($(obj).html());
o.attr('hotel_id', $(obj).attr('hotel_id'));
o.attr('data-lat', $(obj).attr('data-lat'));
o.attr('data-lng', $(obj).attr('data-lng'));
o.find('a.hotel_link').css('color','#ee0000');
o.find('div.hotel_desc').css({'max-height': '', height:'auto'});
o.find('div.hotel_review').css({'max-height': '', height:'auto'});
o.height($(obj).height()+100);
markers.push([
$(obj).attr('data-hotelName'),
parseFloat($(obj).attr('data-lat')),
parseFloat($(obj).attr('data-lng')),
$(obj).find('[data-tip=image]').attr('src'),
$(obj).find('[data-tip=address]').html(),
$(obj).find('[data-tip=town]').html(),
$(obj).find('[data-tip=lowrate]').html(),
$(obj).find('[data-tip=url]').attr('href'),
$(obj).find('[data-tip=score]').html(),
$(obj).find('[data-tip=scoreFrom]').html()
]);
o.attr('data-markerIdx', markers.length-1);
o.find('div.bookNow[data-tip=showMap]').click(function() { _showMap(parseInt($(this).closest('div.hotelOverX').attr('data-markerIdx'))); });
$(obj).before(o);
}
$(document).ready(function() {
$('body').find('div.bookNow').hover(
function() { $(this).removeClass($(this).attr('data-mouseout-class')).addClass($(this).attr('data-mouseover-class')); },
function() { $(this).removeClass($(this).attr('data-mouseover-class')).addClass($(this).attr('data-mouseout-class')); }
);
});
function _showMap(idx) {
if (hotel_markers.length > idx) {
var i;
for (i=0; i