/*!
 * slideViewer 1.2
 * Examples and documentation at: 
 * http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html
 * 2007-2010 Gian Carlo Mingati
 * Version: 1.2.3 (9-JULY-2010)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Requires:
 * jQuery v1.4.1 or later, jquery.easing.1.2
 * 
 
 
<script type="text/javascript"><!--
	
	$(function() {
		
		$('ul.thumb li').find('a').each(function(i) {
			$(this).attr('id', i);
			$(this).click(function(e){
				slide($(this).attr('id'));
				return false;
			});
		});
		//slideshow追加
		$("#slidePhoto").slideView();
		
		slide(-1);
	});
	
	var photo_nowId = 0;
	var photo_maxId = 17;
	function nextSlide(n){
		photo_nowId += parseInt(n);
		if(photo_nowId > photo_maxId-1) photo_nowId = 0;
		if(photo_nowId < 0) photo_nowId = photo_maxId-1;
		//trace(photo_nowId);
		
		slide(photo_nowId);
	}
	function slide(n){
		//clearInterval(timer);
		//timer = setInterval(nextSlide, 6000);
		if(!n && n != 0) return;
		photo_nowId = parseInt(n);
		if(photo_nowId == -1) {
			$('#detail').slideUp();
		} else {
			$("div#slidePhoto").trigger("slide", parseInt(photo_nowId));
			$('#detail').slideDown();
		}
	}
	// --></script>
 
 
 
 */

$(function(){
   //$("div.svw").prepend("<img src='spinner.gif' class='ldrgif' alt='loading...'/ >"); 
});

var j = 0;
var quantofamo = 0;
$.fn.slideView = function(settings) {
	settings = $.extend({
		width: 660,
		height: 480,
		easeFunc: "easeInOutExpo",
		easeTime: 750,
		uiBefore: false,
		toolTip: false,
		ttOpacity: 0.9
	}, settings);
	
	return this.each(function(){
		var container = $(this);
		
		//add css
		container.css("position" , "relative");
		container.css("overflow" , "hidden");
		container.find("ul.detail").css("position" , "relative");		
		container.find("ul.detail > li").css("float" , "left");		
		
		var pictWidth = container.find("img").width();
		var pictHeight = container.find("img").height();
		pictWidth = settings.width;
		pictHeight = settings.height;
		
		var pictEls = container.find("li").size();
		var stripViewerWidth = pictWidth*pictEls;
		var stripViewerHeight = pictHeight*pictEls;
		//stripViewerWidth = 950;
		//stripViewerHeight = 400;
		
		//横スライド用
		container.css("width", settings.width);
		container.find("ul.detail").css("width" , stripViewerWidth);
		container.find("ul.detail > li").css("width" , settings.width);		
		
		//縦スライド用
		//container.find("ul").css("height" , stripViewerHeight);
		//container.css("height" , pictHeight);
		
		$(this).bind("slide", function(e, z){
			if(!e) return;
			
			//var cnt = -(pictHeight*z);
			//container.find("ul").animate({top: cnt}, settings.easeTime);
			var cnt = -(pictWidth*z);
			container.find("ul.detail").stop().animate({left: cnt}, settings.easeTime);
		});
		
		j++;
	});
};
