function confirm_action(strAction)
{
	return (confirm("Are you sure you want to " + strAction + " this entry?"))
}

function openReportWin(FilePath) 
{
	window.open(FilePath,'NoName','directories=no,location=no,menubar=yes,resizable=yes,status=no,toolbar=no,scrollbars=yes,width=750,height=550,left=10,top=10');
}	

function setGenerate(value)
{
	document.getElementById('hidGenerate').value = value;
}

function catchKeyDown(btn, event)
{
	if (document.all)
	{
		if (event.keyCode == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
	else if (document.getElementById)
	{
		if (event.which == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
	else if(document.layers)
	{
		if(event.which == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
}

//-----------------------------------------------------------------------------------

function RowSelectorColumn_VerifySingleBox(gridName, sAction, event) {
    if ( typeof( document.getElementById ) == "undefined" ) return;
    var parentName = getIdForSelector(gridName);
	var parentCheckBox = document.getElementById(parentName);
    if ( parentCheckBox == null || typeof( parentCheckBox.participants ) == "undefined" ) {
        return;
    }
    var iC = new Number;
    iC = 0;
    var participants = parentCheckBox.participants;
    for ( var i=0; i < participants.length; i++ ) {
        var participant = participants[i];
        if ( participant != null ) {
            
            if (participant.checked) {iC++;};
        }
    }
    
    if (iC==1)
    {
		document.frmDefault.FormAction.value=sAction;
		document.frmDefault.submit();
	}
	else
		{
			event.returnValue=false;
			event.cancel = true;
			if (iC==0) alert("Please, select file");
			else alert("Please, select only one file");
		}	

    return false;
}

function RowSelectorColumn_ConfirmDelete(gridName, sAction, event) {
    

    if ( typeof( document.getElementById ) == "undefined" ) return;

    var parentName = getIdForSelector(gridName);
	var parentCheckBox = document.getElementById(parentName);
    if ( parentCheckBox == null || typeof( parentCheckBox.participants ) == "undefined" ) {
        return;
    }
    var iC = new Number;
    iC = 0;
    var participants = parentCheckBox.participants;
    for ( var i=0; i < participants.length; i++ ) {
        var participant = participants[i];
        if ( participant != null ) {
            
            if (participant.checked) {iC++;};
        }
    }
    if (iC>0)
    {
		bConfirmed = window.confirm( iC + ' Files will be deleted. Click OK to delete files')
		if (!bConfirmed)
		{
			event.returnValue=false;
			event.cancel = true;
		}
		else
		{
			document.frmDefault.FormAction.value=sAction;
			document.frmDefault.submit();
		}
	}
else
{
	alert("No files selected")
	event.returnValue=false;
	event.cancel = true;
}	

}

		function getIdForSelector(gridName)
	{
		var sControlName1 = '';
		for (i = 0; i < 100; i++) 
		{                        
			try
			{
			var parent = document.getElementById(gridName + '__ctl' + i + '_RowSelectorColumnAllSelector');
			sControlName1=parent.name;
			sControlName1 = gridName + '__ctl' + i + '_RowSelectorColumnAllSelector' ;//parent.name
			break
			}
			catch(e)
			{sControlName1 = ''	}
		}
		return sControlName1;
	}

