
function ToggleDiscount(DiscountChk)
{
    var DiscPnlBhr = $find("DiscountBhr"),
        passLst = $("#" + PassTypeID)[0];
    DiscountChk.checked ? DiscPnlBhr._doOpen() : DiscPnlBhr._doClose()
}
function ToggleGroup(GroupChk)
{
    var GroupPnlBhr = $find("GroupBhr");
    GroupChk.checked ? GroupPnlBhr._doOpen() : GroupPnlBhr._doClose()
}
function ToggleRoommate(RoommateChk)
{
    var RoommatePnlBhr = $find("RoommateBhr");
    RoommateChk.checked ? RoommatePnlBhr._doOpen() : RoommatePnlBhr._doClose()
}
function VerifyDiscount(code)
{
    var CodeTxt,
        VerifyPnlBhr;
    (code == null || code == "") && (CodeTxt = $get(DiscountCodeTxtID), code = CodeTxt.value), EBC.UI.EBC_Service.VerifyCode(_EventID,code,VerifyDiscountSuccess,VerifyDiscountFail), $get(VerifyBtnID).disabled = !0, VerifyPnlBhr = $find("VerifyBhr"), VerifyPnlBhr._doOpen()
}
function VerifyDiscountSuccess(response)
{
    var VerifyPnlBhr = $find("VerifyBhr"),
        myInfo,
        myDiscount,
        ValidPnlBhr;
    VerifyPnlBhr._doClose();
    if(response.IsValid == !0)
    {
        var PassType = $get(PassTypeID),
            passLst = $("#" + PassTypeID)[0],
            DiscPnlBhr = $find("DiscountBhr");
        response.RequireFullPass && passLst.options[passLst.selectedIndex].getAttribute("ItemCode") != "FULLPASS" ? ($get(VerifyBtnID).disabled = !1, $get(ValidResponseSpnID).innerHTML = "This discount code is valid, but only when used against a full weekend pass.", $("#DiscountResponseDiv").css("border","dashed 2px red")) : (DiscPnlBhr._doClose(), $get(ValidResponseSpnID).innerHTML = response.Message + "<br /><br />" + response.Text, $("#DiscountResponseDiv").css("border","dashed thin green"), myInfo = {}, myInfo.ID = response.Value, myInfo.Price = response.AmountOff, myInfo.DisplayName = "Discount (" + response.Value + ")", myInfo.Type = "DISCOUNT", UpdatePriceRow(myInfo), myDiscount = jQuery.extend(!0,{},myInfo), myDiscount.RequireFullPass = response.RequireFullPass, _discountArr.push(myDiscount))
    }
    else
        $get(VerifyBtnID).disabled = !1, $get(ValidResponseSpnID).innerHTML = response.Message, $("#DiscountResponseDiv").css("border","dashed 2px red");
    ValidPnlBhr = $find("ValidBhr"), ValidPnlBhr._doOpen()
}
function VerifyDiscountFail(response)
{
    var VerifyPnlBhr,
        ValidPnlBhr;
    $get(VerifyBtnID).disabled = !1, VerifyPnlBhr = $find("VerifyBhr"), VerifyPnlBhr._doClose(), ValidPnlBhr = $find("ValidBhr"), ValidPnlBhr._doClose()
}
function UpdateConfirmPass()
{
    alert("called")
}
function UpdateReceipt(CompDrp)
{
    var myInfo = {};
    myInfo.ID = CompDrp.options[CompDrp.selectedIndex].getAttribute("c"), myInfo.Price = CompDrp.options[CompDrp.selectedIndex].getAttribute("p"), myInfo.DisplayName = CompDrp.options[CompDrp.selectedIndex].getAttribute("d"), UpdatePriceRow(myInfo)
}
function UpdateDVD(DVDChk)
{
    $("#" + DVDLstID).find("input").each(function()
    {
        var myInfo = {};
        myInfo.ID = $(this.parentNode).attr("c"), myInfo.DisplayName = $(this.parentNode).attr("d"), $(this).attr("checked") && (myInfo.Price = $(this.parentNode).attr("p")), UpdatePriceRow(myInfo)
    })
}
function UpdateALaCarte(chk)
{
    var cnt = 0;
    $("#" + ALaCarteLstID).find("input").each(function()
    {
        var myInfo = {};
        myInfo.ID = $(this.parentNode).attr("c"), myInfo.DisplayName = $(this.parentNode).attr("d"), $(this).attr("checked") && (myInfo.Price = $(this.parentNode).attr("p"), cnt += 1), UpdatePriceRow(myInfo)
    }), myVal = $get(PassValID), ValidatorEnable(myVal,cnt == 0), cnt > 0 && ($("#" + PassTypeID).val(""), UpdatePass())
}
function UpdatePass()
{
    var myInfo = {},
        passLst = $("#" + PassTypeID)[0],
        PassPricingLevelHdn = $("#" + PassPricingLevelHdnID)[0],
        myCountryLst,
        i;
    myInfo.Price = passLst.options[passLst.selectedIndex].getAttribute("p"), myInfo.ID = "REG", myInfo.DisplayName = "Registration", myInfo.Type = "REG", PassPricingLevelHdn.value = passLst.options[passLst.selectedIndex].getAttribute("pl"), UpdatePriceRow(myInfo), passLst.selectedIndex != 0 && ($("#" + ALaCarteLstID).find("input[type=checkbox]").each(function()
    {
        this.checked = !1
    }), UpdateALaCarte());
    if(passLst.options[passLst.selectedIndex].getAttribute("ItemCode") != "FULLPASS")
        for(myCountryLst = $get(CountryLstID), myCountryLst.options[myCountryLst.selectedIndex].text != "United States" && (myInfo = {}, myInfo.ID = "INTERNATIONAL", myInfo.Price = null, UpdatePriceRow(myInfo)), i = _discountArr.length - 1; i >= 0; i--)
            _discountArr[i].RequireFullPass && (_discountArr[i].Price = null, UpdatePriceRow(_discountArr[i]), _discountArr.splice(i,1), $get(VerifyBtnID).disabled = !1, $get(ValidResponseSpnID).innerHTML = "You had a discount that required a full weekend pass.  That discount has been removed.", $("#DiscountResponseDiv").css("border","dashed 2px red"), $("#" + DiscountCodeChkID)[0].checked = !1);
    else
        UpdateCountry()
}
function UpdatePriceRow(Info)
{
    var table = $get("ConfirmTbl"),
        row,
        DisplayCell,
        PriceCell,
        iLvl;
    $("#ReceiptDiv").show();
    if(Info.Price == null)
        try
        {
            try
            {
                row = $("#ConfirmTbl #" + Info.ID)[0], _Total != null && row != null && (_Total = _Total - parseFloat(row.cells[1].innerHTML.replace(/\$|\,/g,"")))
            }
            catch(e){}
            $("#ConfirmTbl #" + Info.ID).remove(), row = $("#ConfirmTbl #TOTAL")[0].cells[1].innerHTML = "$" + _Total
        }
        catch(e){}
    else
    {
        try
        {
            row = $("#ConfirmTbl #" + Info.ID)[0], DisplayCell = row.cells[0], PriceCell = row.cells[1], _Total = _Total - parseFloat(PriceCell.innerHTML.replace(/\$|\,/g,""))
        }
        catch(err)
        {
            iLvl = 2;
            switch(Info.Type)
            {
                case"DISCOUNT":
                    iLvl = $("#ConfirmTbl tr").size() - 2;
                    break;
                case"REG":
                    iLvl = $("#ConfirmTbl tr").size() - 2;
                    break;
                default:
                    iLvl = 2
            }
            row = table.insertRow(iLvl), row.id = Info.ID, DisplayCell = row.insertCell(0), PriceCell = row.insertCell(1)
        }
        DisplayCell.innerHTML = Info.DisplayName, PriceCell.innerHTML = Info.Price, $(PriceCell).css("align","right"), Info.Type == "DISCOUNT" && ($(PriceCell).addClass("discountRow"), $(DisplayCell).addClass("discountRow")), _Total = _Total != null && _Total != 0 ? _Total + parseFloat(Info.Price.replace(/\$|\,/g,"")) : parseFloat(Info.Price.replace(/\$|\,/g,"")), row = $("#ConfirmTbl #TOTAL")[0].cells[1].innerHTML = formatCurrency(_Total)
    }
}
function formatCurrency(num)
{
    num = num.toString().replace(/\$|\,/g,""), isNaN(num) && (num = "0"), sign = num == (num = Math.abs(num)), num = Math.floor(num * 100 + .50000000001), cents = num % 100, num = Math.floor(num / 100).toString(), 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 ToggleLeadFollowVal(drpdn,valID)
{
    var myVal = $get(valID);
    drpdn.selectedIndex == 1 ? ValidatorEnable(myVal,!0) : ValidatorEnable(myVal,!1)
}
function UpdateCountry()
{
    var myVal,
        myCountryLst = $get(CountryLstID),
        passLst,
        e,
        myInfo;
    myCountryLst.options[myCountryLst.selectedIndex].value != "" && (myCountryLst.options[myCountryLst.selectedIndex].text != "United States" ? (myVal = $get(StateValID), ValidatorEnable(myVal,!1), myVal = $get(ProvinceValID), ValidatorEnable(myVal,!0), $("#" + StateSpnID).hide(), $("#" + StateLblSpnID).hide(), $("#" + ProvinceSpnID).show(), $("#" + ProvinceLblSpnID).show(), passLst = $("#" + PassTypeID)[0], passLst.options[passLst.selectedIndex].getAttribute("ItemCode") == "FULLPASS" && validateInternationalDiscount(), e = document.getElementById(ProvinceSpnID), e.style.display = "block") : (myVal = $get(StateValID), ValidatorEnable(myVal,!0), myVal = $get(ProvinceValID), ValidatorEnable(myVal,!1), $("#" + StateSpnID).show(), $("#" + StateLblSpnID).show(), $("#" + ProvinceSpnID).hide(), $("#" + ProvinceLblSpnID).hide(), myInfo = {}, myInfo.ID = "INTERNATIONAL", myInfo.Price = null, UpdatePriceRow(myInfo)))
}
function CheckUserName(usernameTxt)
{
    EBC.UI.EBC_Service.CheckUserName(usernameTxt.value,CheckUserNameSuccess,CheckUserNameFail)
}
function CheckUserNameSuccess(response)
{
    response.IsValid == !0 ? ($get("UserNameResponseSpn").innerHTML = "Username is available", $("#UserNameResponseSpn").css({
        color:"green"
    }), _isUsernameOK = !0) : ($get("UserNameResponseSpn").innerHTML = "Username is NOT available", $("#UserNameResponseSpn").css({
        color:"red"
    }), _isUsernameOK = !1)
}
function CheckUserNameFail(response)
{
    $get("UserNameResponseSpn").innerHTML = "Username check failed", $("#UserNameResponseSpn").css({
        color:"red"
    }), _isUsernameOK = !1
}
function ValidateUsername(sender,args)
{
    args.IsValid = _isUsernameOK;
    return
}
function validateInternationalDiscount()
{
    EBC.UI.EBC_Service.GetInternationalDiscount(_EventID,validateInternationalDiscountSuccess,validateInternationalDiscountFail)
}
function validateInternationalDiscountSuccess(response)
{
    var myInfo;
    response.IsValid == !0 ? (myInfo = {}, myInfo.ID = response.Value, myInfo.Price = response.AmountOff, myInfo.DisplayName = "Discount (" + response.Value + ")", myInfo.Type = "DISCOUNT", UpdatePriceRow(myInfo), alert("Please note that in order to receive the International Discount, you must present your passport when checking in, otherwise you will be required to pay the full price.")) : (myInfo = {}, myInfo.ID = "INTERNATIONAL", myInfo.Price = null, UpdatePriceRow(myInfo))
}
function validateInternationalDiscountFail(response){}
!0 && Sys.Application.notifyScriptLoaded();
var _Total,
    _isUsernameOK = !1,
    _discountArr = [];
$(document).ready(function()
{
    $("#ReceiptDiv").hide(), $("a.lightbox").lightBox(), $(".tab_content").hide(), $("ul.tabs li:first").addClass("active").show(), $(".tab_content:first").show(), $("ul.tabs li").click(function()
    {
        $("ul.tabs li").removeClass("active"), $(this).addClass("active"), $(".tab_content").hide();
        var activeTab = $(this).find("a").attr("href");
        return $(activeTab).fadeIn(), !1
    })
});
