﻿function paintBackground(context, width, height, elementInfo) {
  var options = { x: 0, height: height, width: width,
    radius: 14, border: 1
  };
  var backgroundGradient = context.createLinearGradient(0, 0, width, width);
  backgroundGradient.addColorStop(0, 'RGB(250,238,240)');
  backgroundGradient.addColorStop(1, 'RGB(79,116,169)');
  options.border = 1;
  context.fillStyle = backgroundGradient;
  $.canvasPaint.roundedRect(context, options);
}
function roundonly(context, width, height, elementInfo) {
  var options = { x: 0, height: height, width: width,
    radius: 14, border: 1
};
  context.fillStyle = elementInfo.$this[0].getAttribute("bg");
  $.canvasPaint.roundedRect(context, options); 
}
function DrawBackground() {
//  $(".gradient").backgroundCanvasPaint(paintBackground);
//  $(".rounded").backgroundCanvasPaint(roundonly);
  if (navigator.appName == "Microsoft Internet Explorer") $(".rounded").backgroundCanvasPaint(roundonly);
}
var drawBackground = false;
$(window).load(function() {
  drawBackground = true;
  window.setTimeout(function() {
    if (drawBackground) {
      drawBackground = false;
      DrawBackground();
    }
  }, 50);
});

$(window).resize(function() {
  drawBackground = true;
  window.setTimeout(function() {
    if (drawBackground) {
      drawBackground = false;
      DrawBackground();
    }
  }, 50);
});

