﻿window.onload = onresize;
var TravelObject = new Travel();

function onresize() {

    var height = findPageHeight() - 90;
    document.getElementById("ctl00_ContentPlaceHolder1_iframpan").style.height = height + "px";

}

function findPageHeight() {
    if (!window.opera && (!document.compatMode ||
    document.compatMode == "CSS1Compat")) {
        return document.documentElement.clientHeight;
    }
    else if (document.compatMode && !window.opera) {
        return document.body.clientHeight;
    }
    return zero(self.innerHeight);
}

function Price_Factor(ItemCnt, Price, Band1Num, Band2Num, Band2Fact, Band3Num, Band3Fact, Band4Num, Band4Fact, BandOverFact) {
    var functionReturnValue = 0;
    if (ItemCnt <= Band1Num) {
        functionReturnValue = ItemCnt * Price;
    }
    else if (ItemCnt <= Band2Num) {
        functionReturnValue = (Band1Num * Price + ((ItemCnt - Band1Num) * Price * Band2Fact));
    }
    else if (ItemCnt <= Band3Num) {
        functionReturnValue = (Band1Num * Price + (Band2Num - Band1Num) * Price * Band2Fact + ((ItemCnt - Band2Num) * Price * Band3Fact));
    }
    else if (ItemCnt <= Band4Num) {
        functionReturnValue = (Band1Num * Price + (Band2Num - Band1Num) * Price * Band2Fact + (Band3Num - Band2Num) * Price * Band3Fact + (ItemCnt - Band3Num) * Price * Band4Fact);
    }
    else if (ItemCnt > Band4Num) {
        functionReturnValue = (Band1Num * Price + (Band2Num - Band1Num) * Price * Band2Fact + (Band3Num - Band2Num) * Price * Band3Fact + (Band4Num - Band3Num) * Price * Band4Fact + ((ItemCnt - Band4Num) * Price * BandOverFact));
    }
    return functionReturnValue * 180;
}

function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num))
        num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    cents = num % 100;
    num = Math.floor(num / 100).toString();
    if (cents < 10)
        cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
        num = num.substring(0, num.length - (4 * i + 3)) + ',' +
       num.substring(num.length - (4 * i + 3));
    return (((sign) ? '' : '-') + '$' + num + '.' + cents);
}

function formatAsMoney(mnt) {
    mnt -= 0;
    mnt = (Math.round(mnt * 100)) / 100;
    return (mnt == Math.floor(mnt)) ? mnt + '.00'
              : ((mnt * 10 == Math.floor(mnt * 10)) ?
                       mnt + '0' : mnt);
}

function DetNumCons(num_days) {
    if (num_days < 20) {
        return 1;
    }
    else if (num_days >= 20 && num_days < 30) {
        return 2;
    }
    else if (num_days >= 30) {
        return 3;
    }
    return 1;
}

function chkNumber(sText) {
    var ValidChars = "0123456789.$,";
    var IsNumber = true;
    var Char;



    for (i = 0; i < sText.length && IsNumber; i++) {
        Char = sText.charAt(i);
        if (ValidChars.indexOf(Char) == -1) {
            IsNumber = false;
        }
    }

    return IsNumber;

}

function GetAttributeValue(attribList, attribName, firstDelim, secondDelim) {
    var attribNameLowerCase = attribName.toLowerCase();
    if (attribList) {
        var attribArr = attribList.split(firstDelim);
        for (var i = 0, loopCnt = attribArr.length; i < loopCnt; i++) {
            var nameValueArr = attribArr[i].split(secondDelim);
            for (var j = 0, loopCnt2 = nameValueArr.length; j < loopCnt2; j++) {
                if (nameValueArr[0].toLowerCase().replace(/\s/g, '') == attribNameLowerCase && loopCnt2 > 1) {
                    return nameValueArr[1];
                }
            }
        }
    }
}

