function goTo(page){
	window.location = page;
}
$(document).ready(function(){	
        //convert richtext popup images to fancybox images
        $(".intLeftMain a").each(function(){
            var href = $(this).attr("href");
            if(href != undefined){
                var index = href.indexOf("viewImage");
                if(index > -1){
                   href = href.replace("javascript:viewImage('", "");
                   href = href.replace("')","");
                   $(this).attr("href", href);
                   $(this).addClass("single_image"); 
                }
            }
        });
        $("a.single_image").fancybox();
        //end convert richtext popup images to fancybox images
        //first level hover
	    $('.aNavName').hover(
	        function()
	        {
		        $(this).children(".menus").stop().css({'display':'block', 'top':'39px'}).animate(
		        {
			        opacity: 1,
			        left: 0
			        //children hover
		        }, "fast").children().hover(
		            
		            function()
		            {
		                $(this).parent().css({'filter':'none'});
		                $(this).addClass('navItemHover');
		                $(this).children('.menuExtra').stop().css({'display':'block', 'top':'0px'}).animate({
			                opacity: 1,
			                left: 0
		                }, "fast");
		            },
		            //children hover out
                    function(){
                        $(this).removeClass('navItemHover');
                        $(this).children('.menuExtra').stop().animate({
	                        opacity: 1,
	                        left: 0
                        }, "fast").animate({
	                        top: -1000
                        }, 2);
                    }
                    //end children hover out
                );
                //end children hover
	        },
	        //first level hover out
	        function(){
		        $(this).children(".menus").stop().animate({
			        opacity: 0,
			        left: 0
		        }, "fast").animate({
			        top: -1000
		        }, 2);
	        }
	        //end first level hover out
	    );
	    //end first level hover	
	
		//NAVAGATION ADD 2 CORNERS	
		$('#navHolder .aNavName').hover(function(){
			$(this).find('.aNavName').css('color','#ccc09b')
		}, function(){
			$(this).find('.aNavName').css('color','#fff')
		});
	//Remove Img if it's empty
	$('.intContent .intMiddle .imgMiddle img').each(function(){
		var imgSrc = $(this).attr("src");
		if(imgSrc == "")
			$(this).parent().remove();
	});
		
	
	$('.intNavItem').hover(function(){
		$(this).addClass('subnav_hover')
	}, function(){
		$(this).removeClass('subnav_hover')
	});
	
	$("#current_weather").fancybox({
		'width'				: 575,
		'height'			: 600,
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'scrolling'			: 'no'
	});
	
	$('#features').jshowoff({ 
		controls: false,
		links: true,
		speed: 9000,
		hoverPause: false
	}); 
	
	$('#leftNav ul li.Selectedtrue a').before('<img src="/images/longArrow.png" />');
	
	$('#features').after('<div class="sliderNavLine"></div>');
	
	//MAIN NAVAGATION DROP DOWN
	$('.navItemArrow').each(function(){
		var itemWidth = $(this).width();
		var holderLeft = (itemWidth / 2) - 26;
		$('.mainDDholder', this).stop().css({'top': '0', 'display':'block', 'opacity': 0, 'left':holderLeft + "px"});
	});
	$('.navItemArrow').hover(
		function() {
			$(this).removeClass("navItemArrow");
			$('.mainDDholder', this).stop().css({'display':'block'});
			$(this).children(".mainDDholder").stop().animate({top: 20, opacity: 1});			
		},
		function() { 
			$(this).addClass("navItemArrow");
			$(this).children(".mainDDholder").stop().animate({top: 0, opacity: 0}).css('display', 'none');			
	});
	
	$("a#aServiceTime").fancybox();
	
	$('.sermonNotes').click(function(){
		$(this).parent().parent().siblings('.sermonDescription').slideToggle('fast');
		$(this).parent().parent().parent('.sermonElement').toggleClass('bg');
	});
	
});
