﻿function displayReportDetails(e)
{
    var clickEvent;
    var eventSourceElement;
    
    if(window.event)
    {
        eventSourceElement =window.event.srcElement;
    }
    else
    {
        eventSourceElement = e.target;
    }
    
    
    var idSplit = eventSourceElement.parentNode.cells[0].firstChild.id.split("_");
    //var currentPath = window.location.pathname.toLowerCase();
    //displayDialog(((currentPath.indexOf("sample/order.aspx") > 0 )?"../":"") + "ReportDetails.aspx?reportId=" + idSplit[1] ,"ReportDetails");
    displayDialog("ReportDetails.aspx?reportId=" + idSplit[1] ,"ReportDetails");
}

function displayDialog(urlTarget, wName) 
{
	if (window.showModalDialog) 
	{
		window.showModalDialog(urlTarget,wName, "dialogWidth:500px;dialogHeight:300px;scroll:no;status:no;resizable:no");
	} 
	else 
	{
		window.open(urlTarget,wName, 'height=4300,width=500,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no ,modal=yes');
	}
} 

       
function reTallyCustomReportPrices()
{
        var customizationTotal = parseInt(document.getElementById('inputCustomization').value);
        var customReportsTable = document.getElementById('bundleTable_Custom');
        //hiddenCustomizationCount
        var totalsTable = document.getElementById('totalsTable');
        var metaTotalsRow = totalsTable.rows[totalsTable.rows.length -1];
        var customizationTotalsRow = totalsTable.rows[totalsTable.rows.length -2];
        var totalCustomReports=parseInt(document.getElementById('hiddenCustomizationCount').value); // - (customReportsTable.rows.length - 2);
        
        for(var j=1;j <= customReportsTable.rows.length - 1;j++)
        {
            var oCB = findCheckBoxInCell(customReportsTable.rows[j].cells[0]);
            if(oCB.checked)
            {
                totalCustomReports++;
                var reportPriceTextBox = findInputInCell(customReportsTable.rows[j].cells[1], "text") 
                var reportGuid = reportPriceTextBox.id.split("_")[1];
                var originalPriceInput = document.getElementById('customReportPriceBeforeChange_' + reportGuid);
                var originalPriceValue = 0;
                
                if(originalPriceInput)
                {
                    originalPriceValue = parseInt(originalPriceInput.value);
                }
                
                var reportPriceValue = parseInt(reportPriceTextBox.value);
                if(isNaN(reportPriceValue))
                {
                    reportPriceValue = 0;
                    reportPriceTextBox.value = 0;
                }
                
                
                customizationTotal +=  reportPriceValue - originalPriceValue;
            }
        }
        
        setCellContent(customizationTotalsRow.cells[1], totalCustomReports);
        setCellDollars(customizationTotalsRow.cells[2], customizationTotal);
        setCellDollars(customizationTotalsRow.cells[5], customizationTotal);
        
        var totPrice = 0;
        var totalReportCount = 0;
        var totalGrossPrice = 0;
        for(var i=1;i <= totalsTable.rows.length - 2;i++)
        {
            totPrice+=getCellInt(totalsTable.rows[i].cells[5]);
            totalReportCount+=getCellInt(totalsTable.rows[i].cells[1]);
            totalGrossPrice+=getCellInt(totalsTable.rows[i].cells[2]);
        }
        
        setCellContent(metaTotalsRow.cells[1], totalReportCount);
        setCellDollars(metaTotalsRow.cells[2], totalGrossPrice);

        setCellDollars(metaTotalsRow.cells[5], totPrice);
        


}

function seeSalesRep()
{
    alert("To place order contact your sales rep or info@gdmllc.com");

}

function downloadSampleOrderPdf()
{
    processOrder(true, true);

}

function downloadOrderPdf()
{
    processOrder(true, false);
}

function customizeOrder()
{
    processOrder(false, false);

}

