$(document).ready(function()
{
		// ajax to retrieve xml for press
		function get_press(year, id, type){

			$(id).empty();
		
	        $.get('includes/'+type+'_'+year+'.xml', function(d){
	        	        
				i = 1;
				
		        $(d).find('article').each(function(){
	
		            var $article = $(this); 
		            var date = $article.find('article_date').text();
		            var title = $article.find('article_title').text();
		            var subtitle = $article.find('article_subtitle').text();
		            
		            var content = $article.find('article_content').text();
					var html = '<p class="xml_date">'+date+'</p>';
		            html += '<h3 id="arrow'+i+'">'+title+'</h3>';
		            html += '<div><span class="loadingPic" alt="Loading" /></div>';
		            html += '<h4>' + subtitle + '</h4>';
		            html += '<div id="description'+i+'" class="description">'+content+'</div>';
		
		            $(id).append($(html));
		            
		            $('.loadingPic').fadeOut(1400);
		            		            
		            i++;
		            
		        });
		        
	            initShowHide();
		    });
	    };
	    
	    
	    // navigation for years
	    
	    $("#dates_filter li").each(function()
		    {
			    $(this).click( function(){
			    	var clicked_year = this.id;
			    	get_press(clicked_year, id_container, type_news);
			    }).hover(
			    		function(){
							$(this).css({'color' : '#0088bb'});
							document.body.style.cursor= 'pointer';
							},
						function(){
							$(this).css({'color' : '#444444'});
							document.body.style.cursor= 'default';
						}
				);
			}
		);	    

		// call current year xml to init page
	    get_press(init_year, id_container, type_news);
	    
});
	
	
