//ポップアップをする-----------------------------

function popup600(url){

	window.open("" + url +"", "_blank", "width=615, menubar=no, toolbar=no, scrollbars=yes, resizable=yes ");
	
}

function popup665(url){

	window.open("" + url +"", "_blank", "width=680, height=680 menubar=no, toolbar=no, scrollbars=yes, resizable=yes ");
	
}

function popup450(url){

	window.open("" + url +"", "_blank", "width=465, menubar=no, toolbar=no, scrollbars=yes, resizable=yes ");
	
}

function popup(url){

	window.open("" + url +"", "wind", "menubar=no, toolbar=no, scrollbars=yes, resizable=yes");
	
}

function popupFull(url){

	window.open("" + url +"", "Test", "fullscreen=yes");
	
}


//プリントアウトのメニューを開く-----------------

function printout() {

	window.print();

}

// focus -----------------
function focusP(url) {
	if(window.opener == null) {
		pw = window.open(url, '_blank');
	}
	else if (!window.opener.closed)  {
		window.opener.location.href = url;
		window.opener.focus();
	} else {
		pw = window.open(url, '_blank');
	}
}


//カテゴリTOPイメージをランダムで表示------------

var genreCount = new Array;

//genreCountはそれぞれのカテゴリのランダム画像の数を表してる。
//ランダム表示の画像の数が変更される場合はここの数を編集する。

genreCount["kitchen"] = 2;
genreCount["sweets"] = 2;
genreCount["beauty"] = 2;
genreCount["daily"] = 2;
genreCount["grooming"] = 2;

function randomtop(genre){

count = Math.floor(Math.random() * genreCount[genre]);

topImage = "<img src='/jp/contents_file/recipe/" + genre + "/i/index_top_0" + count + ".jpg' width='790' height='240' alt='" + genre + "' title='" + genre + "' />";

document.getElementById("TopImg").innerHTML = topImage;

}

//別ページでリンク先を開く-----------------------

function newWindow(URI){

window.open(URI);

}


// モニタークラブ コメント投稿ボタン書き換え------

function CommentButton(){

	document.getElementById("button_submit").innerHTML = "<p class='set-right'><img src='/jp/clubkai/i/em/monitor_button_transmission.gif' width='130' height='25' alt='送信中' title='送信中' /></p>";

}

function CommentComplete(){
	var thanks_message = '投稿ありがとうございました';

	document.getElementById("ContentsComment").innerHTML = "<p>" + thanks_message + "</p>";

}

function CommentError(){

	document.getElementById("AreaMessage").innerHTML = "<p  class='note'>投稿が完了しませんでした。時間をおいて、再度投稿してください。</p>";
	document.getElementById("button_submit").innerHTML = "<p class='set-right m-t20'><input type='image' src='/jp/clubkai/i/em/monitor_button_send.gif' class='button' name='submit' onclick='CommentPage();' value='送信' /></p>";

}


// トップページ ランダムバナー =======================
//掲載バナー数
fixationBMax = 3;
bannerMax = 3;

// バナー定義

//表示用配列初期化
bannerImg                = new Array();
bannerTitle              = new Array();
bannerURI                = new Array();
bannerTargetFlag         = new Array();
bannerCategoryImg        = new Array();
bannerCategoryTitle      = new Array();
bannerCategoryURI        = new Array();
bannerCategoryTargetFlag = new Array();
fixationBImg             = new Array();
fixationBTitle           = new Array();
fixationBURI             = new Array();
fixationBTargetFlag      = new Array();

    //カテゴリ内ランダム表示
    //bannerImg：ファイル名
    //bannerTitle：ページタイトル
    //bannerURI：リンクURI
    //bannerTargetFlag：新規ウィンドウで立ち上げるかどうか(0:画面遷移 1:新規ウィンドウ)

    //bannerCategoryImg:バナーイメージが複数存在する場合に設定します。
    //例：bannerCategoryImg[0] = 'kaitouch_01.gif';
    //    bannerCategoryImg[1] = 'kaitouch_02.gif';
    //bannerCategoryTitle:ページタイトルを設定してください。複数設定することもできますが,bannerCategoryImgの[]内の数字に関連づけてください。
    //例：bannerCategoryImg[0]に対してのタイトルを設定する場合は
    //    bannerCategoryTitle[0] = 'KAI TOUCH Project!';
    //bannerCategoryURI:リンクURIを設定してください。複数設定することもできますが,bannerCategoryImgの[]内の数字に関連づけてください。
    //例：bannerCategoryImg[0]に対してのタイトルを設定する場合は
    //    bannerCategoryURI[0] = '/kaitouch/index.html';
    //bannerCategoryTargetFlag:新規ウィンドウで立ち上げるかどうか設定してください(0:画面遷移 1:新規ウィンドウ)複数設定することもできますが,bannerCategoryImgの[]内の数字に関連づけてください。
    //例：bannerCategoryImg[0]に対してのタイトルを設定する場合は
    //    bannerCategoryTargetFlag[0] = 1;
    
    
    
    
//******************表示用各種バナー表示設定***************************//
bannerImg[0] = 'valios.gif';
bannerTitle[0] = 'VALIOS';
bannerURI[0] = '/jp/campaign/valios/index.html';
bannerTargetFlag[0] = 1;

