(function($){ 
	$(function(){
	//--DO THIS WHEN YOU HAVE WIFI
		//Neons 
		var target, page;
		$('.home #footer #navigation li a').hover(
			function() {
				page = $(this).text();
				target = $('#home-photo .home-neon[rel="' + page + '"]');
				
				if( target.length ) {
					target.find('img').css('visibility', 'visible');
				}
			},
			function() {
				if( target.length ) {
					target.find('img').css('visibility', 'hidden');
				}
			}
		);
		
		$('#share-twitter, #home-twitter-neon').click(function(e) {
			$('#twitter-stream').stop(true,true).slideToggle(400);
			e.preventDefault();
		});
	
		
		$('#twitter-stream .twitter-item').prepend("<span class='username'><a href='http://twitter.com/#!/darrenmcmullen' target='_blank'>darrenmcmullen</a></span>");

		
		$('#wantmore a').click(function(e) {
			$('#wantmore').fadeOut(300);
			$('#content-more').slideDown(500);
			$('#backlink').fadeIn(500);
			e.preventDefault();
		});
		$('#backlink a').click(function(e) {
			$('#wantmore').fadeIn(300);
			$('#content-more').slideUp(500);
			$('#backlink').fadeOut(500);
			e.preventDefault();
		});
		
		var back_was_visible = false;
		$('#showpic').click(function(e) {
			$('#closepic').fadeIn(300);
			$('#showpic, #header, #page-wrapper').fadeOut(300);
			
			if( $('#backlink').css('display') == 'block' ) {
				$('#backlink').fadeOut(300);
				back_was_visible = true;
			}			
			e.preventDefault();
		});
		$('#closepic').click(function(e) {
			$('#showpic, #header, #page-wrapper').fadeIn(300);
			$('#closepic').fadeOut(300);
			if( back_was_visible ) {
				$('#backlink').fadeIn(300);
			}
			e.preventDefault();
		});
	
		// Cufon
		Cufon.replace('#navigation li a, h1, h2, h3, #sidebar-quote, #wantmore, .wpaudio', { hover: true, fontFamily: 'ostrich' });
		
		// Comments
		if ($('#commentform').length > 0){
			$('#commentform').validate();
		}
	});
})(jQuery);

