//
//		Amazon RES 対応
//
//
//
///////////////////////////////////////////////////////////////////////


function getAmBanner(itemId, tp){
	var bheight, bwidth, bxsl;
	bxsl="amazon" + tp + ".xsl";
	switch (tp){
	case 1: case 10: case 13: case 14: case 15: case 16: case 17:
		bheight = 82;	bwidth = 240;
		break;
	case 11:
		bheight = 82;	bwidth = 300;
		break;
	case 12:
		bheight = 82;	bwidth = 400;
		break;
	case 2:
		bheight = 160;	bwidth = 400;
		break;
	case 3:
		bheight = 75;	bwidth = 300;
		break;
	case 4:
		bheight = 240;	bwidth = 300;
		break;
	case 5: case 51: case 52:	// 52:カウントなし
		bheight = 60;	bwidth = 240;
		break;
	case 6:
		bheight = 40;	bwidth = 240;
		break;
	case 61:
		bheight = 40;	bwidth = 240;
		bxsl ="amazon6p.xsl"; 
		break;
	default:
		bheight = 82;	bwidth = 240;
		bxsl ="amazon14.xsl"; 
		break;
	}
	var htm = '';
	htm += '<iframe src="';
	htm += 'http://b.pos.to/heroine/shop/amazonRequest2.cgi?itemId=' + itemId;
	htm += '&style=' + bxsl;
	htm += '" scrolling="no" allowtransparency="true" height="' + bheight + '" ';
	htm += 'width="' + bwidth + '" frameborder="0" ';
	htm += 'marginwidth="0" marginheight="0"></iframe>\n';
	return htm;
}

function getRndBanner(){
	var ids = new Array();
	ids[0] = "B002JLRNUI";	//特命女子アナ 並野容子 [DVD] 
	ids[1] = "B002DYGZOG";	//抜け忍 [DVD]
	ids[2] = "B0016ZT9D2";	//ザ・カゲスター
	ids[3] = "B001ALQXNQ";	//好き!すき!!魔女先生 VOL.2
	ids[4] = "B001RRTORK";	//電撃戦隊チェンジマン 
	ids[5] = "4860327101";	//夢幻戦士ヴァリス 2 
	var selId = Math.floor(Math.random() * ids.length - 0.01);
	return getAmBanner(ids[selId], 14);
}


function getMultiBanner(itemAr, tp){
	var bhini,bhpt, bheight, bwidth, bxsl;
	bxsl="amazon_m" + tp + ".xsl";
	switch (tp){
	case 2:
		bhini = 88;	bhpt = 54; bwidth = 500;
		break;
	case 21: case 22: case 23:
		bhini = 88;	bhpt = 84; bwidth = 500;
		break;
	case 32: case 33: case 34: case 35:
		bhini = 100;	bhpt = 27; bwidth = 300;
		break;
	case 36: case 37: case 38: case 39: case 40:
		bhini = 105;	bhpt = 27; bwidth = 250;
		break;
	case 4: case 41: case 42: case 43: case 44: case 45: case 46:
		bhini = 16;	bhpt = 30; bwidth = 300;
		break;
	case 50: case 250:
		bhini = 280; bhpt = 0; bwidth = 600;
		break;
	case 51: case 52:
		bhini = 470 + Math.floor((itemAr.length)/4) * 90; 
		bhpt = 0; 
		bwidth = 250;
		break;
	default:
		bhini = 88;	bhpt = 54; bwidth = 500;
		break;
	}
	bheight = bhini + (itemAr.length-1) * bhpt;
	if ((tp == 4 || tp == 41 || tp == 42 || tp == 43 || tp==44 || tp==45 || tp==46) && bheight < 88){
		bheight = 88;
	}
	var asinStr = itemAr[0];
	for (var i=1; i < itemAr.length; i++){
		asinStr += ',' + itemAr[i];
	}
	var htm = '';
	htm += '<iframe src="';
	htm += 'http://b.pos.to/heroine/shop/amazonRequest2.cgi?itemId=' + asinStr;
	htm += '&style=' + bxsl;
	htm += '" scrolling="no" allowtransparency="true" height="' + bheight + '" ';
	htm += 'width="' + bwidth + '" frameborder="0" ';
	htm += 'marginwidth="0" marginheight="0"></iframe>\n';
	return htm;
}


function getSearchBanner(kwAr, tp, sindex){
	var bhini,bhpt, bheight, bwidth, bxsl;
	bxsl="amazon_m" + tp + ".xsl";
	switch (tp){
	case 70: case 71: case 72: case 73: case 74: //イメージ出現アニメ
		bhini = 210; bhpt = 0; bwidth = 250;
		break;
	case 80: case 81: case 82: case 83: //イメージ付縦積み
		bhini = 120; bhpt = 0; bwidth = 300;
		break;
	case 90: case 91: //幅広
		bhini = 280; bhpt = 0; bwidth = 600;
		break;
	default:
		bhini = 88;	bhpt = 54; bwidth = 500;
		break;
	}
	bheight = bhini + (kwAr.length-1) * bhpt;
	if ((tp == 81 || tp == 82 || tp == 83 || tp==84 || tp==85 || tp==86) && bheight < 88){
		bheight = 88;
	}
	var asinStr = kwAr[0];
	for (var i=1; i < kwAr.length; i++){
		asinStr += ',' + kwAr[i];
	}
	var htm = '';
	htm += '<iframe src="';
	htm += 'http://b.pos.to/heroine/shop/amazonRequest3.cgi?keywords=' + asinStr;
	if (sindex){
		htm += '&searchIndex=' + sindex;
	}
	htm += '&style=' + bxsl;
	htm += '" scrolling="no" allowtransparency="true" height="' + bheight + '" ';
	htm += 'width="' + bwidth + '" frameborder="0" ';
	htm += 'marginwidth="0" marginheight="0"></iframe>\n';
	return htm;
}