bannerImg[1] = 'knowledge.gif';
bannerTitle[1] = 'KAI的ナレッジ';
bannerURI[1] = '/jp/clubkai/knowledge/index.html';
bannerTargetFlag[1] = 0;


bannerImg[2] = 'moniterclub.gif';
bannerTitle[2] = 'モニタークラブ';
bannerURI[2] = '/jp/clubkai/monitor/index.html';
bannerTargetFlag[2] = 0;

bannerImg[3] = 'kidzania.gif';
bannerTitle[3] = 'キッザニア東京';
bannerURI[3] = '/jp/kidzania/index.html';
bannerTargetFlag[3] = 1;

bannerImg[4] = 'purekomachi.jpg';
bannerTitle[4] = 'MY PureKomachi';
bannerURI[4] = '/jp/clubkai/service/purekomachi/index.html';
bannerTargetFlag[4] = 1;

bannerImg[5] = 'recipe.jpg';
bannerTitle[5] = 'おすすめレシピ集';
bannerURI[5] = '/jp/recipe/index.html';
bannerTargetFlag[5] = 0;


//*****************バナーイメージ複数ランダム表示用設定*****************/
//複数イメージ設定

bannerCategoryImg[0] = 'kaitouch_01.gif';
bannerCategoryImg[1] = 'kaitouch_02.gif';
bannerCategoryImg[2] = 'kaitouch_03.gif';

//タイトル設定
bannerCategoryTitle[0] = 'KAI TOUCH Project!';
bannerCategoryTitle[1] = 'KAI TOUCH Project!';
bannerCategoryTitle[2] = 'KAI TOUCH Project!';

//リンク設定
bannerCategoryURI[0] = '/jp/kaitouch/index.html';
bannerCategoryURI[1] = '/jp/kaitouch/index.html';
bannerCategoryURI[2] = '/jp/kaitouch/index.html';

//新規ウィンドウ設定
bannerCategoryTargetFlag[0] = 1;
bannerCategoryTargetFlag[1] = 1;
bannerCategoryTargetFlag[2] = 1;

//*****************バナー固定設定*****************//
fixationBImg[0] = '100th.gif';
fixationBTitle[0] = '貝印100周年記念 あったかい';
fixationBURI[0] = "javascript:popupFull('http://kai100th.com/');";
fixationBTargetFlag[0] = 0;

fixationBImg[1] = bannerCategoryImg[StartCategoryRandom()];
fixationBTitle[1] = bannerCategoryTitle[StartCategoryRandom()];
fixationBURI[1] = bannerCategoryURI[StartCategoryRandom()];
fixationBTargetFlag[1] = bannerCategoryTargetFlag[StartCategoryRandom()];

fixationBImg[2] = 'koushien.gif';
fixationBTitle[2] = 'スイーツ甲子園';
fixationBURI[2] = "/jp/koushien/index.html";
fixationBTargetFlag[2] = 0;

//*****************************************************************//


function RandomBanner() {

	imgPath = "/jp/i/banner/";


  count = new Array();
	count[0] = arrImage[StartRandom(0)];
	count[1] = arrImage[StartRandom(1)];
	count[2] = arrImage[StartRandom(2)];



	var imgTag= '';

	imgTag += '<ul>';
	
	for(i = 0; i < fixationBMax; i++) {
		img = "banner_" + fixationBImg[i];
		no = "banner_img" + i ;
		title = fixationBTitle[i] ;
		uri = fixationBURI[i] ;
		flag = fixationBTargetFlag[i] ;

		imgTag += '<li><a href="' + uri + '"';

		if(flag == 1) {
			imgTag += 'target="_blank"';
		}

		imgTag += '><img src="' + imgPath + img + '" width="180" height="47" alt="' + title + '" title="' + title + '" /></a></li>';

	}


	for(i = 0; i < bannerMax; i++) {
		img = "banner_" + bannerImg[count[i]];
		no = "banner_img" + i ;
		title = bannerTitle[count[i]] ;
		uri = bannerURI[count[i]] ;
		flag = bannerTargetFlag[count[i]] ;

		imgTag += '<li><a href="' + uri + '"';

		if(flag == 1) {
			imgTag += 'target="_blank"';
		}

		imgTag += '><img src="' + imgPath + img + '" width="180" height="47" alt="' + title + '" title="' + title + '" /></a></li>';

	}

	imgTag += '</ul>';
	document.write(imgTag);

}



var nTemp, nLoop;
//大本のランダム表示
function StartRandom(nIndex)
{
	nLoop = 0;
	nTemp = Math.round(Math.random()*(arrImage.length-1));
	//同じ値かどうかをチェック
	if (nIndex != 0)
	{
		for (nLoop = 0; nLoop < nIndex ; nLoop++) {
			if (nTemp == arrFlag[nLoop]) {
				StartRandom(nIndex);
			}
		}
	}
	arrFlag[nIndex] = nTemp;
	return nTemp;
}
//バナーのランダム表示内のランダム表示
function StartCategoryRandom(){
	amount = bannerCategoryImg.length;
	CategoryNo = Math.floor(Math.random()*amount);
	return CategoryNo;
}


	arrImage = new Array(bannerImg.length);

	for (i = 0; i < bannerImg.length; i++) {
	arrImage[i] = i;
	}

  var arrFlag = new Array(999,999,999);

