﻿
iWindows = new Array();
iCurWin = 0;
var addLink;

function sessionTimedOut()
{
    self.location.href("../../InscoDotNet2.0/login.aspx?timed_out=1")
    parent.frames[1].location.reload();
}

function newFarmersWindow(url, winname, width, height)
{
    var left = (screen.width  - width)/2;
    var top  = (screen.height - height)/2;
    var params = 'width='+width+', height='+height;
    params += ', top='+top+', left='+left;
    params += ', directories=no';
    params += ', location=no';
    params += ', menubar=no';
    params += ', resizable=yes';
    params += ', scrollbars=yes';
    params += ', status=yes';
    params += ', toolbar=no';
    newwin=window.open(url,winname,params);
    newwin.focus();
    return false;
}
    
function newFarmersModalWindow(url, winname, width, height)
{
    var params = 'dialogWidth:'+width+'px;dialogHeight:'+height+'px'
    params += ';resizable:yes';
    params += ';scroll:no';
    params += ';status:no';
    params += ';center:yes';
    var retVal = window.showModalDialog(url,winname,params);
    return retVal;
}


function deleteEndorsement(destinationGridId, rowId)
{
    var confirmDelete = confirm("Are you sure you want to remove this endorsement ?");
    if (confirmDelete)
    {
        var selectedGrid = igtbl_getGridById(destinationGridId);
        var selectedRow = igtbl_getRowById(rowId);
        selectedRow.deleteRow();
        igtbl_doPostBack(destinationGridId);
    }
}


function addEndorsement(destinationGridId, endtKey, endtNumber, endtDescription, retPremium, ratingUrl, url, height, width)
{
   var newRow = igtbl_addNew(destinationGridId,0); 
   
   //EndorsementCodeKey
   newRow.cells[0].setValue(endtKey);
   
   //EndorsementNumber
   newRow.cells[1].setValue(endtNumber);
   
   //Description
   newRow.cells[2].setValue(endtDescription);

   //newRow.getCellFromKey("Premium");
   newRow.cells[3].setValue("$" + retPremium);

   //var cell = newRow.getCellFromKey("Edit");
   var editCell = newRow.cells[4];
   var openLink = "<center><img src='../../images/edit.png' onclick=" + String.fromCharCode(34) + "editEndorsementWindow('" + destinationGridId + "', '" + newRow.Id + "', '" + ratingUrl + "'," + endtKey + ",'showEndorsementScreen'," + height + "," + width + ")" + String.fromCharCode(34) + "></center>";
   editCell.setValue(openLink);
   editCell.Element.innerHTML = openLink;
   editCell.Element.style.textAlign = "center";
   
   var removeCell = newRow.cells[5];
   var removeLink = "<center><img  src='../../images/delete.png' onclick=" + String.fromCharCode(34) + "deleteEndorsement('" + destinationGridId + "', '" + newRow.Id + "')"  + String.fromCharCode(34) + "></center>";
   removeCell.setValue(removeLink);
   removeCell.Element.style.textAlign = "center";
   removeCell.Element.innerHTML = removeLink;
   
   //var cell = newRow.getCellFromKey("RatingURL");
   newRow.cells[6].setValue(ratingUrl);
}


function newLiabilityEndorsement(url, sourceGridId, sourceRowId, destinationGridId, destinationRowId, endtkey, endtNumber, endtDescription, ratingUrl, winname, height, width, liabilityDropDown, medicalDropDown)
{
    var ddlLiabilityCoverage = document.getElementById('ddlLiabilityCoverageAmounts');
    var ddlMedicalCoverage = document.getElementById('ddlMedicalCoverageAmounts');
    
    var iLiabilityCoverage = ddlLiabilityCoverage.options[ddlLiabilityCoverage.selectedIndex].text;
    var iMedicalCoverage = ddlMedicalCoverage.options[ddlMedicalCoverage.selectedIndex].text;
    
    var sURL = url + "&LiabilityCoverage=" + iLiabilityCoverage; 
    var sURL = sURL + "&MedicalCoverage=" + iMedicalCoverage; 
    
    var retPremium = newFarmersModalWindow(sURL, winname, width, height);
    if (retPremium != undefined)
    {
        var sourceGrid = igtbl_getGridById(sourceGridId);
        var sourceRows = sourceGrid.Rows;
        var sourceRow = sourceRows.getRow(sourceRowId);
        sourceRow.setHidden(true);
        addEndorsement(destinationGridId, endtkey, endtNumber, endtDescription, retPremium, ratingUrl, sURL, height, width);
    }
}

