// resizeOverlay
jQuery.fn.panorama = function(options) {
	
	var defaults = {};
	var options = $.extend(defaults, options);
	
	return this.each(function() {
		
		var obj = $(this);
		
		obj
			.parent()
			.children("span.pan_cnt")
			.hide()
		;
		
		obj
			.parent()
			.children("span.pan_link")
			.each(function(){
				
				$(this)
					.mouseover(function(){
						
						var c = $(this)
							.attr("id")
							.replace("link_","")
						;
						
						obj
							.parent()
							.children("span.pan_cnt")
							.hide()
							.parent()
							.children("span#cnt_"+ c +"")
							.show()
						;
						
					})
				;
				
			})
		;
		
	});
};


// navigation
jQuery.fn.navigation = function(options) {
	
	var defaults = {};
	var options = $.extend(defaults, options);
	
	return this.each(function() {
		
		var obj = $(this);
		var speed = 300;
		
		obj
			.next("div.accordion_content")
			.hide()
		;
		
		obj
			.next("div.accordion_content")
			.children("a")
			.each(function(){
				
				if ($(this).hasClass("Active")) {
					$(this)
						.parent()
						.addClass("open")
						.slideDown(0)
					;
				}
				
			})
		;
			
		
		obj
			.click(function(){
				
				if ($(this).next("div.accordion_content").hasClass("open")) {
					
					$(this)
						.next("div.accordion_content")
						.removeClass("open")
						.slideUp(speed)
					;
					
				} else {
					
					$("div.accordion_content.open")
						.removeClass("open")
						.slideUp(speed)
					;
					
					$(this)
						.next("div.accordion_content")
						.addClass("open")
						.slideDown(speed)
					;
					
				}
				
			})
		;
		
		
	});
};


// diashow
jQuery.fn.diashow = function(options) {
	
	var defaults = {};
	var options = $.extend(defaults, options);
	
	return this.each(function() {
		
		var obj = $(this);
		var speed = 2000;
		var animationSpeed = 2000;
		
		/*obj
			.children("img")
			.hide()
		;*/
		
		
		function endlessAnimation() {
			
			var elmFirst = obj
				.children("img:first")
			;
			var elmLast = obj
				.children("img:last")
			;
			
			elmFirst
				.remove()
			;
			elmFirst
				.insertAfter(elmLast)
			;
			$(elmFirst)
				
						.animate({
							opacity:"0.0",
							left: "0"
						},3000,function(){
							
						})
					;	
				
			obj
				.children("img:first")
				.animate({
					opacity:"1.0",
					left: "100px"
				},animationSpeed,function(){
					$(this)
						.animate({
							left: "200px"
						},speed,function(){
							endlessAnimation();
						})
					;
				})
			;
			

		}
		
		
		
		endlessAnimation();
		/*obj
			.children("img:first")
			.fadeIn(0)
			.animate({
					left: "100px"
			},speed,function(){	
				endlessAnimation();
			})
		;*/
		
	});
};

