// sazanamilabel.js

wave_init_html = '';

jQuery(document).ready(function(){
	wave_init_html = jQuery('#wave').html();

	//for top image
	jQuery("div.catalogue_top").animate({width: "0px"}, 1);
	jQuery("div.catalogue_top").css("z-index",10);
	jQuery("div.catalogue_top").hide();
	jQuery("div.catalogue_top .txt_info").hide();
	//top artist list
	jQuery("li.artist_info").corner("5px");
	
	//wave
	// for ie6
	jQuery('.png').ifixpng();
	jQuery('.logo').ifixpng();
	
	if (typeof document.body.style.maxHeight != "undefined") {
	// IE 7, mozilla, safari, opera 9
		initPage();
		jQuery(window).resize( initPage );
	}	
	
	//jQuery('#wave').jparallax({},{yorigin: 1, ytravel: '5px'},{yorigin: 1, ytravel: '20px'}, {ytravel: '15px', xtravel: '200px'}, {yorigin: 1, ytravel: '30px'}, {yorigin: 0.2, xtravel: '20px', ytravel: '20px'});

	//for cart
	//jQuery(".cata_status a.item_add").corner("5px");
	jQuery(".scart_info").hide();
	jQuery(".scart_msg").hide();
	jQuery(".scart_info").corner("10px");
	//jQuery(".scart_info .checkout_mail a").corner("5px");
});

jQuery(window).load(function(){
	var n = jQuery("div.catalogue_top").size();
	var card = Array;
	var now = 1;
	var prev = n;
	var flug = "";
	var selected = "";

	selectedID = function(id){
		jQuery('#main_images_navi a').css("background-color","#ccc");
		jQuery('#c'+id).css("background-color","#cc0000");
	}
	
	ShowSlideID = function(id){
		jQuery("div.catalogue_top").css("z-index",10);
		jQuery('#top_image_'+id).css("z-index","100");
		jQuery('#top_image_'+prev).css("z-index",20);
		jQuery('#top_image_'+id).animate({width: "0px"}, 1);
		jQuery('#top_image_'+id).animate({width: 626}, {duration : 300, complete: function(){jQuery('#top_image_'+id+' .txt_info').show();}});
		selectedID(id);
		prev = now;
	}
	
	ShowSlideAll = function(){
		ShowSlideID(now);
		if( now == n && now!= 1 ){
			now=1;
		}else{
			now++;
		}
	};

	selectCard = function(id){
		now = id;
		ShowSlideAll();
		selected = 1;
	}
	
	//click or hover check
	ShowSlide_notHover = function(){	
		jQuery("div.catalogue_top").click(function() {
			flug = 1;
		});
		jQuery("#main_images *").hover(function() {
			flug = 1;
		});
		if(flug == "" && selected == "" ) { ShowSlideAll(); }
	};
	
	//一枚目を表示
	ShowSlideAll();
	//２枚以上指定されていたら一定時間毎に表示を切り替え
	if (n != 1) {
	setInterval('ShowSlide_notHover()',7000);
	}
	
	if (typeof document.body.style.maxHeight != "undefined") {
	// IE 7, mozilla, safari, opera 9
		initPage();
	}
	
});

function initPage() {
	jQuery('#wave').html(wave_init_html);
	jQuery('#wave').jparallax({},{yorigin: 1, ytravel: '5px'},{yorigin: 1, ytravel: '20px'}, {ytravel: '15px', xtravel: '200px'}, {yorigin: 1, ytravel: '30px'}, {yorigin: 0.2, xtravel: '20px', ytravel: '20px'});
}

