new function(){
	/*
	=========================================================
	JQ-based home-page news scroller
	=========================================================
	*/
	var active = 0;
	var cycleTime;
	$(document).ready(function(){
		var scroller = $(".news-heading");
		if(scroller.length>0){ /* Create scroller object if appropriate element exists  */
		    var theScroller = scroller.get(0);
			var urlRSS = $("div.rss>a",theScroller);
			if(urlRSS.length>0){ /* Use the URL of the RSS feed */
				function cycleNews(d){
					if(typeof(d)=="undefined"){
						d = 1;
					}
					active+=d;
					if(active==($("p",theScroller).length)){active=1;}
					if(active<1){active=$("p",theScroller).length-1}
						$("p:visible",theScroller).animate({
							marginTop:((d==1) ? "-10px" : "30px")
							,opacity:0
						},500,"linear",function(){
						$("p:visible",theScroller).hide();
						var newpara = $("p:eq("+active+")",theScroller);
						newpara.get(0).style.marginTop = ((d==1) ? "20px" : "-10px")
						newpara.show();
						newpara.animate({
							marginTop:"10px"
							,opacity:1		
						},500);
					});
				};
				$.ajax({
					type: "GET",
             		 	  	url: urlRSS.get(0).href,
           	      			dataType: "xml",
             			   	success: function(xml) {
							var p;
							var title;
							var tooltip;
						    $("item:lt(5)",xml).each(function(){
						    try{
								title = "";
								try{
									/* namespace handle for "moog news" must be "mn:" */
									title = String($("mn\\:teaser",this).get(0).firstChild.nodeValue);
									if(title==""){title = String($("title",this).get(0).firstChild.nodeValue);}
								}catch(err){
									title = String($("title",this).get(0).firstChild.nodeValue);
								}
								tooltip = title;
								if(title.length > 70){
									title = title.substring(0,70).replace(/ [^ ]*$/," ") + " .. ";
								}
								p = theScroller.appendChild(document.createElement("p")).appendChild(document.createElement("a"));
								p.appendChild(document.createTextNode(title));
								p.href = $("link",this).get(0).firstChild.nodeValue;
								p.parentNode.style.display = "none";

							}catch(err){
			
							}
                     				});
						cycleNews();
						cycleTime = setInterval(function(){cycleNews(1)},4000);
						$("a:has(img):eq(0)",theScroller).bind("click",function(){
							clearInterval(cycleTime);
							cycleNews(-1);
							return false;
						});
						$("a:has(img):eq(1)",theScroller).bind("click",function(){
							clearInterval(cycleTime);
							cycleNews(1);
							return false;
						});
						
        	        	 	}
	    		     	});
			}
		}
	});
};

