// JavaScript Document
function getXmlHttpRequestObject (){
    if (window.XMLHttpRequest){
        return new XMLHttpRequest ();
    }else if(window.ActiveXObject){
        return new ActiveXObject ("Microsoft.XMLHTTP");
    }else{
        document.getElementById ( "body" ).innerHTML = 'Status: Cound not create XmlHttpRequest Object. Consider upgrading your browser.';
    }
}
  
 function showFullArticle(id, title, tags, description) {
	document.fullArticle.articleId.value = id;
	document.fullArticle.tags.value = tags;
	document.fullArticle.description.value = description;
	document.fullArticle.title.value = title;
	document.fullArticle.submit();	
 }
 
 function firstPage() {
	document.paging.displayCounter.value = 0;
	document.paging.submit();	
}

function previousPage(counter, step) {
	if(counter > 0) {
		document.paging.displayCounter.value = counter - step;
	}
	document.paging.submit();	
}

function nextPage(counter, totalRows, step) {
	if((totalRows - counter) > step) {
		document.paging.displayCounter.value = counter + step;
	}
	document.paging.submit();
}

function lastPage(totalRows, step) {
	if(totalRows <= step) {
		previousPage(0, step);	
	} else {
		nextPage(totalRows - (step*2), totalRows);	
	}
}
 
