/*
jquery.billboard.js
Rich Reuter
rich.reuter@us.sogeti.com
09/29/2008

This jQuery plugin is responsible for replacing the content of the 
billboards in dynamic web parts.  If anything goes wrong, the 
JS will not replace the text and will leave the original text intact.
*/

(function() {  
    jQuery.fn.billboard = function(settings) {
    
        try
        {
            settings = jQuery.extend({
                is_promotal: false, 
                promotal_src: '', 
                content_src: ''
            }, settings);
            
            var content_id = '';
            
            // Check to see if there's a flag for promotal. If so, then 
            // replace the contents of the billboard with the promotal src
            if (settings.is_promotal)
            {
                if (settings.promotal_src)
                {
                    content_id = settings.promotal_src;
                }
            }
            else
            {
                if (settings.content_src)
                {
                    content_id = settings.content_src;
                }
            }
            
            if (content_id != '')
            {
                var j_content_id = '#' + content_id;
                if (jQuery(j_content_id).html().match(/\S+/))
                {
                    jQuery(this).html(jQuery(j_content_id).html());
                }
            }
        } catch (err) {}
        return jQuery;
    };
})(jQuery);  