//////////////////////////////////////////////////////
//
//	The purpose of this file is to
//	apply a hover class on mouseover
//	on the <li> elements in the nav.
//	This is because IE doesn't put
//	the pseudo class :hover on <li> elements
//
//	This is code that uses the
//	jquery javascript library (http://jquery.com/)
//
//////////////////////////////////////////////////////
$(document).ready(function() {
	if (document.all&&document.getElementById) {
		// this is needed for the IE 6 pseudo hover class bug
		$(".navtop li").hover(function () {
			$(this).addClass("hover");
		},function () {
			$(this).removeClass("hover");
		});
	} else {
		// this is need for safari when nav covers flash
		$(".navtop li ul").hover(function () {
			$(this).addClass("redraw");
		},function () {
			$(this).removeClass("redraw");
		});
	}
	
	/*$(".question").click(function () {
		$(this).toggleClass("open");
		$(this).siblings(".answer").slideToggle();
	});*/
	$(".question").click(function () {
		var a = $(this).next('.answer');
		if(a.length > 0)
		{
			a.toggleClass("open");
			a.slideToggle();
		}
		return false;
	});
	
	
	var myfeed = $(".feed ul");
	if (myfeed.length > 0){
		jQuery.getFeed({
		   url: 'cmsxml/News.rss',
		   dataType: ($.browser.msie) ? "text" : "xml",
		   success: function(feed) {
			   var length = feed.items.length;
			   var theHTML = "";
				for(var x = 0; x < length; x++ )
				{
					theHTML = theHTML + '<li><a href="' + feed.items[x].link + '">' + feed.items[x].title + '</a><br/><p>' + feed.items[x].description + '</p><p><a class="more" href="' + feed.items[x].link + '"> Read More</a></li>'
					var bob = feed.items[x];
				}
				myfeed.html(theHTML);
				}
			});
		
	}
		
	
	var numPImages = $('.quote > div').length;
	if ( $('.quote > div').length > 0) {
		var randomnumber=Math.floor(Math.random()*numPImages);
		$($('.quote > div')[randomnumber]).addClass('showquote');	
	}
	
});



