/* default variables
============================================================*/
var agent = navigator.userAgent.toLowerCase();
var dname = new String(document.domain);
var path  = new String(location.pathname);
var w3c   = document.getElementById;

/* client variables
============================================================*/
var win    = (agent.indexOf("windows") != -1);
var mac    = (agent.indexOf("mac") != -1);
var gecko  = agent.indexOf("gecko") != -1;
var opera  = agent.indexOf("opera",0) != -1;
var safari = agent.indexOf("safari") != -1;
var ie     = agent.indexOf("msie") != -1 && !opera;
var ie6win = (agent.indexOf("msie 6.") != -1) && win;
var ie7win = (agent.indexOf("msie 7.") != -1) && win;
var ie5mac = (agent.indexOf("msie") != -1) && mac;
var ns     = agent.indexOf("netscape") != -1 && !opera;
var ns6    = (agent.indexOf("netscape6/6.") != -1) && ns;

/* read adjustment css */

document.open();
if(ie6win){ 
	document.write("<style type='text/css' media='screen'>body {behavior:url('../css/csshover.htc');}</style>");
}
document.close();

/* rollover function
============================================================*/
function setRollOver(){
	if(!document.getElementsByTagName) return false;
	var ovrImgList = document.getElementsByTagName("img");
	for(var i=0;i<ovrImgList.length;i++){
		if(ovrImgList[i].className.match("ov")){
			preLoadImg(ovrImgList[i].src.replace(/_off./i,"_on."));
			ovrImgList[i].onmouseover = function(){
				this.src = this.src.replace(/_off./i,"_on.");
				return false;
			}
			ovrImgList[i].onmouseout = function(){
				this.src = this.src.replace(/_on./i,"_off.");
				return false;
			}
		}
	}
}
/* preload function
============================================================*/
function preLoadImg(){
	if(document.images){
		var loadedImg = new Array();
		var arg = preLoadImg.arguments;
		for(i=0;i<arg.length;i++){
			loadedImg[i] = new Image();
			loadedImg[i].src = arg[i];
		}
	}
}
/* onload function
============================================================*/
function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
addEvent(window,"load",setRollOver);



/* jquery func
============================================================*/
$(document).ready(function(){
	//サイトトップ部分のスライド
	$(".n09 a").click(function(){
		$("#sitemap").slideToggle("normal");
		$(this).toggleClass('current');
	});
	//サービスメニューのチップス
	$("#service-menu a").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-115"}, "slow");
		}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-125"}, "fast");
	});
	//　ページトップのスクロール
	// for jQuery.dequeue is not a function （jQueryのバージョンエラーの回避）
	(function( $ ) {
		$.dequeue = function( a , b ){
			return $(a).dequeue(b);
		};
	})( jQuery );
	$('.top a').click(function(){
		$('#wrapper').ScrollTo(1000, 'easeout');
		return false;
	})
});
$(function(){
	//グループ化されたロールオーバー
	$('.btngroup').click(function(){
	window.location=$(this).find("a").attr("href");return false;	
	});
	
		//奇数、偶数を自動追加
	$('ul').each(function(){
		$(this).find('li:odd').addClass('even');
		$(this).find('li:even').addClass('odd');
	});
	$('table').each(function(){
		$(this).find('tr:odd').addClass('even');
		$(this).find('tr:even').addClass('odd');
	});

	
	//:first-child, :last-childをクラスとして追加
	$(':first-child').addClass('firstChild');
	$(':last-child').addClass('lastChild');
	

});

/* shadowbox：フレームからのリンク処理
============================================================*/
function homeBack(){
	this.location.href='/';
};
function serviceBack(){
	this.location.href='/service/';
};
function estheBack(){
	this.location.href='/esthetics/';
};



