

// JQuery仕様
(function(e){
//* アニメーション速度設定（1000=1秒）  *//	
var animSpeed = 1000;

//* Wipe効果（無し：off、横切り替え：horizontal、縦切り替え：vertical）*//	
var wipe = 'off';

//* イージング設定  *//	
var animEasing = 'easeInOutCubic';

//* ディレクトリ名 *//
var dir = 'top_banner_rotation';


var a={};var c={};var d=0;var b=0;var f;e(function(){e.ajax({type:"GET",url:dir+"/xml/visual.xml?"+new Date().getTime(),dataType:"xml",timeout:1000,success:function(g){c.init(g)}});c={init:function(m){c.autoFlg=true;var g=e("#top-image-block");var i=e("#top-image-rotation");var l=[];var h=e('<div id="img_main-btn"><ul></ul></div>');var o=e("#first-image");c.imgW=o.width();c.imgH=o.height();i.css({width:c.imgW,height:c.imgH});g.css({width:c.imgW,height:c.imgH});c.width2_3=Math.floor(c.imgW/3)*2;var n=e(m).find("top-image-block").get();c.maxImg=parseInt(n[0].getAttribute("maxImage"),10);c.farstdelay=parseInt(n[0].getAttribute("farstDelay"),10)*1000;c.loop=n[0].getAttribute("loopFlag");c.randomFlg=n[0].getAttribute("random");c.menubtn=n[0].getAttribute("menuBtn").toUpperCase();c.menuType=n[0].getAttribute("menuType");c.defclip="rect(0px "+c.imgW+"px "+c.imgH+"px 0px)";if(c.maxImg>e(m).find("img").length){var k=e(m).find("img").length}else{var k=c.maxImg}if(c.randomFlg=="1"){var j=Math.floor(Math.random()*k);b=j}else{var j=0}c.count=0;c.delayArray=[];e(m).find("img").each(function(r){if(r<c.maxImg){c.count+=1;if(this.getAttribute("href")){if(this.getAttribute("target")){var q=this.getAttribute("target")}else{var q="_self"}var s=e('<div class="top-image-block_viewImg"><a href="'+this.getAttribute("href")+'" target="'+q+'"><img src="'+dir+"/images/"+this.getAttribute("src")+'" alt="'+this.getAttribute("alt")+'" /></a></div>')}else{var s=e('<div class="top-image-block_viewImg"><img src="'+dir+"/images/"+this.getAttribute("src")+'" alt="'+this.getAttribute("alt")+'" /></div>')}if(this.getAttribute("delay")){c.delayArray.push(parseInt(this.getAttribute("delay"),10)*1000)}else{c.delayArray.push(c.farstdelay)}if(r==j){s.attr("id","firstLoadImg");s.css({zIndex:100,clip:c.defclip,position:"absolute"})}else{s.css({zIndex:80,clip:c.defclip,visibility:"hidden",position:"absolute"})}i.append(s);if(c.menubtn!="OFF"){if((r+1)<10){ii="0"+(r+1)}else{ii=r+1}if(c.menuType!=1&&c.menuType!=2){if(r==j){var p=e('<li class="img_stay"><span class="img_over">&nbsp;</span></li>')}else{var p=e("<li><span>&nbsp;</span></li>")}}else{if(c.menuType==1){if(r==j){var p=e('<li class="img_stay"><span class="img_over"><img src = "'+dir+"/images/"+this.getAttribute("src")+'" /></span></li>')}else{var p=e('<li><span><img src = "'+dir+"/images/"+this.getAttribute("src")+'" /></span></li>')}}else{if(c.menuType==2){if(r==j){var p=e('<li class="img_stay"><span class="img_over"><img src = "'+dir+"/images/thumb_"+this.getAttribute("src")+'" /></span></li>')}else{var p=e('<li><span><img src = "'+dir+"/images/thumb_"+this.getAttribute("src")+'" /></span></li>')}}}}p.css("visibility","hidden");p.click(c.elmcl);p.hover(function(){e(this).children().addClass("img_over").css("opacity",1)},function(){if(this.className!="img_stay"){e(this).children().removeClass("img_over").css("opacity",0.5)}});h.children().append(p)}}});if(c.menubtn=="WIDTH"){i.after(h);h.css("width",c.count*(h.find("span:first").width()+parseInt(h.find("li:first").css("marginRight").match(/\d+/,10))+(parseInt(h.find("span:first").css("borderRightWidth").match(/\d+/),10)*2)))}else{if(c.menubtn=="HEIGHT"){i.after(h);h.css("height",c.count*(h.find("span:first").height()+parseInt(h.find("li:first").css("marginBottom").match(/\d+/,10))+(parseInt(h.find("span:first").css("borderTopWidth").match(/\d+/),10)*2)))}}e("#first-image").remove();c.elm=i.find("div.top-image-block_viewImg").get();c.elmbtn=h.find("span").get();d=j;if(wipe=="horizontal"){c.clip="rect(0px "+c.imgW+"px "+c.imgH+"px "+c.imgW+"px)"}else{if(wipe=="vertical"){c.clip="rect("+c.imgH/2+"px "+c.imgW+"px "+c.imgH/2+"px "+0+"px)"}else{c.clip=c.defclip}}e("#top-image-rotation img").load(function(){if(c.count--==1){c.elmbtn2()}})},elmbtn2:function(){var g=0;var j=function(){if(g>=c.elmbtn.length){clearInterval(h);c.time=setTimeout(c.elmani2,c.farstdelay);return}e(c.elmbtn[g]).css({visibility:"visible",opacity:"0"});if(c.elmbtn[g].className=="img_over"){e(c.elmbtn[g]).animate({opacity:1},500,"linear")}else{e(c.elmbtn[g]).animate({opacity:0.5},500,"linear")}g++};var h=setInterval(j,100)},elmani2:function(){if(c.endFlg||c.maxImg<=1){return}c.endFlg=true;var g=c.elm[d].style;g.display="block";g.visibility="visible";g.zIndex=100;if(d==(c.elm.length-1)){var i=0;var h=c.elmbtn.length-1}else{var i=d+1;var h=d}c.elm[i].style.display="block";c.elm[i].style.visibility="visible";e(c.elm[i]).css({opacity:"",clip:c.defclip,left:0});e(c.elmbtn[h]).removeClass("img_over").css("opacity",0.5).parent().removeClass("img_stay");e(c.elmbtn[i]).addClass("img_over").css("opacity",1).parent().addClass("img_stay");e(c.elm[d]).stop().animate({opacity:0,clip:c.clip},animSpeed,animEasing,function(){g.zIndex=90;g.visibility="hidden";d++;if(d==(c.elm.length)){d=0;if(c.loop=="0"){c.loopfix=true}}b=d;c.endFlg=false;if(c.autoFlg){clearTimeout(c.time);if(!c.loopfix){c.time=setTimeout(c.elmani2,c.delayArray[d])}}})},elmcl:function(){if(c.endFlg){return}if(this.className=="img_stay"){return}clearTimeout(c.time);c.endFlg=true;e(this).parents("ul").find(".img_stay .img_over").removeClass("img_over").css("opacity",0.5);e(this).parents("ul").find(".img_stay").removeClass("img_stay");this.className="img_stay";d=e("#img_main-btn li").index(this);c.autoFlg=false;var h=c.elm[b].style;var g=c.elm[d].style;g.display="block";g.visibility="visible";h.zIndex=100;g.zIndex=90;e(c.elm[d]).css({clip:c.defclip,left:0,opacity:""});e(c.elm[b]).css({clip:c.defclip,left:0});e(c.elm[b]).stop().animate({opacity:0,clip:c.clip},animSpeed,animEasing,function(){h.zIndex=80;g.zIndex=100;h.visibility="hidden";b=d;c.endFlg=false});c.autoFlg=true;if(!c.loopfix){c.time=setTimeout(c.elmani2,c.delayArray[d])}}}})})(jq142);