function processOrder(isPdfDownload, isSample)
{

    var isValid = validatedOrderForm();

    if(isValid)
    {
                   
        //create form, add inputs, submit
        var orderForm = document.createElement("FORM");
        //orderForm.action ="ProcessOrder.aspx?stage=customize";
        orderForm.action = (isSample?"../":"") + "ProcessOrder/ProcessOrder.aspx?stage=" + (isPdfDownload?"createpdf":"customize");
//        orderForm.action ="zViewFormSubmission.aspx?stage=customize";
        orderForm.method="POST";
        orderForm.name = "OrderForm";
        
        //DateRange
        var oDateRange = document.createElement("input");
        oDateRange.type="hidden";
        oDateRange.value=document.getElementById("inputDateRange").value;
        oDateRange.name="DateRange";
        
        //ClientName
        var oClientName = document.createElement("input");
        oClientName.type="hidden";
        oClientName.value=document.getElementById("inputClientName").value;
        oClientName.name="ClientName";
        
        //SalesRep
        var oSalesRep = document.createElement("input");
        oSalesRep.type="hidden";
        oSalesRep.name="SalesRep";
        oSalesRepSelect = document.getElementById("selectSalesRep");
        oSalesRep.value=oSalesRepSelect.options[oSalesRepSelect.selectedIndex].value;
      
        
        //selectedReports
        var oSelectedReports = document.createElement("input");
        oSelectedReports.type="hidden";
        oSelectedReports.name="selectedReports";
        oSelectedReports.value="";
        
        orderForm.appendChild(oDateRange);
        orderForm.appendChild(oClientName);
        orderForm.appendChild(oSalesRep);


        var customReportTable = document.getElementById("bundleTable_Custom");
        for(var k=1;k<customReportTable.rows.length -1;k++)
        {
            var currentRow = customReportTable.rows[k];
            var oCB = findCheckBoxInCell(currentRow.cells[0]);

            if(oCB.checked)
            {

                var oCustomReportPrice = document.createElement("input");
                var priceInput = findInputInCell(currentRow.cells[1], "text");
                var priceValue =  parseInt(priceInput.value);
                oCustomReportPrice.value = isNaN(priceValue)?0:priceValue;
                oCustomReportPrice.name=priceInput.id;
                oCustomReportPrice.type="hidden";
                orderForm.appendChild(oCustomReportPrice);
                
                var oCustomReportName = document.createElement("input");
                var nameInput = findInputInCell(currentRow.cells[2], "text");
                oCustomReportName.value =  nameInput.value;
                oCustomReportName.name = nameInput.id;
                oCustomReportName.type="hidden";
                orderForm.appendChild(oCustomReportName);


                var oCustomReportDescription = document.createElement("input");
                var descriptionInput = findInputInCell(currentRow.cells[2], "hidden");
                oCustomReportDescription.value =  descriptionInput.value;
                oCustomReportDescription.name = descriptionInput.id;
                oCustomReportDescription.type="hidden";
                orderForm.appendChild(oCustomReportDescription);
                
                
            }
        }
        
        
        
        var eOid =  parseInt(document.getElementById("ExistingOrderId").value);
        if(eOid > 0)
        {
            var oOrderId = document.createElement("input");
            oOrderId.type="hidden";
            oOrderId.name="orderId";
            oOrderId.value=eOid;
            orderForm.appendChild(oOrderId);
            
        }
        

            var totalsTable = document.getElementById('totalsTable');
            var oTotalPrice = document.createElement("input");
            oTotalPrice.type="hidden";
            oTotalPrice.name="totalPrice";
//            var custPrice = parseInt(document.getElementById("inputCustomization").value);
//            oTotalPrice.value=getCellInt(totalsTable.rows[totalsTable.rows.length -1].cells[5]) - custPrice;
            oTotalPrice.value=getTotalPrice();
            orderForm.appendChild(oTotalPrice);
        
        
        if(aryBundleTables)
        {
            for(var i=0;i<aryBundleTables.length;i++)
            {
                addBundleReports(oSelectedReports, "bundleTable_" + aryBundleTables[i]);
            }
        }

        
        if(oSelectedReports.value.length > 1)
        {
    	    oSelectedReports.value = oSelectedReports.value.substr(0, oSelectedReports.value.length-1);
        }
        
        //alert(oSelectedReports.value);
        
        orderForm.appendChild(oSelectedReports);
        document.body.appendChild(orderForm); 
        orderForm.submit();
    }

}

