
	
//check to see if RHS div exists (i.e three column page) and if so activate cycle plug in
		$(document).ready(function() {
			if ($("#RHS").length > 0){
			   $('#RHS_favorites_cycle').cycle({
					fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
					speed: 12000,
					timeout: 20000,
					random: 1	});
				$('#RHS_latest_cycle').cycle({
					fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
					speed: 11000,
					timeout: 20000,
					random: 1,
					delay: -8000	});
								}	
							});


(function( $ ){   //function to parse event click data for google analytics
  		$.fn.event_tracking = function() {
  				var clicked_link = $(this);	
				var clicked_link_id = clicked_link.attr("href");
				_gaq.push(['_trackEvent', 'Specialbike', 'clicked', clicked_link_id]);				
				
	   };
	})( jQuery );

//track externally clicked links
		$(document).ready(function() {
			$('a[href*="http://"]').live('click', function() {  //Track clicks on external links and store them with google analytics
   				var clicked_link = $(this);	
				var clicked_link_id = clicked_link.attr("href");
				_gaq.push(['_trackEvent', 'Specialbike', 'external_links', clicked_link_id]);				
															});				
										});

//change body and menu for clicks on first three links on LHS menu
		$(document).ready(function() {
			$('#home_link').click(function() {//default link				
				$('#home_link').event_tracking();	//call function for analytics event tracking		
				$('#main_body').fadeOut('slow', function(){
				
				 // We're in the callback of the fadeOut()
        			$('#main_body').load('default_body.asp', function(){
				
		            // We're in the callback of the load()
		            $('#main_body').fadeIn('slow');
					$('#LHS_menu a').removeClass("current_page")
									.removeClass("active");
					$('#home_link').addClass("current_page");
					});
			
				});
			return false; // Prevent browser from visiting `#`
			});	
			
			$('#contact_link').click(function() {//contact link
				$('#contact_link').event_tracking();	//call function for analytics event tracking				
				$('#main_body').fadeOut('slow', function(){
				
				 // We're in the callback of the fadeOut()
        			$('#main_body').load('contact_body.asp', function(){
				
		            // We're in the callback of the load()
		            $('#main_body').fadeIn('slow');
					$('#LHS_menu a').removeClass("current_page")
									.removeClass("active");
					$('#contact_link').addClass("current_page");
					});
			
				});
			return false; // Prevent browser from visiting `#`
			});	
			
			$('#news_link').click(function() {//news link
				$('#news_link').event_tracking();	//call function for analytics			
				$('#main_body').fadeOut('slow', function(){
				
				 // We're in the callback of the fadeOut()
        			$('#main_body').load('news_body.asp', function(){
				
		            // We're in the callback of the load()
		            $('#main_body').fadeIn('slow');
					$('#LHS_menu a').removeClass("current_page")
									.removeClass("active");
					$('#news_link').addClass("current_page");
					});
			
				});
			return false; // Prevent browser from visiting `#`
			});	
			
		});



//change body for clicks on detail sub menu links
		$(document).ready(function() {
			$('#detail_links_list a').click(function() {
				var clicked_link = $(this);	
				var clicked_link_id = clicked_link.attr("href");
				
				_gaq.push(['_trackEvent', 'Specialbike', 'clicked', clicked_link_id]);	//do the google event track - but just with the whole page href			
								
				clicked_link_id = clicked_link_id.replace(".asp", "");
				clicked_link_id = clicked_link_id + "_body.asp"
				
				
				$('#main_body').fadeOut('slow', function(){
				
				 // We're in the callback of the fadeOut()
        			$('#main_body').load(clicked_link_id, function(){
				
		            // We're in the callback of the load()
		            $('#main_body').fadeIn('slow');
					$('#LHS_menu a').removeClass("current_page")
									.removeClass("active");
					clicked_link.parent().parent().parent().children(':first-child').addClass("current_page");
					clicked_link.addClass("active");
					});
			
				});
			return false; // Prevent browser from visiting `#`
			});			
		});




//is clicked function - animates play, pause, prev and next buttons

	(function( $ ){   //my first function! add class, delay then remove class
  		$.fn.is_clicked = function() {
  				this.addClass('is_clicked').delay(300).queue(function(next){
				$(this).removeClass('is_clicked');
				next();
				});
	   };
	})( jQuery );
	

