
function serial(list,time,mywid){

	var second = false;
	var i = 0;

	jQuery.timer(250, function (timer) {
		if (!second) {
			jQuery('#'+list[i]).animate({
		        	width : mywid
			},time,"swing")

			i = i + 1;
			if(i >= list.length ){second = true;}
		} else {
			timer.stop();
		}
	});
}

function serialmenu(list,time,myleft){

	var second = false;
	var i = 0;

	jQuery.timer(150, function (timer) {
		if (!second) {
			jQuery('#'+list[i]).animate({
		        	left : myleft
			},time,"swing")

			i = i + 1;
			if(i >= list.length ){second = true;}
		} else {
			timer.stop();
		}
	});
}



jQuery(document).ready(function(){
	jQuery('#wrap').fadeIn(4250,function(){

		var mylist = ['list1','list2','list3','list4','list5','list6'];
		var mytime = 600;
		var myleft  = "0px";
		serialmenu(mylist,mytime,myleft);
		jQuery.timer(1670, function (timer) {
			jQuery('#footer').animate({
			            top : "604" , 
			            height : "262px"
			},800,"swing",function(){
				jQuery('#footer').animate({
					            top : "650px" , 
					            height : "216px"
					},800,"swing",function(){
					jQuery('#contents').animate({
					            width : "354px"
					},800,"swing",function(){
						var mylist = ['i1','i2','i3','i4','i5','i6','i7','i8','i9'];
						var mytime = 700;
						var mywid  = "346px";
						serial(mylist,mytime,mywid);
				        });
			        });
		        });
			timer.stop();
		});

		jQuery.timer(7000, function (timer) {
			jQuery('#new_list').animate({
			            top : "324px" , 
			            height : "514px"
			},1200,"swing")
			timer.stop();
		});

		jQuery.timer(8000, function (timer) {
/*
			jQuery('#back_img').animate({
			            top : "0px" , 
			            height : "846px"
			},1300,"linear")
*/

			jQuery('#back_img').fadeIn(5000,function(){
				/*jQuery('#img_mini').fadeIn(1000);*/
		        });

			
			var second = false;
			var i = 3;
			var switch_flg = 1;
			jQuery.timer(15000, function (timer) {
				if (!second) {

/*
					if(i%2 == 0) {
						jQuery('#back_img').attr("class", "wrap_back_img"+i);
						jQuery('#back_img').fadeIn(5000);
					} else {
						jQuery('#wrap').attr("class", "wrap_back_img"+i);
						jQuery('#back_img').fadeOut(5000);
					}
*/

					if(switch_flg == 0) {
						jQuery('#back_img').attr("class", "wrap_back_img"+i);
						jQuery('#back_img').fadeIn(5000);
						switch_flg = 1;
					} else {
						jQuery('#wrap').attr("class", "wrap_back_img"+i);
						jQuery('#back_img').fadeOut(5000);
						switch_flg = 0;
					}

					i = i + 1;
					if(i >= 7){second = true;}
				} else {
					i = 1;
					second = false;
				}
				
			});

			timer.stop();
		});



	      jQuery("body").animate( {
	        backgroundColor: '#000000'}, 11000)
	        .animate( { backgroundColor: '#ffffff'}, 5000);

        });


	jQuery("ul#contents_list li img").hover(
	function(){
		var index = jQuery("ul#contents_list li img").index(this);
		jQuery(this).attr("src", jQuery("#contents_list_comment li img:eq("+index+")").attr("src"));


	},function(){
		var index = jQuery("ul#contents_list li img").index(this);
		jQuery(this).attr("src", jQuery("#contents_list_hide li img:eq("+index+")").attr("src"));

	});



});