// Travel Stuff
//**************************************************************************************
function Travel() {
    this.msa = "";
    this.airCode = "";
    this.airPort = "";
    this.flightTime = 0.0;
    this.travelTime = 0.0;
    this.travelTotal = 0.0;
    this.airFare = 0.0;
    this.mileage = 0.0;
    this.hotel = 0.0;
    this.car = 0.0;
    this.meals = 0.0;
    this.LoadSelected = LoadSelected;

    function LoadSelected(selectedmsa) {

        var allTravel = document.getElementById("ctl00_ContentPlaceHolder1_txtTravel").value;
        var travelLines = allTravel.split("\n");
        for (i = 0; i < travelLines.length; i++) {
            var selectedTravel = travelLines[i].split(",");
            if (selectedmsa == selectedTravel[0]) {

                this.msa = selectedTravel[0];
                this.airCode = selectedTravel[1];
                this.airPort = selectedTravel[2];
                this.flightTime = selectedTravel[3];
                this.travelTime = selectedTravel[4];
                this.travelTotal = selectedTravel[5];
                this.airFare = selectedTravel[6];
                this.mileage = selectedTravel[7];
                this.hotel = selectedTravel[8];
                this.car = selectedTravel[9];
                this.meals = selectedTravel[10];
            }
        }

    }
}
//**************************************************************************************************


