

// Easingの追加
jQuery.easing.quart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};



/* Event onLoad */
jQuery(document).ready(function(){
	
	// 基本
	rollOver();
	scrollInPage();
	
	// ツールチップ表示
	setToolTip();
});




/*---------------------------------------------------------------*/

function rollOver(){
	var postfix = '_o';
	$('img.navi,input.navi').not('[src*="'+postfix+'."]').each(
		function(){
			var src_org = jQuery(this).attr('src');
			var src_ovr = src_org.substr(0,src_org.lastIndexOf('.')) + postfix + src_org.substr(src_org.lastIndexOf('.'));
			jQuery('<img>').attr('src', src_ovr);
			jQuery(this).hover(
				function(){
					jQuery(this).attr('src',src_ovr);
				},
				function(){
					jQuery(this).attr('src',src_org);
				}
			);
		}
	);
}

/*---------------------------------------------------------------*/

function scrollInPage(){
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = jQuery(this.hash);
			$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				jQuery('html,body').animate({ scrollTop: targetOffset }, 500, 'quart');
				return false;
			}
		}
	});
}

/*---------------------------------------------------------------*/

document.getElementsByClassName = function(ClassName,tagName){
	if(!(this.all || this.getElementsByTagName)) return false;
	var elements=new Array();
	var allElements,i,len;

	if(tagName) allElements= this.getElementsByTagName(tagName) || this.all.tags(tagName);
	else allElements=this.all || this.getElementsByTagName("*");
	for(i=0,len=allElements.length; i<len; i++){
		if(allElements[i].className==ClassName) elements[elements.length]=allElements[i];
	}
	return elements;
}

/*---------------------------------------------------------------*/

var tipSid = "TOOLTIP";

function setToolTip(){
	if(!document.getElementById) return false;
	var i;
	var imgElm = document.getElementsByClassName("tip","IMG");
	for(i=0;i<imgElm.length;i++){
		if(imgElm[i]==null || imgElm[i].src=="undefined" || !imgElm[i].title){
		}else{
			imgElm[i].onmouseover = function(){
				if(!this.title) return false;
				showToolTip(this);
				this.titleOrg = this.title;
				this.title = "";
			}
			imgElm[i].onmouseout = function(){
				hideToolTip(this);
				if(!this.titleOrg) return false;
				this.title = this.titleOrg;
			}
		}
	}
}
function showToolTip(imgObj){
	targetId = tipSid;
	createToolTip(targetId, imgObj.title);
	$("#"+targetId).hide();
	$("#"+targetId).fadeIn(100);
}
function hideToolTip(imgObj){
	targetId = tipSid;
	$("#"+targetId).fadeOut(100);
}

/*---------------------------------------------------------------*/

function closeWindow() {
	var agent = navigator.userAgent.toUpperCase();
	if( agent.indexOf("SAFARI") >= 0 ){
		window.opener = window;
		var win = window.open( location.href, "_self" );
		win.close();
	} else {
		window.close();
	}
}

/*---------------------------------------------------------------*/

function dispBlogScript(pat){
	var param = getURIVars();
	document.write('<textarea cols="30" rows="4" name="blogcode" onmouseover="document.forms[0].blogcode.focus();document.forms[0].blogcode.select();" onfocus="document.forms[0].blogcode.focus();document.forms[0].blogcode.select();">');
	document.write('&lt;script src="http://www.shiseido.co.jp/aqua/js/aqualabel_'+pat+'.js" type="text/javascript"&gt;&lt;/script&gt;');
	document.write('&lt;script type="text/javascript"&gt;');
	document.write('&lt;!--//\n');
	document.write('blogParts("'+param+'");//\n');
	document.write('//--&gt;\n');
	document.write('&lt;/script&gt;</textarea>');
}

/*---------------------------------------------------------------*/