//sScript.Append("&liabilitycoverage=" + ddlLiabilityCoverageAmounts.SelectedItem.Text)
//sScript.Append("&medicalcoverage=" + ddlMedicalCoverageAmounts.SelectedItem.Text + "',")

function newEndorsementWindow(url, sourceGridId, sourceRowId, destinationGridId, destinationRowId, endtkey, endtNumber, endtDescription, ratingUrl, winname, height, width)
{
    var retPremium = newFarmersModalWindow(url, winname, width, height);
    
    if (retPremium != undefined)
    {
        var sourceGrid = igtbl_getGridById(sourceGridId);
        var sourceRows = sourceGrid.Rows;
        var sourceRow = sourceRows.getRow(sourceRowId-1);
        sourceRow.setHidden(true);
        addEndorsement(destinationGridId, endtkey, endtNumber, endtDescription, retPremium, ratingUrl, url, height, width);
    }
}


/*
function deletePolicyEndorsement(destinationGridId, rowId, addLinkFromServer)
{
    //var confirmDelete = confirm("Are you sure you want to remove this endorsement ?");
    var selectedGrid = igtbl_getGridById(destinationGridId);
    var sourceRows = selectedGrid.Rows;
    var selectedRow = sourceRows.getRow(rowId);

    var removeCell = selectedRow.getCellFromKey("Remove");
    removeCell.setValue("-");
    removeCell.Element.innerHTML = "-";
    
    var addCell = selectedRow.getCellFromKey("AddEdit");
    addCell.setValue(addLink);
    addCell.Element.innerHTML = addLink;
    addCell.Element.style.textAlign = "center";
    
    var premiumCell = selectedRow.getCellFromKey("Premium");
    removeCell.setValue("-");
    
    var statusCell = selectedRow.getCellFromKey("Added");
    statusCell.setValue("0");
    
    igtbl_doPostBack(destinationGridId);
}*/

function newNonPremiumEndorsementWindow(url, sourceGridId, sourceRowId, isRated, winname, height, width)
{
    if (isRated == 'True')
        var retPremium = newFarmersModalWindow(url, winname, width, height);
    else
        var retPremium = 0;
        
    if (retPremium != undefined)
    {
        var sourceGrid = igtbl_getGridById(sourceGridId);
        var sourceRows = sourceGrid.Rows;
        var sourceRow = sourceRows.getRow(sourceRowId);
        
        var editCell = sourceRow.getCellFromKey("AddEdit");
        if (isRated == 'True')
        {
            var url = url.replace(/Add/, "Edit");
            var openLink = "<center><img src='../../images/edit.png' onclick=" + String.fromCharCode(34) + "newNonPremiumEndorsementWindow('" + url + "', '" +  sourceGridId + "', '" + sourceRowId + "', 'True','" + winname + "'," + height + "," + width + ")" + String.fromCharCode(34) + "></center>";
            editCell.setValue(openLink);
            editCell.Element.innerHTML = openLink;
            editCell.Element.style.textAlign = "center";
        }
        else
        {
            var okLink = "<img  src='../../images/active_policy.png'>"
            editCell.setValue(okLink);
            editCell.Element.innerHTML = okLink;
            editCell.Element.style.textAlign = "center";
        }
        
        var removeCell = sourceRow.getCellFromKey("Remove");
        var removeLink = "<img  src='../../images/delete.png' onclick=" + String.fromCharCode(34) + "deleteNonPremiumEndorsement('" + sourceGridId + "', '" + sourceRowId + "'" + ")" + String.fromCharCode(34) + ",-1>";
        removeCell.setValue(removeLink);
        removeCell.Element.style.textAlign = "center";
        removeCell.Element.innerHTML = removeLink;
        
        var statusCell = sourceRow.getCellFromKey("Added");
        if (statusCell.getValue() >  0)
            statusCell.setValue(parseInt(statusCell.getValue())+1);
        else
            statusCell.setValue("1");
        
        igtbl_doPostBack(sourceGridId);
    }
}


function newPolicyEndorsementWindow(url, sourceGridId, sourceRowId, destinationGridId, destinationRowId, endtkey, endtNumber, endtDescription, ratingUrl, winname, height, width)
{
    var retPremium = newFarmersModalWindow(url, winname, width, height);
    
    if (retPremium != undefined)
    {
        var sourceGrid = igtbl_getGridById(sourceGridId);
        var sourceRows = sourceGrid.Rows;
        var sourceRow = sourceRows.getRow(sourceRowId);
        sourceRow.setHidden(true);
        addPolicyEndorsement(destinationGridId, endtkey, endtNumber, endtDescription, retPremium, ratingUrl, url, height, width);
        igtbl_doPostBack(sourceGridId);
    }
}

