// jQuery script to handle rider page
jQuery(document).ready(function($){

	// bind clicks on ads
	var bindPrintRiderAds = function() {
		$('#riderAds').click(
			function() {

				var riderId = $('#rider_id').val();
				var brandId = $('#brand_id').val();
				
				$.ajax({
					type: 'POST',
					url: '/ajax/printRiderAds.php',
					data: 'rider_id=' + riderId + '&brand_id=' + brandId,
					cache: false,
					success: function(html){
						$('#teamRiderPicsWrap').hide().html(html).fadeIn('slow');
					}
				});
				
				return false; // return false so the link doesn't actually click anywhere

			}
		);
	};
	
	// bind clicks on pics
	var bindPrintRiderPics = function() {
		$('#riderPics').click(
			function() {

				var riderId = $('#rider_id').val();
				var brandId = $('#brand_id').val();
				
				$.ajax({
					type: 'POST',
					url: '/ajax/printRiderPics.php',
					data: 'rider_id=' + riderId + '&brand_id=' + brandId,
					cache: false,
					success: function(html){
						$('#teamRiderPicsWrap').hide().html(html).fadeIn('slow');
					}
				});
				
				return false; // return false so the link doesn't actually click anywhere

			}
		);
	};
	
	// bind onclick
	bindPrintRiderAds();
	bindPrintRiderPics();

});