function calPrice(field, check_num) {

    /////////////////////////////////////////////////////////////////
    //Should be the same for both forms
    /////////////////////////////////////////////////////////////////
    if (check_num) {
        if (!chkNumber(field.value)) {
            window.alert("INVALID ONLY NUMBERS ALLOWED");
            field.value = "0";
            field.focus();
            return 0;
        }
    }

    var selectedMSA = document.getElementById("ctl00_ContentPlaceHolder1_ddlCity").value;
    if (TravelObject.msa != selectedMSA) {
        TravelObject.LoadSelected(selectedMSA);
    }


    var Vuln_Price = 0;
    var Time_Price = 0;
    var Live_Host = 0;
    var Addr_Spc = 0;
    var Sub_Total = 0;
    var SNMP_tot = 0;
    var Site_Price = 0;
    var AuxSiteVisit_Price = 0;
    var NumConsultantsDel = 0;
    
    var DelDays = 0;
    var DelHotel = 0;
    var DelAirFare = 0;
    var DelRental = 0;
    var DelDining = 0;
    var DelMileage = 0;
    var TrvHrsDel = 0;
    var DlvtTot = 0;

    var AuxSite_Price = 0;
    var AuxSiteSameCity_Price = 0;
    var Wiring_Closet_Price = 0;
    var FPS_Price = 0;
    var AppSvr_Price = 0;
    var OtherSvr_Price = 0;
    var Employee_Price = 0;
    var Routers_Price = 0;
    var Switches_Price = 0;
    var FW_IDS_Price = 0;
    var Domains_Price = 0;
    var DID_Price = 0;
    var Wrkstn_Price = 0;
    var DBSRV_Price = 0;
    var WEBSRV_Price = 0;

    var TotalSites = 0;
    var OnSiteDays = 0;
    var numCons = 0;
    var Labor = 0;
    var DC_Hotel = 0;
    var DCAirFare = 0;
    var car = 0;
    var DCRental = 0;
    var DCDining = 0;
    var DCMileage = 0;
    var DataTot = 0;

//Setting Travel
    if (document.getElementById("ctl00_ContentPlaceHolder1_chkOnsiteDlvr").checked) {
        NumConsultantsDel = 1;
        DelDays = 1;
        DelHotel = Math.round(TravelObject.hotel);
        DelAirFare = Math.round(TravelObject.airFare);
        DelRental = Math.round(TravelObject.car);
        DelDining = Math.round(TravelObject.meals);
        DelMileage = Math.round(0.405 * TravelObject.mileage);
        TrvHrsDel = Math.round(TravelObject.travelTotal);
        DlvrTot = DelHotel + DelAirFare + DelRental + DelDining + DelMileage + TrvHrsDel;

    }
    else {
        NumConsultantsDel = 1;
        DelDays = 0;
        DelHotel = 0;
        DelAirFare = 0;
        DelRental = 0;
        DelDining = 0;
        DelMileage = 0;
        TrvHrsDel = 350;
        DlvrTot = 350;
    }

    document.getElementById("ctl00_ContentPlaceHolder1_txtAirCode").value = TravelObject.airCode;
    document.getElementById("ctl00_ContentPlaceHolder1_txtAirPort").value = TravelObject.airPort;
    document.getElementById("ctl00_ContentPlaceHolder1_txtMSA").value = TravelObject.MSA;

    document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDaysDel").value = DelDays;
    document.getElementById("ctl00_ContentPlaceHolder1_txtDEL_Hotel").value = formatCurrency(Math.round(DelHotel)).replace(".00", "");
    document.getElementById("ctl00_ContentPlaceHolder1_txtDELAirFare").value = formatCurrency(Math.round(DelAirFare)).replace(".00", "");
    document.getElementById("ctl00_ContentPlaceHolder1_txtDELRental").value = formatCurrency(Math.round(DelRental)).replace(".00", "");
    document.getElementById("ctl00_ContentPlaceHolder1_txtDELDining").value = formatCurrency(Math.round(DelDining)).replace(".00", "");
    document.getElementById("ctl00_ContentPlaceHolder1_txtDELMileage").value = formatCurrency(Math.round(DelMileage)).replace(".00", "");
    document.getElementById("ctl00_ContentPlaceHolder1_txtDELLabor").value = formatCurrency(Math.round(TrvHrsDel)).replace(".00", "");
    document.getElementById("ctl00_ContentPlaceHolder1_txtDELTotal").value = formatCurrency(Math.round(DlvrTot)).replace(".00", "");
    
    /////////////////////////////////////////////////////////////////

// setting other prices
    switch (GetAttributeValue(window.location.search.substring(1), "Type", '&', '=')) {
//HIPPA section  
        case ("HIPPA"):
            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_0").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_0").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 0.125, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_0").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_1").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 0.1625, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_1").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_0").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 0.625, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_1").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_1").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 0.8125, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_2").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_0").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 1, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_2").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_1").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 1.3, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_0").checked)
                Addr_Spc = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtIPs").value, 0.01, 64, 96, 0.8, 128, 0.7, 256, 0.5, 0.3);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_1").checked)
                Addr_Spc = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtIPs").value, 0.013, 64, 96, 0.8, 128, 0.7, 256, 0.5, 0.3);



            Site_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtNumSites").value * (45 * 180);
            AuxSiteVisit_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtAuxSitesVisited").value * (15 * 180);


             AuxSite_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtNumAuxSites").value * 180;

             AuxSiteSameCity_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtNumAuxSitesSameCity").value * (2.5 * 180);

             Wiring_Closet_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumWiringClosets").value, 1, 6, 10, 0.8, 20, 0.75, 40, 0.7, 0.6);

             FPS_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumFPS").value, 1, 3, 7, 0.7, 15, 0.65, 50, 0.57, 0.3);

             AppSvr_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumAppSrvs").value, 1, 3, 7, 0.7, 15, 0.65, 50, 0.5, 0.3);

             OtherSvr_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumOthSrvs").value, 1, 12, 25, 0.8, 50, 0.7, 100, 0.6, 0.5);

             Employee_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumEmp").value, 0.075, 25, 50, 0.8, 100, 0.75, 200, 0.7, 0.65);

             Routers_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumRouters").value, 1.5, 5, 10, 0.7, 20, 0.65, 40, 0.6, 0.5);

             Switches_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumSwitches").value, 0.25, 5, 10, 0.7, 20, 0.65, 40, 0.6, 0.5);

             FW_IDS_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumFWandIDS").value, 1.5, 5, 10, 0.8, 20, 0.75, 40, 0.7, 0.6);

             Domains_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtNumDomain").value * (5 * 180);

             DID_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumDID").value, 0.18, 50, 100, 0.8, 150, 0.75, 200, 0.7, 0.65);

             Wrkstn_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumWkstn").value, 0.125, 150, 250, 0.6, 500, 0.5, 1000, 0.4, 0.3);

             DBSRV_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtnumDBSrvs").value, 1, 12, 25, 0.8, 50, 0.7, 100, 0.6, 0.5);

             WEBSRV_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtnumWebSrvs").value, 1, 12, 25, 0.8, 50, 0.7, 100, 0.6, 0.5);

            if (document.getElementById("ctl00_ContentPlaceHolder1_txtNumSNMP").value > 0)
                SNMP_tot = 0;
            else
                SNMP_tot = (0.1 * 180) * (document.getElementById("ctl00_ContentPlaceHolder1_txtNumRouters").value + document.getElementById("ctl00_ContentPlaceHolder1_txtNumSwitches").value);

            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList1_0").checked) {

                Sub_Total = Math.round((Site_Price + AuxSite_Price + AuxSiteVisit_Price + AuxSiteSameCity_Price + Wiring_Closet_Price + FPS_Price + AppSvr_Price + OtherSvr_Price + Vuln_Price + Addr_Spc + Employee_Price + Routers_Price + Switches_Price + FW_IDS_Price + Domains_Price + DID_Price + Wrkstn_Price + DBSRV_Price + WEBSRV_Price + SNMP_tot) * .55);
            }
            else if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList1_2").checked) {
                Sub_Total = Math.round((Site_Price + AuxSite_Price + AuxSiteVisit_Price + AuxSiteSameCity_Price + Wiring_Closet_Price + FPS_Price + AppSvr_Price + OtherSvr_Price + Vuln_Price + Addr_Spc + Employee_Price + Routers_Price + Switches_Price + FW_IDS_Price + Domains_Price + DID_Price + Wrkstn_Price + DBSRV_Price + WEBSRV_Price + SNMP_tot) * .75);
            }
            else {
                Sub_Total = Math.round(Site_Price + AuxSite_Price + AuxSiteVisit_Price + AuxSiteSameCity_Price + Wiring_Closet_Price + FPS_Price + AppSvr_Price + OtherSvr_Price + Vuln_Price + Addr_Spc + Employee_Price + Routers_Price + Switches_Price + FW_IDS_Price + Domains_Price + DID_Price + Wrkstn_Price + DBSRV_Price + WEBSRV_Price + SNMP_tot);
            }

          
            //////////////////////////////////////////////////////////////////////////////
            //if this doesnt change we can break out and only call after swtitch statment
            ///////////////////////////////////////////////////////////////////////////////

            document.getElementById("ctl00_ContentPlaceHolder1_txtDays").value = Math.round(10 + Sub_Total / 1000);
            document.getElementById("ctl00_ContentPlaceHolder1_txtDelivery").value = Math.ceil(document.getElementById("ctl00_ContentPlaceHolder1_txtDays").value / 5);


            TotalSites = Math.round(document.getElementById("ctl00_ContentPlaceHolder1_txtNumSites").value) + Math.round(document.getElementById("ctl00_ContentPlaceHolder1_txtAuxSitesVisited").value);

            OnSiteDays = Math.round(1 + Sub_Total / 9000);
            document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDays").value = OnSiteDays;

            numCons = DetNumCons(OnSiteDays);
            document.getElementById("ctl00_ContentPlaceHolder1__txtOnSiteDays").value = OnSiteDays / numCons;
            document.getElementById("ctl00_ContentPlaceHolder1_txtnumConsultants").value = numCons;

            Labor = numCons * (TravelObject.travelTotal) * TotalSites;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCLabor").value = formatCurrency(Math.round(Labor)).replace(".00", "");
            DC_Hotel = TravelObject.hotel * document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDays").value * TotalSites;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDC_Hotel").value = formatCurrency(Math.round(DC_Hotel)).replace(".00", "");
            DCAirFare = TravelObject.airFare * numCons * TotalSites;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCAirFare").value = formatCurrency(Math.round(DCAirFare)).replace(".00", "");
            car = document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDays").value / numCons;
            DCRental = TravelObject.car * Math.round(car);
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCRental").value = formatCurrency(Math.round(DCRental)).replace(".00", "");
            DCDining = TravelObject.meals * document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDays").value * numCons;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCDining").value = formatCurrency(Math.round(DCDining)).replace(".00", "");
            DCMileage = 0.405 * TravelObject.mileage;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCMileage").value = formatCurrency(Math.round(DCMileage * TotalSites)).replace(".00", "");
            DataTot = Math.round(DC_Hotel + DCAirFare + DCRental + DCDining + DCMileage + Labor);

            document.getElementById("ctl00_ContentPlaceHolder1_txtTotal").value = formatCurrency(DataTot).replace(".00", "");

            document.getElementById("ctl00_ContentPlaceHolder1_txtLaborST").value = formatCurrency(Sub_Total).replace(".00", "");
            document.getElementById("ctl00_ContentPlaceHolder1_txtChnltoCust").value = formatCurrency(Math.round((Sub_Total + DataTot + DlvrTot) * 1.25)).replace(".00", "");
            //////////////////////////////////////////////////////////////////////////////////////////



            break;