function deletePolicyEndorsement(destinationGridId, rowId)
{
    var confirmDelete = confirm("Are you sure you want to remove this endorsement ?");
    if (confirmDelete)
    {
        var selectedGrid = igtbl_getGridById(destinationGridId);
        var selectedRow = igtbl_getRowById(rowId);
        selectedRow.deleteRow();
        /*__doPostBack("WebAsyncRefreshPanel2");*/
        /*igtbl_doPostBack(destinationGridId);*/
    }
}


function addPolicyEndorsement(destinationGridId, endtKey, endtNumber, endtDescription, retPremium, ratingUrl, url, height, width)
{
   var newRow = igtbl_addNew(destinationGridId,0); 
   
   //EndorsementCodeKey
   newRow.cells[0].setValue(endtKey);
   
   newRow.cells[1].setValue("");
   
   //EndorsementNumber
   newRow.cells[2].setValue(endtNumber);
   
   //Description
   newRow.cells[3].setValue(endtDescription);

   //newRow.getCellFromKey("Premium");
   newRow.cells[4].setValue("$" + retPremium);

   var removeCell = newRow.cells[5];
   var removeLink = "<center><img  src='../../images/delete.png' onclick=" + String.fromCharCode(34) + "deletePolicyEndorsement('" + destinationGridId + "', '" + newRow.Id + "')"  + String.fromCharCode(34) + "></center>";
   removeCell.setValue(removeLink);
   removeCell.Element.style.textAlign = "center";
   removeCell.Element.innerHTML = removeLink;
   
   newRow.cells[6].setValue(0);
   
   newRow.cells[7].setValue(ratingUrl);
}

function editEndorsementWindow(editGridId, editRowId, url, endtKey, winname, height, width) {

   url = url + "?Mode=Edit&EndorsementKey=" + endtKey
   var retPremium = newFarmersModalWindow(url, winname, width, height);
   if (retPremium != 0 && retPremium != undefined)
   {
        var editGrid = igtbl_getGridById(editGridId);
        var editRow = igtbl_getRowById(editRowId)
        editRow.cells[3].setValue("$" + retPremium);
   }
}

function editPolicyEndorsementWindow(editGridId, editRowId, url, endtKey, winname, height, width) {

    url = url + "?Mode=Edit&EndorsementKey=" + endtKey
    var retPremium = newFarmersModalWindow(url, winname, width, height);
    if (retPremium != 0 && retPremium != undefined) {
        var editGrid = igtbl_getGridById(editGridId);
        var editRow = igtbl_getRowById(editRowId)
        editRow.getCellFromKey("Premium").setValue("$" + retPremium);
    }
}

function OpenSizedWindow(pagename, name, width, height, top, left)
{
	var f;
	f = "width=" + width + ",height=" + height;
	f = f + ",top=" + top + ",left=" + left;
	f = f + ",toolbar=0,titlebar=no,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0";
	iWindows[iCurWin++] = window.open(pagename, name, f);
}
 
function gotoNextRisk (lobCodeKey, riskTypeKey)
{  
    var oPolicyTab = window.parent.igtab_getTabById('tabNewBusiness');  
    //oPolicyTab.tabFromKey(3).setVisible(true);
    
     switch (lobCodeKey)
        {
            case 4://FL
                 switch (riskTypeKey)
                 {
                    case 3: //  FL - Dwelling Property
                        oPolicyTab.tabFromKey("CoverageRating").setTargetUrl('../../business/policies/fl_dwellingcoverage.aspx');
                        break;
                    case 29: // FL - Mobile Home
                        oPolicyTab.tabFromKey("CoverageRating").setTargetUrl('../../InscoDotNet2.0/business/policies/fl_mobilehomecoverage.aspx');
                        break;
                    case 30: // FL - Barns, Outbuildings, and Silos
                        oPolicyTab.tabFromKey("CoverageRating").setTargetUrl('../../InscoDotNet2.0/business/policies/fl_barnscoverage.aspx');
                        break;
                    case 31: // FL - FPP, Miscellaneous
                         oPolicyTab.tabFromKey("CoverageRating").setTargetUrl('../../InscoDotNet2.0/business/policies/fl_misccoverage.aspx');
                        break;
                 }
        }
}


