$(function(){

//general
$('.balloon').rollover('_on');

//socialPost
$('.socialLinks').socialPost()

if($.browser.ie6){
$('.newsrelease ul li:first-child').addClass('first-child');
}

function newsTicker(selector){

if($(selector).length<=1) return false;

$(selector).each(function(i){
$(this).attr("id","news-"+i);
if(i!=0) $(this).hide();
});

var count = 0,
end = $(selector).length-1;
var interval = 3000;//ミリ秒
                var fadeTimer = setInterval(function(){
$("li#news-"+count).hide();
if(count<=end-1){
                                $("li#news-"+(++count)).fadeIn("slow");
}else{
        count = 0;
$("li#news-"+count).fadeIn("slow");
}
                }, interval);
}

newsTicker('#whatsnew li');
})


/* ! Added a Google+1 button at 12.9.2011 */

$.fn.googlePlus = function(){

if (!($.browser.msie && parseInt($.browser.version) < 8)) {
var posturl = htmlspecialchars($('#showcase .postURL').val());
if(this.find('li.google')){
this.find('li.google').remove();
}

$('<li class="google">')
.appendTo(this)
.append('<div id="bannerGoogle">');
renderPlusone('bannerGoogle', posturl);
}

function renderPlusone(target, posturl){
  gapi.plusone.render(
target,
{
href: posturl,
size: 'small',
annotation: 'none'
}
);
}

function htmlspecialchars(string)
{
var table = [
[/&/g, '&amp;'],
[/</g, '&lt;'],
[/>/g, '&gt;'],
[/"/g, '&quot;'],
[/'/g, '&#039;']
];

for (var i in table) {
string = string.replace(table[i][0], table[i][1]);
}

return string;
}

}

/* end  */







var Showcase = {

changeOne: function(obj,data){
var self = $(obj);

        //img
var img = self.find('.bannerImg');
img.stop(true,true);
img.animate({opacity:0},100,function(){img.attr('src',data.src)});
img.animate({opacity:1},500);

//txt
if(self.find('.caption span').size()){
self.find('.caption span').text(data.txt);
}else{
self.find('.caption').text(data.txt);
}

//link
self.attr('href',data.link);

//target
if(data.target){
self.attr('target',data.target)
}else{
self.removeAttr('target')
}

return this;
},

changeAll: function(navid){
var data = this.data[navid];
this.changeOne('#mainBanner',data.main);
this.changeOne('#pos_1',data.pos_1);
this.changeOne('#pos_2',data.pos_2);
this.changeOne('#pos_3',data.pos_3);
this.changeOne('#pos_4',data.pos_4);

//socialPostURL
$('#showcase .postURL').val(data.main.socialPostURL)
$('#showcase .postMessage').val(data.main.socialPostTxt)
$('#showcase .socialLinks').socialPost()
$('#showcase .socialLinks').socialPost({mixiKey:'0764ab627fb2fb6b1458b6a6bf15a8f524e86811'})
$('#showcase .socialLinks').googlePlus();
return this;
},

preload: function(){
var showcase = this.data;
for(caseset in showcase){
for(pos in showcase[caseset]){
new Image().src = showcase[caseset][pos].src;
}
}
return this;
},

data: {
      
        
        logo: {
                main: {
                src: '/ssi/main/files/20120207_doraemon_a.jpg',
                txt: '映画ドラえもん　アドベンチャーキャンペーン',
                link: 'http://doraemon.yahoo.co.jp/present/?ca=top_fla00_001',
                target: '_blank',
                socialPostURL: 'http://doraemon.yahoo.co.jp/present/',
                socialPostTxt: 'ローソン/映画ドラえもん　アドベンチャーキャンペーン'
                },
                pos_1: {
                src: '/ssi/main/files/20110215_precureayokoku_b.jpg',
                txt: '【予告】プリキュアグッズを当てよう',
                link: 'http://lwp.jp/pas/campaign/static/pas/?ca=top_fla00_002',
                target: '_self'
                },
                pos_2: {
                src: '/ssi/main/files/20120221_strawberryroll_b.jpg',
                txt: 'ウチカフェスイーツおすすめ',
                link: '/recommend/uchicafe/?ca=top_fla00_003',
                target: '_blank'
                },
                pos_3: {
                src: '/ssi/main/files/B_mini_healthya.jpg',
                txt: 'まとめ買いで送料無料',
                link: 'http://loppi.jp/fromlawson/user_data/pickup_products/healthya/?cvid=law_ad120214_01&ca=top_fla00_004',
                target: '_blank'
                },
                pos_4: {
                src: '/ssi/main/files/20120221_bigbang_bnr_b.jpg',
                txt: '【ローソン限定盤】BIGBANG　2NE1',
                link: 'http://l-tike.com/shopping/bigbang_2ne1/?ca=top_fla00_005',
                target: '_blank'
                }
        },
        

        
        gnav01: {
                main: {
                src: '/ssi/main/files/20120207_doraemon_a.jpg',
                txt: '映画ドラえもん　アドベンチャーキャンペーン',
                link: 'http://doraemon.yahoo.co.jp/present/?ca=top_fla01_001',
                target: '_blank',
                socialPostURL: 'http://doraemon.yahoo.co.jp/present/',
                socialPostTxt: 'ローソン/映画ドラえもん　アドベンチャーキャンペーン'
                },
                pos_1: {
                src: '/ssi/main/files/20120214_lawsontei_bnr_b.jpg',
                txt: 'とろけるチーズの彩りカレー',
                link: '/recommend/static/lawsontei/?ca=top_fla01_002',
                target: '_self'
                },
                pos_2: {
                src: '/ssi/main/files/20120214_pastaya_bnr_b.jpg',
                txt: 'パスタ屋　新商品',
                link: '/recommend/static/pastaya/?ca=top_fla01_003',
                target: '_self'
                },
                pos_3: {
                src: '/ssi/main/files/20110927_miso_b.jpg',
                txt: 'からあげクン 仙台味噌味',
                link: '/recommend/static/karaagekun/?ca=top_fla01_004',
                target: '_self'
                },
                pos_4: {
                src: '/ssi/main/files/20120124_hinamatsuri_b.jpg',
                txt: 'ケーキとお寿司でひなまつり',
                link: '/recommend/static/hinamatsuri/?ca=top_fla01_005',
                target: '_self'
                }
        },
        

        
        gnav02: {
                main: {
                src: '/ssi/main/files/20120207_doraemon_a.jpg',
                txt: '映画ドラえもん　アドベンチャーキャンペーン',
                link: 'http://doraemon.yahoo.co.jp/present/?ca=top_fla02_001',
                target: '_blank',
                socialPostURL: 'http://doraemon.yahoo.co.jp/present/',
                socialPostTxt: 'ローソン/映画ドラえもん　アドベンチャーキャンペーン'
                },
                pos_1: {
                src: '/ssi/main/files/20110215_precureayokoku_b.jpg',
                txt: '【予告】プリキュアグッズを当てよう',
                link: 'http://lwp.jp/pas/campaign/static/pas/?ca=top_fla02_002',
                target: '_self'
                },
                pos_2: {
                src: '/ssi/main/files/20120228_rila_yokoku_b.jpg',
                txt: '【予告】春のリラックマフェア',
                link: '/campaign/static/rilakkuma/?ca=top_fla02_003',
                target: '_self'
                },
                pos_3: {
                src: '/ssi/main/files/20120131_opencampaign_b.jpg',
                txt: '旅行券100万円分が当たる！',
                link: '/ponta/static/present_st/20120201_opencampaign/?ca=top_fla02_004',
                target: '_self'
                },
                pos_4: {
                src: '/ssi/main/files/20120214_colopl_b.jpg',
                txt: 'ローソン限定アイテム',
                link: '/campaign/static/colopl/?ca=top_fla02_005',
                target: '_self'
                }
        },
        

        
        gnav03: {
                main: {
                src: '/ssi/main/files/20120207_doraemon_a.jpg',
                txt: '映画ドラえもん　アドベンチャーキャンペーン',
                link: 'http://doraemon.yahoo.co.jp/present/?ca=top_fla03_001',
                target: '_blank',
                socialPostURL: 'http://doraemon.yahoo.co.jp/present/',
                socialPostTxt: 'ローソン/映画ドラえもん　アドベンチャーキャンペーン'
                },
                pos_1: {
                src: '/ssi/main/files/101001_po_mini_1.jpg',
                txt: 'ローソンPontaカード入会',
                link: '/ponta/static/admission.html?ca=top_fla03_002',
                target: '_self'
                },
                pos_2: {
                src: '/ssi/main/files/20120131_otameshi_b.jpg',
                txt: 'お試し引換券',
                link: '/ponta/calendar/?ca=top_fla03_003',
                target: '_self'
                },
                pos_3: {
                src: '/ssi/main/files/20120221_bp_bnr_b.jpg',
                txt: '期間限定 ボーナスポイント',
                link: '/ponta/bonus/?ca=top_fla03_004',
                target: '_self'
                },
                pos_4: {
                src: '/ssi/main/files/100831_po_mini_4.jpg',
                txt: '懸賞に応募しよう！',
                link: '/ponta/prize/?ca=top_fla03_005',
                target: '_self'
                }
        },
        

        
        gnav04: {
                main: {
                src: '/ssi/main/files/20120207_doraemon_a.jpg',
                txt: '映画ドラえもん　アドベンチャーキャンペーン',
                link: ' http://doraemon.yahoo.co.jp/present/?ca=top_fla04_001',
                target: '_blank',
                socialPostURL: ' http://doraemon.yahoo.co.jp/present/',
                socialPostTxt: 'ローソン/映画ドラえもん　アドベンチャーキャンペーン'
                },
                pos_1: {
                src: '/ssi/main/files/20111220_dora.gif',
                txt: '完全予約制',
                link: '/campaign/static/fujiko-f-fujio/?ca=top_fla04_002',
                target: '_self'
                },
                pos_2: {
                src: '/ssi/main/files/top_220-124.jpg',
                txt: '宝くじ5億円',
                link: '/service/static/kuji/?ca=top_fla04_003',
                target: '_self'
                },
                pos_3: {
                src: '/ssi/main/files/20111227_yp_b.jpg',
                txt: 'ネットでますます、お得で便利',
                link: 'http://www.post.japanpost.jp/lpo/auction/?ca=top_fla04_004',
                target: '_blank'
                },
                pos_4: {
                src: '/ssi/main/files/20111220_ghibli.jpg',
                txt: '入場チケット発売中！',
                link: '/ghibli/museum/ticket/?ca=top_fla04_005',
                target: '_self'
                }
        },
        

        
        gnav05: {
                main: {
                src: '/ssi/main/files/20120207_doraemon_a.jpg',
                txt: '映画ドラえもん　アドベンチャーキャンペーン',
                link: ' http://doraemon.yahoo.co.jp/present/?ca=top_fla05_001',
                target: '_blank',
                socialPostURL: ' http://doraemon.yahoo.co.jp/present/',
                socialPostTxt: 'ローソン/映画ドラえもん　アドベンチャーキャンペーン'
                },
                pos_1: {
                src: '/ssi/main/files/20120115_precure_bnr_b.jpg',
                txt: 'グッズ付引換券発売中！',
                link: 'http://l-tike.com/gd/precure-allstars.html?ca=top_fla05_002',
                target: '_blank'
                },
                pos_2: {
                src: '/ssi/main/files/20120207_dct_bnr_b.gif',
                txt: '新作DVD予約受付中！',
                link: 'http://www.hmv.co.jp/news/article/1201270017/',
                target: '_blank'
                },
                pos_3: {
                src: '/ssi/main/files/B_mini_cosme.jpg',
                txt: 'ブランドコスメが大特価',
                link: 'http://loppi.jp/lshop/products/list.php?cid=124081&cvid=law_ad120214_03&ca=top_fla05_004',
                target: '_blank'
                },
                pos_4: {
                src: '/ssi/main/files/B_mini_0221seijo.jpg',
                txt: '成城石井チーズケーキ',
                link: 'http://loppi.jp/seijoishii/user_data/cheese_cake_sp/?cvid=law_ad120221_02&ca=top_fla05_005',
                target: '_blank'
                }
        },
        

        
        gnav06: {
                main: {
                src: '/ssi/main/files/20120207_doraemon_a.jpg',
                txt: '映画ドラえもん　アドベンチャーキャンペーン',
                link: 'http://doraemon.yahoo.co.jp/present/?ca=top_fla06_001',
                target: '_blank',
                socialPostURL: 'http://doraemon.yahoo.co.jp/present/',
                socialPostTxt: 'ローソン/映画ドラえもん　アドベンチャーキャンペーン'
                },
                pos_1: {
                src: '/ssi/main/files/co_mini_1.jpg',
                txt: '株主・投資家情報',
                link: '/company/ir/?ca=top_fla06_002',
                target: '_self'
                },
                pos_2: {
                src: '/ssi/main/files/co_mini_2.jpg',
                txt: '環境保全・社会貢献活動',
                link: '/company/activity/?ca=top_fla06_003',
                target: '_self'
                },
                pos_3: {
                src: '/ssi/main/files/co_mini_3.jpg',
                txt: '加盟店オーナー募集',
                link: '/company/fc/?ca=top_fla06_004',
                target: '_self'
                },
                pos_4: {
                src: '/ssi/main/files/co_mini_4.jpg',
                txt: '出店事例・物件募集',
                link: '/company/branch/?ca=top_fla06_005',
                target: '_self'
                }
        }
        
}
}

Showcase.preload();

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}





