
//
// The following script is used to dynamically inject a floating
// header on the top of pages with a search engine and link out to a 
// contact form with any additional details.
//
// Only do anything if jQuery isn't defined
//

//Custom jquery namespace
var j = {};

//Load up jQuery first if it's not already defined..
if (typeof jQuery == 'undefined') {  
    function getScript(url, success) {
        var script = document.createElement('script');
        script.src = url;

        var head = document.getElementsByTagName('head')[0],
        done = false;

        // Attach handlers for all browsers
        script.onload = script.onreadystatechange = function() {
            if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
                done = true;
                // callback function provided as param
                success();
                script.onload = script.onreadystatechange = null;
                head.removeChild(script);
            };
        };
        head.appendChild(script);
    };
    
    getScript('http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', function() {
        if (typeof jQuery=='undefined') {
        // Super failsafe - still somehow failed...
        } else {
            // jQuery loaded!
            j.query = jQuery.noConflict(true);
            
            doNazWork();
        }
    });
} else { // jQuery was already loaded
    j.query = jQuery;
    doNazWork();
};


function doNazWork()
{
    j.query(document).ready(function($){
        //Put our new tag right below the head tag.
        $("body").prepend('<div id="migrate_warn_header"></div>');
        
        //Fetch the content for display
        $("#migrate_warn_header").load("/naz_migrate/migrate_header.html");
    });
}



$(document).ready(function(){
    $.jGFeed('http://feeds.feedburner.com/ncnnews?format=rss',
        function(feeds){
            // Check for errors
            if(!feeds){
                // there was an error
                return false;
            }
            // do whatever you want with feeds here
            for(var i=0; i<5; i++){
                var entry = feeds.entries[i];
                // title and link our the vars.
                $(".TopStories .NewsItemLink").eq(i).attr("href", entry.link)
                $(".TopStories .NewsItemLink").eq(i).html(entry.title)
            }
        }, 5);
});
            
$(document).ready(function(){
    $.jGFeed('http://feeds.feedburner.com/reflectinggod?format=rss',
        function(feeds){
            // Check for errors

            if(!feeds){
                // there was an error
                return false;
            }
            // do whatever you want with feeds here
            for(var i=0; i<1; i++){
                var entry = feeds.entries[i];
                // title and link our the vars.
                $(".todaysdevo .NewsItemLink").eq(i).attr("href", entry.link)
                $(".todaysdevo .NewsItemLink").eq(i).html(entry.title)
            }
        }, 1);
});
