var initmp;
document.observe('dom:loaded', function() {
	/*
	if ($('mediaplayer_1')) {
		initmp = $('mediaplayer_1').innerHTML;
	}
	*/
	
	if ($(document.body).hasClassName('nm_currentPage_calendar')) {
		webkit.modinit('eventscalendar', 'calendar_nbeversluis.css');
	}
	else if ($(document.body).hasClassName('nm_currentPage_contact')) {
		webkit.modinit('contact');
	}
	else if ($(document.body).hasClassName('nm_currentPage_blog')) {
		nb.blogObservers();
		webkit.modinit('fbshare');
	}
})

function nb() {
	this.playsong = function(songID) {
		/*
		if (songID) {  
			$('mediaplayer_1').update(initmp + '<iframe id = "mediaplayer" name = "mediaplayer" src = "/nm_webkit/templates/mediaplayer.php?width=250&height=40&firstload=0&downloadbutton=0&medialoader=1&songID=' + songID + '" width = "250" height = "40" scrolling = "no" marginwidth = "0" marginheight = "0" frameborder = "0"></iframe>');          
			    $('nm_rightsidebar').setStyle({marginTop:'-60px'});
			new Effect.ScrollTo('mediaplayer_1', { duration:0.5 });
		}
		*/
		
		if (songID) {
			webkit.playsong(songID,'mediaplayer',nb.mpCallback);
		}
	}	
	
	this.mpCallback = function(songID) {
		// mediaplayer callback function
		new Effect.ScrollTo('mediaplayer', { duration:0.5 });
	}
	
	this.blogObservers = function() {
		$('searchsubmit').observe('click', function(e) {
			e.stop();
			window.location = '/search/' + $('s').getValue();
		});
	}
}

var nb = new nb();

function playsong(songID) {
	nb.playsong(songID);
}