	$(function() {			   
	
	
	/* Home Image Banner */	
				
		if ($('#home-banner img').length > 1) {
					
			$('#home-banner') 
			//.after('<div id="home-banner-pager">') 
			.cycle({ 
				fx:     'fade', 
				speed:  'slow', 
				timeout: 5000, 
				//pager:  '#home-banner-pager',
				next:   '#next', 
				prev:   '#prev'
			});
		}
		
	/* toggle top bar dialog boxes */		
		
		$('.search-header').mouseenter(function() {
			$(this).parent().find('.content').slideDown('slow');	
			$(this).removeClass('closed').addClass('open');
		});

		$('#company-search').mouseleave(function() {
			$(this).find('.content').slideUp('slow');	
			$(this).parent().find('.search-header').removeClass('open').addClass('closed');
		});		
		
		/*$('.login-header').click(function(){
			$(this).parent().find('.content').slideToggle('slow');
			
			if ($(this).hasClass('open')) {
				$(this).removeClass('open').addClass('closed');
			} else {
				$(this).removeClass('closed').addClass('open');
			}
			
		})*/
	
	
	/* top navigation */
	
		$('#top-nav li').hover(		
			function(){
				$(this).find('ul:first').show(100).stop(0, 1);
			}, 
			function(){
				$(this).find('ul:first').hide();	
			}		
		)
		
	/* News Feed */	
		
		totalNewsItems = $('.news-item').length;
		totalEle = totalNewsItems;
		currentIndex = 0;
		
		$('.news-item').each(function(){			
			totalNewsItems = totalNewsItems - 1;			
			$(this).css('z-index', totalNewsItems);
		})		
		$('#news-feed-controller .next').click(function(){
			if (!(currentIndex == (totalEle -1))) {
				$('.news-item:eq('+currentIndex+')').fadeOut(250);			
				currentIndex++;
			}
		})		
		$('#news-feed-controller .prev').click(function(){
			if (!(currentIndex == 0)) {
				currentIndex--;
				$('.news-item:eq('+currentIndex+')').fadeIn(500);		
			}			
		})
		
		$('#tabs').tabs();
		$('#accordion').accordion({active: 2 });
		
		$("#add-to-fav").click(function() {
			url = 'http://www.dairygold.ie';
			name = 'Diarygold Corporate';
			
			if (window.sidebar) { // FF
				window.sidebar.addPanel(name, url, "");
			}
			else if (window.external) { // IE
				window.external.AddFavorite(url, name);
			}
			else if (window.opera && window.print) {
				window.external.AddFavorite(url, name);
			}
			else {
				alert('not supported');
			}			
		});
				
	})
	
	/* form text  */
		

