﻿

function ShowLoadArea() {

    $("#resultarea").html("");
    $("#loadarea").html("<img src=\"/img/icons/ajax-loader.gif\"/><br/>Laddar sökresultat...");
    return true;
        
}


function ShowCompare(strType) {

    var strUrl = '/loggedin/compare-' + strType + '.aspx?productIds=';
    var count = 0;

    // Looping all checkboxes and adding ids to url.
    $("input[@name='cbCompare[]']:checked").each(function() {
        strUrl += $(this).val() + ",";
        count++;
    });

    // At least two products to compare
    if (count < 2) {
        alert('Du måste markera minst två produkter för att jämföra.');
    }
    else {
        //Opening the shadowbox
        strUrl = strUrl.substring(0, strUrl.length - 1);

        iWidth = 220 + (200 * count);

        if(iWidth < 900)
            iWidth = 900;
        
        Shadowbox.open({
            content: strUrl,
            player: "iframe",
            title: "Welcome",
            width: iWidth,
            height: 700

        });

    }

}


function radDotToCommaKeyPress(sender, args) {
    if (args.get_keyCharacter() == ".") {
        sender.set_textBoxValue(sender.get_value() + ",");
        args.set_cancel(true);
    }
}

