// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function about() {
  if (Element.empty('about-content')) {
    new Ajax.Updater('about-content', '/rails/info/properties', {
      method:     'get',
      onFailure:  function() {Element.classNames('about-content').add('failure')},
      onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
    });
  } else {
    new Effect[Element.visible('about-content') ? 
      'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
  }
}

// Select the first form field, if there is one. Only selects the common "search"
// field if there is no other field. 
function select_first_form_field_if_any() {
	var forms = document.forms
	var form = null
	for (var i = 0; i < forms.length; i++) {
		form = forms[i]
		if (forms[i].id != 'search') {
			break
		}
	}
	//alert("form id: "+form.id)
	if (form != null) {
		for (var j = 0; j < form.elements.length; j++) {
			elem = form.elements[j]
			if (elem.type != 'hidden' && elem.disabled == false) {
				//alert("elem: id, name: "+elem.id+", "+elem.name)
				elem.focus()
				break
			}
		}
	}
}