function slide(){window.addEvent('domready', function() {
 
 $('loadingnews').setStyle('display', 'none'); //hides the loadingnews image
 var shelfnews = new Fx.Slide('shelfnews').hide(); //creates new Fx.Slide object from shelfnews div, also the hide() function hides the div when the page loads
 $('addnewsheader').addEvent('click', function(e) { //Adds an onClick event to addnewsheader div
    e = new Event(e); 	
	
	if ($('addnewsheader').hasClass('arrow-down')) { //checks if the sliding direction is down - we dont want to send ajax request when hiding the shelfnews
	$('shelfnews').empty() //empties the shelfnews
	$('loadingnews').setStyle('display', 'block'); //Displays the loadingnews image
	new Ajax ('addnews.htm', //url of file
	 {method: 'get', //method
	  update: $('shelfnews'), // element that will be updated with response
	  onComplete: function() { 
	  $('loadingnews').setStyle('display', 'none'); //Hides the loadingnews image 
	    shelfnews.toggle(); //toggles the shelfnews
		 } 		 
	  }).request(); //sends the request
    }
	else { 
	shelfnews.toggle(); //in case we dont want to send ajax request, we just slide it out
	}
	
    if ($('addnewsheader').hasClass('arrow-down')){
	 $('addnewsheader').removeClass('arrow-down').addClass('arrow-up');
	}
	else {
	 $('addnewsheader').removeClass('arrow-up').addClass('arrow-down');
	}
	
	e.stop(); //this makes sure that the user wont be sent to given url (or that the page refreshes when using dummy url like "#") if the clicked element was a link 
 });

	
});
}