function getTotalPrice()
{
    var totalPrice  = parseInt(document.getElementById('inputCustomization').value);
    var customReportsTable = document.getElementById('bundleTable_Custom');
    var totalsTable = document.getElementById('totalsTable');
    
        
        for(var i=1;i <= totalsTable.rows.length - 3;i++)
        {
            totalPrice += getCellInt(totalsTable.rows[i].cells[5])
        
        }
        
        for(var j=1;j <= customReportsTable.rows.length - 1;j++)
        {
            var oCB = findCheckBoxInCell(customReportsTable.rows[j].cells[0]);
            if(oCB.checked)
            {
                var reportPriceTextBox = findInputInCell(customReportsTable.rows[j].cells[1], "text") 
                var reportGuid = reportPriceTextBox.id.split("_")[1];
                var originalPriceInput = document.getElementById('customReportPriceBeforeChange_' + reportGuid);
                var originalPriceValue = 0;
                
                if(originalPriceInput)
                {
                    originalPriceValue = parseInt(originalPriceInput.value);
                }

                
                var reportPriceValue = parseInt(reportPriceTextBox.value);
                
                if(isNaN(reportPriceValue))
                {
                    reportPriceValue = 0;
                    reportPriceTextBox.value = 0;
                }

                totalPrice += (reportPriceValue - originalPriceValue);
            }
        }
        
        return totalPrice;
}




function showCustomReportPage()
{
    var customCount=0;
    var hiddenCRC = parseInt(document.getElementById("hiddenCustomReportCount").value);
    var textCRC = parseInt(document.getElementById("customReportCount").value);
    hiddenCRC = (isNaN(hiddenCRC)?0:hiddenCRC);
    textCRC = (isNaN(textCRC)?0:textCRC);
    ///customReportCount cannot be < hiddenCustomReportCount deletes done from CustomReports.aspx
    customCount = ((textCRC >= hiddenCRC)?textCRC:hiddenCRC);
    
    return customCount;

}

function addBundleReports(oInput, bundleTableId)
{
    var bundleTable=document.getElementById(bundleTableId);

    if(bundleTable)
    {
        for(var i=1;i <= bundleTable.rows.length - 2;i++)
        {
            var cbCell = bundleTable.rows[i].cells[0];
            
            var cellCheckbox = findCheckBoxInCell(cbCell);
            
            if(cellCheckbox.checked)
            {
			    var lcId=(cbCell.firstChild.id.split("_"))[1];
			    oInput.value += lcId + ",";             	
            }
        }
        
        
       //alert(oInput.value);
  }

}


function toggleAll(e)
{
    var eventSourceElement;
    
    if(window.event)
    {
        eventSourceElement =window.event.srcElement;
    }
    else
    {
        eventSourceElement = e.target;
    }

    bCheckAll = (eventSourceElement.value=="Select All");
    eventSourceElement.value = (bCheckAll?"Deselect All":"Select All");
    selectAllBundleReports(bCheckAll, eventSourceElement.parentNode.parentNode.parentNode);


    updateTotals(findCheckBoxInCell(eventSourceElement.parentNode.parentNode.parentNode.rows[1].cells[0]));
}

function initOrderTotals()
{
    
    var oBundleTable;
    
    for(var k=0; k < aryBundleTables.length; k++)
    {
        oBundleTable = document.getElementById('bundleTable_' + aryBundleTables[k]);
        updateTotals(findCheckBoxInCell(oBundleTable.rows[1].cells[0]));
    }
    
}


function findInputInCell(oCell, inputType)
{

    var oInput;

    for(var j=0;j<oCell.childNodes.length;j++)
    {
        if(oCell.childNodes[j].tagName=="INPUT")
        {
            var currentInputType =  new String(oCell.childNodes[j].type);
            //alert("oCell.childNodes[j].id="+ oCell.childNodes[j].id + "\oCell.childNodes[j].value="+ oCell.childNodes[j].value + "\ncurrentInputType=" + currentInputType + "\ninputType=" + inputType);
            if(currentInputType==inputType)
            {
                oInput = oCell.childNodes[j];
                break;
            }
        }
    }
    
    return oInput;
}

function findCheckBoxInCell(oCell)
{
    //firefox and ie differ on what items are viewed as child nodes,
    //so the checkbox must be located rather than simply addressed by index
    var oCheckbox;

    for(var j=0;j<oCell.childNodes.length;j++)
    {
        if(oCell.childNodes[j].tagName=="INPUT")
        {
            oCheckbox = oCell.childNodes[j];
            break;
        }
    }
    
    return oCheckbox;

}


