function setMaisuu(max){
    mai = max;
    document.cookie = "max="+mai;
    idou();
    }

function idou(){
    // ファイル名に "-1" を加えて文字列を出力する
    page = location.href;
    a = page.slice(0, -5);
    b = a + "-1.html";
    window.open(b,"ALBUM","width=820,height=720,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=10,top=10");
}

function getCK(){
    max = document.cookie;
    max = max + "; ";
    max1 = max.search("max"); // "max" の "m" が出てくる文字番目
    max2 = max.indexOf(";", max1); // "m" から数えて ";" が出てくる文字番目
    max3 = max.substring(max1, max2); // maisuu に、"max=n" を定義
    max4 = max3.lastIndexOf("=", max3.length);		// 
    max5 = max3.slice(max4+1); max5 = max5*1;		// 写真の枚数
    }

// ファイル名の規則
// "文字列"　＋　ハイフン　＋　桁ナシの数値　＋　".jpg"

function imgUrl(){
    pageURL=location.href;
    pageNum1 = pageURL.lastIndexOf("-", location.href.length); // URL 全体の文字数
    pageNum2 = pageURL.substring(pageNum1+1, pageURL.length); // ハイフン以降の文字列

    pageNum3 = pageURL.lastIndexOf("/", location.href.length); // 
    pageNum4 = pageURL.substring(pageNum3+1, pageNum1); // 		
    imgNum = pageNum4+"-"+pageNum2.replace("html","jpg"); // imgNum = この画像の名前
    }
		
// ページ移動のスクリプト
	
function pageMoveA(pp){
    getCK();
    bangou = pageNum2.split("."); bangou = bangou[0];bangou=bangou*1;
    bangou = bangou-1;
    if (bangou == 0 ){bangou = max5; }
    location.href = pageNum4+"-"+bangou+".html";
    }
function pageMoveB(pp){
    getCK();
    bangou = pageNum2.split("."); bangou = bangou[0];bangou=bangou*1;
    bangou = bangou+1;
    if (bangou > max5 ){bangou = 1; }
    location.href = pageNum4+"-"+bangou+".html";
    }