﻿var strProducts = "";

strProducts = strProducts + "<div id=\"product\">";
strProducts = strProducts + getProductsList();
strProducts = strProducts + getProductsImage();
strProducts = strProducts + "</div>";

document.write(strProducts);

function getProductsList()
{
	var rtnValue = "";

	rtnValue = rtnValue + "<h3 style=\"background: #fff url(/WellinTec/images/idx_product.jpg) no-repeat;\">取扱製品</h3><div id=\"plist\" style=\"overflow:auto;\"><ul>";
	for(var i=0; i<productslist.length; i++)
	{
		var no = i + 1;
		var key = productslist[i][0];
		var value = productslist[i][1];
		var titleValue = value;
		if(value.indexOf("<br />", 0) != -1)
		{
			var subTitleValue = value.split("<br />", 2);
			titleValue = subTitleValue[0] + subTitleValue[1];
		}
		
		if( (key == "tag1") || (key == "tag2") ){
			rtnValue = rtnValue + "<br/>";
		}
		
		rtnValue = rtnValue + "<li><a ";
		
		if( (key != "tag1") && (key != "tag2") ){
			rtnValue = rtnValue + "href=\"/WellinTec/service/product/list/" + key + "/index.html?prm1=top&prm2=" + key + "\" ";
		}else{
			rtnValue = rtnValue + "style=\"font-size:12pt\; font-weight:Bolder\;\" ";
		}
		rtnValue = rtnValue + "onmouseover=\"showProduct(" + no + ")\" title=\"" + titleValue + "\">" + value + "</a></li>";
	}
	rtnValue = rtnValue + "</ul></div>";

	return rtnValue;
}

function getProductsImage()
{
	var rtnValue = "";
	
	rtnValue = rtnValue + "<div class=\"pexplain\">";
	for(var i=0; i<productslist.length; i++)
	{
		var no = i + 1;
		var key = productslist[i][0];
		var imgExp = productslist[i][2];
		var productExp = productslist[i][3];
		var dispStyle = "";
		var imgStyle = " src=\"/WellinTec/images/" + key + ".jpg\" alt=\"\" ";

		if(key == defDispProduct) dispStyle = " style=\"display: block;\""; else dispStyle = " style=\"display: none;\"";

		rtnValue = rtnValue + "<div id=\"pexplain" + no + "\"" + dispStyle + ">";
		if( (key != "tag1") && (key != "tag2") ){
			rtnValue = rtnValue + "<A href=\"/WellinTec/service/product/list/" + key + "/index.html?prm1=top&prm2=" + key + "\" >";
			rtnValue = rtnValue + "<img " + imgStyle + ">" + "</A>";
		}
		rtnValue = rtnValue + "<p>" + productExp + "</p>";
		if( (key != "tag1") && (key != "tag2") ){
			rtnValue = rtnValue + "<p class=\"pdetail\"><a href=\"/WellinTec/service/product/list/" + key + "/index.html?prm1=top&prm2=" + key + "\" title=\"より詳しく\">より詳しく</a></p>";
		}
		rtnValue = rtnValue + "</div>";
	}
	rtnValue = rtnValue + "</div>";

	return rtnValue;
}