function selectAllBundleReports(bCheck, oBundleTable)
{
    if(oBundleTable)
    {
        for(var i=1;i <= oBundleTable.rows.length - 2;i++)
        {
            var cbCell = oBundleTable.rows[i].cells[0];
            var cellCheckbox = findCheckBoxInCell(cbCell);
            
            if(oBundleTable.rows[i].className != 'reportRowNew' || !bCheck)
            {
                cellCheckbox.checked = bCheck;
            }
        }
    }
}



function reportCheckboxClick(e)
{
   
    var clickEvent;
    var eventSourceElement;
    
    if(window.event)
    {
        eventSourceElement =window.event.srcElement;
    
    }
    else
    {
        eventSourceElement = e.target;
    }
    
    
    getReportPrice(eventSourceElement);
    var isChecked = eventSourceElement.checked;
    updateTotals(eventSourceElement);

}



function validateReportDateRange()
{

    var re = /(\d{1,2})[\/.]?(\d{1,2})?[\/.]?((?:\d{1,4}))/g;
    var reportDateField = document.getElementById("inputDateRange");
    var inputDates = reportDateField.value;
    var dateMatches = inputDates.match(re);
   
    
    if(dateMatches.length < 1)
    {
        alert("Please be certain at least a valid begining date is entered into the Date Range field");
        return;
    }
    else
    {
        var startDate = parseDate(dateMatches[0], true);
        var endDate;
        if(dateMatches.length > 1)
        {
            endDate = parseDate(dateMatches[1], false);
        }
        else
        {
            endDate = new Date();
        }
    }
    
    reportDateField.value = (startDate.getMonth() + 1) + "/" + startDate.getDate() + "/" + startDate.getFullYear() + "-" + (endDate.getMonth() + 1) + "/" + endDate.getDate() + "/" + endDate.getFullYear();

}


function parseDate(strDate, isStartDate)
{
    //alert(strDate);
    var idxDay = 1;
    var idxMonth = 0;
    var idxYear = 2;
    var yr, mo, dy;
    
    
    var dateAry = strDate.split("/");
    
    if(dateAry.length < 3)
    {
        idxYear = 1;
        dy = (isStartDate?1:0);
    }
    else
    {
        dy=dateAry[idxDay];
    }
    
    
    yr = getProperYear(dateAry[idxYear]);
    //adjust date to accomodate lack of day without decrementing month
    mo = parseInt(dateAry[idxMonth]) - (dy==0?0:1);
    
    var fullDate = new Date(yr, mo, dy);
    return  fullDate; 
    
}        


function getProperYear(year)
{
    var locYear = '' + year.toString();
    
    while(locYear.charAt(0)=='0')
    {
        locYear = locYear.substr(1);
    }
    
    var intYear = parseInt(locYear);

    if(intYear < 1000)
    {
        if(intYear > 50)
        {
            return 1900 + intYear;
        }
        else
        {
            return 2000 + intYear;
        }
    }
    else
    {
         return intYear;
    }
       
}


function getReportPrice(checkboxElement)
{
    //alert(checkboxElement.id);
    
    
    var currentRow = checkboxElement.parentNode.parentNode;
    var reportPriceString;
    
    if (document.all) 
    {
        reportPriceString = currentRow.cells[1].innerText;
    }
    else
    {
        reportPriceString = currentRow.cells[1].textContent;
    }

    return parseInt(reportPriceString.replace(/[\s|\$]*/, ''));
}

function updateTotals(checkboxElement)
{
        var currentRow = checkboxElement.parentNode.parentNode;
        var currentBundleTable = currentRow.parentNode.parentNode;
        var currentReportId = checkboxElement.id.split("_")[1];
        var currentBundleId = currentBundleTable.id.split("_")[1];
        var currentBundle = new Bundle(currentBundleId);
        var totalsTable = document.getElementById('totalsTable');
        var metaTotalsRow = totalsTable.rows[totalsTable.rows.length -1];
        var totReportCount=0;
        var totReportGrossPrice = 0;
        var totSavings = 0;
        var totPrice = 0;
        
        for(var i=1;i <= totalsTable.rows.length - 2;i++)
        {
            
            totReportCount+=getCellInt(totalsTable.rows[i].cells[1]);
            totReportGrossPrice+=getCellInt(totalsTable.rows[i].cells[2]);
            totSavings+=getCellInt(totalsTable.rows[i].cells[4]);
            totPrice+=getCellInt(totalsTable.rows[i].cells[5]);
        }
        
        setCellContent(metaTotalsRow.cells[1], totReportCount);
        setCellDollars(metaTotalsRow.cells[2], totReportGrossPrice);
        setCellDollars(metaTotalsRow.cells[4], totSavings);
        setCellDollars(metaTotalsRow.cells[5], totPrice);
        
        

}


