highlightColor = "#990000";
highlightDuration = 4000;

// functions related to basket
//
   function addToCart(id) {
        // for effects, uncomment the fadeIn and fadeOut
        //$('div#cart').fadeOut('fast');
        $('div#cart').load( baseUrl + '?query=/basket/add/id/' + id).Highlight(highlightDuration, highlightColor);
        //$('div#cart').fadeIn('fast');
    }
    
    function removeFromCart(id) {
        // for effects, uncomment the fadeIn and fadeOut
        //$('div#cart').fadeOut('fast');
        $('div#cart').load( baseUrl + '?query=/basket/remove/id/' + id).Highlight(highlightDuration, highlightColor);
        //$('div#cart').fadeIn('fast');
    }

    function cnfAddToCart(id) {
        $("#confirm").load( baseUrl + '?query=/basket/add/source/confirm/id/' + id ).fadeIn();
    }

    function cnfRemoveFromCart(id) {
        $("#confirm").load( baseUrl + '?query=/basket/remove/source/confirm/id/' + id ).fadeIn();
    }

    function confirmStep() {
        // show confirm div and hide others
        $("#cart").hide();
        $("#sivusto").hide();
        $("#confirm").load( baseUrl + '?query=/basket/confirm' ).fadeIn();
    }

    function cancelConfirmStep() {
        // hide confirm div, show others
        $("#confirm").hide();
        $("#cart").fadeIn();
        $("#sivusto").fadeIn();
    }

    function setCompany(name) {
        jQuery.ajax({
            type: "GET",
            data: "",
            url: baseUrl + '?query=/basket/setcompany/company/' + name,
            error: function() {
                return;
            },
            success: function(response) {
                return;
            }
        }); 
    }
         

$(document).ready(function() {
    setCompany(company);
    $('div#cart').load( baseUrl + '?query=/basket/list' );
    $("#confirm").hide();
});

