// Author: Al Sierra
// Version: 6.30.2008
// Description: AJAX for thought archive screen
var thought = {
	_dataURL: 'scripts/php/get_screen.php',
	_docRef: false,
	_section: false,
	_ext: false,
	_id: false,
	
	Init: function(inDocumentRef,loc,section)
	{
		this._docRef = inDocumentRef;
		this._dataURL = loc+this._dataURL;
		this._section = section;
		this.Update('N',0);
		$('master').style.display = 'block';
	},
	ChangePage: function(pagenumber) 
	{	
	 	$('master').style.display = 'none';
		$('search_working_t').style.display = 'block';
		var sort = $('sorter').value;
	 	var pn = pagenumber;
	 	this.Update(sort,pn);
	},
	Sorter: function() 
	{	
	 	$('master').style.display = 'none';
		$('search_working_t').style.display = 'block';
		var sort = $('sorter').value;
	 	var pn = 0;
	 	this.Update(sort,pn);
	},
	
	Update: function(sort,pagenumber) 
	{	
	 	var msg_data = {};
		msg_data.section = this._section;
		//msg_data.ext = this._ext;
		msg_data.sort = sort;
		msg_data.pagenumber = pagenumber;
		
		new Ajax.Updater('master',this._dataURL+'?s=tarchive', {
			parameters: $H(msg_data).toQueryString(),
			evalScripts: true,
			onComplete: function(){
				$('search_working_t').style.display = 'none';
				$('master').style.display = 'block';
			}				
			});
	}	
}
