function getIndex(getFile) {
	getFilename=getFile;
	if(document.getElementById('rssnews')){
	    if (window.XMLHttpRequest) {
			xmlhttp=new XMLHttpRequest();
			}
		else if (window.ActiveXObject){
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		else{
			xmlhttp==false;
			}
		if (xmlhttp) {
		document.getElementById('rssnews').innerHTML="<img src='/img/nowloading3.gif' width='80' height='80' ALT='情報を取得中です' hspace='30' vspace='10'>";
		xmlhttp.onreadystatechange = check;
		xmlhttp.open('GET', getFile, true);
		xmlhttp.send(null);
		}
	}
}

function check() {
	var isMSIE = /*\@cc_on!\@*/false;
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		if (getFilename.match(/txt/i)) {
			xmlDoc = xmlhttp.responseText;
			document.getElementById('rssnews').innerHTML=xmlDoc;
			}
		else{
			xmlDoc = xmlhttp.responseXML;
			dataElm = xmlDoc.getElementsByTagName("title");
			dataElm2 = xmlDoc.getElementsByTagName("link");
			dataElm3 = xmlDoc.getElementsByTagName("CorrectedQuery");
			try{
				data    = dataElm[0].firstChild.nodeValue;
				link    = dataElm2[0].firstChild.nodeValue;
				} catch(e){
				data = "";
				}
			if(data){
				if(data.match(/Amazon/i)){data+="  話題の商品";}
				document.getElementById('amazon').innerHTML="<A HREF='"+ link + "' target=_blank>"+ data +"</A>";
				document.getElementById('rssnews').innerHTML="";
				if(xmlDoc.getElementsByTagName('Errors').length !=0){
					thumb1=xmlDoc.getElementsByTagName('Errors')[0].getElementsByTagName("Message")[0].firstChild.nodeValue;
					document.getElementById('rssnews').innerHTML+=""+thumb1+"<br><img src='/img/trans.gif' width=140 height=2><br>";
					}
				var j=dataElm.length;
				var queryfailed=false;
				if(j>11){j=11;}
				for(i=1;i<j;i++){
					if(dataElm.length<=i){break;}
					data1    = dataElm[i].firstChild.nodeValue;
					link1    = dataElm2[i].firstChild.nodeValue;
					if(dataElm[i].parentNode.parentNode.length !=0){
						if(dataElm3.length !=0){
							for(k=0;k<dataElm3.length;k++){
								queryfailed=false;
								if(dataElm3[k].parentNode.getElementsByTagName("IndexName")[0].firstChild.nodeValue == dataElm[i].parentNode.getElementsByTagName("Binding")[0].firstChild.nodeValue){
									queryfailed=true;
									break;
									}
								}
							if(queryfailed){
								if(dataElm.length>i+1){
									j++;
									continue;
									}
								else{
									break;
									}
								}
							}
						if(dataElm[i].parentNode.parentNode.getElementsByTagName("IsAdultProduct").length != 0){
							if(dataElm.length>i+1){
								j++;
								continue;
								}
							else{
								break;
								}
							}
						if(dataElm[i].parentNode.parentNode.getElementsByTagName("SmallImage").length != 0){
							if(dataElm[i].parentNode.parentNode.getElementsByTagName("SmallImage")[0].getElementsByTagName("Width")[0].firstChild.nodeValue>50){
								thumbh1=Math.round(dataElm[i].parentNode.parentNode.getElementsByTagName("SmallImage")[0].getElementsByTagName("Height")[0].firstChild.nodeValue*50/dataElm[i].parentNode.parentNode.getElementsByTagName("SmallImage")[0].getElementsByTagName("Width")[0].firstChild.nodeValue);
								if(thumbh1>80){
									thumbw1=Math.round(4000/thumbh1);
									thumbh1=80;
									}
								else{
									thumbw1=50;
									}
								thumburl1=dataElm[i].parentNode.parentNode.getElementsByTagName("SmallImage")[0].getElementsByTagName("URL")[0].firstChild.nodeValue;
								}
							else{
								thumbh1=Math.round(dataElm[i].parentNode.parentNode.getElementsByTagName("MediumImage")[0].getElementsByTagName("Height")[0].firstChild.nodeValue*50/dataElm[i].parentNode.parentNode.getElementsByTagName("MediumImage")[0].getElementsByTagName("Width")[0].firstChild.nodeValue);
								if(thumbh1>80){
									thumbw1=Math.round(4000/thumbh1);
									thumbh1=80;
									}
								else{
									thumbw1=50;
									}
								thumburl1=dataElm[i].parentNode.parentNode.getElementsByTagName("MediumImage")[0].getElementsByTagName("URL")[0].firstChild.nodeValue;
								}
							thumb1 = "<img src='"+thumburl1+"' width="+thumbw1+" height="+thumbh1+" align=left border=0>";
							}
						else{
							thumb1 = "<img src='/img/noimage.gif' width=50 height=50 align=left border=0>";
							}
						if(dataElm[i].parentNode.parentNode.getElementsByTagName("Artist").length != 0){
							creator1 = "/"+dataElm[i].parentNode.parentNode.getElementsByTagName("Artist")[0].firstChild.nodeValue;
							}
						else if(dataElm[i].parentNode.parentNode.getElementsByTagName("Author").length != 0){
							creator1 = "/"+dataElm[i].parentNode.parentNode.getElementsByTagName("Author")[0].firstChild.nodeValue;
							}
						else{
							creator1 = "";
							}
						if(dataElm[i].parentNode.parentNode.getElementsByTagName("OfferSummary")[0].getElementsByTagName("LowestNewPrice").length !=0){
							price1="<span style='color:#990000;'>"+dataElm[i].parentNode.parentNode.getElementsByTagName("OfferSummary")[0].getElementsByTagName("LowestNewPrice")[0].getElementsByTagName("FormattedPrice")[0].firstChild.nodeValue+"</span>";
							if(dataElm[i].parentNode.getElementsByTagName("ListPrice").length !=0){
								if(dataElm[i].parentNode.getElementsByTagName("ListPrice")[0].getElementsByTagName("Amount")[0].firstChild.nodeValue>dataElm[i].parentNode.parentNode.getElementsByTagName("OfferSummary")[0].getElementsByTagName("LowestNewPrice")[0].getElementsByTagName("Amount")[0].firstChild.nodeValue){
								price1="<s style='color:#666666;'>"+dataElm[i].parentNode.getElementsByTagName("ListPrice")[0].getElementsByTagName("FormattedPrice")[0].firstChild.nodeValue+"</s>"+price1;
									}
								}
							}
						else if(dataElm[i].parentNode.getElementsByTagName("FormattedPrice").length !=0){
							price1="<span style='color:#990000;'>"+dataElm[i].parentNode.getElementsByTagName("FormattedPrice")[0].firstChild.nodeValue+"</span>";
							}
						else{
							price1="";
							}
						creator1+="<br>"+price1;
						if(dataElm[i].parentNode.parentNode.getElementsByTagName("ProductGroup").length != 0){
							pg1 = "【"+dataElm[i].parentNode.parentNode.getElementsByTagName("ProductGroup")[0].firstChild.nodeValue+"】";
							}
						else{
							pg1 = "";
							}
						amdata1="<table class='amdata'><tr><td class='amgraph'><A HREF='"+ link1 + "' target=_blank>"+thumb1+"</td><td class='amgraph'";
						amdata1+="'>"+"<A HREF='"+ link1 +"' target=_blank>"+ pg1 + data1 + creator1+"</A></td></tr></table>";
						}
					else{
						thumb1="<img src='/img/anewsarrow2.gif' width=12 height=9 border=0>";
						amdata1="<A HREF='"+ link1 + "' target=_blank>"+thumb1 + data1+"</A>";
						}
					if(data1){
						document.getElementById('rssnews').innerHTML+="<div class='anews'>"+amdata1+"</div>";
						}
					else{
						continue;
						}
					}
				}
			else{
					document.getElementById('rssnews').innerHTML+="<div class='anews'>検索結果が見当たりません<br><img src='/img/trans.gif' width=140 height=2><br></div>";
				}

			}

		}
	}

function extractid(idp,idc) {
	document.getElementById(idp).style.display="none";
	document.getElementById(idc).style.display="block";
    return false;
}


function extractid_img(id,image) {
	if(document.getElementById(id).style.display == "block"){
		document.getElementById(id).style.display = "none";
		document.getElementById(image).src = "/img/i_open.gif";
	}
	else{
		document.getElementById(id).style.display = "block";
		document.getElementById(image).src = "/img/i_close.gif";
		}
	}

