/*******************************************************************************
'	Function Name		fnSetEnterClick				
'
'	Description			This function handles the enter key press. If enter key  
'						is pressed, it calls the click event of the control 
'						passed to it
'
'	Modification Log
'
'   Date														Modification 
' 	09-Nov-2006			Archana Amaragandhi[Infosys]            Initial Version
'*******************************************************************************/

function fnSetEnterClick(obj,ControlToHandle)
{

	var ctl = ControlToHandle;
    if(event.keyCode == 13)
    {
		document.getElementById(obj + ctl).click();
		event.returnValue=false;
    }
}

/*******************************************************************************
' Function Name			fnHideSummary
'
' Description			Used for setting the input variable for hiding the data.
'
' Modification Log
'
'   Date														Modification 
' 	09-Nov-2006			Archana Amaragandhi[Infosys]            Initial Version
'*******************************************************************************/
function fnHideSummary(ucName,sShowSummary,sHideSummary)
{
	var cellCount;
	var iCounter1;
	var iCounter2
	var iCellItemCount;
	var iCellItem;
	var iCellChildren;
	var hiddenInput;

	if(document.getElementById(ucName+"_dgResults"))
	{
		//cellCount = document.getElementById(ucName+"_dgResults").cells.length;
		hiddenInput = document.getElementById(ucName+"_hideState");
		
		if (hiddenInput.value != "hide")
		{
			hiddenInput.value = "hide";
		}
		else
		{
			hiddenInput.value = "show";
		}			
			fnTakeHideAction(ucName,sShowSummary,sHideSummary);
			return false;
	}
}
	
/*******************************************************************************
' Function Name		fnTakeHideAction
'
' Description		Used for hiding the description section of the search.
'
' Modification Log
'
'   Date														Modification 
' 	09-Nov-2006			Archana Amaragandhi[Infosys]            Initial Version
'*******************************************************************************/
function fnTakeHideAction(ucName,sShowSummary,sHideSummary)
{
	var cellCount;
	var iCounter1;
	var iCounter2
	var iCellItemCount;
	var iCellItem;
	var hiddenInput;
	var gridTable;
	var tdElements;
	var divElements;

	if(document.getElementById(ucName+"_dgResults"))
	{
		gridTable = document.getElementById(ucName+"_dgResults");		
		tdElements = gridTable.getElementsByTagName('TD');
		cellCount= tdElements.length;

		hiddenInput = document.getElementById(ucName+"_hideState");
		
		var summaryLink = document.getElementById(ucName+"_hideSummaryLink");
				
		if(hiddenInput.value != "hide")
			summaryLink.innerHTML = sHideSummary;
		else
			summaryLink.innerHTML = sShowSummary;
		
		for (iCounter1=0; iCounter1<cellCount; iCounter1++)
		{
			iCellItem = tdElements[iCounter1];
			divElements = iCellItem.getElementsByTagName('DIV');
			iCellItemCount=divElements.length;
		
			for(iCounter2=0; iCounter2<iCellItemCount; iCounter2++)
			{
					if(hiddenInput.value == "hide")
					{
						divElements[iCounter2].style.display = "none";
					}
					else
						divElements[iCounter2].style.display = "inline";
			}
		}
	}
}