function toggleDropDown(dropdownId, relative1, relative2, compare)
{
	var dropdown = document.getElementById(dropdownId);
	var relativeCtl2 = document.getElementById(relative2);
	if (relative1 != 'undefined')
		var relativeCtl1 = document.getElementById(relative1);
	
	if (dropdown[dropdown.selectedIndex].text == compare)
	{
		relativeCtl2.disabled = false;
		relativeCtl2.style.backgroundColor = "#FFFF80";
		relativeCtl2.focus();
		
		if (relative1 != 'undefined')
			relativeCtl1.disabled = false;
	}
	else
	{
		relativeCtl2.disabled = true;
		if (relative1 != 'undefined')
		{
			//relativeCtl1.disabled = true;
			relativeCtl2.style.backgroundColor = "gainsboro";
			relativeCtl2.value="";
		}
	}
}
   
function pnlFileClaim_ExpandedStateChanging(oWebPanel, oEvent)
{
	oEvent.cancel=true;
}

function pnlDocViewExpress_ExpandedStateChanging(oWebPanel, oEvent)
{
	oEvent.cancel=true;
}


function pnlPaymentHistory_ExpandedStateChanging(oWebPanel, oEvent)
{
	oEvent.cancel=true;
}

function pnlPolicyChangeRequest_ExpandedStateChanging(oWebPanel, oEvent)
{
	oEvent.cancel=true;
}


function calculateBasementArea(length, width, relative)
{
	var lengthCtl = document.getElementById(length);
	var widthCtl = document.getElementById(width);
	var relativeCtl = document.getElementById(relative);
	
	relativeCtl.value = lengthCtl.value * 1;
	if (relativeCtl.value == "NaN")
	{
		lengthCtl.value = "";
		relativeCtl.value = "";
		alert('Basement Length should be numeric !');
	}
	
	relativeCtl.value = widthCtl.value * 1;
	if (relativeCtl.value == "NaN")
	{
		widthCtl.value = "";
		relativeCtl.value = "";
		alert('Basement Width should be numeric !');
	}
	
	relativeCtl.value = lengthCtl.value * widthCtl.value;
	
	if (relativeCtl.value == "NaN")
	{
		relativeCtl.value = "";
	}

}


function toggleCheckBox(checkboxID, relative1, relative2, toggleLogic)
{
	var checkbox = document.getElementById(checkboxID);
	var relativeCtl2 = document.getElementById(relative2);
	
	if (relative1 != 'undefined')
		var relativeCtl1 = document.getElementById(relative1);
		
	if (checkbox.status == toggleLogic)
	{
		relativeCtl2.disabled = false;
		if (relativeCtl2.type != "checkbox")
		{
			relativeCtl2.focus();
			relativeCtl2.style.backgroundColor = "#FFFF80";
			
		}
			
		if (relative1 != 'undefined')
			relativeCtl1.disabled = false;
	}
	else
	{
		relativeCtl2.value = "";
		relativeCtl2.disabled = true;
		if (relative1 != 'undefined')
			relativeCtl1.disabled = true;
	}
}

function totalareaCheckBox(checkboxID, relative2, toggleLogic)
{
	var checkbox = document.getElementById(checkboxID);
	var relativeCtl2 = document.getElementById(relative2);
	
	if (checkbox.status == toggleLogic)
	{
		relativeCtl2.readOnly = false;
		relativeCtl2.focus();
		
	}
	else
	{
		relativeCtl2.value = "";
		relativeCtl2.readOnly = true;
		
	}
}



function calculateTotalArea(length, width, stories, relative)
{
	var lengthCtl = document.getElementById(length);
	var widthCtl = document.getElementById(width);
	var storiesCtl = document.getElementById(stories);
	var relativeCtl = document.getElementById(relative);
		
	relativeCtl.value = lengthCtl.value * 1;
	if (relativeCtl.value == "NaN")
	{
		lengthCtl.value = "";
		relativeCtl.value = "";
		alert('Structure Length should be numeric !');
	}
	
	relativeCtl.value = widthCtl.value * 1;
	if (relativeCtl.value == "NaN")
	{
		widthCtl.value = "";
		relativeCtl.value = "";
		alert('Structure Width should be numeric !');
	}
	
	relativeCtl.value = storiesCtl.value * 1;
	if (relativeCtl.value == "NaN")
	{
		storiesCtl.value = "";
		relativeCtl.value = "";
		alert('Number Of Stories should be numeric !');
	}
	
	relativeCtl.value = lengthCtl.value * widthCtl.value * storiesCtl.value;
	
	if (relativeCtl.value == "NaN")
	{
		relativeCtl.value = "";
		//alert('Basement Length and Width should be numeric values !');
	}
	
}

