function  updateCart(url, callbackId, quantityId, quantity, append, priceTotal, priceTotalAll)
{
  jQuery.ajax
  (
    {
      url: url,
      dataType: 'json',
      type: 'post',
      data : {"quantity" : quantity, "append" : append},
      success: function(message)
      {
         if (message.ADDTO_CART)
         {
          jQuery("#"+callbackId).show();
          jQuery("#"+priceTotal).html(message.priceTotal);
          jQuery("#"+priceTotalAll).html(message.priceTotalAll);
         }
         if (-1 != quantityId.indexOf("Input"))
         {
           jQuery("#"+quantityId).val(message.quantity);
         }
         else
         {
           jQuery("#"+quantityId).html(message.quantity);
         }
      }
    }
  );
}
function checkFlipbooks(url, orderurl)
{
  jQuery.ajax
  (
    {
      url: url,
      dataType: 'json',
      type: 'post',
      success: function(message)
      {
        if ('' == message.boughtFlipbooks || ('' != message.boughtFlipbooks && confirm("A k\u00f6vetkez\u0151 flipbookokat m\u00e1r online megv\u00e1s\u00e1rolta: " + message.boughtFlipbooks + ". Biztosan folytatja?")))
        {
          location.href = orderurl;
        }
      }
    }
  );
}
function updateShippingState(url, requiredShipping)
{
  jQuery.ajax
  (
    {
      url: url,
      dataType: 'json',
      type: 'post',
      data : {"requiredShipping" : requiredShipping},
      success: function(message)
      {
        jQuery("#personalButton").attr("disabled",message.UPDATE_SHIPPING_STATE);
        jQuery("#onlineButton").attr("disabled",!message.UPDATE_SHIPPING_STATE);
        jQuery("#deliveryButton").attr("disabled",!message.UPDATE_SHIPPING_STATE);
        jQuery("#shippingPrice").html(message.SHIPPINGPRICE);
        jQuery("#priceSumTotalValue").html(message.TOTALPRICE);
      }
    }
  );
}
function storeSearchFields(form,portletNameSpace)
{
  Liferay.Service.services.SessionHandler.addSearchParameters({ "sessionId" : themeDisplay.getSessionId(), "params" : jQuery("select, :input, :checkbox, :radio", form).serialize()});
}
function searchBySubject(namespace, value, text, schoolType)
{
  var subjectVal = -1;
  if ("" != schoolType)
  {
    subjectVal = jQuery("select[name='" +namespace + "schoolType']:first >  option[text='"+schoolType+"']").attr("value");
  }
  jQuery("select[name='" +namespace + "schoolType']:first").val(subjectVal);
  jQuery("select[name='" +namespace + "schoolClass']:first").val(-1);
  var subject = jQuery("select[name='" +namespace + "subject']:first")
  subject.append("<option value=\"" + value + "\">" + text + "</option>")
  subject.val(value);
  var form = subject.attr("form");
  jQuery('input[@type=submit]', form).trigger('click');
}