$(document).ready(function(){ 

	jQuery.fn.ForceNumericOnly =
	function()
	{
		return this.each(function()
		{
			$(this).keydown(function(e)
			{
				var key = e.charCode || e.keyCode || 0;
				// allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY
				return (
					key == 8 || 
					key == 9 ||
					key == 46 ||
					(key >= 37 && key <= 40) ||
					(key >= 48 && key <= 57) ||
					(key >= 96 && key <= 105));
			})
		})
	};

	$(document).pngFix(); 

    $('.cycle').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});

	$('a.fancy').live('mouseover', function(){ 
		$(this).fancybox({ 
		'titleShow'      : true,
		'transitionIn'   : 'elastic',
		'transitionOut'  : 'elastic'}) 
	});

	$(".fancyframe").click(function () {
		
		$.fancybox({'title'				: 'Terms & Conditions',
					'autoScale'			: false,
					'width'				: 600,
					'height'			: 600,
					'type'				: 'iframe',
					'showCloseButton'	: true,
					'modal'				: false,
					'href'				: '/terms_and_conditions'});
	});
	
	//$("#miles").ForceNumericOnly();
	
	$('form.required-form').simpleValidate({
		errorElement: 'em'
	});
	
	$("#datepicker").datepicker({dateFormat: 'dd/mm/yy'});
	
	$('.timepicker').timepicker();
	
	$('#timepicker_options').timepicker({
		timeSeparator: ':',           // The caracter to use to separate hours and minutes. (default: ':')
		showLeadingZero: true,        // Show leading zero for hours
		showMinutesLeadingZero: true, // Show a leading zero for minutes
		showPeriod: false,            // Show AM/PM with selected time.  
		hourText: 'Hour',             // Define the locale text for "Hours"
		minuteText: 'Minute',         // Define the locale text for "Minute"
		amPmText: ['AM', 'PM'],       // Define the locale text for periods
		altField: '#alternate_input', // Define an anternate input to parse selected time to
		defaultTime: '12:34',         // Define a default time to use if displayed inline or input is empty
	});
	
	$(".airport").click(function () {
		$("#airport").slideToggle();	
	});

	var map = new GMap2(document.getElementById('map')); 
	var bjEng = new GLatLng(52.676865, -2.030321); 
	map.setMapType(G_NORMAL_MAP);
	map.addControl(new GSmallZoomControl());
	map.setCenter(bjEng, 15);
	map.addOverlay(new GMarker(bjEng));

}); 
