var label = 'Package search';
function toggle_arches(enable) {
	arches = $('#searchform_arches');
	descriptions = $('#searchform_descriptions');
	toggle = $('#toggle_link');
	id_submit = $('#id_submit');
	if (enable == null) {
		if ($('#searchform_arches').css('display') == "none")
			enable = 1;
		else
			enable = 0;
		speed = 'fast';
	} else {
		speed = null;
	}
	if (enable) {
		arches.css('left', $('#searchform_query').offset().left + $('#searchform_query').width());
		arches.css('top', $('#id_query').offset().top);
		// Position the descriptions checkbox to the left of the submit input
		descriptions.css('left', id_submit.offset().left + id_submit.outerWidth(true));
		descriptions.css('top', id_submit.offset().top);
		arches.show(speed);
		descriptions.show();
		toggle.text('Hide advanced options');
	} else {
		descriptions.hide();
		arches.hide(speed);
		toggle.text('Show advanced options');
	}
}
function check_submit() {
	id_query = $('#id_query');
	if (id_query.val() != '' && id_query.val() != label)
		return true;
	else
		return false;
}
function query_blur() {
	id_query = $('#id_query');
	if (id_query.val() == '' || id_query.val() == label) {
		id_query.removeClass('in_use');
		id_query.addClass('blank');
		id_query.val(label);
	}
}
function query_focus() {
	id_query = $('#id_query');
	if (id_query.val() == label) {
		id_query.removeClass('blank');
		id_query.addClass('in_use');
		id_query.val('');
	}
}
/*
$(document).ready(function(){
	// Turn off the advanced options
	toggle_arches(0);

	id_query = $('#id_query');
	id_submit = $('#id_submit');
	id_arch = $('#id_arch');
	arches = $('#searchform_arches');
	descriptions = $('#searchform_descriptions');
	toggle = $('#toggle_link');

	// Bind the query events and then run the initial one
	id_query.bind('focus', query_focus);
	id_query.bind('blur', query_blur);
	query_blur();

	// Configure the architecture list
	id_arch.attr('size', 6);
	arches.css('position', 'absolute');

	// Configure the descriptions checkbox
	descriptions.css('margin-left', '5px');
	descriptions.css('position', 'absolute');

	// Style the toggle div here since we don't want underline, pointer,
	// etc. for those contents in the noscript case
	toggle.css('text-decoration', 'underline');
	toggle.css('cursor', 'pointer');
	toggle.css('font-size', 'small');

	// Duplicate help text (hacky hacky hacky)
	id_arch.attr('title', arches.attr('title'));
});
*/

