/**
 * Base JS file
 *
 * @author Fabian Wolf
 * @link http://fwolf.info/
 * @date Mi 30. Dez 04:16:54 CET 2009
 */

jQuery(function() {
/*	var iNumberSearchForms = jQuery('form.search-form').length;
	if(iNumberSearchForms > 1) {*/
	jQuery('div#sidebar div#sidebar-search input.search-form-field').attr('id', 'search-form-input-field').wrap('<div id="search-form-field-container"></div>');
	/*if(jQuery('#search-form-input-field').val() == '') {
		jQuery('div#search-form-field-container').css('display', 'none');
	}*/
// 	jQuery('div#sidebar-search form.search-form')
	jQuery('div#sidebar-search form.search-form').append('<label for="search-form-input-field" id="search-form-input-field-label" title="Open and close Search field">&raquo; Search</label>');


	/*jQuery('#search-form-input-field-label').css('cursor', 'pointer').toggle(
		function() {
			jQuery('div#search-form-field-container').slideDown(500);
			jQuery('#search-form-input-field').focus();
		}, function() {
			jQuery('div#search-form-field-container').slideUp(500);
		}
	);*/

	jQuery('#search-form-input-field-label').css('cursor', 'pointer').click(function() {
// 		jQuery('#search-form-field-container').slideUp(700, function() {
		if(jQuery('#search-form-input-field').val() != '') {
			jQuery(this).parent().submit();
		}
// 		});
	});
	/*jQuery('#search-form-input-field-label span').click(
		function() {
			if(jQuery('div#search-form-field-container:hidden').length > 0) {
				jQuery('div#search-form-field-container').slideDown(500);
			} else {
				jQuery('div#search-form-field-container').slideUp(500);
			}
		}
	);*/
//	}
});