function toggleSubmitCash(txtCheckNumberId, txtAmountPaidId, txtCheckAmountId, btnSubmitCashId)
{
	var txtCheckNumber = document.getElementById(txtCheckNumberId);
	var txtAmountPaid = document.getElementById(txtAmountPaidId);
	var txtCheckAmount = document.getElementById(txtCheckAmountId);
	var btnSubmitCash = document.getElementById(btnSubmitCashId);
	
	if (txtCheckNumber.text != "" && txtAmountPaid.value > 0 && txtCheckAmoun.text > 0)
	{
		btnSubmitCash.disabled = false;
	}
	else
	{
		btnSubmitCash.disabled = true;	
	}
}

function updateCheckAmount(txtCheckNumberId, txtAmountPaidId, txtCheckAmountId, btnSubmitCashId)
{
	var txtCheckNumber = document.getElementById(txtCheckNumberId);
	var txtAmountPaid = document.getElementById(txtAmountPaidId);
	var txtCheckAmount = document.getElementById(txtCheckAmountId);
	var btnSubmitCash = document.getElementById(btnSubmitCashId);
	
	txtCheckAmount.value = txtAmountPaid.value;
	
	if (txtCheckNumber.text != "" && txtAmountPaid.value > 0 && txtCheckAmoun.text > 0)
	{
		btnSubmitCash.disabled = false;
	}
	else
	{
		btnSubmitCash.disabled = true;	
	}
		
}

function returnToAgencyHome(iPolicyTermKey, sPolicyNumber, action)
{
   parent.parent.frames("main").location.href='../../agencydashboard/all_applications.aspx';
   //parent.parent.document.location.reload();
}

function goToPrintSummary()
{
     var webTab = window.parent.igtab_getTabById("tabNewBusiness");
     if(webTab == null)
        return;
        
     webTab.tabFromKey("PrintSummary").setVisible(true);
     webTab.tabFromKey("PrintSummary").setTargetUrl("../../business/policies/decpages/decpage_selection_new.aspx");
     
     webTab.setSelectedTab(webTab.tabFromKey("PrintSummary"));
 }

function goToUploadPhotos() {
     var webTab = window.parent.igtab_getTabById("tabNewBusiness");
     if (webTab == null)
         return;

     webTab.tabFromKey("PhotoUploads").setVisible(true);
     webTab.tabFromKey("PhotoUploads").setTargetUrl("../../business/policies/photo_uploads.aspx");
     webTab.setSelectedTab(webTab.tabFromKey("PhotoUploads"));
}

     
function returnToEmployeeHome()
{
   parent.parent.frames[1].location.reload();
}

function OpenModalWindow(url, width, height, top, left)
{
	var dimensions, retVal;
	dimensions  = "center:yes; status:no; dialogHeight:" + height + "px;dialogLeft:" + parent.width/2 + "px; dialogTop:" + parent.height/2 + "px; dialogWidth:" + width + "px; ";
	retVal = window.showModalDialog(url, "", dimensions);
	return retVal;
}

function openPopupWindow(dialogTitle, url)
{
	var retVal;
	retVal = OpenModalWindow("../../business/policies/dialog_container.aspx?DialogTitle=" + dialogTitle + "&URL=" + url ,600, 600, 0,0);
}

function hideProgressIndicator(oPanel)
{
    oPanel.getProgressIndicator().setTemplate(" ");
}
   
   
function return2ModifyQuote(iPolicyTermKey, action, sQuoteNumber)
{
     parent.parent.frames("main").location.href='../../business/policies/all_quotes.aspx?action=ModifyQuote';
}

function return2FinishNewBusiness(iPolicyTermKey, action, sQuoteNumber)
{
     parent.parent.frames("main").location.href='../../agencydashboard/all_applications.aspx';
}


