$(document).ready(function() {

	// Bookmark site
	if(window.opera) {
		if ($("a.bookmark").attr("rel") != ""){
			$("a.bookmark").attr("rel","sidebar");
		} 
	}

	$("a.bookmark").click(function(event){
		event.preventDefault();
		var url = this.href;
		var title = this.title;

		if (window.sidebar) { 
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { 
			window.external.AddFavorite( url, title);
		} else if(window.opera) { 
			return false; 
		} else { 
			 alert('Sorry, your browser does not support the requested action,'
			 + ' please add this page manually to your bookmarks.');
		}
	});

	if ($("#panel-1").length) {
		$('#panel-1').cycle({
			fx: 'fade',
			timeout: 5000,
			speed: 500
		});
	}

	$('.lightbox').lightBox({fixedNavigation:true});

	var headline_count;
	var headline_interval;
	var old_headline = 0;
	var current_headline = 0;
	headline_count = $("div.headline").size();
	$("div.headline:eq("+current_headline+")").css('top','0px');
	headline_interval = setInterval(headline_rotate,15000); //time in milliseconds

	function headline_rotate() {
		current_headline = (old_headline + 1) % headline_count; 
		$("div.headline:eq(" + old_headline + ")").animate({top: -230},"slow", function() {
		$(this).css('top','230px');
		});
		$("div.headline:eq(" + current_headline + ")").show().animate({top: 0},"slow");  
		old_headline = current_headline;
	}

});
