function openBookingForm( e ){
    e.preventDefault();
	window.open(
	   'http://costarusa.ru/booking.html'
	       + '?hotel_id='+$('#select-hotel').val()
	       + '&date=' + $('#select-month').val() + '-' + $('#select-date').val()
           + '&nights='+$('#nights').val()
           + '&adults='+$('#adults').val(),
	   'Travelline', 'top=' + (screen.height / 2 - 350) + ',left=' + (screen.width / 2 - 325) +',width=700,height=650,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes'
	   );
	
	return false;
}

function changeHeaderImage()
{
    if( $('.header-image img').length > 1 )
    {
        if( $('.header-image .current').next('img').length )
        {
            $('.header-image .current')
                .fadeOut().removeClass('current')
                .next('img').addClass('current').fadeIn();
        }
        else
        {
            $('.header-image .current')
                .fadeOut().removeClass('current');
            $('.header-image img:first-child').addClass('current').fadeIn();
                
        }
        
        setTimeout( changeHeaderImage, 5000 );
    }
}

$(document).ready(function(){


    $(".mouseWheel .jCarouselLite").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 2,
    	scroll:1,
    	speed: 400,
    	circular: false
    });
    
    $('.prev.disabled, .next.disabled').click( function(e){
        e.preventDefault();
        console.log('sdsds');
    });
    
    $('#booking-form').click( openBookingForm );
    
    $("a.lightbox").colorbox({});
    $("a[rel=lightbox]").colorbox({});
    
    setTimeout( changeHeaderImage, 5000 );
    
});
