jQuery.noConflict();
var jq$ = jQuery;

// Initialization
jq$.auto = {
	init: function() {
		for (module in jq$.auto) {
			if (jq$.auto[module].init)
				jq$.auto[module].init();
		}
	}
};
//jq$(document).ready(jq$.auto.init);


// Auto-hidden elements
jq$.auto.hide = {
	init: function() {
		jq$('.Hide').hide();
	}
};
// Mouse hover
jq$.auto.hover = {
	init: function() {
		jq$('IMG.Hover')
			.bind('mouseover', this.enter)
			.bind('mouseout', this.exit)
			.each(this.preload);
	},
	preload: function() {
		this.preloaded = new Image;
		this.preloaded.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
	},
	enter: function() {
		this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
	},
	exit: function() {
		this.src = this.src.replace(/^(.+)_over(\.[a-z]+)$/, "$1$2");
	}
};
// Auto-submitting SELECTs
jq$.auto.submit = {
	init: function() {
		jq$('SELECT.Submit').bind('change', this.on_change);
	},
	on_change: function() {
		if (this.value) this.form.submit();
	}
};
// Auto-selected text in text fields after a label click
jq$.auto.select = {
	init: function() {
		jq$('LABEL.Select').each(this.label_action);
		jq$('INPUT.Select').bind('click', function(){ this.select(); });
	},
	label_action: function() {
		var field = jq$('#'+this.htmlFor).get(0);
		if (field && field.focus && field.select) {
			jq$(this).bind('click', function(){ field.focus(); field.select(); });
		}
	}
};
// Switches tabs on click
jq$.auto.tabs = {
	init: function() {
		jq$('.Tabs').each(function(){
			var f = jq$.auto.tabs.click;
			var group = this;
			jq$('.Tab', group).each(function(){
				this.group = group;
				jq$(this).click(f);
				jq$('#'+this.id+'_body').hide();
			}).filter(':first').trigger('click');
		});
	},
	click: function() {
		var tab = jq$('#'+this.id+'_body').get(0);
		jq$('.Tab', this.group).each(function(){
			jq$(this).removeClass('Active');
			jq$('#'+this.id+'_body').hide();
		});
		jq$(this).addClass('Active');
		jq$(tab).show();
		this.blur();
		return false;
	}
};
function auto_reload(){
	jq$.auto.init;
}
//EOF
