/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var _TEMP_CNT = 0
$(document).ready(function(){
/*
		$(".characterNav a").hover(
			function(){ $(this).hide().stop(true, true).fadeIn("normal"); },
			function(){ $(this).show();
		});
*/
		$(".charct_service").everyTime(800,'slide',function(i) {
            
            if(i%3==0){

                if (_TEMP_CNT==4) {
                    $(".characterShot").children().hide();
                    $("#ch_1").animate({"width":"toggle"},"normal");
                    _TEMP_CNT = 0;
                }
                else if (_TEMP_CNT==0) {
                    $(".characterShot").children().hide();
                    $("#ch_2").animate({"width":"toggle"},"normal");
                    _TEMP_CNT++;
                }
                else if (_TEMP_CNT==1) {
                    $(".characterShot").children().hide();
                    $("#ch_3").animate({"width":"toggle"},"normal");
                    _TEMP_CNT++;
                }
                else if (_TEMP_CNT==2) {
                    $(".characterShot").children().hide();
                    $("#ch_4").animate({"width":"toggle"},"normal");
                    _TEMP_CNT++;
                }
                else if (_TEMP_CNT==3) {
                    $(".characterShot").children().hide();
                    $("#ch_5").animate({"width":"toggle"},"normal");
                    _TEMP_CNT++;
                }
            }
            
		});

		$(".charct_speed").click(function(){
			$(".ch_a").stop(true, true);
			$(".characterShot").children().hide();
			$("#ch_1").animate({"width":"toggle"},"normal");
			$(".charct_service").stopTime('slide');
			return false;
		});
		$(".charct_save").click(function(){
			$(".ch_a").stop(true, true);
			$(".characterShot").children().hide();
			$("#ch_2").animate({"width":"toggle"},"normal");
			$(".charct_service").stopTime('slide');
			return false;
		});
		$(".charct_vision").click(function(){
			$(".ch_a").stop(true, true);
			$(".characterShot").children().hide();
			$("#ch_3").animate({"width":"toggle"},"normal");
			$(".charct_service").stopTime('slide');
			return false;
		});
		$(".charct_colorful").click(function(){
			$(".ch_a").stop(true, true);
			$(".characterShot").children().hide();
			$("#ch_4").animate({"width":"toggle"},"normal");
			$(".charct_service").stopTime('slide');
			return false;
		});
		$(".charct_service").click(function(){
			$(".ch_a").stop(true, true);
			$(".characterShot").children().hide();
			$("#ch_5").animate({"width":"toggle"},"normal");
			$(".charct_service").stopTime('slide');
			return false;
		});

        $("#ch_1").click(go_character);
        $("#ch_2").click(go_character);
        $("#ch_3").click(go_character);
        $("#ch_4").click(go_character);
        $("#ch_5").click(go_character);


        $('.event-ing').hover(
            function(){ $(".event-ing ul").show();},
            function(){ $(".event-ing ul").hide();
        });

        $('.event-end').hover(
            function(){ $(".event-end ul").show();},
            function(){ $(".event-end ul").hide();
        });

});

var go_character = function(e){
    location.href = "/character/"+e.currentTarget.id;
};
