/*
Parameters:
    * string element - name of the element to create
    * object|array attributes - element properties to be set, you shouln't use events attributes here such as onclick, onmouseover etc. since they won't work
    * string|array children - child elements (could also contain text value)
Example:
    * JavaScript/jQuery approach:
      var div = document.createElement('div');
      $(div).attr('id', 'myId').text('myText').appendTo('#myElem');
    * standard jQuery approach:
      $('<div>').attr('id', 'myId').text('myText').appendTo('#myElem');
      or
      $('<div id="myId">myText</div>').appendTo('#myElem');
    * plugin approach:
      $.create('div', {'id': 'myId'}, 'myText').appendTo('#myElem');
*/

(function($){$.extend({create:function(element,attributes,children){var elem=$(document.createElement(element));if(typeof(attributes)=='object'){for(key in attributes){elem.attr(key,attributes[key]);}}if(typeof(children)=='string'){elem.text(children);}else if(typeof(children)=='object'){for(i=0;i<children.length;i++){elem.append(children[i]);}}return elem;}});})(jQuery);