
	
	jQuery(document).ready(
		function()
		{
			jQuery("div.aggregator, div.aggregator div").disableSelection();

			jQuery(".text_content_up_arrow, .text_content_down_arrow, .media_content_down_arrow, .media_content_up_arrow").disableSelection(); 

			jQuery('#dock2').Fisheye(
				{
					maxWidth: 18,
					items: 'a',
					itemsText: 'span',
					container: '.dock-container2',
					itemWidth: 80,
					proximity: 60,
					alignment : 'center',
					valign: 'bottom',
					halign : 'center'
				}
			);

/*			jQuery("div.nav").hover(
				function() {
					jQuery("div.body")
						.stopAll()
						.animate({opacity:"0.3"},500) 
						.css("opacity", "0.3")
						.css("overflow","visible");
				},
				function() {
					jQuery("div.body")
						.stopAll()
						.animate({opacity:"0.3"}, 500)
						.animate({opacity:"1.0"},500) 
						.css("opacity", "1.0");
						.css("overflow","visible");				
				}													
			);														*/

			jQuery("li.item")
				.stopAll()
				.css("display","none");
			jQuery("li.item div")
				.stopAll()
				.css("opacity", "0.0");


			jQuery("div.nav_about").hover(
				function () {
					jQuery("div.nav_ministries li.item div, div.nav_connect li.item div")
						.stopAll()
						.animate({opacity:"0.0"}, 1);
					jQuery("div.nav_ministries li.item, div.nav_blog li.item, div.nav_connect li.item div")
						.stopAll()
						.css("display","none");

					jQuery("div.nav_about li.item")
						.stopAll()
						.css("display","block");
					jQuery("div.nav_about li.item div")
						.stopAll()
						.css("opacity", "0.0")
/*						.animate({ opacity: 0.0}, 600)					*/
						.animate({ opacity: 1.0}, 300);
						
				}, 
				function () {
					jQuery("div.nav_about li.item div")
						.stopAll()
						.animate({ opacity: 0.0}, 200)
						.css("display","none")
					jQuery("div.nav_about li.item")
						.stopAll()
						.animate({ display: "block"}, 250)
						.stopAll()
						.css("display","none");
				}
			);

			jQuery("div.nav_connect").hover(
				function () {
					jQuery("div.nav_ministries li.item div, div.nav_connect li.item div, div.nav_about li.item div")
						.stopAll()
						.animate({opacity:"0.0"}, 1);
					jQuery("div.nav_ministries li.item, div.nav_about li.item, div.nav_connect li.item")
						.stopAll()
						.css("display","none");

					jQuery("div.nav_connect li.item")
						.stopAll()
						.css("display","block");
					jQuery("div.nav_connect li.item div")
						.stopAll()
						.css("opacity", "0.0")
/*						.animate({ opacity: 0.0}, 600)					*/
						.animate({ opacity: 1.0}, 300);
				}, 
				function () {
					jQuery("div.nav_connect li.item div")
						.stopAll()
						.animate({ opacity: 0.0}, 200);
					jQuery("div.nav_connect li.item")
						.stopAll()
						.animate({ display: "block"}, 250)
						.stopAll()
						.css("display","none");
				}
			);

			jQuery("div.nav_ministries").hover(
				function () {
					jQuery("div.nav_ministries li.item div, div.nav_connect li.item div, div.nav_about li.item div")
						.stopAll()
						.animate({opacity:"0.0"}, 1);
					jQuery("div.nav_ministries li.item, div.nav_connect li.item, div.nav_about li.item")
						.stopAll()
						.css("display","none");

					jQuery("div.nav_ministries li.item")
						.stopAll()
						.css("display","block");
					jQuery("div.nav_ministries li.item div")
						.stopAll()
						.css("opacity", "0.0")
/*						.animate({ opacity: 0.0}, 600)					*/
						.animate({ opacity: 1.0}, 300);
				}, 
				function () {
					jQuery("div.nav_ministries li.item div")
						.stopAll()
						.animate({ opacity: 0.0}, 200);
					jQuery("div.nav_ministries li.item")
						.stopAll()
						.animate({ display: "block"}, 250)
						.stopAll()
						.css("display","none");
				}
			);



			var aggregator_feeds_x = 0;
			var aggregator_feeds_y = 0;
			var max_x = jQuery("div.aggregator_feed_single").size();
			var max_y = Array();

			jQuery("div.aggregator_feed_single").each(
				function (index, domEle) {
					max_y[max_y.length] = jQuery(domEle).children().size();
				});
				
			/* Handle mouseover cursors here */
			jQuery("div.aggregator_side_nav_up_arrow")
				.click(function() {
					if (aggregator_feeds_y == 0) return;
					aggregator_feeds_y += 2;
					jQuery("div.aggregator_feeds").animate({top: aggregator_feeds_y*72}, 200);
				});
			jQuery("div.aggregator_side_nav_down_arrow")
				.click(function() {
					if (-aggregator_feeds_y >= max_y[-aggregator_feeds_x]-4 ) return;
					aggregator_feeds_y -= 2;
					jQuery("div.aggregator_feeds").animate({top: aggregator_feeds_y*72}, 200);
				});
			jQuery("div.aggregator_bottom_nav_left_arrow")
				.click(function() {
					if (aggregator_feeds_x == 0) return;
					aggregator_feeds_x += 1;
					jQuery("div.aggregator_feeds").animate({left: aggregator_feeds_x*210}, 200);

					if (-aggregator_feeds_y > max_y[-aggregator_feeds_x]) {
						aggregator_feeds_y = 0
						jQuery("div.aggregator_feeds").animate({top: 0}, 200);
					}
					
					jQuery("div.aggregator_bottom_nav_text").text(jQuery("div.aggregator_feed_single")[-aggregator_feeds_x].id);

				});
			jQuery("div.aggregator_bottom_nav_right_arrow")
				.click(function() {
					if (aggregator_feeds_x <= -max_x + 1) return;
					aggregator_feeds_x -= 1;
					jQuery("div.aggregator_feeds").animate({left: aggregator_feeds_x*210}, 200);

					if (-aggregator_feeds_y > max_y[-aggregator_feeds_x]) {
						aggregator_feeds_y = 0
						jQuery("div.aggregator_feeds").animate({top: 0}, 200);
					}
					jQuery("div.aggregator_bottom_nav_text").text(jQuery("div.aggregator_feed_single")[-aggregator_feeds_x].id);
				});


			var text_content_height = jQuery("div.text_content").height();
			var text_content_wrapper_height = jQuery("div.text_content_wrapper").height();
			var text_content_offset = 0;
			var text_content_offset_increment = 100;
			
			if (text_content_height >= text_content_wrapper_height) {
				jQuery("div.text_content_up_arrow")
					.click(function() {
						if (text_content_offset > 0) {
							text_content_offset -= text_content_offset_increment;

							jQuery("div.text_content")
								.stopAll()
								.animate({top: -text_content_offset}, 200);
						}
					});
				jQuery("div.text_content_down_arrow")
					.click(function() {
						if (text_content_height - text_content_offset >= text_content_wrapper_height) {
							text_content_offset += text_content_offset_increment;
							
							jQuery("div.text_content")
								.stopAll()
								.animate({top: -text_content_offset}, 200);
						}
					});
			}
						
						
					

		}
	);