function moveNextPage(instance){
	var href="?currentRSSInstance=" + instance;
	RSSAdjustQueryStrings(href,"toNextPage")
}
function movePrevPage(instance){
	var href="?currentRSSInstance=" + instance;
	RSSAdjustQueryStrings(href,"toPrevPage")
}
function rssSubmit(theForm){
	var instance=theForm.elements["RSSInstance"].value;
	var pageSize=theForm.elements["pageSize"].value;
	var placeToStart=parseInt(theForm.elements["placeToStart"].value);
	if(isNaN(placeToStart)){
		alert("Only numbers are allowed");
		}
	else{
		var href="?currentRSSInstance=" + instance +"&placeToStart=" + (pageSize*(placeToStart-1));
		RSSAdjustQueryStrings(href,"toAbsolute");
		}
}
function RSSAdjustQueryStrings(href,action){   
	//Action is a querystring which should be appended
	// [action]=placeToStart[curInstance];
	//Send the client to the current page
	//Preseve any querystrings
	//Result Set Scroller query strings may be in the current page
	//If we add any they should be over-written not appended.
	//Two client side JS arrays should have been placed on the page
	//These are placeToStart and cacheID;
	//alert("RSSAdjustQueryStrings: called");
	var curInstance;
	var actionWithRemove;          
	//alert("href=" + href);
	var newURL=new URLClass(href);               
	var curURL=new URLClass(window._webrUnencodedUrl);      
	var finalURL;
	//alert("RSSAdjustQueryStrings: Parse incomming URLs");
	newURL.parse();
	curURL.parse();	  
	//1) Detemine the current instance as passed in on the query string.
	curInstance=newURL.queryString("currentRSSInstance");
	if(curInstance==null){
		alert("ResultSetScroller:Error: Could not determine current instance.");
		return(false);
		}
	curInstance=parseInt(curInstance);	
	//2) Use the current URL as a base	
	finalURL=new URLClass(curURL.getBaseURL());     
	finalURL.parse();
	//alert("ResultSetScroller: document.href=" + document.location.href);
	//alert("ResultSetScroller: finalURL1=" + finalURL.buildURL());
	//3) Add all query strings from the current location to our final URL  
	finalURL.copyQS(curURL,curInstance); 
	//alert("ResultSetScroller: finalURL:aftercopy=" + finalURL.buildURL());	
	//5) Add the cache id, and the action with the place to start.  All qs names should have RSS instance id
	//   appended so that the server can distinguish the instances. 
	actionWithRemove="_webrRemove_" + curInstance + action;
	if(action=="toAbsolute"){
		//alert("PlaceToStart=" + newURL.queryString("placeToStart"));
		finalURL.addQS(actionWithRemove,newURL.queryString("placeToStart"));  
		}
	else
		finalURL.addQS(actionWithRemove,placeToStart[curInstance]);  
	finalURL.addQS("cacheID" + curInstance,cacheID[curInstance]);  
	if (finalURL.buildURL().indexOf("_webrRemoveQS_sortField")>0)
 		finalURL.removeQS("_webrRemoveQS_sortField");   
	//alert("ResultSetScroller: finalURL=" + finalURL.buildURL());	
	//6) Navigate to that location
	document.location=finalURL.buildURL();
	return(false);
}
