<?php
// $Id$

function jquery_ui_menu() {
  $items = array();
  $items['jquery_ui'] = array(
    'title' => 'jQuery UI Test',
    'description' => "Provides a way of testing the jQuery UI.",
    'page callback' => 'jquery_ui_test',
    'access arguments' => array('access content'),
  );
  return $items;
}

function jquery_ui_test() {  
  // Add the jQuery UI Color Picker
  drupal_add_jq('ui.colorpicker');
  drupal_add_jq('ui.dialog');
  drupal_add_jq('ui.datepicker');
  
  // Add the inline JavaScript to show the color picker
  $js = '$(document).ready(
      function () {
        $("#colorpicker").colorpicker({flat:true});
        $("#example").dialog();
        $("#datepicker").datepicker();
      }
    );';
  drupal_add_js($js, 'inline');
  
  // Produce the HTML
  return <<<EOT
<div id="example" title="This is my title">This is a Dialog box!</div>

<h3>Color Picker</h3>
<div id="colorpicker"></div>

<h3>Date Picker</h3>
<div id="date"><input type="text" id="datepicker" value="Click inside me to see a datepicker" style="width:300px;"/></div>
EOT;
}
