$(function(){

/* --------------------------------------------------------------------------------------------

	読み込み＆ポイント判定

-------------------------------------------------------------------------------------------- */
$('#grouppoint #point p span').each(function(){
ptalt = $(this).children('img').attr('alt');
$('#topbanner #mmbpt').append(ptalt);
});
np0239 = eval($('#topbanner #mmbpt').text());

//▼分岐なし(分岐ありの場合は分岐なしの下記1文を消去する)
$('#mmbmip #mmbslide02').remove();

//▼分岐あり（状況に応じて「elseif(){}」の作成の必要あり）
/*if(np0239 >= 1000){ //ポイントが1000ポイント以上の場合
$('#mmbmip #mmbslide01').remove();
}else{
$('#mmbmip #mmbslide02').remove();
}*/
$(function(){
Slideshow();
})
})

/* --------------------------------------------------------------------------------------------

	MIPスライドショー

-------------------------------------------------------------------------------------------- */
function Slideshow(){
//初期値の設定
speed = 6000; //繰り返すスピード　初期値：5000
slide = 300; //スライドイン＆アウトのスピード
txchange = 30; //MIPサムネイルの切り替えスピード
maxnum = 4; //MIPバナー数
mipht = 154; //MIPバナーの高さ（px）
num = 0;
mmgtp = 0;

//MIPバナーにクラスの設定
$('.mip .mipimg li').each(function (i) {
i = i+1;
$(this).addClass("box" + i);
});
//MIPサムネイルにクラスの設定
$('.miptx li').each(function (i) {
i = i+1;
$(this).addClass("box" + i);
});

//MIPサムネイルの初期設定
$('.miptx li.box1').attr('id','on');

//スライドを一定時間で繰り返す
stop = setInterval(Mipmov,speed);

//マウスホバーした際の設定（MIPサムネイル）
$('.miptx li').hover(function(){
clearInterval(stop);
num = eval(($(this).attr('class')).charAt(3));
mmgtp = (num-1)*mipht;
$('.mip .mipimg').css('margin-top','-'+mmgtp+'px');
$('.miptx li').removeAttr('id');
$('.miptx li.box'+num).attr('id','on');
},
function(){
num = num - 1;
stop = setInterval(Mipmov,speed);
})
//マウスホバーした際の設定（MIPバナー）
$('.mipimg li').hover(function(){
clearInterval(stop);
},
function(){
stop = setInterval(Mipmov,speed);
})
}

function Mipmov(){
num = num + 1;
$('.mip .mipimg li').fadeOut(slide,In);
}
function In(){
if(num == maxnum){
num = 0;
mmgtp = 0;
$(this).closest('.mipimg').removeAttr('style');
}else{
mmgtp = num*mipht;
$(this).closest('.mipimg').css('margin-top','-'+mmgtp+'px');
}
$(this).fadeIn(slide);
setTimeout(Miptx,txchange);
}

function Miptx(){
$('.miptx li').removeAttr('id');
$('.miptx li.box'+(num+1)).attr('id','on');
}
