﻿var cdp = function() {
    var l = $("#tblk :checked").length - 1;
    if (typeof (dscs[l]) !== "undefined") {
        $("#korting").html(((parseFloat(dscs[l]) * 100) + " %").replace(".",","));
    }
    else {
        $("#korting").html("0 %");
    }
    $("#korting").css({ fontSize: "26px" }).animate({ fontSize: "16px" });
}

var recalculatePrices = function() {
    var data = new Object();
    
    $(".colMidContent input:checkbox").each(function() {
        data[$(this).attr("class")] = $(this).attr("checked");
    })

    $(".colMidContent input:radio:checked").each(function() {
        data[$(this).attr("class")] = $(this).val();
    })

    Tp.Wis.GetPrice(data, _GetPrice_OnSucceeded, _GetPckg_OnFailed, "ICC");
}

var _GetPckg_OnFailed = function(error) {
    alert(error.get_message());
    alert(error.get_stackTrace());
}

var _GetPrice_OnSucceeded = function(result) {
    $("#sbp").html(result.Budget);
    $("#spp").html(result.Plus);
    $("#sep").html(result.Extra);

    //    $("#sbp").fadeOut("def");
    //    $("#spp").fadeOut("def");
    //    $("#sep").fadeOut("def", function() {
    //            $("#sbp").html(result.Budget);
    //            $("#spp").html(result.Plus);
    //            $("#sep").html(result.Extra);
    //            $("#sbp").fadeIn("def");
    //            $("#spp").fadeIn("def");
    //            $("#sep").fadeIn("def");
    //        }
    //    );
}

var beginRequestHandler = function() {
    $get("ils").style.display = "inline"; 
}

var endRequestHandler = function() {
    $get("ils").style.display = "none";
}

function PrintContent(element, iframe)
{
    try {
    var oIframe = document.getElementById(iframe);
    var oContent = document.getElementById(element).innerHTML;
    var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
    if (oDoc.document) oDoc = oDoc.document;
        oDoc.write("<head><title></title>");
        oDoc.write("</head><body onload='this.focus(); this.print();'>");
        oDoc.write(oContent + "</body>");
        oDoc.close();
}
catch(e){
self.print();
}
}
