/**
* Google Ajax Libraries API handler for CakePHP
*
* Neat trick to load local versions of JavaScript libraries while
* debugging, but Google-hosted versions for production.
* Automatically detects whether debugging is turned on, and
* defaults to jQuery, the best JavaScript library.
*
* Just shove it in your <head> and forget about it :)
* I usually store it somewhere like: /elements/google-jsapi.ctp
*/
if (!isset($library)) $library = 'jquery';
if (!isset($useLocal)) $useLocal = (Configure::read('debug') != 0);
if (!$useLocal) e($javascript->link('http://www.google.com/jsapi'));
else $library .= '-local';
switch ($library) {
case 'jquery':
e($javascript->link('google-jsapi-jquery'));
break;
case 'jquery-local':
e($javascript->link('jquery'));
e($javascript->link('jquery-ui'));
break;
case 'prototype':
e($javascript->link('google-jsapi-prototype'));
break;
case 'prototype-local':
e($javascript->link('prototype'));
e($javascript->link('scriptaculous'));
break;
}