jQuery(document).ready(function($) {
//ロールオーバー
	var postfix = '_on';
	$('.over').not('[src*="'+ postfix +'."]').each(function() {

		var img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		img.hover(
			function() {
				img.attr('src', src_on);
			},
			function() {
				img.attr('src', src);
			}
		);
	});

//ファンクションの起動

	if($.fn.scrollFollow){
		if( document.getElementById('subMenu') ){
		$('#sub').css('height', ( parseInt( $('#main').innerHeight() ) - parseInt( $('#sub_img').innerHeight() ) ) );
		$('#subMenu').css('position','relative').scrollFollow();
		}
	}
});

/*	//	PAGE PRINT
-----------------------------------------------------------------------------------------------------------------*/
function js_page_print(){
	window.print();
	return false
}
/*	//	ウィンドウを閉じる - a要素にclass="js_window_close"でウィンドウを閉じる
-----------------------------------------------------------------------------------------------------------------*/
function js_window_close(){
	window.close();
	return false;
}
/*	//	ポップアップ
-----------------------------------------------------------------------------------------------------------------*/
function m_win(url,windowname,width,height) {
 var features="location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no";
 if (width) {
  if (window.screen.width > width)
   features+=", left="+(window.screen.width-width)/2;
  else width=window.screen.width;
  features+=", width="+width;
 }
 if (height) {
  if (window.screen.height > height)
   features+=", top="+(window.screen.height-height)/2;
  else height=window.screen.height;
  features+=", height="+height;
 }
 window.open(url,windowname,features);
}

/*	//	Firefox用CSSを呼び出し（ルート相対パスなのでサーバー上でのみ）
-----------------------------------------------------------------------------------------------------------------*/
var firefox = ( navigator.userAgent.indexOf("Firefox") != -1 )? true : false; 
if(firefox) document.write('<link rel="stylesheet" type="text/css" media="print" href="/common/css/fx_print.css" />');




var smartPhone = ['Android','iPad'],
	viewport = ['','<meta name="viewport" content="width=1024" />'];

if(       navigator.userAgent.indexOf( smartPhone[0] ) > 0 ){
	//	Android
	//	document.write(viewport[0]);

}else if( navigator.userAgent.indexOf( smartPhone[1] ) > 0 ){
	//	iPad
	//	document.write( viewport[1] );

	function setOrientation() {  
		var orient = Math.abs( window.orientation ) === 90 ? 'landscape' : 'portrait';  
		var cl = document.body.className;  
		cl = cl.replace(/portrait|landscape/, orient);  
		document.body.className = cl;  
	}
	window.addEventListener('load', setOrientation, false);  
	window.addEventListener('orientationchange', setOrientation, false);
	window.addEventListener('load', function(){ setTimeout(scrollTo, 100, 0, 1);}, false);
	
}else{
}



/*-----------------------
* jQuery Plugin: Scroll to Top
* by Craig Wilson, Ph.Creative http://www.ph-creative.com
* 
* Copyright (c) 2009 Ph.Creative Ltd.
* Licensed under the MIT License http://www.opensource.org/licenses/mit-license.php
*
* Description: Adds an unobtrusive "Scroll to Top" link to your page with smooth scrolling.
* For usage instructions and version updates to go http://blog.ph-creative.com/post/jquery-plugin-scroll-to-top-v3.aspx
* 
* Version: 3.1, 29/07/2010
-----------------------*/
(function($){

  $.fn.extend({scrollToTop:function(options){var defaults={speed:"slow",ease:"jswing",start:0}
  var options=$.extend(defaults,options);return this.each(function(){var o=options;var scrollDiv=$(this);$(this).removeAttr("href").css("cursor","pointer");

  scrollDiv.click(function(event){$("html, body").animate({scrollTop:"0px"},o.speed,o.ease);});});}});})(jQuery);

jQuery.easing.easeInSine = function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	};  

$(function() {
		$(".pageTop a").scrollToTop({speed:1000,ease:"easeInSine",start:0});
});

