//別窓オープン
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//ロールオーバー
jQuery.noConflict();
var j$ = jQuery;

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

j$(document).ready(j$.auto.init);

// Auto-hidden elements
j$.auto.hide = {
	init: function() {
		j$('.Hide').hide();
	}
};

// Mouse hover
j$.auto.hover = {

	init: function() {
		j$('IMG.Hover')
			.bind('mouseover', this.enter)
			.bind('mouseout', this.exit)
			.each(this.preload);
		/*
		スモールサット 追記
		classにCurrentを設定したときフォーカスが当たった状態に
		*/
		j$('IMG.Current')
			.each(this.enter);
		/*
		ここまで
		スモールサット 追記
		*/		
	},

	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
j$.auto.submit = {
	init: function() {
		j$('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
j$.auto.select = {
	init: function() {
		j$('LABEL.Select').each(this.label_action);
		j$('INPUT.Select').bind('click', function(){ this.select(); });
	},

	label_action: function() {
		var field = j$('#'+this.htmlFor).get(0);
		if (field && field.focus && field.select) {
			j$(this).bind('click', function(){ field.focus(); field.select(); });
		}
	}
};

// Switches tabs on click
j$.auto.tabs = {

	init: function() {

		j$('.Tabs').each(function(){
			var f = j$.auto.tabs.click;
			var group = this;
			j$('.Tab', group).each(function(){
				this.group = group;
				j$(this).click(f);
				j$('#'+this.id+'_body').hide();
			}).filter(':first').trigger('click');
		});

	},

	click: function() {
		var tab = j$('#'+this.id+'_body').get(0);
		j$('.Tab', this.group).each(function(){
			j$(this).removeClass('Active');
			j$('#'+this.id+'_body').hide();
		});

		j$(this).addClass('Active');
		j$(tab).show();
		this.blur();

		return false;
	}

};
