// JavaScript Document

$(document).ready(function() {

$("a.fancy").fancybox();

$("a.iframe").fancybox({width: 305, height: 250 ,overlayOpacity: .7, overlayColor: '#ccc'});

$("a.youtube").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
});


	$("a.group").fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'speedIn'		:	200, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});


$(function() {
$(".swapper").hover(
function () {
$(this).attr("src", $(this).attr("src").replace(/-off.png/, "-on.png"));
},
function () {
$(this).attr("src", $(this).attr("src").replace(/-on.png/, "-off.png"));
} 
);
});

//home page image rotation
$('#home-slide').cycle({
		fx: 'fade',
	   prev:   '#prev', 
       next:   '#next', 
       after:   onAfter,
       timeout: 5000
	});
	
function onAfter(curr, next, opts) {
        var index = opts.currSlide;
        $('#prev')[index == 0 ? 'hide' : 'show']();
        $('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
    }

//date picker
$(function() {
$(".date-select").datepicker({showOn: 'button', buttonImage: 'http://flyavl.com/templates/common/css/images/book-cal-icon.png', buttonImageOnly: true, dateFormat: 'mm/dd/yy',changeMonth: true,changeYear: true});
	});
	
$("#watchdog-widget-trigger").click(function() {
	$("#tms-hide").hide();
	$("#low-fares").hide();
	$("#watchdog").show();
	});
	
$("#watchdog-widget-close").click(function() {
$("#watchdog").hide();
$("#low-fares").show();
$("#tms-hide").show();
});
		
$("#weather-off").click(function() {
$("#widget").fadeIn();
return false;
});

$("#weather-widget-close").click(function() {
$("#widget").fadeOut();
});

$('.clear-me').focus(function() {
    $(this).val("");
  });

$("#results").tablesorter( {sortList: [[0,0]]} ); 

$(function(){
   $("#subscriber-select").multiselect({noneSelectedText: 'Choose your subscription(s)'

}); 
});
});//end whole thing

