/*document.write('<script type="text/javascript" src="/client/js/lightbox/prototype.js"></script>');
document.write('<script type="text/javascript" src="/client/js/lightbox/scriptaculous.js?load=effects"></script>');
document.write('<script type="text/javascript" src="/client/js/lightbox/lightbox.js"></script>');
*/
$(document).ready(function() {

 
         $('.anythingSlider').anythingSlider({
                easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 3000,                    // How long between slide transitions in AutoPlay mode
                startStopped: false,            // If autoPlay is on, this can force it to start stopped
                animationTime: 600,             // How long the slide transition takes
                hashTags: true,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		startText: "Pradėti",             // Start text
		        stopText: "Stabdyti"               // Stop text

            });

            $("#slide-jump").click(function(){
                $('.anythingSlider').anythingSlider(6);
            });
 
$("#container2 #main_left #main_big_banner").easySlider({auto: true,
	continuous: true,
	auto: true,
	controlsShow: false,
	pause: 5000 });

	$(".link a").hover(function() {  
$(this).next("em").stop(true, true).animate({opacity: "show", top: "-60"}, "slow");  
}, function() {  
$(this).next("em").animate({opacity: "hide", top: "-70"}, "fast");  
}); 

	$(".menu12 a").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-75"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
	});



$('body').supersleight({shim: 'http://www.kalevatravel.lt/x.gif'});

        

   // Kalendoriai
    Date.dayNames = ['Sekmadienis', 'Pirmadienis', 'Antradienis', 'Trečiadienis', 'Ketvirtadienis', 'Penktadienis', 'Šeštadienis'];
    Date.abbrDayNames = ['Sk', 'Pm', 'An', 'Tr', 'Kt', 'Pt', 'Št'];
    Date.monthNames = ['Sausis', 'Vasaris', 'Kovas', 'Balandis', 'Gegužė', 'Birželis', 'Liepa', 'Rugpjūtis', 'Rugsėjis', 'Spalis', 'Lapkritis', 'Gruodis'];
    Date.abbrMonthNames = ['Saus', 'Vas', 'Kov', 'Bal', 'Geg', 'Birž', 'Liep', 'Rugp', 'Rugs', 'Spal', 'Lapk', 'Gruo'];
    Date.firstDayOfWeek = 1;
    Date.format = 'yyyy-mm-dd';
    	
	$('input.d').datePicker({
		clickInput:true, 
		createButton:false
	});
    
    $('#departure').bind(
        'dpClosed',
        function(e, selectedDates)
        {
			$('#seniors').show();
			$('#adults').show();
			$('#teens').show();
            var d = selectedDates[0];
            if (d) 
            {
                d = new Date(d); 
                var dates = $('#arrival').val().split('-');
                var d1 = new Date(dates[0], dates[1] - 1, dates[2]); 
                if (d > d1)
                {
                    $('#arrival').dpSetSelected(d.addDays(7).asString());
                    $('#arrival').attr('value', d.asString());
                }
            }
            d = new Date(d);
            var dates = $('#departure').val().split('-');
            var d = new Date(dates[0], dates[1] - 1, dates[2]); 
            $('#arrival').dpSetStartDate(d.asString());
        }
    );

	$('#arrival').bind(
        'dpClosed',
        function(e, selectedDates)
        {
			$('#children').show();
			$('#infants').show();
        }
    );
                                                                  
    $('a.dep').bind('click', function() 
	{ 
		$('#departure').dpDisplay();
		$('#seniors').hide();
		$('#adults').hide();
		$('#teens').hide();
	});
    $('a.arr').bind('click', function() 
	{ 
		$('#arrival').dpDisplay();
		$('#children').hide();
		$('#infants').hide();
	});

    if ($('#departure').val())
    {
        var dates = $('#departure').val().split('-');
        var d = new Date(dates[0], dates[1] - 1, dates[2]); 
        d.setDate(d.getDate()+1)
        $('#arrival').dpSetStartDate(d.addDays(-1).asString());
        var dates2 = $('#arrival').val().split('-');
        var d = new Date(dates2[0], dates2[1] - 1, dates2[2]);
        $('#arrival').dpSetSelected(d.asString());
        $('#arrival').attr('value', d.asString());
    }
// Jei bilietas tik i viena puse - slepiam grizimo data
    $('input[@name=sectorNumber]').bind('click', function() 
    {
        if ($(this).attr('value')=='1')
            $('#arrival1, #arrival, a.arr').fadeOut(200);
        else                                                                                         
            $('#arrival1, #arrival, a.arr').fadeIn(200);
    });
	
	$('#submitAvia').bind('click', function() 
    {
        var times = $('#departure').val().split('-');
		$('input[@name=month1]').attr('value', times[1]+'/'+times[0]);
		$('input[@name=day1]').attr('value', times[2]);
		if ($('input[@name=sectorNumber]').val() == 2)
		{
			var times = $('#arrival').val().split('-');
			$('input[@name=month2]').attr('value', times[1]+'/'+times[0]);
			$('input[@name=day2]').attr('value', times[2]);
		}
    });

	// Oro uostu pasirinkimas
	$('#city1').attr('value', $('#city1_select').val());
	$('#city2').attr('value', $('#city2_select').val());

    $('#city1_select').bind('change', function () 
    {
		$('#city1').attr('value', $(this).val());

        if ($(this).attr('value')=='other')
        {
            $(this).css('display', 'none');
            $('#city1_text').css('display', 'inline').focus();
			if ($('#explain').css('display') == 'none')
			{
				$('#explain').css('display', 'block');
				$('#avia').css('height', '305px');
			}
        }
    });

    $('#city2_select').bind('change', function () 
    {
		$('#city2').attr('value', $(this).val());

        if ($(this).attr('value')=='other')
        {
            $(this).css('display', 'none');
            $('#city2_text').css('display', 'inline').focus();
			if ($('#explain').css('display') == 'none')
			{
				$('#explain').css('display', 'block');
				$('#avia').css('height', '305px');
			}
        }
    });

	// Ijungiam autokomplete
    $("#city1_text").autocomplete(
        "/airports.php",
        { delay:10, minChars:2, matchSubset:1, matchContains:1, cacheLength:10, onItemSelect:selectItem_from, formatItem:formatItem, autoFill:true }
    );
	// Ijungiam autokomplete
    $("#city2_text").autocomplete(
        "/airports.php",
        { delay:10, minChars:2, matchSubset:1, matchContains:1, cacheLength:10, onItemSelect:selectItem_to, formatItem:formatItem, autoFill:true }
    );

	// Autocompleto funkcijos
	function selectItem_from(li)
	{        
		$("#city1").attr('value', li.extra[0]);
	}
	function selectItem_to(li)
	{                        
		$("#city2").attr('value', li.extra[0]);
	}
	function formatItem(row) {
		return row[0];
	}
	
});
function closetlf(){
	document.getElementById('telefonai').style.display = "none";
}
