/**************************************************************************
onLoad時呼び出し
***************************************************************************/
	$(document).ready(function(){	 
			//カラーボックス設定
			$(".backnumber")
					.colorbox({title: true, opacity: 0.5, iframe:true, innerWidth:834, innerHeight:600
			});
					
			$(document).ready(function(){
				$("a[rel='zoom']").colorbox({opacity: 0.5});
			});
			
			//トップページ姉妹WEBバナー設定
			$(".button img")
					.animate({top:"-60px"}, 300).animate({top:"-8px"}, 500) // first jump
					.animate({top:"-18px"}, 200).animate({top:"-8px"}, 300) // second jump
					.animate({top:"-12px"}, 200).animate({top:"-8px"}, 300); // the last jump
			$(".button img").hover(function(){
					$(this)
					.stop(true, false)//アニメーションをストップ
					.animate({top:"-40px"}, 350).animate({top:"-8px"}, 350) // first jump
					.animate({top:"-14px"}, 200).animate({top:"-8px"}, 300) // second jump
					.animate({top:"-12px"}, 200).animate({top:"-8px"}, 300); // the last jump
		},function(){
			$(this).animate({top:"-8px"}, 400);
		});
	}); 



/**************************************************************************
背景アニメーション設定
***************************************************************************/
(function($) {
		$(document).ready(function() {
			$('#logo').click(function() {
				document.location.href = 'http://www.spritely.net/';
			});
		
			$('#bird')
				.sprite({fps: 9, no_of_frames: 3})
				.spRandom({top: 50, bottom: 200, left: 300, right: 320})
				.isDraggable()
				.activeOnClick()
				.active();
			$('#clouds_back').pan({fps: 20, speed: 0.7, dir: 'left', depth: 10});
			$('#clouds_front').pan({fps: 23, speed: 2, dir: 'left', depth: 30});
			$('#hill1').pan({fps: 30, speed: 3, dir: 'left', depth: 70});
			$('#hill1, #clouds_front, #clouds_back').spRelSpeed(3);
			
			window.actions = {
				fly_slowly_forwards: function() {
					$('#bird')
						.fps(10)
						.spState(1);
					$('#hill1, #clouds_front, #clouds_back')
						.spRelSpeed(10)
						.spChangeDir('left');
				},
				fly_slowly_backwards: function() {
					$('#bird')
						.fps(10)
						.spState(2);
					$('#hill1, #clouds_front, #clouds_back')
						.spRelSpeed(10)
						.spChangeDir('right');
				},
				fly_quickly_forwards: function() {
					$('#bird')
						.fps(20)
						.spState(1);
					$('#hill1, #clouds_front, #clouds_back')
						.spRelSpeed(30)
						.spChangeDir('left');
				},
				fly_quickly_backwards: function() {
					$('#bird')
						.fps(20)
						.spState(2);
					$('#hill1, #clouds_front, #clouds_back')
						.spRelSpeed(30)
						.spChangeDir('right');
				},
				fly_like_lightning_forwards: function() {
					$('#bird')
						.fps(25)
						.spState(1);
					$('#hill1, #clouds_front, #clouds_back')
						.spSpeed(40)
						.spChangeDir('left');
				},
				fly_like_lightning_backwards: function() {
					$('#bird')
						.fps(25)
						.spState(2);
					$('#hill1, #clouds_front, #clouds_back')
						.spSpeed(40)
						.spChangeDir('right');
				}
			};
			
			window.page = {
				hide_panels: function() {
					$('.panel').hide(300);
				},
				show_panel: function(el_id) {
					this.hide_panels();
					$(el_id).show(300);
				}
			}
			
		});
	})(jQuery);
	
	
	
/**************************************************************************
画像プリロード設定
***************************************************************************/
	$(function () {
		$('.pl img').hide();//hide all the images on the page
	});
	
	var i = 0;//initialize
	var int=0;//Internet Explorer Fix
	$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
		var int = setInterval("doThis(i)",100);//500 is the fade in speed in milliseconds
	});

	function doThis() {
		var imgs = $('.pl img').length;//count the number of images on the page
		if (i >= imgs) {// Loop the images
			clearInterval(int);//When it reaches the last image the loop ends
		}
		$('.pl img:hidden').eq(0).fadeIn(400);//fades in the hidden images one by one
		i++;//add 1 to the count
	}


/**************************************************************************
スライドショー設定
***************************************************************************/
$(window).bind("load", function() {
	$("div#my-folio-of-works").slideViewerPro({
		thumbs: 7, 
		autoslide: true, 
		asTimer: 3500, 
		typo: true,
    galBorderWidth: 0,
		thumbsBorderOpacity: 0, 
		buttonsTextColor: "#0b8a08",
		buttonsWidth: 20,
		thumbsActiveBorderOpacity: 0.8,
		thumbsActiveBorderColor: "#0b8a08",
		shuffle: false
		});
	$("div#basic").slideViewerPro();
	$("div#fewoptions").slideViewerPro({
		thumbs: 3, 
		thumbsPercentReduction: 20,
		galBorderWidth: 0,
		galBorderColor: "aqua",
		thumbsTopMargin: 10,
		thumbsRightMargin: 10,
		thumbsBorderWidth: 5,
		thumbsActiveBorderColor: "gold",
		thumbsActiveBorderOpacity: 0.8,
		thumbsBorderOpacity: 0,
		buttonsTextColor: "#707070",
		leftButtonInner: "<img src='http://www.gcmingati.net/wordpress/wp-content/uploads/larw.gif' />",
		rightButtonInner: "<img src='http://www.gcmingati.net/wordpress/wp-content/uploads/rarw.gif' />",
		autoslide: true, 
		typo: true
		});	
	$("div#noui").slideViewerPro({
		galBorderWidth: 0,
		autoslide: true, 
		thumbsVis: false,
		shuffle: true
		});	
	// chili syntax highlighter
	$("code").chili();
});
ChiliBook.automatic = false;
ChiliBook.recipeFolder = "http://www.gcmingati.net/wordpress/wp-content/themes/giancarlo-mingati/js/chili/";  
ChiliBook.stylesheetFolder = "http://www.gcmingati.net/wordpress/wp-content/themes/giancarlo-mingati/js/chili/";

