1 /* create basic elements */
 
   3 var widget      = document.getElementById(id);
 
   4 var linkLogo    = document.createElement('a');
 
   5 var logo        = document.createElement('img');
 
   6 var form        = document.createElement('form');
 
   7 var inputText   = document.createElement('input');
 
   8 var inputSubmit = document.createElement('input');
 
   9 var body        = document.getElementsByTagName('body')
 
  10 var stylesheet = document.createElement('link');
 
  12 /* set attributes of created elements */
 
  13 stylesheet.setAttribute('type', 'text/css');
 
  14 stylesheet.setAttribute('rel', 'stylesheet');
 
  15 stylesheet.setAttribute('href', 'http://lektury.staging.nowoczesnapolska.org.pl/static/css/widget.css');
 
  16 linkLogo.setAttribute('href', 'http://lektury.staging.nowoczesnapolska.org.pl');
 
  17 logo.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/img/logo.png');
 
  18 form.setAttribute('action', 'http://lektury.staging.nowoczesnapolska.org.pl/katalog/szukaj/');
 
  19 form.setAttribute('method', 'get');
 
  20 form.setAttribute('accept-charset', 'utf-8');
 
  21 form.setAttribute('id', 'wl-form');
 
  22 inputText.setAttribute('type', 'text');
 
  23 inputText.setAttribute('title', 'tytul, autor, motyw/temat, epoka, rodzaj, gatunek');
 
  24 inputText.setAttribute('value', '');
 
  25 inputText.setAttribute('name', 'q');
 
  26 inputText.setAttribute('id', 'id_qq');
 
  27 inputText.setAttribute('size', '13');
 
  28 inputSubmit.setAttribute('type', 'image');
 
  29 inputSubmit.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/img/search.png');
 
  30 inputSubmit.setAttribute('style', 'position:relative; top:5px; margin-left:5px');
 
  32 /* import jquery and autocomplete */
 
  33 var scriptJ = document.createElement('script');
 
  34 scriptJ.setAttribute('type', 'text/javascript');
 
  35 scriptJ.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/js/jquery.js');
 
  37 var scriptAutoComplete = document.createElement('script');
 
  38 scriptAutoComplete.setAttribute('type', 'text/javascript');
 
  39 scriptAutoComplete.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/js/jquery-ui-1.8.2.custom.min.js');
 
  41 var scriptInit = document.createElement('script');
 
  42 scriptInit.setAttribute('type', 'text/javascript');
 
  43 scriptInit.setAttribute('src', 'http://lektury.staging.nowoczesnapolska.org.pl/static/js/widgetInit.js');
 
  45 body[0].appendChild(scriptJ);
 
  46 body[0].appendChild(scriptAutoComplete);
 
  47 body[0].appendChild(scriptInit);
 
  49 /* append elements to widget */
 
  50 widget.appendChild(stylesheet);
 
  51 widget.appendChild(linkLogo);
 
  52 linkLogo.appendChild(logo);
 
  53 widget.appendChild(form);
 
  54 form.appendChild(inputText);
 
  55 form.appendChild(inputSubmit);
 
  57 /* ...and a little make-up */
 
  58 widget.style.borderColor = "#84BF2A";
 
  59 widget.style.borderWidth = "2px";
 
  60 widget.style.borderStyle = "solid";
 
  61 widget.style.width = "160px";
 
  62 widget.style.padding = "10px";
 
  63 widget.style.fontSize = "12px";
 
  64 form.style.paddingTop = "10px";