jQuery(document).ready(function(){
	// add to favorites
	jQuery("a.favorites").click(function(){
		if(window.sidebar) {
			window.sidebar.addPanel(document.title,window.location,"");
		} else if(window.opera && window.print) {
			jQuery(this).attr("href",window.location);
			jQuery(this).attr("title",document.title);
		} else if(document.all) {
			window.external.AddFavorite(window.location,document.title);
		}
		return false;
	});

	// go top
	jQuery(window).scroll(function() {
		if(jQuery(this).scrollTop() > 200) {
			jQuery('#goTop').show();
		} else {
			jQuery('#goTop').stop().fadeOut();
		}
	});
	jQuery('#goTop').hide();
	setTimeout(function(){
		if(jQuery(window).scrollTop() > 200)
			jQuery('#goTop').show();
	}, 100);
	// Opera fix: DynamicDrive script ::jQuery Scroll to Top Control v1.1
	// http://www.dynamicdrive.com/dynamicindex3/scrolltop.htm
	var mode = (window.opera) ? ((document.compatMode == "CSS1Compat") ? jQuery('html') : jQuery('body')) : jQuery('html,body');
	jQuery('#goTop').click(function() {
		var self=this;
		mode.animate({scrollTop:0}, 500, function(){
			jQuery(self).stop().fadeOut();
		});
		return false;
	});

	// flash messages
	jQuery(".flash, .flash-success").delay(5000).fadeOut();
});
