//$Id $

function deleteReports(url)
{
    var editReportsForm = document.editReports;
    var len = editReportsForm.elements.length;
    var selectedEntity = '';
    for ( var i=0; i < len; i++)
    {
        formElement = editReportsForm.elements[i];
        if (formElement.type == "checkbox" && formElement.name == 'rowSelection' && formElement.checked == true)
        {
            if(selectedEntity == '')
            {
                selectedEntity = formElement.value;
            }
            else
            {
                selectedEntity = selectedEntity+','+formElement.value;
            }
        }
    }
    alert(selectedEntity);
    location.href = "/report/CustomizeReports.do?type="+url+"&selectedRows="+selectedEntity;
}

function Preferences(count,period)
{
    location.href="/report/Preferences.do?ReportsLength="+count+"&ReportsPeriod="+period;
}

function Preferences(count,period,indReports,moType,Type,pdName,units)
{
    if(units=='%')
    {
        units="Percentage";
    }
    location.href="/report/Preferences.do?ReportsLength="+count+"&ReportsPeriod="+period+"&reportsPage="+indReports+"&moType="+moType+"&type="+Type+"&pdName="+pdName+"&units="+units;
}

function exportReports(count,period,indReports,moType,type,pdName,units,fileType)
{
    if(units=='%')
    {
        units="Percentage";
    }
	window.open("/report/PDFReports.do?ReportsLength="+count+"&ReportsPeriod="+period+"&reportsPage="+indReports+"&moType="+moType+"&type="+type+"&pdName="+pdName+"&units="+units+"&fileType="+fileType,"PDFFormat","height=500,width=750,resizable=yes,menubar=yes,toolbar=yes,scrollbars=yes");
}

function addReports()
{
    //window.open("/report/AddReports.do","AddReports","height=350,width=450,resizable=no,menubar=no,toolbar=no");
    location.href="/report/AddReports.do";
}
function AddPO()
{
	location.href="/report/AddPollingObjectValues.do?toPerform=userProperties";
}
function ModifyPO()
{
	location.href="/report/UpdatePollingObjects.do?toPerform=fillUpDetails&list_oid=none";
}
function getPollingObjectDetails(poName)
{
	location.href("/report/ModifyPollingObjects.do?poName="+poName);
}
function DeletePO()
{
    var left = Math.floor( (screen.width - 400) / 2);
    var top = Math.floor( (screen.height - 200) / 2);
    window.open("/report/DeletePollingObjects.do","Delete_Polling_Objects","height=180,width=400,resizable=no,top="+top+",left="+left);
}
function removePollingObject(index)
{    
    location.href="/report/DeletePollingObjects.do?reqType=delete&poName="+index;
}
