$.jGFeed('http://news.sky.com/sky-news/rss/world-news/rss.xml',
  function(feeds){
    //var $scrolling_news = $("#scrolling_news");
	var scrolling_news = document.getElementById('scrolling_news');
    if (!(scrolling_news)) {
		return false;
	}
    // Check for errors
	scrolling_news.innerHTML = '';
    //$scrolling_news.html("");
    if(!feeds){
        $scolling_news.html("Error: Cannot Load Feed");
        return false;
    }
    // do whatever you want with feeds here
    $(feeds.entries).each(function(i) {        
		  
    	  //var $scrolling_news_title = $("<a>").css({
    	  //	"border-right" : "2px solid #fff",
    	  //	"padding-left" : "10px",
    	  //	"padding-right" : "10px",
    	  //	"color" : "#fff",
    	  //	"text-decoration" : "none"
    	  // });

		  var scrolling_news_title = document.createElement('a');
		  scrolling_news_title.style.borderRight = '2px solid #fff';
		  scrolling_news_title.style.padding = '0px 10px 0px 10px';
		  scrolling_news_title.style.color = '#fff';
		  scrolling_news_title.textDecoration = 'none';
		  scrolling_news_title.setAttribute('href', this.link);
		  scrolling_news_title.setAttribute('target', '_blank');

    	  //$scrolling_news_title.attr({
    	  //    "href" : this.link,
    	  //    "target" : "_blank"
    	  //});
		  scrolling_news_title.innerHTML = "<span>" + this.title + "</span>";

    	  //$scrolling_news_title.append($("<span>" + this.title + "</span>"));
    	  scrolling_news.appendChild(scrolling_news_title);

    });
    $(scrolling_news).marquee('pointer').mouseover(function () {
        $(this).trigger('stop');
    }).mouseout(function () {
        $(this).trigger('start');
    });
}, 10);
var make_feedback = function() {	
	if (document.getElementById('neuronPageView')) {
		return false;
	}	
	$("#feedBack").remove();
	$("#feedBackBubble").remove();
	var $feedBack = $("<img>").attr({
		"src" : "/css/feedback_guy.png",
		"alt" : "Leave Feedback",
		"id" : "feedBack",
		"z-index" : "80",
		"width" : "88",
		"height" : "134"
	});
	$(document.body).append($feedBack);
	if (($(window).width()-$feedBack.width()) > 978) {
		l = $("#header_inner").offset().left + (978 - 44);
	} else {
		l = $(window).width() - ($feedBack.width()*2);
	}
	$feedBack.css({
		"position" : "fixed",
		"top" : ($feedBack.height()+50),
		"left" : l,
		"cursor" : "pointer",
		"z-index" : "80"
	});
	var $feedBackBubble = $("<img>").attr({
		"src" : "/css/feedback_bubble.png",
		"alt" : "Leave Feedback",
		"id" : "feedBackBubble"
	});
    $(document.body).append($feedBackBubble);
    $feedBackBubble.hide();
	$feedBackBubble.css({
		"top" : ($feedBack.height()-30),
		"left" : l-10,
		"position" : "fixed",
		"z-index" : "80"	
	});		
	$feedBack.hover(
		function() {
			$feedBackBubble.show();
		},
		function() {
			$feedBackBubble.hide();
		}
	);
	$feedBack.click(function() {	    
    	document.location = '/Feedback';
	});
};
var hoverTimer;
$(window).resize(make_feedback);
$(window).load(function() {
	make_feedback();
    $('a').each(function(indx){
		if($(this).attr('href').search('http://') != -1) {
			$(this).attr("target","_blank");
		}
	});
});
$(document).ready(function() {
	$("#mainMenu").children('li').each(function() {
		$(this).hover(
		function() {
			$(this).children("a:first").css("color","#e60b00");
		},
		function() {
			$(this).children("a:first").css("color","#fff");
		}
		);
	});
});

