
$(document).ready(function() {
	imgRollover();
	imgFade();
	objHeight();
	selectNavi();
});

$(window).load(function() {
	objHeight();
});




/**********************************************************
* onload */

function addEvent(elm,listener,fn){
	try{
		elm.addEventListener(listener,fn,false);
	}catch(e){
		elm.attachEvent("on"+listener,fn);
	}
}




/**********************************************************
* imgRollover */

function imgRollover() {
	$('img.rollover, input.rollover').not('[src*="_on."],[src*="_over."]').each(function(){
		var img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.')) + '_over' + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		img.hover(function(){
			img.attr('src', src_on);
		},function(){
			img.attr('src', src);
		});
	});
}




/**********************************************************
* imgFade */

function imgFade() {
	$('img.fade').not('[src*="_on."],[src*="_over."]').each(function(){
		$(this).fadeTo(0,1.0);
		$(this).hover(function(){
			$(this).stop();
			$(this).fadeTo(200,0.7);
		},function(){
			$(this).stop();
			$(this).fadeTo(200,1.0);
		});
	});
}




/**********************************************************
* objHeight */

function objHeight() {
	var obj = 0;
	$('.objH').css('height', '');
	$('.objH').each(function(){
		var h = this.offsetHeight;
		if (h > obj) obj = h;
	});
	$('.objH').css('height', obj + 'px').css('display', 'block');
}




/**********************************************************
* selectNavi */

function selectNavi() {
	$('#selectNaviBtn').click(function() {
		var url = $('#selectNavi').attr('value');
		location.href = url;
	});
}




/**********************************************************
* openWindow */

function openWindow(winURL,winName,winW,winH) {
	var winFeatures = 'toolbar=no,resizable=no,menubar=no,directories=no,scrollbars=yes,status=no,location=no,width=' + winW + ',height=' + winH + '';
	window.subwin = window.open(winURL,winName,winFeatures);
	window.subwin.focus();
}

