YUI().use('node-base', 'swfdetect', 'event-delegate', 'transition', function(Y) {
		
	if (Y.one(document.body).hasClass('nm_currentPage_calendar')) {
		webkit.modinit('eventscalendar', 'calendar_nbeversluis.css');
	}
	else if (Y.one(document.body).hasClass('nm_currentPage_contact')) {
		webkit.modinit('contact');
	}
	else if (Y.one(document.body).hasClass('nm_currentPage_home')) {
		blogObservers();
		webkit.modinit('fbshare');
		webkit.setupForLightbox();
	}	
	else if (Y.one(document.body).hasClass('nm_currentPage_media'))	{
		webkit.modinit('jplayer');
	}
	
	function blogObservers() {
		webkit.modinit('jplayer');
		
		// accordian category observers
		Y.delegate('click', function(e) {
			e.preventDefault();
			var category = this.get('id').replace(/^cat_/,'');
			if (Y.one('#posts_' + category).hasClass('displaynone')) {
				// show category
				Y.one('#posts_' + category).setStyle('opacity', 0);
				Y.one('#posts_' + category).removeClass('displaynone');
				Y.one('#posts_' + category).show('fadeIn', {
					duration:0.35
				})
			}
			else {
				// hide category
				Y.one('#posts_' + category).hide('fadeOut', {
					duration:0.35,
					on : {
						end: function() {
							Y.one('#posts_' + category).addClass('displaynone');							
						}
					}
				})
			}			
		}, '#nm_rightsidebar #categories', '.category');
		
		Y.on('click', function(e) {
			e.preventDefault();
			window.location = '/search/' + Y.one('#s').get('value');
		}, '#searchsubmit');	
		
		/*
		$('searchsubmit').observe('click', function(e) {
			e.stop();
			window.location = '/search/' + $('s').getValue();
		});
		*/
		
		webkit.initMoreLinks();
	}
	
});


function playsong (songID) {
	YUI().use('node', function(Y) {
		if (songID) {
		//	webkit.playsong(songID,'mediaplayer',mpCallback);

			Y.one('#mediaplayer').removeClass('displaynone');
			var J = jQuery.noConflict();
			var jPlayerConfig = {
				J:J,
				playerID: 1,
				trackID: songID,
				autostart:true
			}
			soundclips.trackID = songID;	
			webkit.YUIscrollTo('mediaplayer', webkit.jPlayerPlay, jPlayerConfig);
		}		
	})

}	

/*
function mpCallback (songID) {
	// mediaplayer callback function
	new Effect.ScrollTo('mediaplayer', { duration:0.5 });
}
*/

