function amazon(si, bn, nd) {

	var url = "getAmazon.cgi";
	var st  = "salesrank";
	var pa  = "si=" + si + "&bn=" + bn + "&st=" + st;

	var day = new Date();
	var str = day.getTime();
	
	url += '?time=' + str;

	new Ajax.Request(url, {
			method:		"get",
			parameters:	pa,
			onSuccess:function(httpObj){
				
				
				var xmlObj = httpObj.responseXML;
				var item   = $A(xmlObj.getElementsByTagName("Item"));
				var rankTg = "";
				var titlTg = "";
				var link   = "";
				var imageU = "";
				var imageH = "";
				var intH   = 0;
				var intW   = 0;
				var imageW = "";
				var attr;
				var author = "";
				var pubDay = "";
				var puber  = "";
				var title  = "";
				var price  = "";
				var node;
				var node1;
				var htm1   = "";
				var htm2   = "";


				for (var i=0; i<item.length; i++) {

					htm1 = htm2 = imageU = author = pubDay = puber = title = price = imageH = imageW = "";
					rankTg = 'rank'  + nd + i;
					titlTg = 'title' + nd + i;
					link   = item[i].getElementsByTagName("DetailPageURL")[0].firstChild.nodeValue;
					node   = item[i].getElementsByTagName("MediumImage")[0];
					attr   = item[i].getElementsByTagName("ItemAttributes")[0];

					if (node) {
						imageU += node.getElementsByTagName("URL")[0].firstChild.nodeValue;
						imageH += node.getElementsByTagName("Height")[0].firstChild.nodeValue;
						imageW += node.getElementsByTagName("Width")[0].firstChild.nodeValue;


						intH = parseInt(imageH);
						intW = parseInt(imageW);
						
						if (intW > 100) {
							intH = (100 * intH) / intW;
							intW = 100;
						}

					} else {
						imageU = "img/notimg.jpg";
						intH = 160;
						intW = 105;
					}
					
					node = attr.getElementsByTagName("Author")[0];
					if (node.firstChild) { author = node.firstChild.nodeValue; }
					node = attr.getElementsByTagName("PublicationDate")[0];
					if (node.firstChild) { pubDay = node.firstChild.nodeValue; }
					node = attr.getElementsByTagName("Publisher")[0];
					if (node.firstChild) { puber  = node.firstChild.nodeValue; }
					node = attr.getElementsByTagName("Title")[0];
					if (node.firstChild) { title  = node.firstChild.nodeValue; }
					if (title.length > 20) {
						title = title.substr(0, 20) + "..";
					}

					node = attr.getElementsByTagName("ListPrice")[0];
					if (node.firstChild) {
						node1 = node.getElementsByTagName("FormattedPrice")[0];
						if (node1.firstChild) { price = node1.firstChild.nodeValue; }
					}
				
					htm1 += '<a href="' + link + '" target="_blank">' + title + '</a>';
					htm2 += '<br /><a href="' + link + '" target="_blank">';
					htm2 += '<img src="' + imageU + '" width="' + intW + '" height="' + intH + '" border="0" /></a>';
					htm2 += '<br /><font size="-1">' + author + '<br /><b>' + price + '</b><br />' + puber + '<br />' + pubDay + '<br />';

					$(titlTg).innerHTML = htm1;
					$(rankTg).innerHTML = htm2;
				}
			},
			onFailure:function(httpObj){
				$("rank0").innerHTML = "エラーで読み込めませんでした";
			}
	});
}


