/* Modified to support Opera */
function bookmarksite(title, url){
    if (window.sidebar) // firefox
        window.sidebar.addPanel(title, url, "");
    else 
        if (window.opera && window.print) { // opera
            var elem = document.createElement('a');
            elem.setAttribute('href', url);
            elem.setAttribute('title', title);
            elem.setAttribute('rel', 'sidebar');
            elem.click();
        }
        else 
            if (document.all)// ie
                window.external.AddFavorite(url, title);
}
	
jQuery(document).ready(function(){
    var newsoption1 = {
         firstname: "toDisplay",
		 secondname: "fg_content",
		 thirdname:"news_display",
		 fourthname:"news_button" 
    }
	jQuery.init_news(newsoption1);
});

jQuery(function () {
    jQuery('ul.spy').simpleSpy();
});

(function (jQuery) {
    
    jQuery.fn.simpleSpy = function(limit, interval){
        limit = limit || 3;
        interval = interval || 5000;
        
        return this.each(function(){
            // 1. setup
            // capture a cache of all the list items
            // chomp the list down to limit li elements
            var jQuerylist = jQuery(this), items = [], // uninitialised
     currentItem = limit, total = 0, // initialise later on
     height = jQuerylist.find('> li:first').height();
            
            // capture the cache
            jQuerylist.find('> li').each(function(){
                items.push('<li>' + jQuery(this).html() + '</li>');
            });
            
            total = items.length;
            
            jQuerylist.wrap('<div class="spyWrapper" />').parent().css({
                height: height * limit
            });
            
            jQuerylist.find('> li').filter(':gt(' + (limit - 1) + ')').remove();
            
            // 2. effect        
            function spy(){
                // insert a new item with opacity and height of zero
                var jQueryinsert = jQuery(items[currentItem]).css({
                    height: 0,
                    opacity: 0,
                    display: 'none'
                }).prependTo(jQuerylist);
                
                // fade the LAST item out
                jQuerylist.find('> li:last').animate({
                    opacity: 0
                }, 1000, function(){
                    // increase the height of the NEW first item
                    jQueryinsert.animate({
                        height: height
                    }, 1000).animate({
                        opacity: 1
                    }, 1000);
                    
                    // AND at the same time - decrease the height of the LAST item
                    // jQuery(this).animate({ height : 0 }, 1000, function () {
                    // finally fade the first item in (and we can remove the last)
                    jQuery(this).remove();
                    // });
                });
                
                currentItem++;
                if (currentItem >= total) {
                    currentItem = 0;
                }
                
                setTimeout(spy, interval)
            }
            
            spy();
        });
    };
    
})(jQuery);