// ----------------------------------------------------------------
// Studio Buzz : Background Image Fade
// http://www.studio-buzz.jp/
// info@studio-buzz.jp
// ----------------------------------------------------------------
var CIname = '#loop_photo';	// Id or Class Name
var FIN    = 1000;			// Fade In Time
var FOUT   = 1000;			// Fade Out Time
var WAIT1  = 1000;			// Fast Weit Time
var WAIT2  = 1500;			// Weit Time
var WAIT3  = 5000;			// Weit Time
var inum   = 0;
var TI     = "";

var t1 = new Date();

jQuery.noConflict();
jQuery(window).load(function(){
	// img表示
	jQuery(CIname+" img").css("visibility","visible");
	
	// 画像非表示
	jQuery(CIname+' img:gt(0)').hide();
	
	// 画像リンク設定（imgのaltにURLを記載する）
	jQuery("img[id^=i]").click(function(){
		var idn = this.getAttribute("Id").split("i")[1];
		if(idn.length){
			var alt = jQuery("#i"+idn).attr("alt");
			if(alt.length > 0){
				window.open(alt,"_blank");
				return false;
			}
		}
	});
	
	// jQueryの対象オブジェクト数取得
	inum = jQuery(CIname+" img").size();
	
	if(inum > 0){	TI = setTimeout("Fade()",WAIT1);}
});

// Fade設定
function Fade(){
	clearTimeout(TI);
	IDS = jQuery(CIname+' :first-child')
		.fadeOut(FOUT)
		.next('img')
		.fadeIn(FIN)
		.end()
		.appendTo(CIname)
		.get(0);
	
	if(IDS.src.match(/03/)){
		TI = setTimeout("Fade()",WAIT3);
	}else{
		TI = setTimeout("Fade()",WAIT2);
	}
}
