var pokemonCookie_data = getCookie("pokemon");
if (pokemonCookie_data == null || pokemonCookie_data == 0) {
    document.writeln('<div class="startpage">');
    document.writeln('<p><img src="image/txt_startpage.gif" alt="ポケモンドミノキッズひろばをスタートページにできるよ！" width="189" height="35" /></p>');
    document.writeln('<p class="btn"><a href="javascript:pokemonCookie()"><img src="image/btn_startpage.gif" alt="このページをスタートページにする" width="419" height="46" /></a></p>');
    document.writeln('</div>');
}else{
	document.writeln('<div class="startpage release">');
    document.writeln('<p><img src="image/txt_startpage_release.gif" alt="もとのトップページにするときはこのボタンをクリックしてね！" width="189" height="35" /></p>');
    document.writeln('<p class="btn"><a href="javascript:pokemonCookie_del()"><img src="image/btn_startpage_release.gif" alt="スタートページをもとにもどす" width="419" height="46" /></a></p>');
    document.writeln('</div>');
}

function pokemonCookie(){
	var name = "pokemon";
	var value = 1;
	var days = 365;
	var date = new Date();
	date.setTime(date.getTime()+(days*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	document.cookie = name+"="+value+expires+"; domain=.dominos.jp; path=/;";
	window.alert("次からはドミノ・ピザのトップページでポケモンたちがお迎えするよ!");
	location.reload()
}

function pokemonCookie_del(){
	var name = "pokemon";
	var value = 0;
	var expires = "; expires=Thu,01-Jan-70 00:00:01 GMT";
	document.cookie = name+"="+value+expires+"; domain=.dominos.jp; path=/;";
	window.alert("また遊びにきてね!");
	location.href = "/";
}

function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}