/* CSSハック用 */
/* ----------------------------------------------------- */
var css_browser_selector = function() {
	var 
		ua=navigator.userAgent.toLowerCase(),
		is=function(t){ return ua.indexOf(t) != -1; },
		h=document.getElementsByTagName('html')[0],
		b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
		os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
	var c=b+os+' js';
	h.className += h.className?' '+c:c;
}();

/* ----------------------------------------------------- */
/* jquery ロード*/
/* ----------------------------------------------------- */
$(function(){

	/* aタグクリック時の枠線無効に */
	/* ----------------------------------------------------- */
	$('a').focus(
		function(){
		this.blur();
	});

	/* 関数Call */
	/* ----------------------------------------------------- */
	

	/* ページ内スクロール */
	/* ----------------------------------------------------- */
	$('a[href^=#]').click(function(event) {
		var hash = this.hash;
		if(hash!==''){
			var tarPosition = $(hash).offset().top;
			if(undefined !== window.opera && "function" === typeof window.opera.version){ // opera
				$('html').animate({scrollTop: tarPosition}, 400, 'easeOutQuad'); 
			}
			else{
				$('html, body').animate({scrollTop: tarPosition}, 400, 'easeOutQuad');
			}
			return false;
		}
	});
	
	/* フォーム */
	/* ----------------------------------------------------- */
	$("form input[type=text],form textarea").focus(function(){
		$(this).addClass('focus');
	});
	$("form input[type=text],form textarea").blur(function(){
		$(this).removeClass('focus');
	});

});

/* ----------------------------------------------------- */
/*　ページ内スクロール用　*/
/* ----------------------------------------------------- */
jQuery.easing.easeOutQuad = function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
};
	
/* ----------------------------------------------------- */
/*　ロールオーバー　*/
/* ----------------------------------------------------- */
var Rollover = function(obj,thisSrc) {
	/* 変数宣言 */
	var sTempSrc = thisSrc;
	var ftype = thisSrc.substring(thisSrc.lastIndexOf('.'), thisSrc.length);
	var hsrc = thisSrc.replace(ftype, '-o'+ftype);	
	var aPreLoad = new Image();

	/* プリロード */
	aPreLoad.src = hsrc;

	re = new RegExp('-o[\.]');
	
	if(!sTempSrc.match(re)){
		$(obj).attr('src', hsrc);
	}
	
	if (sTempSrc.match(re)) {
		sTempSrc = $(obj).attr('src').replace('-o'+ftype, ftype);
		$(obj).attr('src', sTempSrc);
	}
}