function Bundle(BundleId)
{
    this.bundleId = BundleId;
    this.bundlePrice = 0;
    this.bundleReportsCount = 0;
    this.bundleReportsSelectedCount = 0;
    this.bundleReportsTotalCost = 0;
    this.bundleReportsSelectedCost = 0;
    this.bundleAllSelected = true;
    //this.bundleDiscountPriceCellIndex = 3;    
    this.discountSavings = 0;
    this.newReportSelectedTotal=0;
    this.newReportSelectedCount=0;
    
    var _totalsRow = document.getElementById("bundleTotals_" + this.bundleId);
    var _bundleTable = document.getElementById('bundleTable_' + this.bundleId);
    var bundleReportCountCellIndex = 1;
    var bundleReportGrossPriceCellIndex = 2;
    var bundleDiscountPriceCellIndex = 3;
    var bundleSavingsCellIndex = 4;
    var bundleTotalsCellIndex = 5

    
    if(_bundleTable)
    {
        this.bundlePrice = getCellInt(_totalsRow.cells[bundleDiscountPriceCellIndex]);
        this.bundleReportsCount = _bundleTable.rows.length - 2;
        
        
        for(var i=1;i<=_bundleTable.rows.length - 2;i++)
        {
            var reportPrice = getCellInt(_bundleTable.rows[i].cells[1]);
            this.bundleReportsTotalCost += reportPrice;
            var cbCell = _bundleTable.rows[i].cells[0];
            
            var cellCheckbox = findCheckBoxInCell(cbCell);
            var rowClassName = _bundleTable.rows[i].className;
            
            if(cellCheckbox.checked && (rowClassName != 'reportRowNew'))
            {
                
                this.bundleReportsSelectedCost += reportPrice;
                this.bundleReportsSelectedCount++;
            }
            else
            {
                //if report has been added since order was originally placed
                //it is not included in bundle discount
                if(rowClassName == 'reportRowNew')
                {
                    this.bundleReportsCount--;
                    if(cellCheckbox.checked)
                    {
                        this.newReportSelectedTotal += reportPrice;
                        this.newReportSelectedCount++;
                    }
                }
                else
                {
                    this.bundleAllSelected = false;
                }
            }
        }
    }
    
    
    if(this.bundleAllSelected)
    {
        var selectAllCell = _bundleTable.rows[_bundleTable.rows.length - 1].cells[0];
        for(var j=0;j<selectAllCell.childNodes.length;j++)
        {
            if(selectAllCell.childNodes[j].tagName=="INPUT")
            {
                selectAllCell.childNodes[j].value="Deselect All";
            }
        }
    
    }
    
    
    if ((this.bundleAllSelected) && (this.bundlePrice < this.bundleReportsSelectedCost) && (this.bundlePrice > 0))
    {
        this.discountSavings = this.bundleReportsSelectedCost - this.bundlePrice;
        setCellDollars(_totalsRow.cells[bundleTotalsCellIndex], this.bundlePrice + this.newReportSelectedTotal);
    }
    else
    {
        setCellDollars(_totalsRow.cells[bundleTotalsCellIndex], this.bundleReportsSelectedCost + this.newReportSelectedTotal);
    }
    
    setCellContent(_totalsRow.cells[bundleReportCountCellIndex], this.bundleReportsSelectedCount + this.newReportSelectedCount);
    setCellDollars(_totalsRow.cells[bundleReportGrossPriceCellIndex], this.bundleReportsSelectedCost  + this.newReportSelectedTotal);
    setCellDollars(_totalsRow.cells[bundleSavingsCellIndex], this.discountSavings);

    
}

function isReportRowSelected(oRow)
{


}