//ESA section 
        case ("ESA"):

            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_0").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_0").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 0.125, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_0").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_1").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 0.1625, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_1").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_0").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 0.625, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_1").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_1").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 0.8125, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_2").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_0").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 1, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList2_2").checked && document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_1").checked)
                Vuln_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtHost").value, 1.3, 8, 20, 0.8, 50, 0.75, 100, 0.7, 0.65);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_0").checked)
                Addr_Spc = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtIPs").value, 0.01, 64, 96, 0.8, 128, 0.7, 256, 0.5, 0.3);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList3_1").checked)
                Addr_Spc = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumExtIPs").value, 0.013, 64, 96, 0.8, 128, 0.7, 256, 0.5, 0.3);



            Site_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtNumSites").value * (35 * 180);
            AuxSiteVisit_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtAuxSitesVisited").value * (10 * 180);


             AuxSite_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtNumAuxSites").value * 180;

             AuxSiteSameCity_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtNumAuxSitesSameCity").value * (2.5 * 180);

             Wiring_Closet_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumWiringClosets").value, 0.25, 5, 10, 0.8, 20, 0.75, 40, 0.7, 0.6);

             FPS_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumFPS").value, 0.25, 3, 7, 0.7, 15, 0.65, 50, 0.57, 0.3);

             AppSvr_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumAppSrvs").value, 0.25, 3, 7, 0.7, 15, 0.65, 50, 0.5, 0.3);

             OtherSvr_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumOthSrvs").value, 0.25, 6, 14, 0.8, 30, 0.7, 100, 0.6, 0.5);

             Employee_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumEmp").value, 0.025, 50, 100, 0.8, 150, 0.65, 200, 0.45, 0.1);

             Routers_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumRouters").value, 1.5, 2, 5, 0.7, 10, 0.65, 20, 0.6, 0.5);

             Switches_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumSwitches").value, 0.25, 5, 10, 0.7, 20, 0.65, 40, 0.6, 0.5);

             FW_IDS_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumFWandIDS").value, 1, 5, 10, 0.8, 20, 0.75, 40, 0.7, 0.6);

             Domains_Price = document.getElementById("ctl00_ContentPlaceHolder1_txtNumDomain").value * (4 * 180);

             DID_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumDID").value, 0.18, 5, 10, 0.8, 100, 0.6, 250, 0.55, 0.5);

             Wrkstn_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtNumWkstn").value, 0.125, 150, 250, 0.6, 500, 0.5, 1000, 0.4, 0.3);

             DBSRV_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtnumDBSrvs").value, 0.25, 3, 7, 0.7, 15, 0.65, 50, 0.57, 0.3);

             WEBSRV_Price = Price_Factor(document.getElementById("ctl00_ContentPlaceHolder1_txtnumWebSrvs").value, 0.25, 3, 7, 0.7, 15, 0.65, 50, 0.57, 0.3);

            if (document.getElementById("ctl00_ContentPlaceHolder1_txtNumSNMP").value > 0)
                SNMP_tot = 0;
            else
                SNMP_tot = (0.1 * 180) * (document.getElementById("ctl00_ContentPlaceHolder1_txtNumRouters").value + document.getElementById("ctl00_ContentPlaceHolder1_txtNumSwitches").value);


            if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList1_0").checked) {

                Sub_Total = Math.round((Site_Price + AuxSite_Price + AuxSiteVisit_Price + AuxSiteSameCity_Price + Wiring_Closet_Price + FPS_Price + AppSvr_Price + OtherSvr_Price + Vuln_Price + Addr_Spc + Employee_Price + Routers_Price + Switches_Price + FW_IDS_Price + Domains_Price + DID_Price + Wrkstn_Price + DBSRV_Price + WEBSRV_Price + SNMP_tot) * .55);
            }
            else if (document.getElementById("ctl00_ContentPlaceHolder1_RadioButtonList1_2").checked) {
                Sub_Total = Math.round((Site_Price + AuxSite_Price + AuxSiteVisit_Price + AuxSiteSameCity_Price + Wiring_Closet_Price + FPS_Price + AppSvr_Price + OtherSvr_Price + Vuln_Price + Addr_Spc + Employee_Price + Routers_Price + Switches_Price + FW_IDS_Price + Domains_Price + DID_Price + Wrkstn_Price + DBSRV_Price + WEBSRV_Price + SNMP_tot) * .75);
            }
            else {
                Sub_Total = Math.round(Site_Price + AuxSite_Price + AuxSiteVisit_Price + AuxSiteSameCity_Price + Wiring_Closet_Price + FPS_Price + AppSvr_Price + OtherSvr_Price + Vuln_Price + Addr_Spc + Employee_Price + Routers_Price + Switches_Price + FW_IDS_Price + Domains_Price + DID_Price + Wrkstn_Price + DBSRV_Price + WEBSRV_Price + SNMP_tot);
            }

            //////////////////////////////////////////////////////////////////////////////
            //if this doesnt change we can break out and only call after swtitch statment
            ///////////////////////////////////////////////////////////////////////////////

            document.getElementById("ctl00_ContentPlaceHolder1_txtDays").value = Math.round(10 + Sub_Total / 1000);
            document.getElementById("ctl00_ContentPlaceHolder1_txtDelivery").value = Math.ceil(document.getElementById("ctl00_ContentPlaceHolder1_txtDays").value / 5);


            TotalSites = Math.round(document.getElementById("ctl00_ContentPlaceHolder1_txtNumSites").value) + Math.round(document.getElementById("ctl00_ContentPlaceHolder1_txtAuxSitesVisited").value);

            OnSiteDays = Math.round(1 + Sub_Total / 9000);
            document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDays").value = OnSiteDays;

            numCons = DetNumCons(OnSiteDays);
            document.getElementById("ctl00_ContentPlaceHolder1__txtOnSiteDays").value = OnSiteDays / numCons;
            document.getElementById("ctl00_ContentPlaceHolder1_txtnumConsultants").value = numCons;

            Labor = numCons * (TravelObject.travelTotal) * TotalSites;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCLabor").value = formatCurrency(Math.round(Labor)).replace(".00", "");
            DC_Hotel = TravelObject.hotel * document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDays").value * TotalSites;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDC_Hotel").value = formatCurrency(Math.round(DC_Hotel)).replace(".00", "");
            DCAirFare = TravelObject.airFare * numCons * TotalSites;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCAirFare").value = formatCurrency(Math.round(DCAirFare)).replace(".00", "");
            car = document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDays").value / numCons;
            DCRental = TravelObject.car * Math.round(car);
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCRental").value = formatCurrency(Math.round(DCRental)).replace(".00", "");
            DCDining = TravelObject.meals * document.getElementById("ctl00_ContentPlaceHolder1_txtOnSiteDays").value * numCons;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCDining").value = formatCurrency(Math.round(DCDining)).replace(".00", "");
            DCMileage = 0.405 * TravelObject.mileage;
            document.getElementById("ctl00_ContentPlaceHolder1_txtDCMileage").value = formatCurrency(Math.round(DCMileage * TotalSites)).replace(".00", "");
            DataTot = Math.round(DC_Hotel + DCAirFare + DCRental + DCDining + DCMileage + Labor);

            document.getElementById("ctl00_ContentPlaceHolder1_txtTotal").value = formatCurrency(DataTot).replace(".00", "");
           
            document.getElementById("ctl00_ContentPlaceHolder1_txtLaborST").value = formatCurrency(Sub_Total).replace(".00", "");
            document.getElementById("ctl00_ContentPlaceHolder1_txtChnltoCust").value = formatCurrency(Math.round((Sub_Total + DataTot + DlvrTot) * 1.25)).replace(".00", "");
            //////////////////////////////////////////////////////////////////////////////////////////

            break;
    }

    


    var firstChannel = document.getElementById("ctl00_ContentPlaceHolder1_lstChannel").value;
}