function return2Search(sAction, searchType)
{
     var webTab =  window.parent.igtab_getTabById ("tabNewBusiness");
     
     if(webTab == null)
        return;

     webTab.tabFromKey("ClaimGeneralInfo").setTargetUrl("");   
     webTab.tabFromKey("ClaimGeneralInfo").setVisible(false);
     
     webTab.tabFromKey("Claimants").setTargetUrl("");   
     webTab.tabFromKey("Claimants").setVisible(false);
     
     webTab.tabFromKey("ClaimantsCoverages").setTargetUrl("");   
     webTab.tabFromKey("ClaimantsCoverages").setVisible(false);
     
     webTab.tabFromKey("ClaimTransactions").setTargetUrl("");   
     webTab.tabFromKey("ClaimTransactions").setVisible(false);
     
     webTab.tabFromKey("ClaimSummary").setTargetUrl("");   
     webTab.tabFromKey("ClaimSummary").setVisible(false);
     
     webTab.tabFromKey("FinalSummary").setTargetUrl("");   
     webTab.tabFromKey("FinalSummary").setVisible(false);

     webTab.tabFromKey("Search").setTargetUrl("../../web/utils/new_search.aspx?action=" + sAction + "&searchtype=" + searchType + "&Description=Policy");   
     webTab.setSelectedTab(webTab.tabFromKey("Search")); 
     webTab.tabFromKey("Search").setVisible(true);  
}
  

/*
function newPolicyEndorsementWindow(url, sourceGridId, sourceRowId, isRated, winname, height, width)
{
    if (isRated == 'True')
        var retPremium = newFarmersModalWindow(url, winname, width, height);
    else
        var retPremium = 0;
        
    if (retPremium != undefined)
    {
        var sourceGrid = igtbl_getGridById(sourceGridId);
        var sourceRows = sourceGrid.Rows;
        var sourceRow = sourceRows.getRow(sourceRowId);
        
        addLink =  "<a onclick=" + String.fromCharCode(34) + "newPolicyEndorsementWindow('" + url + "', '" + sourceGridId + "', '" +  sourceRowId + "', '" + winname + "'," + height + "," + width + ")" + String.fromCharCode(34) + ">Add</a>";
        
        var premiumCell = sourceRow.getCellFromKey("Premium");
        premiumCell.setValue('$' + retPremium);
        
        var editCell = sourceRow.getCellFromKey("AddEdit");
        if (isRated == 'True')
        {
            var openLink = "<center><img src='../../images/edit.png' onclick=" + String.fromCharCode(34) + "newPolicyEndorsementWindow('" + url + "', '" +  sourceGridId + "', '" + sourceRowId + "', '" + winname + "'," + height + "," + width + ")" + String.fromCharCode(34) + "></center>";
            editCell.setValue(openLink);
            editCell.Element.innerHTML = openLink;
            editCell.Element.style.textAlign = "center";
        }
        else
        {
            var okLink = "<img  src='../../images/active_policy.png'>"
            editCell.setValue(okLink);
            editCell.Element.innerHTML = okLink;
            editCell.Element.style.textAlign = "center";
        }
        
        var removeCell = sourceRow.getCellFromKey("Remove");
        var removeLink = "<img  src='../../images/delete.png' onclick=" + String.fromCharCode(34) + "deletePolicyEndorsement('" + sourceGridId + "', '" + sourceRowId + "'" + ")" + String.fromCharCode(34) + ",-1>";
        removeCell.setValue(removeLink);
        removeCell.Element.style.textAlign = "center";
        removeCell.Element.innerHTML = removeLink;
        
        var statusCell = sourceRow.getCellFromKey("Added");
        statusCell.setValue("1");
        
        igtbl_doPostBack(sourceGridId);
    }
}*/

function getInternetExplorerVersion() {

    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;
}

function checkIEVersion() {

    var msg = "It appears you're not using Windows Internet Explorer. This website is optimized for use with Windows IE only.\n\nYou may download Internet Explorer from the Microsoft website";
    var ver = getInternetExplorerVersion();
    if (ver > -1) {
        if (ver >= 8.0) 
            msg = "It appears you're using Windows Internet Explorer 8.0, please set Compatibility Mode, by going to Tools - Compatbility View Settings"
        else 
            msg = "OK"
            
    }
    if (msg != "OK") alert(msg);
}

function deletePayment(destinationGridId, rowId) {
    var confirmDelete = confirm("Are you sure you want to remove this payment ?");
    var oConfirmation = document.getElementById("txtUserConfirmation");
    oConfirmation.value = confirmDelete;
}

function disableSubmitButton() {
    var btnSubmitButton = document.getElementById('btnSubmitPayment');
    btnSubmitButton.runtimeStyle.visibility = "hidden";
}