/* GLOBAL LINKS */

// alert('GLOBAL links loaded');


$(document).ready(function(){ 

	// SCRUB LINKS
	$("a").bind("focus",function(){
		if(this.blur)this.blur();
	});

	// ADD HOVER TO LINKS
	$('.link').livequery(function(){ 
		
			/* Add 'hover' class to items with 'link' class (to make friendly to non-js browsers):
			*		$('.link').addClass('hover'); 
			*	Fails when AJAX is used to load content on same page
			*	INSTEAD USE LIVEQUERY PLUGIN (shown below)
			*	Also define .hover {cursor:pointer;} on 'reset.css'. cursor:hand; maybe required for IE?
			*/
			
		$(this).hover(function() { 
			$(this).addClass('hover'); 
		}, function() { 
			$(this).removeClass('hover'); 
		}); 
	});

	/* H2 WEBLINKS - WITH 'weblink:' floated left, link aligned right
	$('.weblink').each(function() {
		var link_text = $(this).text();
		$(this).hover(
			function() {
				$(this).text( $(this).attr('title') ).prepend( '<span>weblink:</span>').addClass('arrow');
			},
			function() {
				$(this).remove('span').text(link_text).removeClass('arrow');
				
			}
		);
	});
	*/
	
	// H2 WEBLINKS
	$('.weblink').each(function() {
		var link_text = $(this).text();
		$(this).hover(
			function() {
				$(this).text( $(this).attr('title') ).addClass('arrow');
			},
			function() {
				$(this).text(link_text).removeClass('arrow');
				
			}
		);
	});
	
	/* H2 LINKS
	$('.h2.link').each(function() {
		var link_text = $(this).text();
		$(this).hover(
			function() {
				$(this).addClass('arrow');
			},
			function() {
				$(this).removeClass('arrow');
				
			}
		);
	});
	*/
	

	
	
	// GLOBAL LINKS
	
	// HOME
	$('#nav-home, .home.link').livequery('click', function(event) {     
		$('#masthead').removeClass('link');
		change_content('home'); 
		return false;
    });
	$('.welcome.link').livequery('click', function(event) { 
        $('#masthead').addClass('link');
		change_content('home','welcome'); 
		return false;
    });


	// RECORDINGS
	$('#nav-recordings, .recordings.link').livequery('click', function(event) { 
		change_content('recordings','catalog'); return false;
    });
	$('.recordings-swings.link').livequery('click', function(event) { 
		change_content('recordings','swings'); return false;
	});
	$('.recordings-vintage.link').livequery('click', function(event) { 
        change_content('recordings','vintage'); return false;
    });


	// PRESS
	$('#nav-press, .press.link').livequery('click', function(event) { 
        change_content('press'); return false;
    });	
	// PRESS ARTICLES - COPY FROM press.js AS NEEDED
	$('.press-bluenote_review.link').livequery('click', function(event) { 
		change_content('press','bluenote_review'); return false;
 	});


	// SHOWS
	$('#nav-shows, .shows.link').livequery('click', function(event) { 
        change_content('shows'); return false;
    });


	// GALLERY
	$('#nav-gallery, .gallery.link').livequery('click', function(event) { 
		change_content('gallery'); return false;
    });
		/*
		$('.gallery-swings.link').livequery('click', function(event) { 
			change_content('gallery','swings'); return false;
	    });
		$('.gallery-vintage.link').livequery('click', function(event) { 
			change_content('gallery','vintage'); return false;
	    });
		$('.gallery-video.link').livequery('click', function(event) { 
	        change_content('gallery','video'); return false;
	    });
		*/


	// BIOGRAPHY
	$('#nav-biography, .biography.link').livequery('click', function(event) { 
        change_content('biography'); return false;
    });


	// CONTACTS
	$('#nav-contacts, .contacts.link').livequery('click', function(event) { 
        change_content('contacts'); return false;
    });



});


