var iSelActPage = oIThelp.mGetUrlParam('uap') != '' ? oIThelp.mGetUrlParam('uap') : 1, iSelRecsPerPage = oIThelp.mGetUrlParam('up') != '' ? oIThelp.mGetUrlParam('upp') : 10;

function mUserSearch(iPage, iRecsPerPage){
	var oFrm = theForm ? theForm : document.forms[0], sMenuId = mGetMainParam('menuid'), sModuleId = mGetMainParam('moduleid');
	iPage = iPage ? iPage : 1;
	iRecsPerPage = iRecsPerPage ? iRecsPerPage : 10;
	iSelActPage = iPage;
	iSelRecsPerPage = iRecsPerPage;
	var sUrl = oIThelp.mGetApplicationPath()+'/DesktopDefault.aspx?menuid='+sMenuId+'&backsearch=true&upp='+iRecsPerPage+'&uap='+iPage+'&commod=stdget&s='+document.getElementById('part_of_hbn_people_name').value+'&c='+document.getElementById('part_of_hbn_card_number').value;
	var	sAJAXUrl = oIThelp.mGetApplicationPath()+'/BackEnd.aspx?menuid='+sMenuId+'&amp;moduleid='+sModuleId+'&mode=search&upp='+iRecsPerPage+'&uap='+iPage;
	if(mGetMainParam('communicationmode') == 'ajax')
		mSearchByAJAX(sAJAXUrl, sUrl, oFrm);
	else
		mSearchByStdGET(sUrl, oFrm);
}

function mUserSearchCallBack(oRequest){
	oIThelp.mStopPlainLoading();
	if(oRequest.responseText.contains('<content>'))
		document.getElementById('user_result_section').innerHTML = oIThelp.getCallBackEndContent(oRequest.responseText);
	else alert(oRequest.responseText);
}

function mSearchByAJAX(sAJAXUrl, sUrl, oFrm){
	try{
		var aSIs = document.getElementById('user_search_section').getElementsByTagName('INPUT'), sParams = '';
		for(var p = 0; p < aSIs.length;p++) sParams += (p!=0?'@sep':'') + aSIs[p].id + '@eq'+ oIThelp.mEscape(aSIs[p].value);
		oXMLLib.mCallBackEnd(sAJAXUrl, sParams, mUserSearchCallBack, null);
		oIThelp.mPlainLoading();
	}
	catch(e){
		mSearchByStdGET(sUrl, oFrm);
	}
}

function mSearchByStdGET(sUrl, oFrm){
	window.location = sUrl;
}

function mSetUserPaging(iPage){
	mUserSearch(iPage, document.getElementById('select_recsperpage').value);
}

function mSetUserRecsPerPage(oSender){
	mUserSearch(1, oSender.value);
}

function mGetMainParam(sParam){
	var oB = document.getElementById('us_button');
	return oIThelp.mGetAttribute(oB, sParam);
}

function mShowPeopleDetails(iMenuid, sParam){
	window.location = oIThelp.mGetApplicationPath()+'/DesktopDefault.aspx?menuid='+iMenuid+'&frommode=frompeoplesearch&backsearch=true&upp='+iSelRecsPerPage+'&uap='+iSelActPage+'&'+sParam+'&referrermenuid='+mGetMainParam('menuid')+'&s='+document.getElementById('part_of_hbn_people_name').value+'&c='+document.getElementById('part_of_hbn_card_number').value;
}


