function CreateBookmarkLink()
{
	var title = document.title;
	var url = location.href;
	if(window.sidebar) window.sidebar.addPanel(title, url,"");
	else if(document.all) window.external.AddFavorite(url, title);
}

$(document).ready(function() {
	
	$('#menubar .submenu').hover(function() {
		$(this).prev().addClass('hovered');
	}, function() {
		$(this).prev().removeClass('hovered');
	});
	
	$('#menubar .menuitem').hover(function() {
		$(this).addClass('hovered');
		// $(this).fadeTo(400, 0);
	
	
	}, function() {
		// $(this).fadeTo(400, 1);
		$(this).removeClass('hovered');
	
	});
	 
	 
	 link_width = 28;
	 first_run = true;
	 need_fix = $.support.opacity;
	 
	 function sliderBefore(currSlideElement, nextSlideElement, options, forwardFlag) 
	 {
		if(need_fix) $('#runner').stop().animate({ backgroundPosition: (first_run ? 0 : options.nextSlide) * link_width + 'px 0px' }, 250);
		else $('#runner').stop().animate({ backgroundPositionX: (first_run ? 0 : options.nextSlide) * link_width + 'px' }, 250);
		if(!($(nextSlideElement).hasClass('loaded')))
		 {
			$(nextSlideElement).css('background-image', 'url(/img/objects/' + $(nextSlideElement).attr('id').substr(7) + '.gif)').addClass('loaded');
		 }
		first_run = false;
	 }

	 
	$('#spotlight').cycle({
			 before: sliderBefore,
			 cleartypeNoBg: true,
			 timeout: 7000,
			 //manualTrump:   false,
			 fastOnEvent:   1000,
			 pager:  '#nav',
			 pagerEvent: 'mouseover', 
			 pauseOnPagerHover: true, 
			 activePagerClass: 'current',
		 	 pagerAnchorBuilder: function(idx, slide) { 
				return '<a href="#">' + $(slide).attr('id').substr(7) + '</a>'; 
			 }, 
			 slideExpr: 'a.slide'
	});
	
	link_count = $('#nav a').length;
	
	$('#runner').css('width', (link_count - 1) * link_width + 6 + 'px');
	$('#nav').css('width', (link_count) * link_width + 'px');

});
