/*-------------------------------------

character

-------------------------------------*/

if(typeof syanago === "undefined"){
	var syanago={};
}

$(function(){

	syanago.character={};
	syanago.character.currentIllust = $(".illust");
	syanago.character.move = function(px){
		syanago.character.currentIllust.animate({left:px + "px"},300);
	};

	var flg = "default",
		flg2 = "default",
		flg3 = "default",
		flg4 = "default",
		flg5 = "default",
		fit = $(".fit"),
		passo = $(".passo"),
		leaf = $(".leaf"),
		axela = $(".axela"),
		outlander = $(".outlander"),

		currentIllust = $(".illust"),

		fitPoint = $(".fit .point_button"),
		fitPointarea = $(".fit .pointarea"),
		passoPoint = $(".passo .point_button"),
		passoPointarea = $(".passo .pointarea"),
		leafPoint = $(".leaf .point_button"),
		leafPointarea = $(".leaf .pointarea"),
		axelaPoint = $(".axela .point_button"),
		axelaPointarea = $(".axela .pointarea"),
		outlanderPoint = $(".outlander .point_button"),
		outlanderPointarea = $(".outlander .pointarea"),
		
		honda_button = $(".car_list ul li:eq(0) img"),
		toyota_button = $(".car_list ul li:eq(1) img"),
		nissan_button = $(".car_list ul li:eq(2) img"),
		mazda_button = $(".car_list ul li:eq(3) img"),
		mitsubishi_button = $(".car_list ul li:eq(4) img");

		$(".pointarea").css('opacity','0');

	fitPoint.on('click',function() {
		if(flg == "default"){
			fitPointarea.animate({opacity:1},700);
			$(".fit .serif").stop().animate({opacity:0},"fast");
			$(".fit .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point_current.png");		
			flg = "changed";
		}else{
			fitPointarea.animate({opacity:0},700);
			$(".fit .serif").stop().animate({opacity:1},"fast");
			$(".fit .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point.png");		
			flg = "default";			
		}
	});
	passoPoint.on('click',function() {
		if(flg2 == "default"){
			passoPointarea.animate({opacity:1},700);
			$(".passo .serif").stop().animate({opacity:0},"fast");
			$(".passo .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point_current.png");		
			flg2 = "changed";
		}else{
			passoPointarea.animate({opacity:0},700);
			$(".passo .serif").stop().animate({opacity:1},"fast");
			$(".passo .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point.png");		
			flg2 = "default";			
		}
	});
	leafPoint.on('click',function() {
		if(flg3 == "default"){
			leafPointarea.animate({opacity:1},700);
			$(".leaf .serif").stop().animate({opacity:0},"fast");
			$(".leaf .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point_current.png");		
			flg3 = "changed";
		}else{
			leafPointarea.animate({opacity:0},700);
			$(".leaf .serif").stop().animate({opacity:1},"fast");
			$(".leaf .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point.png");		
			flg3 = "default";			
		}
	});
	axelaPoint.on('click',function() {
		if(flg4 == "default"){
			axelaPointarea.animate({opacity:1},700);
			$(".axela .serif").stop().animate({opacity:0},"fast");
			$(".axela .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point_current.png");		
			flg4 = "changed";
		}else{
			axelaPointarea.animate({opacity:0},700);
			$(".axela .serif").stop().animate({opacity:1},"fast");
			$(".axela .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point.png");		
			flg4 = "default";			
		}
	});
	outlanderPoint.on('click',function() {
		if(flg5 == "default"){
			outlanderPointarea.animate({opacity:1},700);
			$(".outlander .serif").stop().animate({opacity:0},"fast");
			$(".outlander .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point_current.png");		
			flg5 = "changed";
		}else{
			outlanderPointarea.animate({opacity:0},700);
			$(".outlander .serif").stop().animate({opacity:1},"fast");
			$(".outlander .point_button img").attr("src","http://fsv-static.autoc-one.jp/syanago/assets/pc/images/character/button_point.png");		
			flg5 = "default";			
		}
	});
});



