var AuthorManager = Class.create({
	lastRef: 0,
	initialize: function() {
			    
	  	var listElem = $('articleList').select('.articleLine');
  		for (var i = 0; i < listElem.length; i++) {  	
  			listElem[i].observe('click', this.SelectArticle.bindAsEventListener());
  		}
  	 
	},
	SelectArticle: function(event){
		//var item = event.element().select("div").first();
		
		var item = "articleDetails";
		item = item + event.element().id.substring(11);
		
		if(! $(item).visible() ){
			$(item).style.display = "";
		}
		else {
			$(item).style.display = "none";
		}
		
		item = "articleLine";
		item = item + event.element().id.substring(11);
		if($(item).hasClassName('selected')){
			$(item).removeClassName('selected');
		} else {
			$(item).addClassName('selected');
		}
		
		/*if(! $(item.id).visible() ){
			$(item.id).style.display = "";
		}
		else {
			$(item.id).style.display = "none";
		}*/	
	}
});

Event.observe(window,'load', function() {
	new AuthorManager()
});

function deleteArticle(ArticleID) {
	if (confirm("Are you sure you want to delete this article?")) {
		document.location.href = "deleteArticle.htm?articleId=" + ArticleID; 
	}
}