/*
====================================================
	
	DEPOC JavaScript Function Version:4.00
	
		depoc function.js
		include jquery
		
		Copyright (c) 2011 DEPOC Inc.
		http://depoc.jp
		
		Update:11/04/15
	
====================================================
*/
/*
------------------------------------------------------------
	main-V-fade
--------------------------------------------------------- */
var setImg = '#main-visual00 img';
var fadeSpeed = 1500;
var switchDelay = 2500;

$(function(){
	$(setImg).css("display","none");
	$(setImg + ":first").fadeIn(fadeSpeed);
});

var i = 0;
var int=0;
$(window).bind("load", function() {
	var int=setInterval("imgFunc(i)",switchDelay);
});
function imgFunc() {
	var imgs = $(setImg).length;
	if (i >= imgs) {
		clearInterval(int);
	}
	$(setImg+":hidden").eq(0).fadeIn(fadeSpeed);
	i++;
}

/*
------------------------------------------------------------
	slide-navi
--------------------------------------------------------- */
var containerWidth = $(window).width();
var centerWidth = containerWidth/2 - 315 + "px"

$(function(){
	/*start event*/
	if (containerWidth <= 920) {
		getOpen2();
	} else {
		getOpen();
	}
	$(document).oneTime(4500,'timer01',function(){
		getClose();
	});
	
	/*click event*/
	$('#slide-navi li#slide-navi-btn').toggle(function(){
		if (containerWidth <= 920) {
			getOpen2();
		} else {
			getOpen();
		}
	}, function() {
		getClose();
	});
	
	/*resize event*/
	$( window ).resize(function(){
	$(function(){
		var slideWidth = $("#slide-navi").width();
		getWidth();
			if (slideWidth != 0 && containerWidth > 920) {
				$("#slide-navi").css("width",centerWidth);
			} else if(slideWidth != 0 && containerWidth <= 920) {
				$("#slide-navi").css("width","150px");
			} else if(slideWidth = 0) {
				$("#slide-navi").css("width","0px");
			}
		});
	});
});

function getOpen(){
	getWidth();
	$("#slide-navi").animate({width:centerWidth},{queue:false,duration:800});
	$("#slide-navi-btn a img").attr("src",$("#slide-navi-btn a img").attr("src").replace("_close", "_open"));
}
function getOpen2(){
	$("#slide-navi").animate({width:"150px"},{queue:false,duration:800});
	$("#slide-navi-btn a img").attr("src",$("#slide-navi-btn a img").attr("src").replace("_close", "_open"));
}
function getClose(){
	getWidth();
	$("#slide-navi").animate({width:'0px'},{queue:false,duration:800});
	$("#slide-navi-btn a img").attr("src",$("#slide-navi-btn a img").attr("src").replace("_open", "_close"));
}
function getWidth(){
	containerWidth = $(window).width();
	centerWidth = containerWidth/2 - 315 + "px";
}

/*---------------------------------------------------
	jCarouselLite
---------------------------------------------------*/
$(function() {
	$("#slide .jCarouselLite").jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		auto: 3000,
		speed: 1000,
		visible: 3
	});
});
/*---------------------------------------------------
	RollOver
---------------------------------------------------*/
$(function(){
	$(".current").each(function(){
		var newSrc = $(this).attr('src').replace("_off.", "_on.");
		$(this).attr("src", newSrc);
	});
});
$(document).ready(function(){
	$("img,input").mouseover(function(){
		if ($(this).attr("src")){
			$(this).attr("src",$(this).attr("src").replace("_off.", "_on."));
		}
	});
	$("img[class!='current'],input").mouseout(function(){
		if ($(this).attr("src")){
			$(this).attr("src",$(this).attr("src").replace("_on.", "_off."));
		}
	});
});
/*------------------------------------------------------------
	slide-box
--------------------------------------------------------- */
$(function(){
	$('.btn').toggle(function(){
			$("#slide-box").animate({top:'-45px',height:'325px'},{queue:false,duration:400});
			openBox();
	}, function() {
			$("#slide-box").animate({top:'160px',height:'120px'},{queue:false,duration:400});
			closeBox();
	});
});
function openBox(){
	$(".btn").each(function(){
		var newSrc = $(this).attr('src').replace("_close.", "_open.");
		$(this).attr("src", newSrc);
	});
}
function closeBox(){
	$(".btn").each(function(){
		var newSrc = $(this).attr('src').replace("_open.", "_close.");
		$(this).attr("src", newSrc);
	});
};
/*
------------------------------------------------------------
	pngFix
--------------------------------------------------------- */
$(function(){
	$("img#slide-navi-btn").pngFix();
});


