/*

	ImageChanger ver2.0 for jQuery(gt Ver 1.3.2) 
	Developped  by Coichiro Aso
	Copyright Codesign.verse 2009　http://codesign.verse.jp/
	Licensed under the MIT license:http://www.opensource.org/licenses/mit-license.php/

	コピーライト書いてますが、削除しない限り
	ご自由にお使い頂けます
	ただし使用の際は、自己責任でお願いします。

-------------------------------------------------------------------------------------------*/
/*function imgchanger() {
             var $active = $('#imgchanger img.active');
             if ( $active.length == 0 ) $active = $('#imgchanger img:last');
             var $next =  $active.next().length ? $active.next() : $('#imgchanger img:first');
             $active.addClass('last-active');
             $next.css({opacity: 0.0})
                 .addClass('active')
                 .animate({opacity: 1.0}, 1000, function() {
                     $active.removeClass('active last-active');
               });
         }
         $(function() {
             setInterval( "imgchanger()", 4000 );
         });

*/

(function($){

	$.fn.imgchanger=function(options){

		//オプション設定
		var defaults={
			speed:1500,
			autostart: true,
			fimg:'2'
		};
			
		if(defaults.auto) imgchanger(defaults);


	//変数・定数設定
	var options = $.extend(defaults, options);
	var target=$(this);
	var bimg=$("#mainimgs li img");
	var bban=$("#banimgs li");
	var ids=0;
	var fimg=0;

	function setini(){
		//bimg.hide();
		//if(options.fimg=='random'){
		//	fimg=Math.ceil(Math.random()*bimg.length-1);
		//}else{
		//	fimg=options.fimg-1;
		//}
		$(bimg[fimg]).fadeIn(options.speed);
	}

	bban.hover(
		//マウスオーバー時
		function(){

		ids=$(this).attr("class");	

			bimg.fadeOut(options.speed);

			$(bimg[ids]).fadeIn(options.speed);
		},
		//マウスアウト時
		function(){

		}
	);


	setini();


	}
})(jQuery);


