/**
 * @version 1.0 $Id: recurrence.js 30 2009-05-08 10:22:21Z roland $
 * @package Joomla
 * @subpackage redEVENT
 * @copyright redEVENT (C) 2008 redCOMPONENT.com / EventList (C) 2005 - 2008 Christoph Lukes
 * @license GNU/GPL, see LICENSE.php
 * redEVENT is based on EventList made by Christoph Lukes from schlu.net
 * redEVENT can be downloaded from www.redcomponent.com
 * redEVENT is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2
 * as published by the Free Software Foundation.

 * redEVENT is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with redEVENT; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

// requires mootools
// requires mootools
window.addEvent('domready', function(){

redhint = {

// some global variables
blurClass : 'blur',
$input : $('filter'),
$form : $('adminForm'),

removehint : function() {
if (redhint.$input) {
if (redhint.$input.value === redhint.$input.title && redhint.$input.hasClass(redhint.blurClass)) {
redhint.$input.setProperty('value','').removeClass(redhint.blurClass);
}
}
},

init : function() {
// only apply logic if the element has the attribute
if (redhint.$input) {
var title = redhint.$input.title;
// on blur, set value to title attr if text is blank
redhint.$input.addEvent('blur', function(){
if (this.value === '') {
this.setProperty('value', title).addClass(redhint.blurClass);
}
}).addEvent('focus', redhint.removehint).fireEvent('blur'); // now change input to title

// clear the pre-defined text when form is submitted
redhint.$form.addEvent('submit', redhint.removehint);    
if ($('limit')) {
$('limit').addEvent('click', redhint.removehint);
}
window.addEvent('unload', redhint.removehint); // handles Firefox's autocomplete
}
}

};
redhint.init();

});

function tableOrdering( order, dir, view )
{
var form = document.getElementById("adminForm");

// remove the hint from the filter
redhint.removehint();

form.filter_order.value  = order;
form.filter_order_Dir.value = dir;
form.submit( view );
}
