function SortResultGrid()
{
	var SortCombo = getElementsByClassName(document,"select","SearchBoxDropdownCommon_SR");
	if( SortCombo != null && SortCombo[0] != null)
	{
		var SortValue = SortCombo[0].options[SortCombo[0].selectedIndex].value;	 		
		if(SortValue != "--")
		{
			AjaxPro.timeoutPeriod = 60*1000;
			Dtf.WebSite.Default.SortSearchResultGrid(SortValue);			
			__doPostBack('lnkdummy','');			
		}
	}
}
function ChangeGridPageCount()
{
	var PageSizeCombo = getElementsByClassName(document,"select","SearchBoxDropdownCommon_SR");
	if( PageSizeCombo != null && PageSizeCombo[1] != null)
	{
		var PageSizeComboValue = PageSizeCombo[1].options[PageSizeCombo[1].selectedIndex].value;	 		
		if(PageSizeComboValue != " ")
		{
			AjaxPro.timeoutPeriod = 60*1000;
			Dtf.WebSite.Default.ReloadSearchResultGrid(PageSizeComboValue);
			__doPostBack('lnkdummy','');			
		}
	}
}
function FillSortCombo()
{
	var SortCombo = getElementsByClassName(document,"select","SearchBoxDropdownCommon_SR");
	if( SortCombo != null && SortCombo[0] != null)
	{
		AjaxPro.timeoutPeriod = 60*1000;
		Dtf.WebSite.Default.GetSortCollection(CallBackSortCombo);
	}
}
function CallBackSortCombo(result)
{
	var Collection = new Ajax.Web.NameValueCollection();
	if(result != null && result.value[0] != null)
	{
		Collection = result.value[0];
		var SortCombo = getElementsByClassName(document,"select","SearchBoxDropdownCommon_SR")[0];	
		var arrayCount = 0;
		var keys = Collection.getKeys();
		for(var i=0; i < keys.length; i++)
		{
			if(!FindItemByValue(SortCombo,Collection.getValue(keys[i])))
			{
				SortCombo.options[arrayCount] = new Option(keys[i],Collection.getValue(keys[i]));
				arrayCount++;
			}
		}
	}
	if(result != null && result.value[1] != null && result.value[1] != "")
	{
		for(nIndx=0;nIndx<SortCombo.length;nIndx++)
		{
			if(SortCombo.options[nIndx].value == result.value[1])
			{
				nSelectedIndx = nIndx;
			}
		}
		SortCombo.selectedIndex = nSelectedIndx;
	}
	else
		SortCombo.selectedIndex = 0;	
}
function FillPageSizeCombo()
{
	var PageSizeCombo = getElementsByClassName(document,"select","SearchBoxDropdownCommon_SR");
	if( PageSizeCombo != null && PageSizeCombo[1] != null)
	{
		AjaxPro.timeoutPeriod = 60*1000;
		Dtf.WebSite.Default.GetPageSizeCollection(CallBackPageSizeCombo);
	}
}
function CallBackPageSizeCombo(result)
{
	var Collection = new Ajax.Web.NameValueCollection();
	var PageSizeCombo = getElementsByClassName(document,"select","SearchBoxDropdownCommon_SR")[1];	
	if(result != null && result.value[0] != null)
	{
		Collection = result.value[0];
		var arrayCount = 0;
		var keys = Collection.getKeys();
		for(var i=0; i < keys.length; i++)
		{
			if(!FindItemByValue(PageSizeCombo,Collection.getValue(keys[i])))
			{
				PageSizeCombo.options[arrayCount] = new Option(keys[i],Collection.getValue(keys[i]));
				arrayCount++;
			}
		}
	}	
	if(result != null && result.value[1] != null && result.value[1] != "")
	{
		for(nIndx=0;nIndx<PageSizeCombo.length;nIndx++)
		{
			if(PageSizeCombo.options[nIndx].value == result.value[1])
			{
				nSelectedIndx = nIndx;
			}
		}
		PageSizeCombo.selectedIndex = nSelectedIndx;
	}
	else
		PageSizeCombo.selectedIndex = 0;
}
function RedirectToSearchPage(PageUrl)
{
	window.close();	
	window.opener.location.href = PageUrl;
}