var arrDisAbleControl  = new Array();
var arrOnclickFunction = new Array();
var intDisAbleControl = 0;

function fnGetAjaxPagination(strContentId, intLimit, intPage, strFuseName,enmLoading)
{ 
	if (strContentId != "" && parseInt(intLimit) > 0 && parseInt(intPage) > 0)
	{
		if (enmLoading)
		{
			/*
			WRITE THIS FUNCTION IN YOUR CLASS JAVASCRIPT FILE
			*/
			fnAjaxPaginationLoader(strContentId);
		}

		/* DISABLE ALL PAGINATION OBJECTS */
		fnChangeObjectStatus('disable');
		
		ajaxObjects[0] = new sack();
		if (strFuseName.indexOf("?") == -1)
			ajaxObjects[0].requestFile = sitename+"/index.php?action="+strFuseName+"&mode=ajax&ajax_action=ajaxpagination&limit="+intLimit+"&page="+intPage;
		else
			ajaxObjects[0].requestFile = sitename+"/"+strFuseName+"&mode=ajax&ajax_action=ajaxpagination&limit="+intLimit+"&page="+intPage;
		ajaxObjects[0].onCompletion = function(){ 
													document.getElementById(strContentId).innerHTML = ajaxObjects[0].response;
													document.getElementById(strContentId).style.display = "";
													fnChangeObjectStatus('enable');
												}
		ajaxObjects[0].runAJAX();
	}
}

function fnChangeObjectStatus(strAction)
{
	if (arrDisAbleControl.length ==0)
		return "";
	
	for (intLength = 0; intLength <= intDisAbleControl; intLength++)
	{
		if (strAction == "disable")
		{
			try
			{
				arrOnclickFunction[intLength] = document.getElementById(arrDisAbleControl[intLength]).onclick;
				document.getElementById(arrDisAbleControl[intLength]).onclick = "";
			}
			catch(e)
			{
				arrOnclickFunction[intLength] = "";
			}
		}
		else if (strAction == "enable")
		{
			if (arrOnclickFunction[intLength] != "")
			{
				try
				{
					document.getElementById(arrDisAbleControl[intLength]).onclick = arrOnclickFunction[intLength];
				}
				catch (e)
				{
				}
			}
		}
	}
}

