/* =======================================

	Common JS

========================================== */


/* win/mac
========================================== */
$(function(){
	var UA = navigator.userAgent;
	if(UA.match(/[Ww]in/)) {
		$('body').addClass('win');
	} else if(UA.match(/[Mm]ac/)) {
		$('body').addClass('mac');
	}
});


/* 最初に出てきたlv2の上マージンを0にする
========================================== */
$(function(){
	$('#main .section h3:first, #main .section .lv2:first').css({'margin-top':'0'});
});


/* Smooth Scroll
========================================== */
$(function(){ 
	$('a[href^=#]:not(a[href$=#])').click(function(){
		var href= this.hash;
		var $target = $(href == '#_top' ? 'body' : href);

		// アンカーリンクがあるページでだけ以下を実行
		if($target.size()){
			var top = $target.offset().top;
			$($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 500, 'swing');
		}
		return false;
	});
});


/* Mouse Over
========================================== */
$(function() {
	var image_cache = new Object();
	$(".swap").each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_o' + this.src.substr(dot, 4);
		image_cache[this.src] = new Image();
		image_cache[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on; },
			function() { this.src = imgsrc; });
	});
});


/* Hover Light
========================================== */
$(function() {
	$('.hoverLight').hover(function(){
		$(this).animate({'opacity': '0.7'}, 200);
	}, function(){
		$(this).animate({'opacity': '1'}, 200);
	});
});


/* IE6で砂時計回避
========================================== */
try {
	document.execCommand('BackgroundImageCache', false, true);
}catch(e){}


/* IEでクリッカブルマップの線を消す（ただし、タブでリンクの移動ができなくなる）
=========================================== */
$(function(){
	$('area').focus(function(){ $(this).blur();});
});





