/**
 * @author Ie Ling Tjam
 */
// Requires ajaxbase.js
var mcsHandle = null;
 
SearchContentServices.prototype = new Ajax();
 
 function SearchContentServices()
 {
 	this.method = "POST";
	this.headerName = "content-type";
	this.headerValue = "application/x-www-form-urlencoded; charset=UTF-8";
	this.url="";
	this.content="";
	this.registry = new Array();
	mcsHandle = this;
}
 
SearchContentServices.prototype.handleGetSearchContentPost = function() 
{
	if(mcsHandle.xmlHttp.readyState == 4) 
	{
		//if(mcs.xmlHttp.status != 200)
			//alert("xmlHttpStatus: " + mcs.xmlHttp.status );
		mcsHandle.registry[0](mcsHandle.xmlHttp.responseXML, mcsHandle.xmlHttp.status == 200);
		mcsHandle.registry[0] = null;
	}
};

SearchContentServices.prototype.postGetSearchContent = function(
		searchString, 
		mediaType, 
		periodType, 
		sortBy,
		currentPage, 
		pageSize, 
		maxPages,
		isDescendingOrder,
		isGeneralAudience,
		categoryID,
		tagOnly, 
		callback) 
{
	this.registry[0] = callback;
	this.url = "/WebAPI/InvokeCMS/CMSWebSearchContent/GetSearchContent";
	this.content = 	"pSearchString="		+ searchString; 
	this.content += "&pMediaType=" 			+ mediaType;
	this.content += "&pPeriodType=" 		+ periodType;
	this.content += "&pSortBy=" 			+ sortBy;
	this.content += "&pCurrentPage="		+ currentPage;
	this.content += "&pPageSize="			+ pageSize;	
	this.content += "&pMaxPages="			+ maxPages;		
	this.content += "&pIsDescendingOrder="	+ isDescendingOrder;
	this.content += "&pIsGeneralAudience=" 	+ isGeneralAudience;	
	this.content += "&pCategoryID=" 		+ categoryID;
	this.content += "&pTagOnly="			+ tagOnly;
	this.send(this.method, this.url, this.headerName, this.headerValue, null, null, this.content, this.handleGetSearchContentPost);
};