function setCellDollars(cell, amt)
{
    setCellContent(cell, '$' + amt);
}

function setCellContent(oCell, sContent)
{
  if(document.all)
  {
    oCell.innerText = sContent;
  }
  else
  {
    oCell.textContent = sContent;
  }
}


function getCellInt(intCell)
{
    var cellText = getCellText(intCell);
    return getIntFromText(cellText);
}


function getCellText(textCell)
{
    var cellText = "";
    
    if (document.all) 
    {
        cellText = textCell.innerText;
    }
    else
    {
        cellText = textCell.textContent;
    }
    
    return cellText;
}


function getIntFromText(iText)
{
    var cleanText = iText.replace(/[\s|\$]*/, '');
    if(cleanText.length < 1)
    {
        return 0;
    }
    else
    {
        return parseInt(cleanText);
    }
}

function extractAmountsFromString(inString)
{
    var totalAmount=0;
    var moneyMatches = inString.match(/-?\$?\d{2,5}/g);

    if(moneyMatches)
    {
        for(var j=0;j<moneyMatches.length;j++)
        {
	        totalAmount += parseInt(moneyMatches[j].replace(/\$/, ''));
        }
    }
	
    return totalAmount;
}


function initPage() 
{
    /*
    var winWidth = 0, winHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) 
    {
        //Non-IE
       
        winWidth = window.outerWidth;
        winHeight = window.outerHeight;
    } 
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
    {
        //IE 6+ in 'standards compliant mode'
        winWidth = document.documentElement.clientWidth;
        winHeight = document.documentElement.clientHeight;
    } 
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
    {
        //IE 4 compatible
        winWidth = document.body.clientWidth;
        winHeight = document.body.clientHeight;
    }

    //window.alert( 'Width = ' + winWidth + ', Height = ' + winHeight);

  
    var desiredWinHeight = (winHeight < 1100? 1100:winHeight);
    var desiredWinWidth = (winWidth < 1150? 1150:winWidth);
    window.resizeTo(desiredWinWidth, desiredWinHeight); 
    */
}


function validateInput()
{
    //text, num, date

}

					
					
function addCustomReportRow()
{
	
	var customReportTable = document.getElementById("bundleTable_Custom");
	var reportCount = customReportTable.rows.length - 2;
	var customReportNumber = reportCount + 1;
	
	var newReportRow = 	customReportTable.insertRow(reportCount + 1); //document.createElement("tr");
	newReportRow.className = ((reportCount + 1) % 2 == 0)?"reportRowB":"reportRowA";
	var cellCb = newReportRow.insertCell(0); //document.createElement("td");
	cellCb.className = "reportCheckboxCell";
		
	var cbInput = document.createElement("input");
	cbInput.type = "checkbox";
	cbInput.checked = true;
	cbInput.id = "customReportCheckbox_" + customReportNumber;
	cbInput.onclick = reTallyCustomReportPrices;
	
	
	cellCb.appendChild(cbInput);
		
	var cellPrice = newReportRow.insertCell(1); 
	cellPrice.className = "reportPrice";

	var tbPrice = document.createElement("input");
	tbPrice.type = "text";
	tbPrice.id = "customReportPrice_" + customReportNumber;
	tbPrice.onchange = reTallyCustomReportPrices;
	tbPrice.size = 2;
	tbPrice.maxLength = 6;
	tbPrice.value = "0";
	//setCellContent(cellPrice, "$");
	//cellPrice.appendChild("$");
	cellPrice.appendChild(tbPrice);
	//newReportRow.appendChild(cellPrice);
	//may need insertCell
	
	var cellName = newReportRow.insertCell(2); //document.createElement("td");
	cellName.className = "reportName";
	cellName.style.width = "175px";
	
	var tbName = document.createElement("input");
	tbName.type = "text";
	tbName.id = "customReportName_" + customReportNumber;
	tbName.size = 33;
	tbName.maxLength = 50;
	tbName.value = " ";

    cellName.appendChild(tbName);
	
	var hidDescription = document.createElement("input");
	hidDescription.type = "hidden";
	hidDescription.id = "customReportDescription_" + customReportNumber;
	hidDescription.value = " ";
    cellName.appendChild(hidDescription);


	
	reTallyCustomReportPrices();
	

}