function chIframe() {
    var listBox1 = document.getElementById("lstChannel");
    var firstChannel = document.getElementById("ctl00_ContentPlaceHolder1_lstChannel").value;
    var Deliverable = document.getElementById("ctl00_ContentPlaceHolder1_lboxDeliverable").value;

    switch (GetAttributeValue(window.location.search.substring(1), "Type", '&', '=')) {
        case ("HIPPA"):
            switch (Deliverable) {
                case ("Collateral"):
                    switch (firstChannel) {
                        case ("AT&T NI"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/ATT/Factsheets/Docs/ACE_HIPAA_Asmt_Fact_Sheet_07_2006.pdf";
                            break;
                        case ("AT&T NDO"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/ATT/Factsheets/Docs/ACE_HIPAA_Asmt_Fact_Sheet_07_2006.pdf";
                            break;
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/Spohn/Fact Sheets/Docs/NetAUDIT HIPAA Security Assessment v.3.0.pdf";
                            break;
                    }
                    break;
                case ("Audit Report V1"):
                    switch (firstChannel) {
                        case ("AT&T NDO"):
                        case ("AT&T NI"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/HIPAA Audit Report Findings Vol 1 (Acme)-redacted - AT&T.pdf";
                            break;
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/HIPAA Audit Report Findings Vol 1 (Acme)-redacted.pdf";
                            break;
                    }
                    break;
                case ("Audit Report V2"):
                    switch (firstChannel) {
                        case ("AT&T NDO"):
                        case ("AT&T NI"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/HIPAA Audit Report Findings Vol 2 - Technical (ACME)-redacted - ATT.pdf";
                            break;
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/HIPAA Audit Report Findings Vol 2 - Technical (ACME)-redacted.pdf";
                            break;
                    }
                    break;
                case ("Audit Report Opinion"):
                    switch (firstChannel) {
                        case ("AT&T NDO"):
                        case ("AT&T NI"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/HIPAA Compliance Report Opinion (ACME) - redacted - AT&T.pdf";
                            break;
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/HIPAA Compliance Report Opinion (ACME) - redacted.pdf";
                            break;
                    }
                    break;
                case ("SOW"):
                    switch (firstChannel) {
                        case ("AT&T NDO"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/SOW Templates/ATT NDO/Master_SOW_ACE_CAHIPAA_07_2006.pdf";
                            break;
                        case ("AT&T NI"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/SOW Templates/ATT NI/ATT NI ESA HIPAA Template v3.0 NEW FORMAT.pdf";
                            break;
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/SOW Templates/Direct_CDW/HIPAA Compliance SOW-  v 2.0 NEW.pdf";
                            break;
                    }
                    break;
                    swi
                case ("ESA Mind Map"):
                    document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/Spohn/Overview/Docs/ESA_v3.mm.pdf";
                    break;
                case ("ESA FAQ"):

                    document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/Spohn/Overview/Docs/ESA-NSA FAQ.pdf";
                    break;
                case ("HIPPA Case Study"):
                    document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/Spohn/Case Studies/Docs/HIPAA Case Study.pdf";
                    break;
                case ("Questionnaire"):
                    document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Questionnaire/ESA Questionnaire.doc";
                    break;
                case ("Definitions"):
                    document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Definitions/ESA Definitions.pdf";
                    break;


            }
            break;
        case ("ESA"):
            switch (Deliverable) {
                case ("Collateral"):
                    switch (firstChannel) {
                        case ("AT&T NI"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/ATT/Factsheets/Docs/ACE_SA_Comp_Fact_Sheet_07_2006.pdf";
                            break;
                        case ("AT&T NDO"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/ATT/Factsheets/Docs/ACE_SA_Comp_Fact_Sheet_07_2006.pdf";
                            break;
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/Spohn/Fact Sheets/Docs/NetAUDIT Enterprise Security Assessment v 3.0.pdf";
                            break;
                    }
                    break;
                case ("SOW"):
                    switch (firstChannel) {
                        case ("AT&T NDO"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/SOW Templates/ATT NDO/Master_SOW_ACE_SAC_07_2006a_v2.pdf";
                            break;
                        case ("AT&T NI"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/SOW Templates/ATT NI/ATT NI ESA Template 4.0 NEW FORMAT.pdf";
                            break;
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/SOW Templates/Direct_CDW/ESA SOW-C.v.6 - NEW.pdf";
                            break;
                    }
                    break;
                case ("ESA Vol 1"):
                    switch (firstChannel) {
                        case ("AT&T NDO"):
                        case ("AT&T NI"):
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/ESA Vol 1 - Redacted.pdf";
                            break;
                    }
                    break;
                case ("ESA Vol 2"):
                    switch (firstChannel) {
                        case ("AT&T NDO"):
                        case ("AT&T NI"):
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/ESA Vol 2 - Redacted.pdf";
                            break;
                    }
                    break;
                case ("ESA Opinion"):
                    switch (firstChannel) {
                        case ("AT&T NDO"):
                        case ("AT&T NI"):
                        case ("CDW"):
                        case ("Spohn Direct"):
                            document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Deliverables/ESA/ESA Opinion - Redacted.pdf";
                            break;
                    }
                    break;
                case ("ESA Case Study"):

                    document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/Spohn/Case Studies/Docs/ESA Case Study.pdf";


                    break;
                case ("ESA Mind Map"):

                    document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/Spohn/Overview/Docs/ESA_v3.mm.pdf";


                    break;
                case ("ESA FAQ"):

                    document.getElementById('ctl00_ContentPlaceHolder1_pdfDoc').src = "./documents/Sales Info/Split/Collateral/Spohn/Overview/Docs/ESA-NSA FAQ.pdf";


                    break;
            }
            break;
    }

}
 
