/*
* ファイル名:global.js
* ディレクトリ:/share/global.js
* 作成日:08/11/17
* 更新日:08/11/18
*/

$(document).ready(function(){

	//faceboxの呼び出し(/share/facebox/)
	$('a[rel*=facebox]').facebox();

	//faceboxの背景透過処理（IE6用Hack）
	$('#facebox .b, #facebox .tl, #facebox .tr, #facebox .bl, #facebox .br').pngFix();

	//ランダムイメージの前に<span>タグを追加
	$("#randomImage li").prepend("<span></span>").pngFix();

	//シングルページ内にある中サイズ画像を<div>タグでラップ、さらに<span>タグを追加
	$("#mainPhoto a:first").wrap('<div id="mainPhotoFix"></div>');
	$("#mainPhoto a:first").prepend("<span></span>").pngFix();

	/*
	 * フォーム関連の指定
	 */

	//フォーカス
	$('input[@type^="text"],textarea').focus(function(){
		$(this).css("background-color","#555");
	});
	//ホバー
	$('input[@type^="text"],textarea').hover(function(){
		$(this).css("border-color","#777");
		},
		function(){
			$(this).css("border-color","#555");
		}
	);
	//フォーカスアウト
	$('input[@type^="text"],textarea').blur(function(){
		$(this).css("background-color", "#333", "border-color", "#555");
	});

	//検索フォームのボタンイメージ
	$("#searchsubmit").hover(
		function(){
			$(this).attr("src","/images/searchbtn_on.gif");
		},
		function(){
			$(this).attr("src","/images/searchbtn.gif");
		}
	);

	//お問い合わせフォームのボタンイメージ
	$("#wpcf7-f1-p912-o1 p input").hover(
		function(){
			$(this).attr("src","/images/submitbtn_on.gif");
		},
		function(){
			$(this).attr("src","/images/submitbtn.gif");
		}
	);

	/*
	 * 関連画像のスクロールアクション(/share/jquery.scrollShow.js)
	 */

	//重複している最初の画像を取り除く
	$("#relatedGallery li:first").remove();

	//スライドする速さと移動距離
	//borrowed from jQuery easing plugin
	//http://gsgd.co.uk/sandbox/jquery.easing.php
	$.easing.backout = function(x, t, b, c, d){
		var s=1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	};

	//オプション指定
	$('#scrollShow').scrollShow({
		view:'#view',
		content:'#relatedGallery',
		easing:'backout',
		wrappers:'simple,crop',
		navigators:'a[id]',
		navigationMode:'sl',
		circular:true,
		start:0
	});

});